如何解决异常“A RenderFlex 在底部溢出 23 个像素”。在我的应用程序中,我创建了 Gridview。但是每次运行代码时都会获得 RenderFlex。我用扩展添加包装 Gridview
- 滚动方向:Axis.vertical,
- 收缩包装:是的,
但仍然没有效果得到这个异常。谁能纠正我;我在我的代码中做错了什么?我应该怎么做。
这是我收到错误的代码:
Widget build(BuildContext context) {
return Scaffold(
body:Container(
height: 150,
width: MediaQuery.of(context).size.width,
color: Colors.grey[100],
child: Column(children: [
Expanded(
child: Padding(
padding: EdgeInsets.fromLTRB(10, 40, 0, 0),
child: Container(
child: Column(
children: [
Align(
alignment: Alignment.centerLeft,
child: Container(
child: Text('Oliver Queen'),
),
),
SizedBox(height:5),
Align(
alignment: Alignment.centerLeft,
child: Container(
child: Text('olieequeen77@gmail'),
),
),
SizedBox(height:5),
Align(
alignment: Alignment.centerLeft,
child: Container(
child: Text('9874561239'),
),
),
],
),
),
),
),
Expanded(
child: GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
scrollDirection: Axis.vertical,
shrinkWrap: true,
children: <Widget>[
Container(
color: Colors.grey[100],
height: 90.0,
width: 110.0,
child: TextButton(onPressed: (){
},
child: Column(children: [
Icon(Icons.home,size: 45,
color: Colors.purple,),
Text("My Settings",
style: TextStyle(fontSize: 12,color: Colors.black)),
],),
),
),
Container(
color: Colors.grey[100],
height: 90.0,
width: 110.0,
child: TextButton(onPressed: (){
},
child: Column(children: [
Icon(Icons.home,size: 45,
color: Colors.purple,),
Text("My Settings",
style: TextStyle(fontSize: 12,color: Colors.black)),
],),
),
),
Container(
color: Colors.grey[100],
height: 90.0,
width: 110.0,
child: TextButton(onPressed: (){
},
child: Column(children: [
Icon(Icons.home,size: 45,
color: Colors.purple,),
Text("My Settings",
style: TextStyle(fontSize: 12,color: Colors.black)),
],),
),
),
Container(
color: Colors.grey[100],
height: 90.0,
width: 110.0,
child: TextButton(onPressed: (){
},
child: Column(children: [
Icon(Icons.home,size: 45,
color: Colors.purple,),
Text("My Settings",
style: TextStyle(fontSize: 12,color: Colors.black)),
],),
),
),
Container(
color: Colors.grey[100],
height: 90.0,
width: 110.0,
child: TextButton(onPressed: (){
},
child: Column(children: [
Icon(Icons.home,size: 45,
color: Colors.purple,),
Text("My Settings",
style: TextStyle(fontSize: 12,color: Colors.black)),
],),
),
),
],
),
)
],
),
),
);
}
}