AutoFocus is not Working
abumoallim opened this issue · comments
abumoallim commented
When the OTP page open, the keyboard should by default open and cursor for the first box should be selected.
and if keyboard is open already open from previous page, it should focus the first edittext without on it explicitly.
Rafał Gajewski commented
I've resolved same problem like this:
@OverRide
void initState() {
super.initState();
myFocusNode = new FocusNode();
WidgetsBinding.instance.addPostFrameCallback((_) => focusBug());
}
void focusBug() {
myFocusNode.unfocus();
FocusScope.of(context).requestFocus(myFocusNode);
}
@OverRide
void dispose() {
myFocusNode.dispose();
super.dispose();
}