Generalize grid layout
This patch make grid layout much more flexible. The behavior is factored out into a GridDelegate that's modeled after the custom layout delegates. The patch includes a MaxTileWidthGridDelegate that implements the old behavior and a FixedColumnCountGridDelegate that implements a grid layout with a fixed number of columns. Fixes #1048
This commit is contained in:
@@ -20,7 +20,10 @@ Color randomColor() {
|
||||
|
||||
RenderBox buildGridExample() {
|
||||
List<RenderBox> children = new List<RenderBox>.generate(30, (_) => new RenderSolidColorBox(randomColor()));
|
||||
return new RenderGrid(children: children, maxChildExtent: 100.0);
|
||||
return new RenderGrid(
|
||||
children: children,
|
||||
delegate: new MaxTileWidthGridDelegate(maxTileWidth: 100.0)
|
||||
);
|
||||
}
|
||||
|
||||
main() => new RenderingFlutterBinding(root: buildGridExample());
|
||||
|
||||
Reference in New Issue
Block a user