Fix: Show keyboard when renaming a wallet (thx Boris)

This commit is contained in:
poka 2021-11-11 22:37:27 +01:00
parent a417f9e0d3
commit 6b146d7917
2 changed files with 8 additions and 36 deletions

View File

@ -125,7 +125,7 @@ class WalletOptionsProvider with ChangeNotifier {
return _pinLenght; return _pinLenght;
} }
Future _renameWallet(List<int> _walletID, _newName) async { void _renameWallet(List<int> _walletID, _newName) async {
MyWalletsProvider myWalletClass = MyWalletsProvider(); MyWalletsProvider myWalletClass = MyWalletsProvider();
WalletData _walletTarget = myWalletClass.getWalletData(_walletID); WalletData _walletTarget = myWalletClass.getWalletData(_walletID);
@ -176,18 +176,17 @@ class WalletOptionsProvider with ChangeNotifier {
); );
} }
Future<bool> editWalletName(List<int> _wID) async { bool editWalletName(List<int> _wID) {
bool nameState; bool nameState;
if (isEditing) { if (isEditing) {
if (!nameController.text.contains(':') && if (!nameController.text.contains(':') &&
nameController.text.length <= 39) { nameController.text.length <= 39) {
await _renameWallet(_wID, nameController.text); _renameWallet(_wID, nameController.text);
nameState = true; nameState = true;
} else { } else {
nameState = false; nameState = false;
} }
} else { } else {
walletNameFocus.requestFocus();
nameState = true; nameState = true;
} }

View File

@ -127,6 +127,7 @@ class WalletOptions extends StatelessWidget {
width: 260, width: 260,
child: TextField( child: TextField(
key: Key('walletName'), key: Key('walletName'),
autofocus: false,
focusNode: _walletOptions.walletNameFocus, focusNode: _walletOptions.walletNameFocus,
enabled: _walletOptions.isEditing, enabled: _walletOptions.isEditing,
controller: _walletOptions.nameController, controller: _walletOptions.nameController,
@ -223,36 +224,11 @@ class WalletOptions extends StatelessWidget {
InkWell( InkWell(
key: Key('renameWallet'), key: Key('renameWallet'),
onTap: () async { onTap: () async {
// _walletOptions.isEditing = true; _isNewNameValid = _walletOptions
// _walletOptions.reloadBuild();
// _walletOptions.walletNameFocus
// .requestFocus();
_isNewNameValid = await _walletOptions
.editWalletName(_walletOptions.walletID); .editWalletName(_walletOptions.walletID);
// .then((_) { await Future.delayed(
// _walletOptions.walletNameFocus Duration(milliseconds: 30));
// .requestFocus(); _walletOptions.walletNameFocus.requestFocus();
// _walletOptions.reloadBuild();
// });
// .then(
// (_result) {
// if (_result == true) {
// WidgetsBinding.instance
// .addPostFrameCallback((_) {
// _myWalletProvider.listWallets =
// _myWalletProvider
// .readAllWallets(
// _currentChest);
// _myWalletProvider.rebuildWidget();
// });
// Navigator.popUntil(
// context,
// ModalRoute.withName('/mywallets'),
// );
// }
// },
// );
}, },
child: ClipRRect( child: ClipRRect(
child: Image.asset( child: Image.asset(
@ -262,9 +238,6 @@ class WalletOptions extends StatelessWidget {
width: 20, width: 20,
height: 20), height: 20),
)), )),
// Image.asset(
// 'assets/walletOptions/edit.png',
// ),
SizedBox( SizedBox(
height: 60, height: 60,
) )