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;
}
Future _renameWallet(List<int> _walletID, _newName) async {
void _renameWallet(List<int> _walletID, _newName) async {
MyWalletsProvider myWalletClass = MyWalletsProvider();
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;
if (isEditing) {
if (!nameController.text.contains(':') &&
nameController.text.length <= 39) {
await _renameWallet(_wID, nameController.text);
_renameWallet(_wID, nameController.text);
nameState = true;
} else {
nameState = false;
}
} else {
walletNameFocus.requestFocus();
nameState = true;
}

View File

@ -127,6 +127,7 @@ class WalletOptions extends StatelessWidget {
width: 260,
child: TextField(
key: Key('walletName'),
autofocus: false,
focusNode: _walletOptions.walletNameFocus,
enabled: _walletOptions.isEditing,
controller: _walletOptions.nameController,
@ -223,36 +224,11 @@ class WalletOptions extends StatelessWidget {
InkWell(
key: Key('renameWallet'),
onTap: () async {
// _walletOptions.isEditing = true;
// _walletOptions.reloadBuild();
// _walletOptions.walletNameFocus
// .requestFocus();
_isNewNameValid = await _walletOptions
_isNewNameValid = _walletOptions
.editWalletName(_walletOptions.walletID);
// .then((_) {
// _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'),
// );
// }
// },
// );
await Future.delayed(
Duration(milliseconds: 30));
_walletOptions.walletNameFocus.requestFocus();
},
child: ClipRRect(
child: Image.asset(
@ -262,9 +238,6 @@ class WalletOptions extends StatelessWidget {
width: 20,
height: 20),
)),
// Image.asset(
// 'assets/walletOptions/edit.png',
// ),
SizedBox(
height: 60,
)