From f559b10c97d42f0d2af0c382779f8fe8e982fd4f Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 22 Aug 2022 15:42:36 +0300 Subject: [PATCH] fix UI validation bug (#439) --- .../screens/new_wallet/new_wallet_page.dart | 58 +++++++++---------- .../wallet_restore_from_keys_form.dart | 52 ++++++++--------- .../wallet_restore_from_seed_form.dart | 38 ++++++------ lib/src/widgets/seed_widget.dart | 6 +- 4 files changed, 78 insertions(+), 76 deletions(-) diff --git a/lib/src/screens/new_wallet/new_wallet_page.dart b/lib/src/screens/new_wallet/new_wallet_page.dart index 9455a76cd..2ea1eca94 100644 --- a/lib/src/screens/new_wallet/new_wallet_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_page.dart @@ -141,38 +141,38 @@ class _WalletNameFormState extends State { .decorationColor, width: 1.0), ), + suffixIcon: IconButton( + onPressed: () async { + final rName = await generateName(); + FocusManager.instance.primaryFocus?.unfocus(); + + setState(() { + _controller.text = rName; + _walletNewVM.name = rName; + _controller.selection = TextSelection.fromPosition( + TextPosition(offset: _controller.text.length)); + }); + }, + icon: Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Theme.of(context).hintColor, + ), + width: 34, + height: 34, + child: Image.asset( + 'assets/images/refresh_icon.png', + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor, + ), + ), + ), ), validator: WalletNameValidator(), ), - IconButton( - onPressed: () async { - final rName = await generateName(); - FocusManager.instance.primaryFocus?.unfocus(); - - setState(() { - _controller.text = rName; - _walletNewVM.name = rName; - _controller.selection = TextSelection.fromPosition( - TextPosition(offset: _controller.text.length)); - }); - }, - icon: Container( - padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Theme.of(context).hintColor, - ), - width: 34, - height: 34, - child: Image.asset( - 'assets/images/refresh_icon.png', - color: Theme.of(context) - .primaryTextTheme - .display1 - .decorationColor, - ), - ), - ), ], ), ), diff --git a/lib/src/screens/restore/wallet_restore_from_keys_form.dart b/lib/src/screens/restore/wallet_restore_from_keys_form.dart index 1058380b7..a74c8c290 100644 --- a/lib/src/screens/restore/wallet_restore_from_keys_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_keys_form.dart @@ -64,33 +64,33 @@ class WalletRestoreFromKeysFromState extends State { controller: nameTextEditingController, hintText: S.of(context).wallet_name, validator: WalletNameValidator(), - ), - IconButton( - onPressed: () async { - final rName = await generateName(); - FocusManager.instance.primaryFocus?.unfocus(); + suffixIcon: IconButton( + onPressed: () async { + final rName = await generateName(); + FocusManager.instance.primaryFocus?.unfocus(); - setState(() { - nameTextEditingController.text = rName; - nameTextEditingController.selection = - TextSelection.fromPosition(TextPosition( - offset: nameTextEditingController.text.length)); - }); - }, - icon: Container( - padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Theme.of(context).hintColor, - ), - width: 34, - height: 34, - child: Image.asset( - 'assets/images/refresh_icon.png', - color: Theme.of(context) - .primaryTextTheme - .display1 - .decorationColor, + setState(() { + nameTextEditingController.text = rName; + nameTextEditingController.selection = + TextSelection.fromPosition(TextPosition( + offset: nameTextEditingController.text.length)); + }); + }, + icon: Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Theme.of(context).hintColor, + ), + width: 34, + height: 34, + child: Image.asset( + 'assets/images/refresh_icon.png', + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor, + ), ), ), ), diff --git a/lib/src/screens/restore/wallet_restore_from_seed_form.dart b/lib/src/screens/restore/wallet_restore_from_seed_form.dart index 07405871c..289d0855d 100644 --- a/lib/src/screens/restore/wallet_restore_from_seed_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_seed_form.dart @@ -71,16 +71,11 @@ class WalletRestoreFromSeedFormState extends State { BaseTextFormField( controller: nameTextEditingController, hintText: S.of(context).wallet_name, - validator: WalletNameValidator(), - ), - Container( - width: 34, - height: 34, - margin: const EdgeInsets.only(bottom: 15, left: 13), - child: InkWell( - onTap: () async { + suffixIcon: IconButton( + onPressed: () async { final rName = await generateName(); FocusManager.instance.primaryFocus?.unfocus(); + setState(() { nameTextEditingController.text = rName; nameTextEditingController.selection = @@ -88,17 +83,24 @@ class WalletRestoreFromSeedFormState extends State { offset: nameTextEditingController.text.length)); }); }, - child: Container( - padding: EdgeInsets.all(8), - decoration: BoxDecoration( - color: Theme.of(context).hintColor, - borderRadius: BorderRadius.all(Radius.circular(6))), - child: Image.asset('assets/images/refresh_icon.png', - color: Theme.of(context) - .primaryTextTheme - .display1 - .decorationColor)), + icon: Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Theme.of(context).hintColor, + ), + width: 34, + height: 34, + child: Image.asset( + 'assets/images/refresh_icon.png', + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor, + ), + ), ), + validator: WalletNameValidator(), ), ], )), diff --git a/lib/src/widgets/seed_widget.dart b/lib/src/widgets/seed_widget.dart index ea67c5d6b..e0d1e8e8d 100644 --- a/lib/src/widgets/seed_widget.dart +++ b/lib/src/widgets/seed_widget.dart @@ -103,10 +103,10 @@ class SeedWidgetState extends State { )), Positioned( top: 0, - right: 0, + right: 8, child: Container( - width: 34, - height: 34, + width: 32, + height: 32, child: InkWell( onTap: () async => _pasteText(), child: Container(