Skip to content
Snippets Groups Projects
Commit b835c701 authored by poka's avatar poka
Browse files

fix: keep keyboard focus when changing wallet source in payment popup

parent dc1b54a0
Branches
Tags
No related merge requests found
...@@ -145,16 +145,14 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -145,16 +145,14 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Consumer<SubstrateSdk>(builder: (context, sub, _) { Consumer<SubstrateSdk>(builder: (context, sub, _) {
// TODO: about keyboard dismiss issue, should try this: https://stackoverflow.com/a/76352647/8301867
return DropdownButton( return DropdownButton(
dropdownColor: const Color(0xffffeed1), dropdownColor: const Color(0xffffeed1),
elevation: 12, elevation: 12,
key: dropdownKey, key: dropdownKey,
value: defaultWallet, value: defaultWallet,
// onTap: () async { onTap: () {
// await Future.delayed(const Duration(milliseconds: 10)); FocusScope.of(context).requestFocus(amountFocus);
// amountFocus.requestFocus(); },
// },
selectedItemBuilder: (_) { selectedItemBuilder: (_) {
return myWalletProvider.listWallets return myWalletProvider.listWallets
.map((WalletData wallet) { .map((WalletData wallet) {
...@@ -268,7 +266,13 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -268,7 +266,13 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
], ],
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
TextField( Focus(
onFocusChange: (focused) {
setState(() {
FocusScope.of(context).requestFocus(amountFocus);
});
},
child: TextField(
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
onEditingComplete: () async => onEditingComplete: () async =>
canValidate ? await executeTransfert() : null, canValidate ? await executeTransfert() : null,
...@@ -305,8 +309,8 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -305,8 +309,8 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
filled: true, filled: true,
fillColor: Colors.transparent, fillColor: Colors.transparent,
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: borderSide: BorderSide(
BorderSide(color: Colors.grey[500]!, width: 2), color: Colors.grey[500]!, width: 2),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
contentPadding: const EdgeInsets.all(20), contentPadding: const EdgeInsets.all(20),
...@@ -317,6 +321,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) { ...@@ -317,6 +321,7 @@ void paymentPopup(BuildContext context, String toAddress, String username) {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
),
const Spacer(), const Spacer(),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment