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),
child: Form(
key: _formKey,
child: TextFormField(
onChanged: (value) => _walletNewVM.name = value,
controller: _controller,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color),
decoration: InputDecoration(
suffixIcon: IconButton(
child: Stack(
alignment: Alignment.centerRight,
children: [
TextFormField(
onChanged: (value) => _walletNewVM.name = value,
controller: _controller,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20.0,
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 {
final rName = await generateName();
FocusManager.instance.primaryFocus?.unfocus();
setState(() {
_controller.text = 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(
key: formKey,
child: Column(children: <Widget>[
BaseTextFormField(
controller: nameTextEditingController,
hintText: S.of(context).wallet_name,
validator: WalletNameValidator(),
suffixIcon: Container(
width: 12,
height: 14,
margin: const EdgeInsets.only(bottom: 15, left: 13),
child: InkWell(
onTap: () async {
Stack(
alignment: Alignment.centerRight,
children: [
BaseTextFormField(
controller: nameTextEditingController,
hintText: S.of(context).wallet_name,
validator: WalletNameValidator(),
),
IconButton(
onPressed: () async {
final rName = await generateName();
FocusManager.instance.primaryFocus?.unfocus();
setState(() {
nameTextEditingController.text = rName;
nameTextEditingController.selection =
@ -72,18 +74,24 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
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,
),
),
),
),
],
),
Container(height: 20),
BaseTextFormField(

View file

@ -61,36 +61,42 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
return Container(
padding: EdgeInsets.only(left: 24, right: 24),
child: Column(children: [
BaseTextFormField(
controller: nameTextEditingController,
hintText: S.of(context).wallet_name,
validator: WalletNameValidator(),
suffixIcon: Container(
width: 12,
height: 14,
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)),
Stack(
alignment: Alignment.centerRight,
children: [
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 {
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),
SeedWidget(