Switch clients to ScrollGrid (#7752)

The only remaining client of ScrollableGrid (the old version) is Pesto,
which needs AppBar integration.
This commit is contained in:
Adam Barth
2017-02-01 11:01:02 -08:00
committed by GitHub
parent 41f1f8a489
commit fe01c71cf4
6 changed files with 44 additions and 38 deletions

View File

@@ -310,9 +310,6 @@ class GridListDemoState extends State<GridListDemo> {
});
}
// When the ScrollableGrid first appears we want the last row to only be
// partially visible, to help the user recognize that the grid is scrollable.
// The GridListDemoGridDelegate's tileHeightFactor is used for this.
@override
Widget build(BuildContext context) {
final Orientation orientation = MediaQuery.of(context).orientation;

View File

@@ -203,14 +203,12 @@ class GridLists {
// START gridlists
// Creates a scrollable grid list with images
// loaded from the web.
new ScrollableGrid(
delegate: new FixedColumnCountGridDelegate(
columnCount: 3,
tileAspectRatio: 1.0,
padding: const EdgeInsets.all(4.0),
columnSpacing: 4.0,
rowSpacing: 4.0
),
new ScrollGrid.count(
crossAxisCount: 3,
childAspectRatio: 1.0,
padding: const EdgeInsets.all(4.0),
mainAxisSpacing: 4.0,
crossAxisSpacing: 4.0,
children: <String>[
'https://example.com/image-0.jpg',
'https://example.com/image-1.jpg',
@@ -224,7 +222,7 @@ new ScrollableGrid(
),
child: new Image.network(url, fit: ImageFit.cover)
);
})
}).toList(),
);
// END
}

View File

@@ -76,14 +76,14 @@ class AdaptiveContainer extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) {
return new ScrollableList(
return new ScrollView(
itemExtent: _kListItemExtent,
children: names.map((String name) => new AdaptedListItem(name: name))
children: names.map((String name) => new AdaptedListItem(name: name)).toList(),
);
} else {
return new ScrollableGrid(
delegate: new MaxTileWidthGridDelegate(maxTileWidth: _kMaxTileWidth),
children: names.map((String name) => new AdaptedGridItem(name: name))
return new ScrollGrid.extent(
maxCrossAxisExtent: _kMaxTileWidth,
children: names.map((String name) => new AdaptedGridItem(name: name)).toList(),
);
}
}