我有Flutter(Dart)RenderFlex溢出像素的问题.渲染库的一个例外.
如何管理或应用滚动功能到我的应用页面视图,并避免Flutter使用以下消息呈现异常:
RenderFlex底部溢出28像素.
如果你有任何机会需要完整的日志来帮助我在这里:
在热重载时,它根据消息在底部出现黄色/黑色条纹.
这是我可以使用可滚动小部件管理的东西吗?或者我可以声明我的小部件以控制它?
完整代码,如果需要(我更改了文本数据,但假设出现的文本长于屏幕大小,因此出现错误):
@override
Widget build(BuildContext context) {
return new DefaultTabController(
length: 3,
child: new Scaffold(
appBar: new AppBar(
bottom: new TabBar(
tabs: [
new Tab(text: "xxx",),
new Tab(text: "xxx",),
new Tab(text: "xxx",),
],
),
title: new Text(data["xxx"]),
),
body: new TabBarView(
children: [
new Column(
children: <Widget>[
new Text(data["xxx"],
style: new TextStyle(
fontStyle: FontStyle.italic,
color: Colors.blue,
fontSize: 16.0
),),
new Text(data["xxx"],
style: new TextStyle(
fontStyle: FontStyle.italic,
color: Colors.blue,
fontSize: 10.0
),),
new Text(data["xxx"],
style: new …Run Code Online (Sandbox Code Playgroud) 我是Flutter的新手,所以我通过简单的表格来训练自己。我意识到在iPhone上进行调试时,虚拟键盘触发了一个错误:“ RenderFlex在底部溢出了29个像素”。我通过将Container包装在SingleChildScrollView中解决了此问题。
现在的问题是我专栏的内容不再居中。我不知道为什么...
这是我的代码,可帮助您了解:
List<Widget> _buildBody() {
var listWidget = List<Widget>();
SingleChildScrollView singleChild = SingleChildScrollView(
padding: EdgeInsets.only(top: 1.0),
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.all(30.0),
padding: EdgeInsets.all(10.0),
child: Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
margin: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 50.0),
child: Image.asset(
'assets/github.png',
width: 100.0,
height: 100.0,
),
),
Container(
margin: EdgeInsets.only(bottom: 10.0),
child: TextFormField(
controller: _usernameController,
autofocus: true,
decoration: InputDecoration(
hintText: 'Username',
suffixIcon: Icon(Icons.account_circle)))),
Container(
child: TextFormField(
controller: _passwordController,
obscureText: true,
decoration: InputDecoration(
hintText: 'Password', suffixIcon: Icon(Icons.vpn_key)), …Run Code Online (Sandbox Code Playgroud)