Android 如何解决颤振中的RenderFlex溢出问题
嗨,我是一个新手,尝试编写我的第一个应用程序,我如何解决RenderFlex错误,我想让show将两个文本字段放在不同的容器中 我的第二张单子上又出现了这个问题。我还打算显示列表中最近的项目,但实际上它仍然位于底部导航层下,并且没有完全显示。我的代码在这里,提前感谢您的指导Android 如何解决颤振中的RenderFlex溢出问题,android,flutter,dart,Android,Flutter,Dart,嗨,我是一个新手,尝试编写我的第一个应用程序,我如何解决RenderFlex错误,我想让show将两个文本字段放在不同的容器中 我的第二张单子上又出现了这个问题。我还打算显示列表中最近的项目,但实际上它仍然位于底部导航层下,并且没有完全显示。我的代码在这里,提前感谢您的指导 Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomPadding: false, body: Column( c
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false,
body: Column(
children: <Widget>[
Padding(
padding:
const EdgeInsets.only(top: 32, left: 16, right: 16),
child: Row(
children: <Widget>[
Container(
height: 45,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
blurRadius: 10.0,
color: Colors.black.withOpacity(.1),
offset: Offset(3.0, 3.0),
),
],
),
child: RaisedButton.icon(
onPressed: () {},
icon: Icon(Icons.arrow_drop_down_circle),
label: Text("انتخاب موقعیت"),
color: Color(0XffF1F2F3),
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(18.0),
),
)),
SizedBox(
width: 20,
),
Container(
height: 50,
width: MediaQuery.of(context).size.width / 1.899,
child: TextField(
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(top: 5),
hintText: "جستوجو آگهی ...",
prefixIcon: Icon(
Icons.search,
color: (Colors.grey),
),
filled: true,
fillColor: Color(0XffF1F2F3),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide.none)),
),
)
],
),
),
Container(
height: 130,
child: ListView.builder(
itemCount: 10,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 8),
child: new Container(
width: 70,
height: 70,
decoration: new BoxDecoration(
boxShadow: [
BoxShadow(
blurRadius: 8.0,
color: Colors.black38
.withOpacity(.5),
offset: Offset(2.0, 2.0),
),
],
border: Border.all(
width: 1,
color: Colors.red,
style: BorderStyle.solid),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.yellow,
Colors.amber,
Colors.orangeAccent,
Colors.deepOrange,
Colors.redAccent,
Colors.red
]),
shape: BoxShape.circle,
image: new DecorationImage(
image: new NetworkImage(
"https://cdn0.iconfinder.com/data/icons/classic-cars-by-cemagraphics/512/camaro_512.png")))),
),
Padding(
padding: const EdgeInsets.only(top: 8),
child: Text(
"خودرو",
style: TextStyle(
fontSize: 15, color: Colors.black87),
),
),
],
),
);
}),
),
SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: ListView.builder(
itemCount: 10,
scrollDirection: Axis.vertical,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(
left: 8, right: 8, bottom: 12),
child: Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
blurRadius: 9.0,
color: Colors.black54.withOpacity(.3),
offset: Offset(5.0, 5.0),
),
],
color: Color(0XffF3F3F4),
borderRadius: BorderRadius.circular(10),
border: Border.all(
width: 1,
color: Color(0XffF3F3F4),
style: BorderStyle.solid),
),
child: Row(
children: <Widget>[
Container(
height: 200,
width: MediaQuery.of(context).size.width /
2.1,
decoration: new BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.only(
topRight:
const Radius.circular(10.0),
bottomRight:
const Radius.circular(10.0)),
image: new DecorationImage(
fit: BoxFit.fill,
image: new NetworkImage(
"https://s101.divarcdn.com/static/pictures/1576001315/QXv36p38.jpg")))),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(
top: 10,
left: 8,
right: 8,
bottom: 60),
child: Text(
"سمند سفید مشابه صفر",
style: TextStyle(
fontSize: 18,
color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"29000000 تومان",
style: TextStyle(
fontSize: 15,
color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(
right: 8,
left: 8,
top: 40,
bottom: 10),
child: Row(
children: <Widget>[
Text(
"دقایقی پیش در شیراز",
style: TextStyle(
fontSize: 13,
color: Colors.black),
),
SizedBox(
width: 20,
),
Text(
"خودرو",
style: TextStyle(
fontSize: 11,
color: Colors.black),
),
],
),
),
],
)
],
),
));
},
),
),
),
],
),
);
小部件构建(构建上下文){
返回脚手架(
resizeToAvoidBottomPadding:false,
正文:专栏(
儿童:[
填充物(
衬垫:
仅限常数边集(顶部:32,左侧:16,右侧:16),
孩子:排(
儿童:[
容器(
身高:45,
装饰:盒子装饰(
boxShadow:[
箱形阴影(
半径:10.0,
颜色:颜色。黑色。不透明度(.1),
偏移量:偏移量(3.0,3.0),
),
],
),
子:RaisedButton.icon(
按下:(){},
图标:图标(图标。箭头\下拉\圆圈),
标签:文本(“文本”),
颜色:颜色(0XffF1F2F3),
形状:圆形矩形边框(
边界半径:新边界半径。圆形(18.0),
),
)),
大小盒子(
宽度:20,
),
容器(
身高:50,
宽度:MediaQuery.of(context).size.width/1.899,
孩子:TextField(
装饰:输入装饰(
contentPadding:仅限常量边集(顶部:5),
hintText:“جستوآگهی…”,
前缀:图标(
Icons.search,
颜色:(颜色。灰色),
),
是的,
填充颜色:颜色(0XffF1F2F3),
边框:大纲输入边框(
边界半径:边界半径。圆形(20),
borderSide:borderSide.无,
),
)
],
),
),
容器(
身高:130,
子项:ListView.builder(
物品计数:10,
滚动方向:轴水平,
itemBuilder:(上下文,索引){
返回填充(
填充:常量边集。全部(8),
子:列(
crossAxisAlignment:crossAxisAlignment.center,
儿童:[
填充物(
填充:仅限常量边集(顶部:8),
子容器:新容器(
宽度:70,
身高:70,
装饰:新盒子装饰(
boxShadow:[
箱形阴影(
半径:8.0,
颜色:颜色
.具有不透明度(.5),
偏移量:偏移量(2.0,2.0),
),
],
边界:边界(
宽度:1,
颜色:颜色,红色,
样式:边框样式。实心),
梯度:线性梯度(
开始:Alignment.topLeft,
结束:对齐。右下角,
颜色:[
颜色,黄色,
颜色,琥珀色,
颜色。橙色每分,
颜色,深橙色,
颜色,红色口音,
颜色。红色
]),
形状:BoxShape.circle,
图片:新装饰图片(
图像:新网络图像(
"https://cdn0.iconfinder.com/data/icons/classic-cars-by-cemagraphics/512/camaro_512.png")))),
),
填充物(
填充:仅限常量边集(顶部:8),
子:文本(
"خودرو",
样式:TextStyle(
字体大小:15,颜色:颜色。黑色87),
),
),
],
),
);
}),
),
SingleChildScrollView(
滚动方向:轴垂直,
子:容器(
高度:MediaQuery.of(context).size.height,
宽度:MediaQuery.of(context).size.width,
子项:ListView.builder(
物品计数:10,
滚动方向:轴垂直,
itemBuilder:(上下文,索引){
返回填充(
填充:仅限常量边设置(
左:8,右:8,下:12),
子:容器(
装饰:盒子装饰(
boxShadow:[
箱形阴影(
半径:9.0,
颜色:颜色。黑色54。不透明度(.3),
偏移量:偏移量(5.0,5.0),
),
],
颜色:颜色(0xFFF3F4),
边界半径:边界半径。圆形(10),
边界:边界(
宽度:1,
颜色:颜色(0xFFF3F4),
风格
return Scaffold(
resizeToAvoidBottomPadding: false,
body: ListView( // use ListView instead of Column
children: <Widget>[
Padding(
padding:
const EdgeInsets.only(top: 32, left: 16, right: 16),
child: Row(
...