I have a textfield with number type and for testing I’m running app on responsive web version with iOS simulator. As below in GIF keyboard appears again on tap done. How can i fix this?
Code:
SizedBox(
width: context.isDesktop ? 300 : (context.width - 40),
height: 50,
child: TextField(
controller: _textController,
autocorrect: false,
enableSuggestions: false,
keyboardType: TextInputType.number,
style: DesignFont.regular(20),
decoration: const InputDecoration(
hintText: Localized.enterPinCode,
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(2)),
borderSide: BorderSide(color: StyleColor.border),
),
),
),
)
1
Handle done action on keyboard for unfocus
void handleAction(TextInputAction action) {
if (action == TextInputAction.done) {
// Handle the "Done" action
FocusScope.of(context).unfocus();
}
}
on TextField add
onSubmitted: (value) => handleAction(TextInputAction.done)
1