【发布时间】:2020-09-27 14:49:52
【问题描述】:
我是 Flutter 的新手。我有一个带有多个浮动操作按钮的网格视图。有什么方法可以将我的网格视图小部件定位在 y 轴上。我想要屏幕中间的网格视图小部件。 一般如何在颤振中定位布局?
感谢您的帮助
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: GridView.count(
padding: const EdgeInsets.all(20),
crossAxisSpacing: 15,
mainAxisSpacing: 20,
crossAxisCount: 4,
children: <Widget>[
FloatingActionButton(
onPressed: () {
press_1_button();
},
child: Text("1"),)
,FloatingActionButton(
onPressed: (){
press_2_button();
},
child: Text("2"),)
,FloatingActionButton(
onPressed: () {
press_3_button();
},
child: Text("3"),)
,FloatingActionButton(
onPressed: (){
press_4_button();
},
child: Text("4"),)
,FloatingActionButton(
onPressed: () {
press_5_button();
},
child: Text("5"),)
,FloatingActionButton(
onPressed: (){
press_6_button();
},
child: Text("6"),)
,FloatingActionButton(
onPressed: () {
press_7_button();
},
child: Text("7"),)
,FloatingActionButton(
onPressed: (){
press_8_button();
},
child: Text("8"),)
,FloatingActionButton(
onPressed: () {
press_9_button();
},
child: Text("9"),)
],
),
),
);
}
}
【问题讨论】: