Flutter是否支持级联网格?

时间:2017-11-14 01:51:40

标签: layout flutter

Flutter是否支持级联网格样式布局,例如:

enter image description here

2 个答案:

答案 0 :(得分:1)

您可以在一行中创建4个扩展并在每个扩展中添加容器列:

以下是我运行的代码,并提供您希望的确切结果:

new Row(
                children: <Widget>[
                    new Expanded(
                        child: new Column(
                            children: <Widget>[
                                new Container(
                                    height: 50.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                                new Container(
                                    height: 24.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                                new Container(
                                    height: 150.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                            ],
                        ),
                    ),
                    new Expanded(
                        child: new Column(
                            children: <Widget>[
                                new Container(
                                    height: 140.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                                new Container(
                                    height: 90.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                                new Container(
                                    height: 58.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                            ],
                        ),
                    ),
                    new Expanded(
                        child: new Column(
                            children: <Widget>[
                                new Container(
                                    height: 20.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                                new Container(
                                    height: 220.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                                new Container(
                                    height: 50.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                            ],
                        ),
                    ),
                    new Expanded(
                        child: new Column(
                            children: <Widget>[
                                new Container(
                                    height: 50.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                                new Container(
                                    height: 150.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                                new Container(
                                    height: 100.0,
                                    color: Colors.grey,
                                    margin: new EdgeInsets.all(10.0),
                                ),
                            ],
                        ),
                    ),
                ],
            )

它给出了以下结果:

enter image description here

答案 1 :(得分:1)

您可以将CustomScrollViewSliderGrid与自定义gridDelegate

一起使用