Skip to content

Commit c904641

Browse files
FIX: Make use of given 'spacing' in GridGoldenSceneLayout
1 parent 8f097bc commit c904641

File tree

1 file changed

+21
-38
lines changed

1 file changed

+21
-38
lines changed

lib/src/scenes/layouts/grid_layout.dart

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:flutter/cupertino.dart';
12
import 'package:flutter/material.dart' show Colors;
23
import 'package:flutter/widgets.dart';
34
import 'package:flutter_test/flutter_test.dart';
@@ -71,14 +72,20 @@ class GridGoldenScene extends StatelessWidget {
7172
}
7273

7374
items.add(
74-
_buildItem(
75-
context,
76-
entries[index].key.metadata,
77-
Image.memory(
78-
key: entries[index].value,
79-
entries[index].key.pngBytes,
80-
width: entries[index].key.size.width,
81-
height: entries[index].key.size.height,
75+
Padding(
76+
padding: EdgeInsets.only(
77+
top: row > 0 ? defaultGridSpacing.between : 0,
78+
left: col > 0 ? defaultGridSpacing.between : 0,
79+
),
80+
child: _buildItem(
81+
context,
82+
entries[index].key.metadata,
83+
Image.memory(
84+
key: entries[index].value,
85+
entries[index].key.pngBytes,
86+
width: entries[index].key.size.width,
87+
height: entries[index].key.size.height,
88+
),
8289
),
8390
),
8491
);
@@ -96,37 +103,13 @@ class GridGoldenScene extends StatelessWidget {
96103
child: GoldenSceneBounds(
97104
child: ColoredBox(
98105
color: Colors.white,
99-
child: Table(
100-
defaultColumnWidth: IntrinsicColumnWidth(),
101-
children: rows,
106+
child: Padding(
107+
padding: spacing.around,
108+
child: Table(
109+
defaultColumnWidth: IntrinsicColumnWidth(),
110+
children: rows,
111+
),
102112
),
103-
// child: ConstrainedBox(
104-
// constraints: BoxConstraints(maxWidth: maxWidth),
105-
// // ^ We have to constrain the width due to the vertical scrolling viewport in the
106-
// // the GridView.
107-
// // TODO: Use some other grid implementation that doesn't include scrolling.
108-
// child: GridView(
109-
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
110-
// mainAxisSpacing: 0,
111-
// crossAxisCount: 3,
112-
// crossAxisSpacing: 0,
113-
// ),
114-
// shrinkWrap: true,
115-
// padding: const EdgeInsets.all(0),
116-
// children: [
117-
// for (final entry in goldens.entries)
118-
// ColoredBox(
119-
// color: Colors.green,
120-
// child: Image.memory(
121-
// key: entry.value,
122-
// entry.key.pngBytes,
123-
// width: entry.key.size.width,
124-
// height: entry.key.size.height,
125-
// ),
126-
// ),
127-
// ],
128-
// ),
129-
// ),
130113
),
131114
),
132115
);

0 commit comments

Comments
 (0)