fix UI validation bug (#439)

This commit is contained in:
Serhii 2022-08-22 15:42:36 +03:00 committed by GitHub
parent 0754d4cd45
commit f559b10c97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 76 deletions

View file

@ -141,38 +141,38 @@ class _WalletNameFormState extends State<WalletNameForm> {
.decorationColor, .decorationColor,
width: 1.0), 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(), 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,
),
),
),
], ],
), ),
), ),

View file

@ -64,33 +64,33 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
controller: nameTextEditingController, controller: nameTextEditingController,
hintText: S.of(context).wallet_name, hintText: S.of(context).wallet_name,
validator: WalletNameValidator(), validator: WalletNameValidator(),
), suffixIcon: IconButton(
IconButton( onPressed: () async {
onPressed: () async { final rName = await generateName();
final rName = await generateName(); FocusManager.instance.primaryFocus?.unfocus();
FocusManager.instance.primaryFocus?.unfocus();
setState(() { setState(() {
nameTextEditingController.text = rName; nameTextEditingController.text = rName;
nameTextEditingController.selection = nameTextEditingController.selection =
TextSelection.fromPosition(TextPosition( TextSelection.fromPosition(TextPosition(
offset: nameTextEditingController.text.length)); offset: nameTextEditingController.text.length));
}); });
}, },
icon: Container( icon: Container(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0), borderRadius: BorderRadius.circular(6.0),
color: Theme.of(context).hintColor, color: Theme.of(context).hintColor,
), ),
width: 34, width: 34,
height: 34, height: 34,
child: Image.asset( child: Image.asset(
'assets/images/refresh_icon.png', 'assets/images/refresh_icon.png',
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.display1 .display1
.decorationColor, .decorationColor,
),
), ),
), ),
), ),

View file

@ -71,16 +71,11 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
BaseTextFormField( BaseTextFormField(
controller: nameTextEditingController, controller: nameTextEditingController,
hintText: S.of(context).wallet_name, hintText: S.of(context).wallet_name,
validator: WalletNameValidator(), suffixIcon: IconButton(
), onPressed: () async {
Container(
width: 34,
height: 34,
margin: const EdgeInsets.only(bottom: 15, left: 13),
child: InkWell(
onTap: () async {
final rName = await generateName(); final rName = await generateName();
FocusManager.instance.primaryFocus?.unfocus(); FocusManager.instance.primaryFocus?.unfocus();
setState(() { setState(() {
nameTextEditingController.text = rName; nameTextEditingController.text = rName;
nameTextEditingController.selection = nameTextEditingController.selection =
@ -88,17 +83,24 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
offset: nameTextEditingController.text.length)); offset: nameTextEditingController.text.length));
}); });
}, },
child: Container( icon: Container(
padding: EdgeInsets.all(8), padding: const EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).hintColor, borderRadius: BorderRadius.circular(6.0),
borderRadius: BorderRadius.all(Radius.circular(6))), color: Theme.of(context).hintColor,
child: Image.asset('assets/images/refresh_icon.png', ),
color: Theme.of(context) width: 34,
.primaryTextTheme height: 34,
.display1 child: Image.asset(
.decorationColor)), 'assets/images/refresh_icon.png',
color: Theme.of(context)
.primaryTextTheme
.display1
.decorationColor,
),
),
), ),
validator: WalletNameValidator(),
), ),
], ],
)), )),

View file

@ -103,10 +103,10 @@ class SeedWidgetState extends State<SeedWidget> {
)), )),
Positioned( Positioned(
top: 0, top: 0,
right: 0, right: 8,
child: Container( child: Container(
width: 34, width: 32,
height: 34, height: 32,
child: InkWell( child: InkWell(
onTap: () async => _pasteText(), onTap: () async => _pasteText(),
child: Container( child: Container(