Commit 99876e38 authored by Hans Muller's avatar Hans Muller

Merge pull request #1938 from HansMuller/grid_layout

Added Grid row and column spacing, changed padding interpretation

Grid padding now defines the distance the overall grid is inset. The grid rowSpacing and columnSpacing attributes define the space between rows and columns respectively.
parents 5960a134 ba3930cc
...@@ -22,6 +22,7 @@ export 'package:flutter/rendering.dart' show ...@@ -22,6 +22,7 @@ export 'package:flutter/rendering.dart' show
FlexJustifyContent, FlexJustifyContent,
FractionalOffsetTween, FractionalOffsetTween,
GridDelegate, GridDelegate,
GridSpecification,
HitTestBehavior, HitTestBehavior,
MaxTileWidthGridDelegate, MaxTileWidthGridDelegate,
MultiChildLayoutDelegate, MultiChildLayoutDelegate,
...@@ -1192,6 +1193,8 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase { ...@@ -1192,6 +1193,8 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase {
Key key, Key key,
List<Widget> children: _emptyWidgetList, List<Widget> children: _emptyWidgetList,
this.columnCount, this.columnCount,
this.columnSpacing,
this.rowSpacing,
this.tileAspectRatio: 1.0, this.tileAspectRatio: 1.0,
this.padding: EdgeDims.zero this.padding: EdgeDims.zero
}) : super(key: key, children: children) { }) : super(key: key, children: children) {
...@@ -1201,6 +1204,12 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase { ...@@ -1201,6 +1204,12 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase {
/// The number of columns in the grid. /// The number of columns in the grid.
final int columnCount; final int columnCount;
/// The horizontal distance between columns.
final double columnSpacing;
/// The vertical distance between rows.
final double rowSpacing;
/// The ratio of the width to the height of each tile in the grid. /// The ratio of the width to the height of each tile in the grid.
final double tileAspectRatio; final double tileAspectRatio;
...@@ -1210,6 +1219,8 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase { ...@@ -1210,6 +1219,8 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase {
FixedColumnCountGridDelegate createDelegate() { FixedColumnCountGridDelegate createDelegate() {
return new FixedColumnCountGridDelegate( return new FixedColumnCountGridDelegate(
columnCount: columnCount, columnCount: columnCount,
columnSpacing: columnSpacing,
rowSpacing: rowSpacing,
tileAspectRatio: tileAspectRatio, tileAspectRatio: tileAspectRatio,
padding: padding padding: padding
); );
...@@ -1224,6 +1235,8 @@ class MaxTileWidthGrid extends GridRenderObjectWidgetBase { ...@@ -1224,6 +1235,8 @@ class MaxTileWidthGrid extends GridRenderObjectWidgetBase {
Key key, Key key,
List<Widget> children: _emptyWidgetList, List<Widget> children: _emptyWidgetList,
this.maxTileWidth, this.maxTileWidth,
this.columnSpacing,
this.rowSpacing,
this.tileAspectRatio: 1.0, this.tileAspectRatio: 1.0,
this.padding: EdgeDims.zero this.padding: EdgeDims.zero
}) : super(key: key, children: children) { }) : super(key: key, children: children) {
...@@ -1236,6 +1249,12 @@ class MaxTileWidthGrid extends GridRenderObjectWidgetBase { ...@@ -1236,6 +1249,12 @@ class MaxTileWidthGrid extends GridRenderObjectWidgetBase {
/// The ratio of the width to the height of each tile in the grid. /// The ratio of the width to the height of each tile in the grid.
final double tileAspectRatio; final double tileAspectRatio;
/// The horizontal distance between columns.
final double columnSpacing;
/// The vertical distance between rows.
final double rowSpacing;
/// The amount of padding to apply to each child. /// The amount of padding to apply to each child.
final EdgeDims padding; final EdgeDims padding;
...@@ -1243,6 +1262,8 @@ class MaxTileWidthGrid extends GridRenderObjectWidgetBase { ...@@ -1243,6 +1262,8 @@ class MaxTileWidthGrid extends GridRenderObjectWidgetBase {
return new MaxTileWidthGridDelegate( return new MaxTileWidthGridDelegate(
maxTileWidth: maxTileWidth, maxTileWidth: maxTileWidth,
tileAspectRatio: tileAspectRatio, tileAspectRatio: tileAspectRatio,
columnSpacing: columnSpacing,
rowSpacing: rowSpacing,
padding: padding padding: padding
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment