/// 网格布局
class MyGridView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GridView(
padding: const EdgeInsets.fromLTRB(12.0,20.0,12.0,20.0),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, // 横轴的列数
mainAxisSpacing: 12.0, // 主轴间距
crossAxisSpacing: 12.0, // 横轴间距
childAspectRatio: 0.7 // item的宽高比
),
children: [
Image.network("http://img5.mtime.cn/mt/2018/10/22/104316.77318635_180X260X4.jpg",fit: BoxFit.fill),
Image.network("http://img5.mtime.cn/mt/2018/10/22/104316.77318635_180X260X4.jpg",fit: BoxFit.fill),
Image.network("http://img5.mtime.cn/mt/2018/10/22/104316.77318635_180X260X4.jpg",fit: BoxFit.fill),
Image.network("http://img5.mtime.cn/mt/2018/10/22/104316.77318635_180X260X4.jpg",fit: BoxFit.fill),
Image.network("http://img5.mtime.cn/mt/2018/10/22/104316.77318635_180X260X4.jpg",fit: BoxFit.fill),
Image.network("http://img5.mtime.cn/mt/2018/10/22/104316.77318635_180X260X4.jpg",fit: BoxFit.fill),
Image.network("http://img5.mtime.cn/mt/2018/10/22/104316.77318635_180X260X4.jpg",fit: BoxFit.fill)
],
);
}
}
网友评论