微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flutter中的交错网格视图-如何给瓷砖提供不同的宽度

如何解决Flutter中的交错网格视图-如何给瓷砖提供不同的宽度

我一直试图在Flutter中创建以下屏幕:

https://i.imgur.com/meBdNFz.png

到目前为止,我已经使用“交错网格视图”软件包做到了这一点:

https://i.imgur.com/mR6pQ3A.png

很抱歉,无法上传图片

但是,我仍然不知道如何为图块使用不同的宽度。第一个图块需要填充大约70%的容器大小,而右边的图块则需要填充其余的大小。

目前,我有以下代码

new StaggeredGridView.countBuilder(
          padding: EdgeInsets.all(30),crossAxisCount: 2,itemCount: 7,itemBuilder: (BuildContext context,int index) => new Container(
              margin: EdgeInsets.all(4),color: Colors.green,child: new Center(
                child: new CircleAvatar(
                  backgroundColor: Colors.white,child: new Text('$index'),),)),staggeredTileBuilder: (int index) => (index == 0)
              ? new StaggeredTile.count(2,1)
              : (index % 2 == 0)
                  ? new StaggeredTile.count(1,0.8)
                  : new StaggeredTile.count(1,0.8),mainAxisspacing: 4.0,crossAxisspacing: 4.0,)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。