我正在建立一个设置页面。
class SettingsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Settings",
style: TextStyle(
color: primaryColor,
fontFamily: titleFontStyle
),
),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: primaryColor),
onPressed: () => Navigator.of(context).pop(),
),
centerTitle: true,
backgroundColor: Colors.white,
elevation: 0.0,
),
backgroundColor: Colors.white,
body: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height - 40.0,
padding: EdgeInsets.fromLTRB(20.0, 60.0, 20.0, 0.0),
child: ListView(
children: <Widget>[
Container(
child: TextField(
autofocus: true,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Username',
),
),
),
Container(
margin: EdgeInsets.only(top: 20.0),
child: RaisedButton(
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 40.0),
textColor: Colors.white,
color: primaryColor,
child: Text(
'Update',
style: TextStyle(
color: Colors.white
),
),
onPressed: () {},
),
),
],
),
),
);
}
}
每当我尝试按“后退”按钮时,都会出现渲染flex溢出错误。
错误消息如下:-
The specific RenderFlex in question is:
I/flutter (18259): RenderFlex#17a8f relayoutBoundary=up1 OVERFLOWING
I/flutter (18259): creator: Column ← MediaQuery ← LayoutId
我尝试将容器包装在SingleChildScrollView()
中,但是它不起作用。
在使用Column()
之前,我曾经使用ListView()
,但是那也不起作用。
答案 0 :(得分:0)
这是由软键盘引起的,请将其添加到脚手架小部件中
>>> from email import message_from_string
>>> full_email_text = """From: santa@northpole
... To: the_responsible_owner_of_this_email_address@example.com
... X-DSPAM-Confidence: 0.8475
... Subject: Attractive offer of shared wealth
...
... Dear ...
...
... Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ...
...
... """
>>> msg = message_from_string(full_email_text)
>>> confidence = msg.get("X-DSPAM-Confidence")
>>> confidence
'0.8475 '
>>> float(confidence)
0.8475
或
>>> msg.get("X-DSPAM-Confidence")
'0.8475 '
>>> msg.get("x-dspam-confidence")
'0.8475 '
>>> msg.get("X-dSpAm-CoNfIdEnCe")
'0.8475 '
答案 1 :(得分:0)
存在多种避免该错误的方法,但更重要的是,该错误的唯一解决方法是,我们可以使用C4C所说的来完成,它可以了解发生了什么,您可以在this帖子中了解有关此错误的更多信息来自Flutter社区的Scott Stoll
您也可以使用Expanded或Flexible窗口小部件来避免这种情况,在阅读他所做的4篇文章后,您将了解有关此错误的更多信息。
您还可以从容器中删除尺寸,并添加列表视图的属性rinkWrap:true。