Merge pull request #252 from cake-tech/CW-24

soft keyboard dismisses when generate-name icon is pressed
This commit is contained in:
mkyq 2022-02-03 13:45:56 +02:00 committed by GitHub
commit be473dfd93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 107 additions and 83 deletions

View file

@ -105,18 +105,50 @@ class _WalletNameFormState extends State<WalletNameForm> {
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: Form( child: Form(
key: _formKey, key: _formKey,
child: TextFormField( child: Stack(
onChanged: (value) => _walletNewVM.name = value, alignment: Alignment.centerRight,
controller: _controller, children: [
textAlign: TextAlign.center, TextFormField(
style: TextStyle( onChanged: (value) => _walletNewVM.name = value,
fontSize: 20.0, controller: _controller,
fontWeight: FontWeight.w600, textAlign: TextAlign.center,
color: Theme.of(context).primaryTextTheme.title.color), style: TextStyle(
decoration: InputDecoration( fontSize: 20.0,
suffixIcon: IconButton( fontWeight: FontWeight.w600,
color:
Theme.of(context).primaryTextTheme.title.color),
decoration: InputDecoration(
hintStyle: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.accentTextTheme
.display3
.color),
hintText: S.of(context).wallet_name,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.accentTextTheme
.display3
.decorationColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.accentTextTheme
.display3
.decorationColor,
width: 1.0),
),
),
validator: WalletNameValidator(),
),
IconButton(
onPressed: () async { onPressed: () async {
final rName = await generateName(); final rName = await generateName();
FocusManager.instance.primaryFocus?.unfocus();
setState(() { setState(() {
_controller.text = rName; _controller.text = rName;
_walletNewVM.name = rName; _walletNewVM.name = rName;
@ -141,29 +173,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
), ),
), ),
), ),
hintStyle: TextStyle( ],
fontSize: 18.0,
fontWeight: FontWeight.w500,
color:
Theme.of(context).accentTextTheme.display3.color),
hintText: S.of(context).wallet_name,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.accentTextTheme
.display3
.decorationColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.accentTextTheme
.display3
.decorationColor,
width: 1.0),
),
),
validator: WalletNameValidator(),
), ),
), ),
), ),

View file

@ -54,17 +54,19 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
child: Form( child: Form(
key: formKey, key: formKey,
child: Column(children: <Widget>[ child: Column(children: <Widget>[
BaseTextFormField( Stack(
controller: nameTextEditingController, alignment: Alignment.centerRight,
hintText: S.of(context).wallet_name, children: [
validator: WalletNameValidator(), BaseTextFormField(
suffixIcon: Container( controller: nameTextEditingController,
width: 12, hintText: S.of(context).wallet_name,
height: 14, validator: WalletNameValidator(),
margin: const EdgeInsets.only(bottom: 15, left: 13), ),
child: InkWell( IconButton(
onTap: () async { onPressed: () async {
final rName = await generateName(); final rName = await generateName();
FocusManager.instance.primaryFocus?.unfocus();
setState(() { setState(() {
nameTextEditingController.text = rName; nameTextEditingController.text = rName;
nameTextEditingController.selection = nameTextEditingController.selection =
@ -72,18 +74,24 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
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,
),
),
), ),
), ],
), ),
Container(height: 20), Container(height: 20),
BaseTextFormField( BaseTextFormField(

View file

@ -61,36 +61,42 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
return Container( return Container(
padding: EdgeInsets.only(left: 24, right: 24), padding: EdgeInsets.only(left: 24, right: 24),
child: Column(children: [ child: Column(children: [
BaseTextFormField( Stack(
controller: nameTextEditingController, alignment: Alignment.centerRight,
hintText: S.of(context).wallet_name, children: [
validator: WalletNameValidator(), BaseTextFormField(
suffixIcon: Container( controller: nameTextEditingController,
width: 12, hintText: S.of(context).wallet_name,
height: 14, validator: WalletNameValidator(),
margin: const EdgeInsets.only(bottom: 15, left: 13),
child: InkWell(
onTap: () async {
final rName = await generateName();
setState(() {
nameTextEditingController.text = rName;
nameTextEditingController.selection =
TextSelection.fromPosition(TextPosition(
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)),
), ),
), Container(
width: 34,
height: 34,
margin: const EdgeInsets.only(bottom: 15, left: 13),
child: InkWell(
onTap: () async {
final rName = await generateName();
FocusManager.instance.primaryFocus?.unfocus();
setState(() {
nameTextEditingController.text = rName;
nameTextEditingController.selection =
TextSelection.fromPosition(TextPosition(
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)),
),
),
],
), ),
Container(height: 20), Container(height: 20),
SeedWidget( SeedWidget(