【问题标题】:Is there a way to achieve a gridview with different size child widgets like this?有没有办法实现像这样具有不同大小的子小部件的gridview?
【发布时间】:2021-05-12 16:40:12
【问题描述】:

我正在使用 Flutter 开发应用程序屏幕,但在设计此设计和循环数据库中的数据时遇到问题。有没有人在颤振中创造了这样的设计,请给我一个方法。

【问题讨论】:

    标签: flutter flutter-layout photo-gallery


    【解决方案1】:
        StaggeredGridView.countBuilder(
          crossAxisCount: 3,
          itemCount: 16,
          itemBuilder: (BuildContext context, int index) => Container(
              color: Colors.green,
              child: Text('$index'),//your photo in place of this child
    ),
          staggeredTileBuilder: (int index) =>StaggeredTile.count(index%7==0?2:1,index%7==0?2:1,),
          mainAxisSpacing: 8.0,
          crossAxisSpacing: 8.0,
        )
    

    【讨论】:

    • 非常感谢迪帕克。你拯救了我的一天。
    • 很高兴,我能帮助你:)
    猜你喜欢
    • 2017-04-27
    • 2015-09-16
    • 2011-10-02
    • 1970-01-01
    • 2020-09-12
    • 2013-09-04
    • 2012-06-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多