Flutter Gridview.count颤振不工作,显示黄色和黑色条纹
我做了一个Gridview.count,用于渲染2列3行中的6个按钮,它不渲染组件,而是显示黄色和黑色条纹。我已经设置了高度和宽度,全部包装在一个容器中Flutter Gridview.count颤振不工作,显示黄色和黑色条纹,flutter,Flutter,我做了一个Gridview.count,用于渲染2列3行中的6个按钮,它不渲染组件,而是显示黄色和黑色条纹。我已经设置了高度和宽度,全部包装在一个容器中 返回脚手架( 主体:容器( 高度:450.0, 宽度:double.infinity, 子项:GridView.count( 收缩膜:对, 小学:对, 交叉轴计数:2, 儿童:[ 居中( 孩子:扁平按钮( 按下:()=>{}, 填充:所有边缘设置(10.0), 子项:列(子项:[ 影像资产( “assets/img/wifi.png”, 身高
返回脚手架(
主体:容器(
高度:450.0,
宽度:double.infinity,
子项:GridView.count(
收缩膜:对,
小学:对,
交叉轴计数:2,
儿童:[
居中(
孩子:扁平按钮(
按下:()=>{},
填充:所有边缘设置(10.0),
子项:列(子项:[
影像资产(
“assets/img/wifi.png”,
身高:50.0,
宽度:50.0,
),
文本(“Wifi”)
]),
),
),
居中(
孩子:扁平按钮(
按下:()=>{},
填充:所有边缘设置(10.0),
子项:列(子项:[
影像资产(
“assets/img/wifi.png”,
身高:50.0,
宽度:50.0,
),
文本('Key/Access')
]),
),
),
居中(
孩子:扁平按钮(
按下:()=>{},
填充:所有边缘设置(10.0),
子项:列(子项:[
影像资产(
“assets/img/wifi.png”,
身高:50.0,
宽度:50.0,
),
文本('Key/Access')
]),
),
),
居中(
孩子:扁平按钮(
按下:()=>{},
填充:所有边缘设置(10.0),
子项:列(子项:[
影像资产(
“assets/img/wifi.png”,
身高:50.0,
宽度:50.0,
),
文本('Key/Access')
]),
),
),
],
)));
}
}
拜托,有人知道为什么渲染不正确吗?或者有一个替代的小部件,可以更好地工作?谢谢
此小部件导入到此小部件中:
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF88B4E0),
appBar: AppBar(
leading: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: Icon(Icons.arrow_back_ios),
color: Colors.white,
),
backgroundColor: Colors.transparent,
elevation: 0.0,
title: Text('Help and FAQ',
style: TextStyle(fontSize: 18.0, color: Colors.white)),
centerTitle: true,
actions: <Widget>[
SearchButton(),
],
),
body: ListView(children: [
Stack(children: [
Container(
height: MediaQuery.of(context).size.height - 82.0,
width: MediaQuery.of(context).size.width,
color: Colors.transparent),
Positioned(
top: 75.0,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(45.0),
topRight: Radius.circular(45.0),
),
color: Colors.white),
height: MediaQuery.of(context).size.height - 100.0,
width: MediaQuery.of(context).size.width,
child: Column(
children: [
SizedBox(height: 20.0),
Testing(),
],
),
)),
]),
]),
);
}
void moveBack() {
Navigator.pop(context);
}
}
小部件构建(构建上下文){
返回脚手架(
背景颜色:颜色(0xFF88B4E0),
appBar:appBar(
领先:IconButton(
已按下:(){
Navigator.of(context.pop();
},
图标:图标(图标、箭头、背面),
颜色:颜色,白色,
),
背景颜色:颜色。透明,
标高:0.0,
标题:文本(“帮助和常见问题”,
样式:TextStyle(fontSize:18.0,颜色:Colors.white)),
标题:对,
行动:[
SearchButton(),
],
),
正文:列表视图(子项:[
堆栈(子对象:[
容器(
高度:MediaQuery.of(context).size.height-82.0,
宽度:MediaQuery.of(context).size.width,
颜色:颜色。透明),
定位(
排名:75.0,
子:容器(
装饰:盒子装饰(
borderRadius:仅限borderRadius(
左上:半径。圆形(45.0),
右上角:半径。圆形(45.0),
),
颜色:颜色。白色),
高度:MediaQuery.of(context).size.height-100.0,
宽度:MediaQuery.of(context).size.width,
子:列(
儿童:[
尺寸箱(高度:20.0),
测试(),
],
),
)),
]),
]),
);
}
void moveBack(){
Navigator.pop(上下文);
}
}
尝试将gridview.count包装在SingleChildScrollView()中,并在其中设置滚动方向。此代码工作正常。这个小部件放在哪里?考虑从控制台添加错误日志。尝试将GRIDVIEW.COUNT包在SUNLIDHOLDSCLVIEW视图()中,并在该代码中工作时设置滚动方向。这个小部件放在哪里?考虑从控制台添加错误日志。
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF88B4E0),
appBar: AppBar(
leading: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: Icon(Icons.arrow_back_ios),
color: Colors.white,
),
backgroundColor: Colors.transparent,
elevation: 0.0,
title: Text('Help and FAQ',
style: TextStyle(fontSize: 18.0, color: Colors.white)),
centerTitle: true,
actions: <Widget>[
SearchButton(),
],
),
body: ListView(children: [
Stack(children: [
Container(
height: MediaQuery.of(context).size.height - 82.0,
width: MediaQuery.of(context).size.width,
color: Colors.transparent),
Positioned(
top: 75.0,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(45.0),
topRight: Radius.circular(45.0),
),
color: Colors.white),
height: MediaQuery.of(context).size.height - 100.0,
width: MediaQuery.of(context).size.width,
child: Column(
children: [
SizedBox(height: 20.0),
Testing(),
],
),
)),
]),
]),
);
}
void moveBack() {
Navigator.pop(context);
}
}