@@ -8,6 +8,7 @@ import 'package:get_10101/common/custom_app_bar.dart';
8
8
import 'package:get_10101/common/amount_text.dart' ;
9
9
import 'package:get_10101/common/application/switch.dart' ;
10
10
import 'package:get_10101/common/color.dart' ;
11
+ import 'package:get_10101/common/dlc_channel_change_notifier.dart' ;
11
12
import 'package:get_10101/common/domain/model.dart' ;
12
13
import 'package:get_10101/common/scrollable_safe_area.dart' ;
13
14
import 'package:get_10101/common/secondary_action_button.dart' ;
@@ -49,6 +50,7 @@ class _ReceiveScreenState extends State<ReceiveScreen> {
49
50
super .initState ();
50
51
_createPaymentRequest (amount, description)
51
52
.then ((paymentRequest) => setState (() => _paymentRequest = paymentRequest));
53
+ context.read <DlcChannelChangeNotifier >().refreshDlcChannels ();
52
54
}
53
55
54
56
String rawInvoice () {
@@ -63,6 +65,11 @@ class _ReceiveScreenState extends State<ReceiveScreen> {
63
65
Widget build (BuildContext context) {
64
66
final bridge.Config config = context.read< bridge.Config > ();
65
67
68
+ final balance =
69
+ context.watch <WalletChangeNotifier >().walletInfo.balances.onChain ?? Amount .zero ();
70
+ final hasDlcChannel = context.watch <DlcChannelChangeNotifier >().hasDlcChannel ();
71
+ const minBalance = 275000 ;
72
+
66
73
if (_paymentRequest == null ) {
67
74
return Scaffold (
68
75
appBar: AppBar (title: const Text ("Receive funds" )),
@@ -202,6 +209,34 @@ class _ReceiveScreenState extends State<ReceiveScreen> {
202
209
BitcoinAddress (
203
210
address: _paymentRequest == null ? "" : _paymentRequest! .address,
204
211
),
212
+ const SizedBox (height: 20 ),
213
+ Visibility (
214
+ visible: ! hasDlcChannel && balance.sats < minBalance,
215
+ child: Container (
216
+ padding: const EdgeInsets .symmetric (vertical: 10 , horizontal: 20 ),
217
+ decoration: BoxDecoration (
218
+ border: Border .all (color: tenTenOnePurple),
219
+ color: Colors .white,
220
+ borderRadius: BorderRadius .circular (10 )),
221
+ child: Row (
222
+ mainAxisAlignment: MainAxisAlignment .start,
223
+ children: [
224
+ const Icon (
225
+ Icons .info,
226
+ color: tenTenOnePurple,
227
+ size: 22 ,
228
+ ),
229
+ const SizedBox (width: 10 ),
230
+ Expanded (
231
+ child: Text (
232
+ "Receive around ${formatSats (Amount (minBalance ))} to be able to trade." ,
233
+ softWrap: true ,
234
+ style: const TextStyle (fontSize: 16 ),
235
+ ),
236
+ )
237
+ ],
238
+ )),
239
+ ),
205
240
]),
206
241
)));
207
242
}
@@ -548,6 +583,7 @@ class _InvoiceDrawerScreen extends State<InvoiceDrawerScreen> {
548
583
color: Colors .grey.shade300,
549
584
borderRadius: BorderRadius .circular (4 )),
550
585
child: InvoiceInputField (
586
+ keyboardType: TextInputType .number,
551
587
onChanged: (value) => {
552
588
setState (() {
553
589
_amount = int .parse (value);
@@ -631,6 +667,7 @@ class InvoiceInputField extends StatelessWidget {
631
667
final String hintText;
632
668
final List <TextInputFormatter >? inputFormatters;
633
669
final String value;
670
+ final TextInputType ? keyboardType;
634
671
final Widget ? prefixIcon;
635
672
final Widget ? suffixIcon;
636
673
@@ -640,6 +677,7 @@ class InvoiceInputField extends StatelessWidget {
640
677
required this .hintText,
641
678
required this .inputFormatters,
642
679
required this .value,
680
+ this .keyboardType,
643
681
this .prefixIcon,
644
682
this .suffixIcon,
645
683
});
@@ -648,6 +686,7 @@ class InvoiceInputField extends StatelessWidget {
648
686
Widget build (BuildContext context) {
649
687
return TextFormField (
650
688
initialValue: value,
689
+ keyboardType: keyboardType,
651
690
decoration: InputDecoration (
652
691
border: InputBorder .none,
653
692
hintText: hintText,
0 commit comments