![](/img/trans.png)
[英]Push screen bottom on top of keyboard in flutter when TextField or TextFormField is focused
[英]how to avoid keyboard when textfield focused in flutter
將 resizeToAvoidBottomInset 添加到腳手架:
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false, // add here
或者用 SingleChildScrollView 包裝 Colum,如下所示:
SingleChildScrollView( // wrap in
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFieldsHere
],
),
),
您可以將 FocusNode 創建為: FocusNode focusNode; 在 initState 方法中初始化它之后,您可以使用 TextFormField 的 focusNode 屬性將您創建的 focusNode 分配給該屬性
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.