Answers for "how to dismiss the keyboard in flutter"

1

dismiss keyboard flutter

// The correct way of closing the keyboard is

FocusScope.of(context).unfocus();
Posted by: Guest on June-19-2021
2

flutter close keyboard

FocusScope.of(context).unfocus();
Posted by: Guest on October-12-2020
0

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();
        },),    
      ],
    )
  );
  }
}
Posted by: Guest on November-09-2020

Code answers related to "how to dismiss the keyboard in flutter"

Browse Popular Code Answers by Language