fix UI validation bug (#439)

Serhii committed Aug 22, 2022 at 15:42 UTC f559b10c97d42f0d2af0c382779f8fe8e982fd4f
4 files changed +78 -76
lib/src/screens/new_wallet/new_wallet_page.dart
+29 -29
@@ -141,37 +141,37 @@ class _WalletNameFormState extends State<WalletNameForm> {
141 .decorationColor,
142 width: 1.0),
143 ),
144 - ),
145 - validator: WalletNameValidator(),
146 - ),
147 - IconButton(
148 - onPressed: () async {
149 - final rName = await generateName();
150 - FocusManager.instance.primaryFocus?.unfocus();
151 -
152 - setState(() {
153 - _controller.text = rName;
154 - _walletNewVM.name = rName;
155 - _controller.selection = TextSelection.fromPosition(
156 - TextPosition(offset: _controller.text.length));
157 - });
158 - },
159 - icon: Container(
160 - padding: const EdgeInsets.all(8),
161 - decoration: BoxDecoration(
162 - borderRadius: BorderRadius.circular(6.0),
163 - color: Theme.of(context).hintColor,
164 - ),
165 - width: 34,
166 - height: 34,
167 - child: Image.asset(
168 - 'assets/images/refresh_icon.png',
169 - color: Theme.of(context)
170 - .primaryTextTheme
171 - .display1
172 - .decorationColor,
144 + suffixIcon: IconButton(
145 + onPressed: () async {
146 + final rName = await generateName();
147 + FocusManager.instance.primaryFocus?.unfocus();
148 +
149 + setState(() {
150 + _controller.text = rName;
151 + _walletNewVM.name = rName;
152 + _controller.selection = TextSelection.fromPosition(
153 + TextPosition(offset: _controller.text.length));
154 + });
155 + },
156 + icon: Container(
157 + padding: const EdgeInsets.all(8),
158 + decoration: BoxDecoration(
159 + borderRadius: BorderRadius.circular(6.0),
160 + color: Theme.of(context).hintColor,
161 + ),
162 + width: 34,
163 + height: 34,
164 + child: Image.asset(
165 + 'assets/images/refresh_icon.png',
166 + color: Theme.of(context)
167 + .primaryTextTheme
168 + .display1
169 + .decorationColor,
170 + ),
171 + ),
172 ),
173 ),
174 + validator: WalletNameValidator(),
175 ),
176 ],
177 ),
lib/src/screens/restore/wallet_restore_from_keys_form.dart
+26 -26
@@ -64,33 +64,33 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
64 controller: nameTextEditingController,
65 hintText: S.of(context).wallet_name,
66 validator: WalletNameValidator(),
67 - ),
68 - IconButton(
69 - onPressed: () async {
70 - final rName = await generateName();
71 - FocusManager.instance.primaryFocus?.unfocus();
67 + suffixIcon: IconButton(
68 + onPressed: () async {
69 + final rName = await generateName();
70 + FocusManager.instance.primaryFocus?.unfocus();
71
73 - setState(() {
74 - nameTextEditingController.text = rName;
75 - nameTextEditingController.selection =
76 - TextSelection.fromPosition(TextPosition(
77 - offset: nameTextEditingController.text.length));
78 - });
79 - },
80 - icon: Container(
81 - padding: const EdgeInsets.all(8),
82 - decoration: BoxDecoration(
83 - borderRadius: BorderRadius.circular(6.0),
84 - color: Theme.of(context).hintColor,
85 - ),
86 - width: 34,
87 - height: 34,
88 - child: Image.asset(
89 - 'assets/images/refresh_icon.png',
90 - color: Theme.of(context)
91 - .primaryTextTheme
92 - .display1
93 - .decorationColor,
72 + setState(() {
73 + nameTextEditingController.text = rName;
74 + nameTextEditingController.selection =
75 + TextSelection.fromPosition(TextPosition(
76 + offset: nameTextEditingController.text.length));
77 + });
78 + },
79 + icon: Container(
80 + padding: const EdgeInsets.all(8),
81 + decoration: BoxDecoration(
82 + borderRadius: BorderRadius.circular(6.0),
83 + color: Theme.of(context).hintColor,
84 + ),
85 + width: 34,
86 + height: 34,
87 + child: Image.asset(
88 + 'assets/images/refresh_icon.png',
89 + color: Theme.of(context)
90 + .primaryTextTheme
91 + .display1
92 + .decorationColor,
93 + ),
94 ),
95 ),
96 ),
lib/src/screens/restore/wallet_restore_from_seed_form.dart
+20 -18
@@ -71,16 +71,11 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
71 BaseTextFormField(
72 controller: nameTextEditingController,
73 hintText: S.of(context).wallet_name,
74 - validator: WalletNameValidator(),
75 - ),
76 - Container(
77 - width: 34,
78 - height: 34,
79 - margin: const EdgeInsets.only(bottom: 15, left: 13),
80 - child: InkWell(
81 - onTap: () async {
74 + suffixIcon: IconButton(
75 + onPressed: () async {
76 final rName = await generateName();
77 FocusManager.instance.primaryFocus?.unfocus();
78 +
79 setState(() {
80 nameTextEditingController.text = rName;
81 nameTextEditingController.selection =
@@ -88,17 +83,24 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
83 offset: nameTextEditingController.text.length));
84 });
85 },
91 - child: Container(
92 - padding: EdgeInsets.all(8),
93 - decoration: BoxDecoration(
94 - color: Theme.of(context).hintColor,
95 - borderRadius: BorderRadius.all(Radius.circular(6))),
96 - child: Image.asset('assets/images/refresh_icon.png',
97 - color: Theme.of(context)
98 - .primaryTextTheme
99 - .display1
100 - .decorationColor)),
86 + icon: Container(
87 + padding: const EdgeInsets.all(8),
88 + decoration: BoxDecoration(
89 + borderRadius: BorderRadius.circular(6.0),
90 + color: Theme.of(context).hintColor,
91 + ),
92 + width: 34,
93 + height: 34,
94 + child: Image.asset(
95 + 'assets/images/refresh_icon.png',
96 + color: Theme.of(context)
97 + .primaryTextTheme
98 + .display1
99 + .decorationColor,
100 + ),
101 + ),
102 ),
103 + validator: WalletNameValidator(),
104 ),
105 ],
106 )),
lib/src/widgets/seed_widget.dart
+3 -3
@@ -103,10 +103,10 @@ class SeedWidgetState extends State<SeedWidget> {
103 )),
104 Positioned(
105 top: 0,
106 - right: 0,
106 + right: 8,
107 child: Container(
108 - width: 34,
109 - height: 34,
108 + width: 32,
109 + height: 32,
110 child: InkWell(
111 onTap: () async => _pasteText(),
112 child: Container(