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(
alignment: Alignment.centerRight,
children: [
TextFormField(
onChanged: (value) => _walletNewVM.name = value, onChanged: (value) => _walletNewVM.name = value,
controller: _controller, controller: _controller,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 20.0, fontSize: 20.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color), color:
Theme.of(context).primaryTextTheme.title.color),
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: IconButton( 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>[
Stack(
alignment: Alignment.centerRight,
children: [
BaseTextFormField( BaseTextFormField(
controller: nameTextEditingController, controller: nameTextEditingController,
hintText: S.of(context).wallet_name, hintText: S.of(context).wallet_name,
validator: WalletNameValidator(), validator: WalletNameValidator(),
suffixIcon: Container( ),
width: 12, IconButton(
height: 14, onPressed: () async {
margin: const EdgeInsets.only(bottom: 15, left: 13),
child: InkWell(
onTap: () 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,19 +74,25 @@ 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(
borderRadius: BorderRadius.circular(6.0),
color: Theme.of(context).hintColor, color: Theme.of(context).hintColor,
borderRadius: BorderRadius.all(Radius.circular(6))), ),
child: Image.asset('assets/images/refresh_icon.png', width: 34,
height: 34,
child: Image.asset(
'assets/images/refresh_icon.png',
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .primaryTextTheme
.display1 .display1
.decorationColor)), .decorationColor,
), ),
), ),
), ),
],
),
Container(height: 20), Container(height: 20),
BaseTextFormField( BaseTextFormField(
controller: addressController, controller: addressController,

View file

@ -61,17 +61,22 @@ 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: [
Stack(
alignment: Alignment.centerRight,
children: [
BaseTextFormField( BaseTextFormField(
controller: nameTextEditingController, controller: nameTextEditingController,
hintText: S.of(context).wallet_name, hintText: S.of(context).wallet_name,
validator: WalletNameValidator(), validator: WalletNameValidator(),
suffixIcon: Container( ),
width: 12, Container(
height: 14, width: 34,
height: 34,
margin: const EdgeInsets.only(bottom: 15, left: 13), margin: const EdgeInsets.only(bottom: 15, left: 13),
child: InkWell( child: InkWell(
onTap: () async { onTap: () 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 =
@ -91,6 +96,7 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
.decorationColor)), .decorationColor)),
), ),
), ),
],
), ),
Container(height: 20), Container(height: 20),
SeedWidget( SeedWidget(