File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ class _BuySparkNameViewState extends ConsumerState<BuySparkNameView> {
6060 String get _title => isRenewal ? "Renew name" : "Buy name" ;
6161
6262 int _years = 1 ;
63+ late bool _buttonEnabled;
6364
6465 bool _lockAddressFill = false ;
6566 Future <void > _fillCurrentReceiving () async {
@@ -185,10 +186,19 @@ class _BuySparkNameViewState extends ConsumerState<BuySparkNameView> {
185186 @override
186187 void initState () {
187188 super .initState ();
189+
188190 if (isRenewal) {
189191 additionalInfoController.text = widget.nameToRenew! .additionalInfo ?? "" ;
190192 addressController.text = widget.nameToRenew! .address;
191193 }
194+ _buttonEnabled = addressController.text.isNotEmpty;
195+ addressController.addListener (() {
196+ if (mounted) {
197+ setState (() {
198+ _buttonEnabled = addressController.text.isNotEmpty;
199+ });
200+ }
201+ });
192202 }
193203
194204 @override
@@ -527,7 +537,8 @@ class _BuySparkNameViewState extends ConsumerState<BuySparkNameView> {
527537 PrimaryButton (
528538 label: isRenewal ? "Renew" : "Buy" ,
529539 buttonHeight: Util .isDesktop ? ButtonHeight .l : null ,
530- onPressed: _prepareNameTx,
540+ enabled: _buttonEnabled,
541+ onPressed: _buttonEnabled ? _prepareNameTx : null ,
531542 ),
532543 SizedBox (height: Util .isDesktop ? 32 : 16 ),
533544 ],
You can’t perform that action at this time.
0 commit comments