dismiss keyboard flutter
// The correct way of closing the keyboard is
FocusScope.of(context).unfocus();
dismiss keyboard flutter
// The correct way of closing the keyboard is
FocusScope.of(context).unfocus();
flutter close keyboard
FocusScope.of(context).unfocus();
how i can close keyboard in flutter
class YourPage extends StatefulWidget {
createState() => _YourPageState();
}
class _YourPageState extends State<MobileHome> {
FocusNode focusNode = new FocusNode();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextField(
focusNode: focusNode,
),
SizedBox(height: 10,),
RaisedButton(child: Text("UP"),onPressed: (){
FocusScope.of(context).requestFocus(focusNode);
},),
SizedBox(height: 10,),
RaisedButton(child: Text("DOWN"),onPressed: (){
focusNode.unfocus();
},),
],
)
);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us