mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-02-02 03:06:35 +00:00
[skip ci] remove / move unneeded observers
This commit is contained in:
parent
45e1a4d223
commit
f2d575dc34
1 changed files with 78 additions and 82 deletions
|
@ -117,88 +117,84 @@ class LightningInvoicePage extends BasePage {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
child: Observer(builder: (_) {
|
child: Padding(
|
||||||
return Padding(
|
padding: EdgeInsets.fromLTRB(24, 120, 24, 0),
|
||||||
padding: EdgeInsets.fromLTRB(24, 120, 24, 0),
|
child: LightningInvoiceForm(
|
||||||
child: LightningInvoiceForm(
|
descriptionController: _descriptionController,
|
||||||
descriptionController: _descriptionController,
|
amountController: _amountController,
|
||||||
amountController: _amountController,
|
depositAmountFocus: _amountFocusNode,
|
||||||
depositAmountFocus: _amountFocusNode,
|
formKey: _formKey,
|
||||||
formKey: _formKey,
|
lightningInvoicePageViewModel: lightningInvoicePageViewModel,
|
||||||
lightningInvoicePageViewModel: lightningInvoicePageViewModel,
|
),
|
||||||
),
|
),
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
bottomSection: Observer(builder: (_) {
|
bottomSection: Column(
|
||||||
return Column(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Container(
|
||||||
Container(
|
padding: const EdgeInsets.only(top: 12, bottom: 12, right: 6),
|
||||||
padding: const EdgeInsets.only(top: 12, bottom: 12, right: 6),
|
margin: const EdgeInsets.only(left: 24, right: 24, bottom: 48),
|
||||||
margin: const EdgeInsets.only(left: 24, right: 24, bottom: 48),
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
borderRadius: BorderRadius.all(Radius.circular(15)),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(15)),
|
color: Color.fromARGB(255, 170, 147, 30),
|
||||||
color: Color.fromARGB(255, 170, 147, 30),
|
border: Border.all(
|
||||||
border: Border.all(
|
color: Color.fromARGB(178, 223, 214, 0),
|
||||||
color: Color.fromARGB(178, 223, 214, 0),
|
width: 2,
|
||||||
width: 2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
margin: EdgeInsets.only(left: 12, bottom: 48, right: 20),
|
|
||||||
child: Image.asset(
|
|
||||||
"assets/images/warning.png",
|
|
||||||
color: Color.fromARGB(128, 255, 255, 255),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
FutureBuilder(
|
|
||||||
future: lightningInvoicePageViewModel.lightningViewModel
|
|
||||||
.invoiceSoftLimitsSats(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.data == null) {
|
|
||||||
return Expanded(
|
|
||||||
child:
|
|
||||||
Container(child: Center(child: CircularProgressIndicator())));
|
|
||||||
}
|
|
||||||
late String finalText;
|
|
||||||
InvoiceSoftLimitsResult limits =
|
|
||||||
snapshot.data as InvoiceSoftLimitsResult;
|
|
||||||
if (limits.inboundLiquidity == 0) {
|
|
||||||
finalText = S.of(context).lightning_invoice_min(
|
|
||||||
limits.feePercent.toString(),
|
|
||||||
lightning!.satsToLightningString(limits.minFee));
|
|
||||||
} else {
|
|
||||||
finalText = S.of(context).lightning_invoice_min_max(
|
|
||||||
limits.feePercent.toString(),
|
|
||||||
lightning!.satsToLightningString(limits.minFee),
|
|
||||||
lightning!.satsToLightningString(limits.inboundLiquidity),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Expanded(
|
|
||||||
child: Text(
|
|
||||||
finalText,
|
|
||||||
maxLines: 5,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color:
|
|
||||||
Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
LoadingPrimaryButton(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
margin: EdgeInsets.only(left: 12, bottom: 48, right: 20),
|
||||||
|
child: Image.asset(
|
||||||
|
"assets/images/warning.png",
|
||||||
|
color: Color.fromARGB(128, 255, 255, 255),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
FutureBuilder(
|
||||||
|
future: lightningInvoicePageViewModel.lightningViewModel
|
||||||
|
.invoiceSoftLimitsSats(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.data == null) {
|
||||||
|
return Expanded(
|
||||||
|
child:
|
||||||
|
Container(child: Center(child: CircularProgressIndicator())));
|
||||||
|
}
|
||||||
|
late String finalText;
|
||||||
|
InvoiceSoftLimitsResult limits = snapshot.data as InvoiceSoftLimitsResult;
|
||||||
|
if (limits.inboundLiquidity == 0) {
|
||||||
|
finalText = S.of(context).lightning_invoice_min(
|
||||||
|
limits.feePercent.toString(),
|
||||||
|
lightning!.satsToLightningString(limits.minFee));
|
||||||
|
} else {
|
||||||
|
finalText = S.of(context).lightning_invoice_min_max(
|
||||||
|
limits.feePercent.toString(),
|
||||||
|
lightning!.satsToLightningString(limits.minFee),
|
||||||
|
lightning!.satsToLightningString(limits.inboundLiquidity),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Expanded(
|
||||||
|
child: Text(
|
||||||
|
finalText,
|
||||||
|
maxLines: 5,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Theme.of(context).extension<DashboardPageTheme>()!.textColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Observer(builder: (_) {
|
||||||
|
return LoadingPrimaryButton(
|
||||||
text: S.of(context).create_invoice,
|
text: S.of(context).create_invoice,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
|
@ -211,10 +207,10 @@ class LightningInvoicePage extends BasePage {
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
isLoading: lightningInvoicePageViewModel.state is IsExecutingState,
|
isLoading: lightningInvoicePageViewModel.state is IsExecutingState,
|
||||||
),
|
);
|
||||||
],
|
}),
|
||||||
);
|
],
|
||||||
}),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue