gpt4 book ai didi

flutter - 如何在 Flutter 应用程序中创建响应式网格?

转载 作者:IT王子 更新时间:2023-10-29 06:52:39 25 4
gpt4 key购买 nike

让 Flutter 应用响应式最佳实践是什么?在下面的代码中是一个带有硬编码值StraggeredGridView

我应该编写一个根据屏幕尺寸计算值的方法,还是有任何其他方法可以这样做?

感谢您的帮助!

  StaggeredGridView.count(
crossAxisCount: 2,
crossAxisSpacing: 20,
mainAxisSpacing: 20,
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 20),
//shrinkWrap: true,
children: <Widget>[
_buildTile(
Padding(
padding: const EdgeInsets.all(20.0),
child: Column(children: <Widget>[
Material(
color: Color.fromRGBO(123, 228, 193, 0.5),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Image.asset(
'assets/siren.png',
height: 40,
),
)),
Padding(padding: EdgeInsets.only(bottom: 10.0)),
Text('NOTRUF', style: tileFontStyle),
]),
),),

最佳答案

使用responsive_grid

它像 Bootstrap 网格系统一样工作

关于flutter - 如何在 Flutter 应用程序中创建响应式网格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56930648/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com