Flutter 底部的RenderFlex溢出147像素
下面是我正在尝试构建的应用程序的屏幕截图 单击“出生日期”字段应显示日历。假设我在email textform字段中,键盘打开,现在用户移动到出生日期字段。只要用户点击date of birth字段,我就会移除键盘并显示日历,当时我得到一个异常,底部的RenderFlex溢出了147个像素 我已经讨论了一些关于这个的堆栈问题,其中提到了使用我正在使用的ListView。下面是我的代码片段Flutter 底部的RenderFlex溢出147像素,flutter,flutter-layout,Flutter,Flutter Layout,下面是我正在尝试构建的应用程序的屏幕截图 单击“出生日期”字段应显示日历。假设我在email textform字段中,键盘打开,现在用户移动到出生日期字段。只要用户点击date of birth字段,我就会移除键盘并显示日历,当时我得到一个异常,底部的RenderFlex溢出了147个像素 我已经讨论了一些关于这个的堆栈问题,其中提到了使用我正在使用的ListView。下面是我的代码片段 return Scaffold( body: Column( children: <Wi
return Scaffold(
body: Column(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 8.0, 40.0, 8.0),
child: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
},
child: ListView(
children: <Widget>[
Image.asset(
"images/alphaurbanelogo.png",
width: 150.0,
height: 150.0,
),
Text("Sign Up",
style: TextStyle(
color: Colors.black,
fontFamily: "aktivgroteskBold",
fontSize: 25.0)),
SizedBox(
height: 5.0,
),
Text("Create an account to access\n TAUP system",
style: TextStyle(
color: Colors.black,
fontFamily: "aktivgroteskLight",
fontSize: 15.0)),
SizedBox(
height: 10.0,
),
TextFormField(
style: TextStyle(color: Color(0xFF5c2a7c)),
decoration: InputDecoration(
hintText: "First Name",
hintStyle: TextStyle(color: Color(0xFF5c2a7c)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFF5c2a7c)))),
),
SizedBox(
height: 10.0,
),
TextFormField(
style: TextStyle(color: Color(0xFF5c2a7c)),
decoration: InputDecoration(
hintText: "Last Name",
hintStyle: TextStyle(color: Color(0xFF5c2a7c)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFF5c2a7c)))),
),
SizedBox(
height: 10.0,
),
TextFormField(
style: TextStyle(color: Color(0xFF5c2a7c)),
decoration: InputDecoration(
hintText: "Email",
hintStyle: TextStyle(color: Color(0xFF5c2a7c)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFF5c2a7c)))),
),
SizedBox(
height: 10.0,
),
InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode());
_selectDate(context);
},
child: Row(
children: <Widget>[
Flexible(
child: TextFormField(
style: TextStyle(
color: Color(0xFF5c2a7c), height: 2.0),
enabled: false,
controller: dobController,
decoration: InputDecoration.collapsed(
hintText: "Date of Birth",
hintStyle: TextStyle(color: Color(0xFF5c2a7c)),
)),
),
Icon(
Icons.email,
color: Color(0xFF5c2a7c),
),
],
),
),
Divider(
color: Color(0xFF5c2a7c),
height: 5.0,
),
SizedBox(
height: 10.0,
),
TextFormField(
style: TextStyle(color: Color(0xFF5c2a7c)),
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: "Contact Number",
hintStyle: TextStyle(color: Color(0xFF5c2a7c)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFF5c2a7c)))),
),
SizedBox(
height: 10.0,
),
TextFormField(
style: TextStyle(color: Color(0xFF5c2a7c)),
decoration: InputDecoration(
hintText: "Parent Email",
hintStyle: TextStyle(color: Color(0xFF5c2a7c)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFF5c2a7c)))),
),
SizedBox(
height: 10.0,
),
TextFormField(
style: TextStyle(color: Color(0xFF5c2a7c)),
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: "Parent Contact Number",
hintStyle: TextStyle(color: Color(0xFF5c2a7c)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0xFF5c2a7c)))),
),
SizedBox(
height: 10.0,
),
DropdownButton<String>(
items: _schools.map((String dropDownStringItem) {
return DropdownMenuItem<String>(
value: dropDownStringItem,
child: Text(dropDownStringItem),
);
}).toList(),
hint: Text("School/Institution"),
onChanged: (String newValueSelected) {
setState(() {
this._currentItemSelected = newValueSelected;
});
},
value: _currentItemSelected,
style: TextStyle(color: Color(0xFF5c2a7c), fontSize: 16.0),
),
SizedBox(
height: 1.0,
),
Divider(
color: Color(0xFF5c2a7c),
height: 5.0,
),
SizedBox(
height: 10.0,
),
Row(
children: <Widget>[
Spacer(),
InkWell(
child: Image.asset(
"images/next.png",
width: 40.0,
height: 40.0,
),
onTap: () {},
)
],
)
],
),
),
)),
BottomBar()
],
),
);
Future<Null> _selectDate(BuildContext context) async {
final DateTime picked = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: new DateTime(1900),
lastDate: new DateTime(2100));
if (picked != null) {
var formatter = new DateFormat('yyyy-MM-dd');
choosenDate = formatter.format(picked);
dobController.text = choosenDate;
}
}
返回脚手架(
正文:专栏(
儿童:[
扩大(
孩子:填充(
填充:LTRB(20.0,8.0,40.0,8.0)中的常数边集,
孩子:InkWell(
onTap:(){
FocusScope.of(context.requestFocus(FocusNode());
},
子:ListView(
儿童:[
影像资产(
“images/alphaurbanelogo.png”,
宽度:150.0,
高度:150.0,
),
文本(“注册”,
样式:TextStyle(
颜色:颜色,黑色,
fontFamily:“aktivgroteskBold”,
字体大小:25.0),
大小盒子(
身高:5.0,
),
文本(“创建帐户以访问\n TAUP系统”,
样式:TextStyle(
颜色:颜色,黑色,
fontFamily:“奇幻之光”,
字体大小:15.0),
大小盒子(
身高:10.0,
),
TextFormField(
样式:TextStyle(颜色:颜色(0xFF5c2a7c)),
装饰:输入装饰(
hintText:“名字”,
hintStyle:TextStyle(颜色:颜色(0xFF5c2a7c)),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:颜色(0xFF5c2a7c)),
),
大小盒子(
身高:10.0,
),
TextFormField(
样式:TextStyle(颜色:颜色(0xFF5c2a7c)),
装饰:输入装饰(
hintText:“姓氏”,
hintStyle:TextStyle(颜色:颜色(0xFF5c2a7c)),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:颜色(0xFF5c2a7c)),
),
大小盒子(
身高:10.0,
),
TextFormField(
样式:TextStyle(颜色:颜色(0xFF5c2a7c)),
装饰:输入装饰(
hintText:“电子邮件”,
hintStyle:TextStyle(颜色:颜色(0xFF5c2a7c)),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:颜色(0xFF5c2a7c)),
),
大小盒子(
身高:10.0,
),
墨水池(
onTap:(){
FocusScope.of(context.requestFocus(FocusNode());
_选择日期(上下文);
},
孩子:排(
儿童:[
灵活的(
子项:TextFormField(
样式:TextStyle(
颜色:颜色(0xFF5c2a7c),高度:2.0),
启用:false,
控制器:控制器,
装饰:输入装饰(
hintText:“出生日期”,
hintStyle:TextStyle(颜色:颜色(0xFF5c2a7c)),
)),
),
图标(
Icons.email,
颜色:颜色(0xFF5c2a7c),
),
],
),
),
分隔器(
颜色:颜色(0xFF5c2a7c),
身高:5.0,
),
大小盒子(
身高:10.0,
),
TextFormField(
样式:TextStyle(颜色:颜色(0xFF5c2a7c)),
键盘类型:TextInputType.number,
装饰:输入装饰(
hintText:“联系电话”,
hintStyle:TextStyle(颜色:颜色(0xFF5c2a7c)),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:颜色(0xFF5c2a7c)),
),
大小盒子(
身高:10.0,
),
TextFormField(
样式:TextStyle(颜色:颜色(0xFF5c2a7c)),
装饰:输入装饰(
hintText:“家长电子邮件”,
hintStyle:TextStyle(颜色:颜色(0xFF5c2a7c)),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:颜色(0xFF5c2a7c)),
),
大小盒子(
身高:10.0,
),
TextFormField(
样式:TextStyle(颜色:颜色(0xFF5c2a7c)),
键盘类型:TextInputType.number,
装饰:输入装饰(
hintText:“家长联系电话”,
hintStyle:TextStyle(颜色:颜色(0xFF5c2a7c)),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:颜色(0xFF5c2a7c)),
),
大小盒子(
身高:10.0,
),
下拉按钮(
项目:_schools.map((字符串dropDownStringItem){
返回下拉菜单项(
值:dropDownStringItem,
子:文本(drop)
return Form(
key: _formKey,
autovalidate: _autoValidate,
child: SingleChildScrollView(
padding: const EdgeInsets.all(10.0),
child: Column(
(...)