底部溢出 14 个像素的 RenderFlex。导致错误的相关小部件是 AlertDialog
A RenderFlex overflowed by 14 pixels on the bottom. The relevant error-causing widget was AlertDialog
我正在创建一个对话框,当我点击编辑图标按钮时它会打开,但是当我点击文本字段输入文本时它会向我发送此错误
════════ Exception caught by rendering library ═════════════════════════════════
A RenderFlex overflowed by 14 pixels on the bottom.
The relevant error-causing widget was
AlertDialog
这是我的对话框代码
void _getSelectedRowInfo(dynamic date,dynamic timein,dynamic timeout) {
Widget okButton = FlatButton(
child: Text("Submit",style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blue[500],fontSize: 20),),
onPressed: () {
},
);
AlertDialog alert = AlertDialog(
scrollable: true,
//contentPadding:EdgeInsets.fromLTRB(0, 20, 0, 20),
insetPadding: EdgeInsets.symmetric(vertical: 150),
//contentPadding: const EdgeInsets.all(16.0),
title: Text("Request to change time",style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blue[500])),
content:Container(child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child:Column(children:<Widget> [
TextField(
decoration: InputDecoration(labelText: date,hintText: "Date"),
controller:dateController ,
),
TextField(
decoration: InputDecoration(labelText: timein,hintText: "Time in"),
controller:timeinController ,
),
TextField(
decoration: InputDecoration(labelText:timeout,hintText: "Time out"),
controller:timeoutController ,
),
]),
)
),
actions: [
okButton,
],
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}
这是我的对话框的样子
当点击第一个文本字段时,它看起来像这样
请帮我解决一下。
可以将AlertDialog
的scrollable
参数设置为true
来避免溢出:
AlertDialog(
scrollable: true,
insetPadding: EdgeInsets.symmetric(vertical: 150),
title: Text("Request to change time",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.blue[500],)),
content: Column(children: <Widget>[
TextField(
decoration: InputDecoration(labelText: date, hintText: "Date"),
controller: dateController,
),
TextField(
decoration: InputDecoration(labelText: timein, hintText: "Time in"),
controller: timeinController,
),
TextField(
decoration:
InputDecoration(labelText: timeout, hintText: "Time out"),
controller: timeoutController,
),
]),
actions: [
...
]
)
AlertDialog alert = AlertDialog(
scrollable: true,
//contentPadding:EdgeInsets.fromLTRB(0, 20, 0, 20),
insetPadding: EdgeInsets.symmetric(vertical: 150),
//contentPadding: const EdgeInsets.all(16.0),
title: Text("Request to change time",style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blue[500])),
content:Container(child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child:Column(
crossAxisAlignment: CrossAxisAlignment.spaceBetween,
children:<Widget> [
TextField(
decoration: InputDecoration(labelText: date,hintText: "Date"),
controller:dateController ,
),
TextField(
decoration: InputDecoration(labelText: timein,hintText: "Time in"),
controller:timeinController ,
),
TextField(
decoration: InputDecoration(labelText:timeout,hintText: "Time out"),
controller:timeoutController ,
),
]),
)
),
actions: [
okButton,
],
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}
我正在创建一个对话框,当我点击编辑图标按钮时它会打开,但是当我点击文本字段输入文本时它会向我发送此错误
════════ Exception caught by rendering library ═════════════════════════════════
A RenderFlex overflowed by 14 pixels on the bottom.
The relevant error-causing widget was
AlertDialog
这是我的对话框代码
void _getSelectedRowInfo(dynamic date,dynamic timein,dynamic timeout) {
Widget okButton = FlatButton(
child: Text("Submit",style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blue[500],fontSize: 20),),
onPressed: () {
},
);
AlertDialog alert = AlertDialog(
scrollable: true,
//contentPadding:EdgeInsets.fromLTRB(0, 20, 0, 20),
insetPadding: EdgeInsets.symmetric(vertical: 150),
//contentPadding: const EdgeInsets.all(16.0),
title: Text("Request to change time",style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blue[500])),
content:Container(child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child:Column(children:<Widget> [
TextField(
decoration: InputDecoration(labelText: date,hintText: "Date"),
controller:dateController ,
),
TextField(
decoration: InputDecoration(labelText: timein,hintText: "Time in"),
controller:timeinController ,
),
TextField(
decoration: InputDecoration(labelText:timeout,hintText: "Time out"),
controller:timeoutController ,
),
]),
)
),
actions: [
okButton,
],
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}
这是我的对话框的样子
当点击第一个文本字段时,它看起来像这样
请帮我解决一下。
可以将AlertDialog
的scrollable
参数设置为true
来避免溢出:
AlertDialog(
scrollable: true,
insetPadding: EdgeInsets.symmetric(vertical: 150),
title: Text("Request to change time",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.blue[500],)),
content: Column(children: <Widget>[
TextField(
decoration: InputDecoration(labelText: date, hintText: "Date"),
controller: dateController,
),
TextField(
decoration: InputDecoration(labelText: timein, hintText: "Time in"),
controller: timeinController,
),
TextField(
decoration:
InputDecoration(labelText: timeout, hintText: "Time out"),
controller: timeoutController,
),
]),
actions: [
...
]
)
AlertDialog alert = AlertDialog(
scrollable: true,
//contentPadding:EdgeInsets.fromLTRB(0, 20, 0, 20),
insetPadding: EdgeInsets.symmetric(vertical: 150),
//contentPadding: const EdgeInsets.all(16.0),
title: Text("Request to change time",style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blue[500])),
content:Container(child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child:Column(
crossAxisAlignment: CrossAxisAlignment.spaceBetween,
children:<Widget> [
TextField(
decoration: InputDecoration(labelText: date,hintText: "Date"),
controller:dateController ,
),
TextField(
decoration: InputDecoration(labelText: timein,hintText: "Time in"),
controller:timeinController ,
),
TextField(
decoration: InputDecoration(labelText:timeout,hintText: "Time out"),
controller:timeoutController ,
),
]),
)
),
actions: [
okButton,
],
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}