GridView
中出现的问题是,在第二行及以后创建的项目之间存在空格,如下图所示。
项目小部件:
return Material(
color: MyColors.Transparent,
child: Container(
margin: EdgeInsets.only(left: 3.5, right: 3.5),
width: 120,
child:
Column(
children: [
Card(
color: MyColors.Shadow,
child: InkWell(
onTap: () {
AppController.Debug(Index);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Image.network(
height: 50,
width: Variables.MATCH_PARENT,
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ4xhc0rw70Yodsy2N2FKbxKJxCE8dAIG0sBA&s"),
SizedBox(
height: 7,
),
Container(
margin: EdgeInsets.symmetric(horizontal: 5),
child: Align(
alignment: Alignment.centerRight,
child: CustomWidget(
' Item $Index',
FontSize: 12,
),
)),
],
))),
],
)
),
);
网格视图:
Directionality(
textDirection: TextDirection.rtl,
child: GridView.count(
crossAxisCount: 4,
children: items)),
试试这个
方向性( 文本方向:TextDirection.rtl, 子项:GridView.count( 交叉轴数:4, 主轴间距:0,
横轴间距:0,
子纵横比:1,
儿童:物品,
),
);