[英]When open Keyboard shows overflow in Flutter
就我而言,我的所有輸入(附加圖像 1)都有一個圓形背景,但是當我單擊最后一個 TextField 時,我收到溢出警告(附加圖像 2)並且無法向下滾動。
我曾嘗試在 Scaffold resizeToAvoidBottomInset: false
中使用,但最后一個 TextField 位於鍵盤下方,所以這不是我想要的。
我認為您需要將所有文本字段包裝在Listview
小部件中。
用SingleChildScrollView
包裝你的代碼
SingleChildScrollView(
child:Stack(
...))
您可以使用Expanded
小部件包裝SingleChildScrollView
小部件。 這是您唯一需要的。
Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded( // Wrap with Expanded!
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.symmetric(
vertical: 16.0, horizontal: 24.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(32.0),
topRight: Radius.circular(32.0),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding:
const EdgeInsets.symmetric(vertical: 16.0),
child: Text('Sign Up',
style: TextStyle(
fontSize: 20.0,
fontFamily: 'Montserrat',
fontWeight: FontWeight.bold)),
),
],
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.