Hey how do I dismiss the keyboard here? I want the keyboard to dismiss when tapped outside the area.
Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.fromLTRB(15, 0, 15, 0), child: TextFormField( keyboardType: TextInputType.number, maxLength: 10, controller: widget._phoneController, onTap: () => FocusScope.of(context).unfocus(), inputFormatters: [ //input type FilteringTextInputFormatter.allow( RegExp(r'[0-9]'), ), ], //how the text box is decorated decoration: buildInputDecoration( Icons.phone, 'Enter your 10 digit phone number'), ), );
}
https://stackoverflow.com/questions/66575488/how-do-i-dismiss-the-keyboard-in-textformfeild-flutter-2-0-1 March 11, 2021 at 10:05AM
没有评论:
发表评论