Rename and refactor ScrollView hierarchy (#7865)
This prepares us for a CustomScrollView that takes slivers.
diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart
index 6909675..a7dac64 100644
--- a/dev/benchmarks/complex_layout/lib/main.dart
+++ b/dev/benchmarks/complex_layout/lib/main.dart
@@ -588,7 +588,7 @@
@override
Widget build(BuildContext context) {
return new Drawer(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new FancyDrawerHeader(),
new DrawerItem(
diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart
index aa3c0e8..1bb534d 100644
--- a/dev/manual_tests/card_collection.dart
+++ b/dev/manual_tests/card_collection.dart
@@ -123,7 +123,7 @@
return new Drawer(
child: new IconTheme(
data: const IconThemeData(color: Colors.black),
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new DrawerHeader(child: new Center(child: new Text('Options'))),
buildDrawerCheckbox("Make card labels editable", _editable, _toggleEditable),
diff --git a/dev/manual_tests/pageable_list.dart b/dev/manual_tests/pageable_list.dart
index 5f6a788..ea338b3 100644
--- a/dev/manual_tests/pageable_list.dart
+++ b/dev/manual_tests/pageable_list.dart
@@ -84,7 +84,7 @@
Widget _buildDrawer() {
return new Drawer(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new DrawerHeader(child: new Center(child: new Text('Options'))),
new DrawerItem(
diff --git a/examples/flutter_gallery/lib/demo/cards_demo.dart b/examples/flutter_gallery/lib/demo/cards_demo.dart
index a7167d7..fb1e9e9 100644
--- a/examples/flutter_gallery/lib/demo/cards_demo.dart
+++ b/examples/flutter_gallery/lib/demo/cards_demo.dart
@@ -134,7 +134,7 @@
appBar: new AppBar(
title: new Text('Travel stream')
),
- body: new ScrollView(
+ body: new ListView(
itemExtent: TravelDestinationItem.height,
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
children: destinations.map((TravelDestination destination) {
diff --git a/examples/flutter_gallery/lib/demo/chip_demo.dart b/examples/flutter_gallery/lib/demo/chip_demo.dart
index 118f874..162f5c9 100644
--- a/examples/flutter_gallery/lib/demo/chip_demo.dart
+++ b/examples/flutter_gallery/lib/demo/chip_demo.dart
@@ -41,7 +41,7 @@
return new Scaffold(
appBar: new AppBar(title: new Text('Chips')),
- body: new ScrollView(
+ body: new ListView(
children: chips.map((Widget widget) {
return new Container(
height: 100.0,
diff --git a/examples/flutter_gallery/lib/demo/colors_demo.dart b/examples/flutter_gallery/lib/demo/colors_demo.dart
index fabb70e..95cdac6 100644
--- a/examples/flutter_gallery/lib/demo/colors_demo.dart
+++ b/examples/flutter_gallery/lib/demo/colors_demo.dart
@@ -98,7 +98,7 @@
}).toList());
}
- return new ScrollView(
+ return new ListView(
itemExtent: kColorItemHeight,
children: colorItems,
);
diff --git a/examples/flutter_gallery/lib/demo/data_table_demo.dart b/examples/flutter_gallery/lib/demo/data_table_demo.dart
index e53c3ae..b17bb6d 100644
--- a/examples/flutter_gallery/lib/demo/data_table_demo.dart
+++ b/examples/flutter_gallery/lib/demo/data_table_demo.dart
@@ -165,7 +165,7 @@
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text('Data tables')),
- body: new ScrollView(
+ body: new ListView(
padding: const EdgeInsets.all(20.0),
children: <Widget>[
new PaginatedDataTable(
diff --git a/examples/flutter_gallery/lib/demo/dialog_demo.dart b/examples/flutter_gallery/lib/demo/dialog_demo.dart
index c69af1f..9c5b761 100644
--- a/examples/flutter_gallery/lib/demo/dialog_demo.dart
+++ b/examples/flutter_gallery/lib/demo/dialog_demo.dart
@@ -89,7 +89,7 @@
appBar: new AppBar(
title: new Text('Dialogs')
),
- body: new ScrollView(
+ body: new ListView(
padding: const EdgeInsets.symmetric(vertical: 24.0, horizontal: 72.0),
children: <Widget>[
new RaisedButton(
diff --git a/examples/flutter_gallery/lib/demo/drawer_demo.dart b/examples/flutter_gallery/lib/demo/drawer_demo.dart
index 68e9732..25987b6 100644
--- a/examples/flutter_gallery/lib/demo/drawer_demo.dart
+++ b/examples/flutter_gallery/lib/demo/drawer_demo.dart
@@ -88,7 +88,7 @@
title: new Text('Navigation drawer'),
),
drawer: new Drawer(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: new Text('Zach Widget'),
diff --git a/examples/flutter_gallery/lib/demo/full_screen_dialog_demo.dart b/examples/flutter_gallery/lib/demo/full_screen_dialog_demo.dart
index e519902..60e5f41 100644
--- a/examples/flutter_gallery/lib/demo/full_screen_dialog_demo.dart
+++ b/examples/flutter_gallery/lib/demo/full_screen_dialog_demo.dart
@@ -157,7 +157,7 @@
)
]
),
- body: new ScrollView(
+ body: new ListView(
padding: const EdgeInsets.all(16.0),
children: <Widget>[
new Container(
diff --git a/examples/flutter_gallery/lib/demo/grid_list_demo.dart b/examples/flutter_gallery/lib/demo/grid_list_demo.dart
index 42c0a9e..4f50bc2 100644
--- a/examples/flutter_gallery/lib/demo/grid_list_demo.dart
+++ b/examples/flutter_gallery/lib/demo/grid_list_demo.dart
@@ -339,7 +339,7 @@
body: new Column(
children: <Widget>[
new Expanded(
- child: new ScrollGrid.count(
+ child: new GridView.count(
crossAxisCount: (orientation == Orientation.portrait) ? 2 : 3,
mainAxisSpacing: 4.0,
crossAxisSpacing: 4.0,
diff --git a/examples/flutter_gallery/lib/demo/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/leave_behind_demo.dart
index 704f8fe..8cd3af1 100644
--- a/examples/flutter_gallery/lib/demo/leave_behind_demo.dart
+++ b/examples/flutter_gallery/lib/demo/leave_behind_demo.dart
@@ -161,7 +161,7 @@
)
]
),
- body: new ScrollView(
+ body: new ListView(
children: leaveBehindItems.map(buildItem).toList()
)
);
diff --git a/examples/flutter_gallery/lib/demo/list_demo.dart b/examples/flutter_gallery/lib/demo/list_demo.dart
index b802d3a..905de7c 100644
--- a/examples/flutter_gallery/lib/demo/list_demo.dart
+++ b/examples/flutter_gallery/lib/demo/list_demo.dart
@@ -40,7 +40,7 @@
decoration: new BoxDecoration(
border: new Border(top: new BorderSide(color: Colors.black26))
),
- child: new ScrollView(
+ child: new ListView(
shrinkWrap: true,
children: <Widget>[
new ListItem(
diff --git a/examples/flutter_gallery/lib/demo/menu_demo.dart b/examples/flutter_gallery/lib/demo/menu_demo.dart
index 4e7e9ad..0822629 100644
--- a/examples/flutter_gallery/lib/demo/menu_demo.dart
+++ b/examples/flutter_gallery/lib/demo/menu_demo.dart
@@ -83,7 +83,7 @@
)
]
),
- body: new ScrollView(
+ body: new ListView(
padding: const EdgeInsets.symmetric(vertical: 8.0),
children: <Widget>[
// Pressing the PopupMenuButton on the right of this item shows
diff --git a/examples/flutter_gallery/lib/demo/snack_bar_demo.dart b/examples/flutter_gallery/lib/demo/snack_bar_demo.dart
index 56786cf..dfc2fe8 100644
--- a/examples/flutter_gallery/lib/demo/snack_bar_demo.dart
+++ b/examples/flutter_gallery/lib/demo/snack_bar_demo.dart
@@ -29,7 +29,7 @@
int _snackBarIndex = 1;
Widget buildBody(BuildContext context) {
- return new ScrollView(
+ return new ListView(
padding: const EdgeInsets.all(24.0),
children: <Widget>[
new Text(_text1),
diff --git a/examples/flutter_gallery/lib/demo/tabs_demo.dart b/examples/flutter_gallery/lib/demo/tabs_demo.dart
index 617ef1e..6e41931 100644
--- a/examples/flutter_gallery/lib/demo/tabs_demo.dart
+++ b/examples/flutter_gallery/lib/demo/tabs_demo.dart
@@ -127,7 +127,7 @@
),
body: new TabBarView(
children: _allPages.keys.map((_Page page) {
- return new ScrollView(
+ return new ListView(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
itemExtent: _CardDataItem.height,
children: _allPages[page].map((_CardData data) {
diff --git a/examples/flutter_gallery/lib/demo/tooltip_demo.dart b/examples/flutter_gallery/lib/demo/tooltip_demo.dart
index d264fcd..2e1dddd 100644
--- a/examples/flutter_gallery/lib/demo/tooltip_demo.dart
+++ b/examples/flutter_gallery/lib/demo/tooltip_demo.dart
@@ -22,7 +22,7 @@
),
body: new Builder(
builder: (BuildContext context) {
- return new ScrollView(
+ return new ListView(
children: <Widget>[
new Text(_introText, style: theme.textTheme.subhead),
new Row(
diff --git a/examples/flutter_gallery/lib/demo/typography_demo.dart b/examples/flutter_gallery/lib/demo/typography_demo.dart
index 2daa1a8..b2304ce 100644
--- a/examples/flutter_gallery/lib/demo/typography_demo.dart
+++ b/examples/flutter_gallery/lib/demo/typography_demo.dart
@@ -66,7 +66,7 @@
return new Scaffold(
appBar: new AppBar(title: new Text('Typography')),
- body: new ScrollView(children: styleItems)
+ body: new ListView(children: styleItems)
);
}
}
diff --git a/examples/flutter_gallery/lib/gallery/drawer.dart b/examples/flutter_gallery/lib/gallery/drawer.dart
index 280b488..aee84fb 100644
--- a/examples/flutter_gallery/lib/gallery/drawer.dart
+++ b/examples/flutter_gallery/lib/gallery/drawer.dart
@@ -305,6 +305,6 @@
));
}
- return new Drawer(child: new ScrollView(children: allDrawerItems));
+ return new Drawer(child: new ListView(children: allDrawerItems));
}
}
diff --git a/examples/flutter_gallery/lib/gallery/example_code.dart b/examples/flutter_gallery/lib/gallery/example_code.dart
index ca8c31b..6dcb837 100644
--- a/examples/flutter_gallery/lib/gallery/example_code.dart
+++ b/examples/flutter_gallery/lib/gallery/example_code.dart
@@ -203,7 +203,7 @@
// START gridlists
// Creates a scrollable grid list with images
// loaded from the web.
-new ScrollGrid.count(
+new GridView.count(
crossAxisCount: 3,
childAspectRatio: 1.0,
padding: const EdgeInsets.all(4.0),
diff --git a/examples/layers/widgets/media_query.dart b/examples/layers/widgets/media_query.dart
index 3904f35..475c358 100644
--- a/examples/layers/widgets/media_query.dart
+++ b/examples/layers/widgets/media_query.dart
@@ -76,12 +76,12 @@
@override
Widget build(BuildContext context) {
if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) {
- return new ScrollView(
+ return new ListView(
itemExtent: _kListItemExtent,
children: names.map((String name) => new AdaptedListItem(name: name)).toList(),
);
} else {
- return new ScrollGrid.extent(
+ return new GridView.extent(
maxCrossAxisExtent: _kMaxTileWidth,
children: names.map((String name) => new AdaptedGridItem(name: name)).toList(),
);
diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart
index e3fcdb5..105b5ab 100644
--- a/examples/stocks/lib/stock_home.dart
+++ b/examples/stocks/lib/stock_home.dart
@@ -121,7 +121,7 @@
Widget _buildDrawer(BuildContext context) {
return new Drawer(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new DrawerHeader(child: new Center(child: new Text('Stocks'))),
new DrawerItem(
diff --git a/examples/stocks/lib/stock_settings.dart b/examples/stocks/lib/stock_settings.dart
index 1f1ba7e..4c09c1d 100644
--- a/examples/stocks/lib/stock_settings.dart
+++ b/examples/stocks/lib/stock_settings.dart
@@ -240,7 +240,7 @@
]);
return true;
});
- return new ScrollView(
+ return new ListView(
padding: const EdgeInsets.symmetric(vertical: 20.0),
children: rows,
);
diff --git a/packages/flutter/lib/src/material/grid_tile.dart b/packages/flutter/lib/src/material/grid_tile.dart
index 06446f9..c0e9bcd 100644
--- a/packages/flutter/lib/src/material/grid_tile.dart
+++ b/packages/flutter/lib/src/material/grid_tile.dart
@@ -8,13 +8,13 @@
/// A tile in a material design grid list.
///
-/// A grid list is a [ScrollGrid] of tiles in a vertical and horizontal
+/// A grid list is a [GridView] of tiles in a vertical and horizontal
/// array. Each tile typically contains some visually rich content (e.g., an
/// image) together with a [GridTileBar] in either a [header] or a [footer].
///
/// See also:
///
-/// * [ScrollGrid], which is a scrollable grid of tiles.
+/// * [GridView], which is a scrollable grid of tiles.
/// * [GridTileBar], which is typically used in either the [header] or
/// [footer].
/// * <https://material.google.com/components/grid-lists.html>
diff --git a/packages/flutter/lib/src/material/stepper.dart b/packages/flutter/lib/src/material/stepper.dart
index bf73547..b8e9e79 100644
--- a/packages/flutter/lib/src/material/stepper.dart
+++ b/packages/flutter/lib/src/material/stepper.dart
@@ -542,7 +542,7 @@
);
}
- return new ScrollView(
+ return new ListView(
shrinkWrap: true,
children: children,
);
diff --git a/packages/flutter/lib/src/material/two_level_list.dart b/packages/flutter/lib/src/material/two_level_list.dart
index 618bd7e..f02e13a 100644
--- a/packages/flutter/lib/src/material/two_level_list.dart
+++ b/packages/flutter/lib/src/material/two_level_list.dart
@@ -283,7 +283,7 @@
@override
Widget build(BuildContext context) {
- return new ScrollView(
+ return new ListView(
padding: padding,
shrinkWrap: true,
children: KeyedSubtree.ensureUniqueKeysForList(children),
diff --git a/packages/flutter/lib/src/widgets/scroll_view.dart b/packages/flutter/lib/src/widgets/scroll_view.dart
index ef00905..d0487a5 100644
--- a/packages/flutter/lib/src/widgets/scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/scroll_view.dart
@@ -13,17 +13,13 @@
import 'sliver.dart';
import 'viewport.dart';
-/// A convenience widget that combines common scrolling-related widgets.
-class ScrollView extends StatelessWidget {
+abstract class ScrollView extends StatelessWidget {
ScrollView({
Key key,
this.scrollDirection: Axis.vertical,
this.reverse: false,
- this.padding,
- this.itemExtent,
this.physics,
this.shrinkWrap: false,
- this.children: const <Widget>[],
}) : super(key: key) {
assert(reverse != null);
assert(shrinkWrap != null);
@@ -33,18 +29,10 @@
final bool reverse;
- final EdgeInsets padding;
-
- final double itemExtent;
-
final ScrollPhysics physics;
final bool shrinkWrap;
- final List<Widget> children;
-
- SliverChildListDelegate get childrenDelegate => new SliverChildListDelegate(children);
-
@protected
AxisDirection getDirection(BuildContext context) {
// TODO(abarth): Consider reading direction.
@@ -58,6 +46,131 @@
}
@protected
+ List<Widget> buildSlivers(BuildContext context);
+
+ @override
+ Widget build(BuildContext context) {
+ List<Widget> slivers = buildSlivers(context);
+ AxisDirection axisDirection = getDirection(context);
+ return new Scrollable2(
+ axisDirection: axisDirection,
+ physics: physics,
+ viewportBuilder: (BuildContext context, ViewportOffset offset) {
+ if (shrinkWrap) {
+ return new ShrinkWrappingViewport(
+ axisDirection: axisDirection,
+ offset: offset,
+ slivers: slivers,
+ );
+ } else {
+ return new Viewport2(
+ axisDirection: axisDirection,
+ offset: offset,
+ slivers: slivers,
+ );
+ }
+ }
+ );
+ }
+
+ @override
+ void debugFillDescription(List<String> description) {
+ super.debugFillDescription(description);
+ description.add('$scrollDirection');
+ if (shrinkWrap)
+ description.add('shrink-wrapping');
+ }
+}
+
+abstract class BoxScrollView extends ScrollView {
+ BoxScrollView({
+ Key key,
+ Axis scrollDirection: Axis.vertical,
+ bool reverse: false,
+ ScrollPhysics physics,
+ bool shrinkWrap: false,
+ this.padding,
+ }) : super(
+ key: key,
+ scrollDirection: scrollDirection,
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ );
+
+ final EdgeInsets padding;
+
+ @override
+ List<Widget> buildSlivers(BuildContext context) {
+ Widget sliver = buildChildLayout(context);
+ if (padding != null)
+ sliver = new SliverPadding(padding: padding, child: sliver);
+ return <Widget>[ sliver ];
+ }
+
+ @protected
+ Widget buildChildLayout(BuildContext context);
+
+ @override
+ void debugFillDescription(List<String> description) {
+ super.debugFillDescription(description);
+ if (padding != null)
+ description.add('padding: $padding');
+ }
+}
+
+/// A scrollable list of boxes.
+// TODO(ianh): More documentation here.
+///
+/// See also:
+///
+/// * [SingleChildScrollView], when you need to make a single child scrollable.
+/// * [GridView], for a scrollable grid of boxes.
+/// * [PageView], for a scrollable that works page by page.
+class ListView extends BoxScrollView {
+ ListView({
+ Key key,
+ Axis scrollDirection: Axis.vertical,
+ bool reverse: false,
+ ScrollPhysics physics,
+ bool shrinkWrap: false,
+ EdgeInsets padding,
+ this.itemExtent,
+ List<Widget> children: const <Widget>[],
+ }) : childrenDelegate = new SliverChildListDelegate(children), super(
+ key: key,
+ scrollDirection: scrollDirection,
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ padding: padding,
+ );
+
+ ListView.custom({
+ Key key,
+ Axis scrollDirection: Axis.vertical,
+ bool reverse: false,
+ ScrollPhysics physics,
+ bool shrinkWrap: false,
+ EdgeInsets padding,
+ this.itemExtent,
+ @required this.childrenDelegate,
+ }) : super(
+ key: key,
+ scrollDirection: scrollDirection,
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ padding: padding,
+ ) {
+ assert(childrenDelegate != null);
+ }
+
+ final double itemExtent;
+
+ final SliverChildListDelegate childrenDelegate;
+
+ @override
Widget buildChildLayout(BuildContext context) {
if (itemExtent != null) {
return new SliverList(
@@ -69,91 +182,121 @@
}
@override
- Widget build(BuildContext context) {
- Widget sliver = buildChildLayout(context);
- if (padding != null)
- sliver = new SliverPadding(padding: padding, child: sliver);
- AxisDirection axisDirection = getDirection(context);
- return new Scrollable2(
- axisDirection: axisDirection,
- physics: physics,
- viewportBuilder: (BuildContext context, ViewportOffset offset) {
- if (shrinkWrap) {
- return new ShrinkWrappingViewport(
- axisDirection: axisDirection,
- offset: offset,
- slivers: <Widget>[ sliver ],
- );
- } else {
- return new Viewport2(
- axisDirection: axisDirection,
- offset: offset,
- slivers: <Widget>[ sliver ],
- );
- }
- }
- );
- }
-
- @override
void debugFillDescription(List<String> description) {
super.debugFillDescription(description);
- description.add('$scrollDirection');
- if (padding != null)
- description.add('padding: $padding');
if (itemExtent != null)
description.add('itemExtent: $itemExtent');
- if (shrinkWrap)
- description.add('shrink-wrapping');
}
}
-class ScrollGrid extends ScrollView {
- ScrollGrid({
+/// A scrollable grid of boxes.
+// TODO(ianh): More documentation here.
+///
+/// See also:
+///
+/// * [SingleChildScrollView], when you need to make a single child scrollable.
+/// * [ListView], for a scrollable list of boxes.
+/// * [PageView], for a scrollable that works page by page.
+class GridView extends BoxScrollView {
+ GridView({
Key key,
Axis scrollDirection: Axis.vertical,
- EdgeInsets padding,
+ bool reverse: false,
+ ScrollPhysics physics,
bool shrinkWrap: false,
- this.gridDelegate,
+ EdgeInsets padding,
+ @required this.gridDelegate,
List<Widget> children: const <Widget>[],
- }) : super(key: key, scrollDirection: scrollDirection, padding: padding, shrinkWrap: shrinkWrap, children: children);
+ }) : childrenDelegate = new SliverChildListDelegate(children), super(
+ key: key,
+ scrollDirection: scrollDirection,
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ padding: padding,
+ ) {
+ assert(gridDelegate != null);
+ }
- ScrollGrid.count({
+ GridView.custom({
Key key,
Axis scrollDirection: Axis.vertical,
- EdgeInsets padding,
+ bool reverse: false,
+ ScrollPhysics physics,
bool shrinkWrap: false,
+ EdgeInsets padding,
+ @required this.gridDelegate,
+ @required this.childrenDelegate,
+ }) : super(
+ key: key,
+ scrollDirection: scrollDirection,
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ padding: padding,
+ ) {
+ assert(gridDelegate != null);
+ assert(childrenDelegate != null);
+ }
+
+ GridView.count({
+ Key key,
+ Axis scrollDirection: Axis.vertical,
+ bool reverse: false,
+ ScrollPhysics physics,
+ bool shrinkWrap: false,
+ EdgeInsets padding,
@required int crossAxisCount,
double mainAxisSpacing: 0.0,
double crossAxisSpacing: 0.0,
double childAspectRatio: 1.0,
List<Widget> children: const <Widget>[],
}) : gridDelegate = new SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: crossAxisCount,
- mainAxisSpacing: mainAxisSpacing,
- crossAxisSpacing: crossAxisSpacing,
- childAspectRatio: childAspectRatio,
- ), super(key: key, scrollDirection: scrollDirection, padding: padding, shrinkWrap: shrinkWrap, children: children);
+ crossAxisCount: crossAxisCount,
+ mainAxisSpacing: mainAxisSpacing,
+ crossAxisSpacing: crossAxisSpacing,
+ childAspectRatio: childAspectRatio,
+ ),
+ childrenDelegate = new SliverChildListDelegate(children), super(
+ key: key,
+ scrollDirection: scrollDirection,
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ padding: padding,
+ );
- ScrollGrid.extent({
+ GridView.extent({
Key key,
Axis scrollDirection: Axis.vertical,
- EdgeInsets padding,
+ bool reverse: false,
+ ScrollPhysics physics,
bool shrinkWrap: false,
+ EdgeInsets padding,
@required double maxCrossAxisExtent,
double mainAxisSpacing: 0.0,
double crossAxisSpacing: 0.0,
double childAspectRatio: 1.0,
List<Widget> children: const <Widget>[],
}) : gridDelegate = new SliverGridDelegateWithMaxCrossAxisExtent(
- maxCrossAxisExtent: maxCrossAxisExtent,
- mainAxisSpacing: mainAxisSpacing,
- crossAxisSpacing: crossAxisSpacing,
- childAspectRatio: childAspectRatio,
- ), super(key: key, scrollDirection: scrollDirection, padding: padding, shrinkWrap: shrinkWrap, children: children);
+ maxCrossAxisExtent: maxCrossAxisExtent,
+ mainAxisSpacing: mainAxisSpacing,
+ crossAxisSpacing: crossAxisSpacing,
+ childAspectRatio: childAspectRatio,
+ ),
+ childrenDelegate = new SliverChildListDelegate(children), super(
+ key: key,
+ scrollDirection: scrollDirection,
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ padding: padding,
+ );
final SliverGridDelegate gridDelegate;
+ final SliverChildListDelegate childrenDelegate;
+
@override
Widget buildChildLayout(BuildContext context) {
return new SliverGrid(
@@ -163,17 +306,52 @@
}
}
-class PageView extends ScrollView {
+/// A scrollable list that works page by page.
+// TODO(ianh): More documentation here.
+///
+/// See also:
+///
+/// * [SingleChildScrollView], when you need to make a single child scrollable.
+/// * [ListView], for a scrollable list of boxes.
+/// * [GridView], for a scrollable grid of boxes.
+class PageView extends BoxScrollView {
PageView({
Key key,
Axis scrollDirection: Axis.horizontal,
+ bool reverse: false,
+ ScrollPhysics physics: const PageScrollPhysics(),
+ bool shrinkWrap: false,
+ EdgeInsets padding,
List<Widget> children: const <Widget>[],
+ }) : childrenDelegate = new SliverChildListDelegate(children), super(
+ key: key,
+ scrollDirection: scrollDirection,
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ padding: padding,
+ );
+
+ PageView.custom({
+ Key key,
+ Axis scrollDirection: Axis.horizontal,
+ bool reverse: false,
+ ScrollPhysics physics: const PageScrollPhysics(),
+ bool shrinkWrap: false,
+ EdgeInsets padding,
+ @required this.childrenDelegate,
}) : super(
key: key,
scrollDirection: scrollDirection,
- physics: const PageScrollPhysics(),
- children: children,
- );
+ reverse: reverse,
+ physics: physics,
+ shrinkWrap: shrinkWrap,
+ padding: padding,
+ ) {
+ assert(childrenDelegate != null);
+ }
+
+ final SliverChildListDelegate childrenDelegate;
@override
Widget buildChildLayout(BuildContext context) {
diff --git a/packages/flutter/lib/src/widgets/single_child_scroll_view.dart b/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
index f8bc058..3549857 100644
--- a/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
@@ -10,13 +10,31 @@
import 'framework.dart';
import 'scrollable.dart';
-// ///
-// /// The viewport will shrink-wrap the child in both axes.
-// ///
-// /// See also:
-// /// * [ScrollView], which handles multiple children in a scrolling list.
-// /// * [ScrollGrid], which handles multiple children in a scrolling grid.
-// /// * [Scrollable2], which handles arbitrary scrolling effects.
+
+/// A box in which a single widget can be scrolled.
+///
+/// This widget is useful when you have a single box that will normally be
+/// entirely visible, for example a clock face in a time picker, but you need to
+/// make sure it can be scrolled if the container gets too small in one axis
+/// (the scroll direction).
+///
+/// It is also useful if you need to shrink-wrap in both axes (the main
+/// scrolling direction as well as the cross axis), as one might see in a dialog
+/// or pop-up menu. In that case, you might pair the [SingleChildScrollView]
+/// with a [BlockBody] child.
+///
+/// When you have a list of children and do not require cross-axis
+/// shrink-wrapping behavior, for example a scrolling list that is always the
+/// width of the screen, consider [ListView], which is vastly more efficient
+/// that a [SingleChildScrollView] containing a [BlockBody] or [Column] with
+/// many children.
+///
+/// See also:
+///
+/// * [ListView], which handles multiple children in a scrolling list.
+/// * [GridView], which handles multiple children in a scrolling grid.
+/// * [PageView], for a scrollable that works page by page.
+/// * [Scrollable2], which handles arbitrary scrolling effects.
class SingleChildScrollView extends StatelessWidget {
SingleChildScrollView({
Key key,
diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart
index 6775ec2..c5722e2 100644
--- a/packages/flutter/test/material/about_test.dart
+++ b/packages/flutter/test/material/about_test.dart
@@ -18,7 +18,7 @@
title: new Text('Home'),
),
drawer: new Drawer(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new AboutDrawerItem(
applicationVersion: '0.1.2',
diff --git a/packages/flutter/test/material/drawer_test.dart b/packages/flutter/test/material/drawer_test.dart
index 98e8925..25d86ce 100644
--- a/packages/flutter/test/material/drawer_test.dart
+++ b/packages/flutter/test/material/drawer_test.dart
@@ -12,7 +12,7 @@
await tester.pumpWidget(
new Scaffold(
drawer: new Drawer(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new DrawerHeader(
child: new Container(
diff --git a/packages/flutter/test/material/list_item_test.dart b/packages/flutter/test/material/list_item_test.dart
index d97bc74..02635b9 100644
--- a/packages/flutter/test/material/list_item_test.dart
+++ b/packages/flutter/test/material/list_item_test.dart
@@ -32,7 +32,7 @@
home: new Material(
child: new Builder(
builder: (BuildContext context) {
- return new ScrollView(
+ return new ListView(
children: ListItem.divideItems(
context: context,
items: titles.map((String title) => new ListItem(title: new Text(title))),
diff --git a/packages/flutter/test/material/progress_indicator_test.dart b/packages/flutter/test/material/progress_indicator_test.dart
index db8c6f8..2821683 100644
--- a/packages/flutter/test/material/progress_indicator_test.dart
+++ b/packages/flutter/test/material/progress_indicator_test.dart
@@ -50,9 +50,9 @@
});
testWidgets('LinearProgressIndicator causes a repaint when it changes', (WidgetTester tester) async {
- await tester.pumpWidget(new ScrollView(children: <Widget>[new LinearProgressIndicator(value: 0.0)]));
+ await tester.pumpWidget(new ListView(children: <Widget>[new LinearProgressIndicator(value: 0.0)]));
List<Layer> layers1 = tester.layers;
- await tester.pumpWidget(new ScrollView(children: <Widget>[new LinearProgressIndicator(value: 0.5)]));
+ await tester.pumpWidget(new ListView(children: <Widget>[new LinearProgressIndicator(value: 0.5)]));
List<Layer> layers2 = tester.layers;
expect(layers1, isNot(equals(layers2)));
});
diff --git a/packages/flutter/test/material/scrollbar_test.dart b/packages/flutter/test/material/scrollbar_test.dart
index 7617f04..a982496 100644
--- a/packages/flutter/test/material/scrollbar_test.dart
+++ b/packages/flutter/test/material/scrollbar_test.dart
@@ -17,7 +17,7 @@
height: 200.0,
width: 300.0,
child: new Scrollbar2(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Container(height: 40.0, child: new Text('0')),
new Container(height: 40.0, child: new Text('1')),
@@ -35,13 +35,13 @@
);
SchedulerBinding.instance.debugAssertNoTransientCallbacks('Building a list with a scrollbar triggered an animation.');
- await tester.tap(find.byType(ScrollView));
+ await tester.tap(find.byType(ListView));
SchedulerBinding.instance.debugAssertNoTransientCallbacks('Tapping a block with a scrollbar triggered an animation.');
await tester.pump(const Duration(milliseconds: 200));
await tester.pump(const Duration(milliseconds: 200));
await tester.pump(const Duration(milliseconds: 200));
await tester.pump(const Duration(milliseconds: 200));
- await tester.scroll(find.byType(ScrollView), const Offset(0.0, -10.0));
+ await tester.scroll(find.byType(ListView), const Offset(0.0, -10.0));
expect(SchedulerBinding.instance.transientCallbackCount, greaterThan(0));
await tester.pump(const Duration(milliseconds: 200));
await tester.pump(const Duration(milliseconds: 200));
diff --git a/packages/flutter/test/material/slider_test.dart b/packages/flutter/test/material/slider_test.dart
index c5e4ffc..89c88a6 100644
--- a/packages/flutter/test/material/slider_test.dart
+++ b/packages/flutter/test/material/slider_test.dart
@@ -115,7 +115,7 @@
(WidgetTester tester) async {
double value = 0.0;
await tester.pumpWidget(new Material(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Slider(
value: value,
diff --git a/packages/flutter/test/widgets/block_test.dart b/packages/flutter/test/widgets/block_test.dart
index 89e6f35..04d574e 100644
--- a/packages/flutter/test/widgets/block_test.dart
+++ b/packages/flutter/test/widgets/block_test.dart
@@ -13,7 +13,7 @@
void main() {
testWidgets('Cannot scroll a non-overflowing block', (WidgetTester tester) async {
await tester.pumpWidget(
- new ScrollView(
+ new ListView(
key: blockKey,
children: <Widget>[
new Container(
@@ -38,7 +38,7 @@
testWidgets('Can scroll an overflowing block', (WidgetTester tester) async {
await tester.pumpWidget(
- new ScrollView(
+ new ListView(
key: blockKey,
children: <Widget>[
new Container(
diff --git a/packages/flutter/test/widgets/center_test.dart b/packages/flutter/test/widgets/center_test.dart
index 3748567..7cdac37 100644
--- a/packages/flutter/test/widgets/center_test.dart
+++ b/packages/flutter/test/widgets/center_test.dart
@@ -7,6 +7,6 @@
void main() {
testWidgets('Can be placed in an infinite box', (WidgetTester tester) async {
- await tester.pumpWidget(new ScrollView(children: <Widget>[new Center()]));
+ await tester.pumpWidget(new ListView(children: <Widget>[new Center()]));
});
}
diff --git a/packages/flutter/test/widgets/container_test.dart b/packages/flutter/test/widgets/container_test.dart
index 3f195e6..82ee85f 100644
--- a/packages/flutter/test/widgets/container_test.dart
+++ b/packages/flutter/test/widgets/container_test.dart
@@ -50,6 +50,6 @@
});
testWidgets('Can be placed in an infinite box', (WidgetTester tester) async {
- await tester.pumpWidget(new ScrollView(children: <Widget>[new Container()]));
+ await tester.pumpWidget(new ListView(children: <Widget>[new Container()]));
});
}
diff --git a/packages/flutter/test/widgets/date_picker_test.dart b/packages/flutter/test/widgets/date_picker_test.dart
index 1ee34e6..95e4a71 100644
--- a/packages/flutter/test/widgets/date_picker_test.dart
+++ b/packages/flutter/test/widgets/date_picker_test.dart
@@ -10,7 +10,7 @@
DateTime currentValue;
Widget widget = new Material(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new MonthPicker(
selectedDate: new DateTime.utc(2015, 6, 9, 7, 12),
diff --git a/packages/flutter/test/widgets/draggable_test.dart b/packages/flutter/test/widgets/draggable_test.dart
index 927bb74..c696248 100644
--- a/packages/flutter/test/widgets/draggable_test.dart
+++ b/packages/flutter/test/widgets/draggable_test.dart
@@ -312,7 +312,7 @@
Point firstLocation, secondLocation, thirdLocation;
await tester.pumpWidget(new MaterialApp(
- home: new ScrollView(
+ home: new ListView(
children: <Widget>[
new DragTarget<int>(
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
@@ -418,7 +418,7 @@
Point firstLocation, secondLocation, thirdLocation;
await tester.pumpWidget(new MaterialApp(
- home: new ScrollView(
+ home: new ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
new DragTarget<int>(
diff --git a/packages/flutter/test/widgets/drawer_test.dart b/packages/flutter/test/widgets/drawer_test.dart
index eb59d42..d468f75 100644
--- a/packages/flutter/test/widgets/drawer_test.dart
+++ b/packages/flutter/test/widgets/drawer_test.dart
@@ -135,7 +135,7 @@
return new Scaffold(
key: scaffoldKey,
drawer: new Drawer(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Text('drawer'),
new FlatButton(
diff --git a/packages/flutter/test/widgets/form_test.dart b/packages/flutter/test/widgets/form_test.dart
index 65fb2ff..f942a27 100644
--- a/packages/flutter/test/widgets/form_test.dart
+++ b/packages/flutter/test/widgets/form_test.dart
@@ -149,7 +149,7 @@
autovalidate: true,
child: new Focus(
key: focusKey,
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new TextField(
key: fieldKey
diff --git a/packages/flutter/test/widgets/heroes_test.dart b/packages/flutter/test/widgets/heroes_test.dart
index 1c76377..39da092 100644
--- a/packages/flutter/test/widgets/heroes_test.dart
+++ b/packages/flutter/test/widgets/heroes_test.dart
@@ -11,7 +11,7 @@
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
'/': (BuildContext context) => new Material(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Container(height: 100.0, width: 100.0),
new Card(child: new Hero(tag: 'a', child: new Container(height: 100.0, width: 100.0, key: firstKey))),
@@ -21,7 +21,7 @@
)
),
'/two': (BuildContext context) => new Material(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Container(height: 150.0, width: 150.0),
new Card(child: new Hero(tag: 'a', child: new Container(height: 150.0, width: 150.0, key: secondKey))),
@@ -35,7 +35,7 @@
class ThreeRoute extends MaterialPageRoute<Null> {
ThreeRoute() : super(builder: (BuildContext context) {
return new Material(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Container(height: 200.0, width: 200.0),
new Card(child: new Hero(tag: 'a', child: new Container(height: 200.0, width: 200.0, key: thirdKey))),
@@ -168,7 +168,7 @@
await tester.pumpWidget(new MaterialApp(
home: new Material(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Hero(tag: 'a', child: new Text('foo')),
new Builder(builder: (BuildContext context) {
diff --git a/packages/flutter/test/widgets/list_test.dart b/packages/flutter/test/widgets/list_test.dart
index 2072950..d5d6247 100644
--- a/packages/flutter/test/widgets/list_test.dart
+++ b/packages/flutter/test/widgets/list_test.dart
@@ -6,9 +6,9 @@
import 'package:flutter/widgets.dart';
void main() {
- testWidgets('ScrollView itemExtent control test', (WidgetTester tester) async {
+ testWidgets('ListView itemExtent control test', (WidgetTester tester) async {
await tester.pumpWidget(
- new ScrollView(
+ new ListView(
itemExtent: 200.0,
children: new List<Widget>.generate(20, (int i) {
return new Container(
@@ -27,7 +27,7 @@
expect(find.text('3'), findsNothing);
expect(find.text('4'), findsNothing);
- await tester.scroll(find.byType(ScrollView), const Offset(0.0, -250.0));
+ await tester.scroll(find.byType(ListView), const Offset(0.0, -250.0));
await tester.pump();
expect(find.text('0'), findsNothing);
@@ -38,7 +38,7 @@
expect(find.text('5'), findsNothing);
expect(find.text('6'), findsNothing);
- await tester.scroll(find.byType(ScrollView), const Offset(0.0, 200.0));
+ await tester.scroll(find.byType(ListView), const Offset(0.0, 200.0));
await tester.pump();
expect(find.text('0'), findsOneWidget);
@@ -49,11 +49,11 @@
expect(find.text('5'), findsNothing);
});
- testWidgets('ScrollView large scroll jump', (WidgetTester tester) async {
+ testWidgets('ListView large scroll jump', (WidgetTester tester) async {
List<int> log = <int>[];
await tester.pumpWidget(
- new ScrollView(
+ new ListView(
itemExtent: 200.0,
children: new List<Widget>.generate(20, (int i) {
return new Builder(
diff --git a/packages/flutter/test/widgets/reparent_state_test.dart b/packages/flutter/test/widgets/reparent_state_test.dart
index 096ba5e..ec1572c 100644
--- a/packages/flutter/test/widgets/reparent_state_test.dart
+++ b/packages/flutter/test/widgets/reparent_state_test.dart
@@ -195,7 +195,7 @@
StateMarkerState keyState = key.currentState;
keyState.marker = "marked";
- await tester.pumpWidget(new ScrollView(
+ await tester.pumpWidget(new ListView(
itemExtent: 100.0,
children: <Widget>[
new Container(
diff --git a/packages/flutter/test/widgets/scroll_grid_test.dart b/packages/flutter/test/widgets/scroll_grid_test.dart
index 6501fb8..5e4d35c 100644
--- a/packages/flutter/test/widgets/scroll_grid_test.dart
+++ b/packages/flutter/test/widgets/scroll_grid_test.dart
@@ -8,17 +8,17 @@
import 'states.dart';
void main() {
- testWidgets('Empty ScrollGrid', (WidgetTester tester) async {
- await tester.pumpWidget(new ScrollGrid.count(
+ testWidgets('Empty GridView', (WidgetTester tester) async {
+ await tester.pumpWidget(new GridView.count(
crossAxisCount: 4,
children: const <Widget>[],
));
});
- testWidgets('ScrollGrid.count control test', (WidgetTester tester) async {
+ testWidgets('GridView.count control test', (WidgetTester tester) async {
List<String> log = <String>[];
- await tester.pumpWidget(new ScrollGrid.count(
+ await tester.pumpWidget(new GridView.count(
crossAxisCount: 4,
children: kStates.map((String state) {
return new GestureDetector(
@@ -83,10 +83,10 @@
log.clear();
});
- testWidgets('ScrollGrid.extent control test', (WidgetTester tester) async {
+ testWidgets('GridView.extent control test', (WidgetTester tester) async {
List<String> log = <String>[];
- await tester.pumpWidget(new ScrollGrid.extent(
+ await tester.pumpWidget(new GridView.extent(
maxCrossAxisExtent: 200.0,
children: kStates.map((String state) {
return new GestureDetector(
@@ -126,11 +126,11 @@
log.clear();
});
- testWidgets('ScrollGrid large scroll jump', (WidgetTester tester) async {
+ testWidgets('GridView large scroll jump', (WidgetTester tester) async {
List<int> log = <int>[];
await tester.pumpWidget(
- new ScrollGrid.extent(
+ new GridView.extent(
scrollDirection: Axis.horizontal,
maxCrossAxisExtent: 200.0,
childAspectRatio: 0.75,
@@ -186,11 +186,11 @@
log.clear();
});
- testWidgets('ScrollGrid - change crossAxisCount', (WidgetTester tester) async {
+ testWidgets('GridView - change crossAxisCount', (WidgetTester tester) async {
List<int> log = <int>[];
await tester.pumpWidget(
- new ScrollGrid(
+ new GridView(
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
),
@@ -217,7 +217,7 @@
log.clear();
await tester.pumpWidget(
- new ScrollGrid(
+ new GridView(
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
@@ -245,11 +245,11 @@
expect(find.text('4'), findsNothing);
});
- testWidgets('ScrollGrid - change maxChildCrossAxisExtent', (WidgetTester tester) async {
+ testWidgets('GridView - change maxChildCrossAxisExtent', (WidgetTester tester) async {
List<int> log = <int>[];
await tester.pumpWidget(
- new ScrollGrid(
+ new GridView(
gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200.0,
),
@@ -276,7 +276,7 @@
log.clear();
await tester.pumpWidget(
- new ScrollGrid(
+ new GridView(
gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 400.0,
),
diff --git a/packages/flutter/test/widgets/scroll_view_test.dart b/packages/flutter/test/widgets/scroll_view_test.dart
index 93d896a..cfc9dea 100644
--- a/packages/flutter/test/widgets/scroll_view_test.dart
+++ b/packages/flutter/test/widgets/scroll_view_test.dart
@@ -8,10 +8,10 @@
import 'states.dart';
void main() {
- testWidgets('ScrollView control test', (WidgetTester tester) async {
+ testWidgets('ListView control test', (WidgetTester tester) async {
List<String> log = <String>[];
- await tester.pumpWidget(new ScrollView(
+ await tester.pumpWidget(new ListView(
children: kStates.map<Widget>((String state) {
return new GestureDetector(
onTap: () {
@@ -45,9 +45,9 @@
log.clear();
});
- testWidgets('ScrollView restart ballistic activity out of range', (WidgetTester tester) async {
- Widget buildScrollView(int n) {
- return new ScrollView(
+ testWidgets('ListView restart ballistic activity out of range', (WidgetTester tester) async {
+ Widget buildListView(int n) {
+ return new ListView(
children: kStates.take(n).map<Widget>((String state) {
return new Container(
height: 200.0,
@@ -60,9 +60,9 @@
);
}
- await tester.pumpWidget(buildScrollView(30));
- await tester.fling(find.byType(ScrollView), const Offset(0.0, -4000.0), 4000.0);
- await tester.pumpWidget(buildScrollView(15));
+ await tester.pumpWidget(buildListView(30));
+ await tester.fling(find.byType(ListView), const Offset(0.0, -4000.0), 4000.0);
+ await tester.pumpWidget(buildListView(15));
await tester.pump(const Duration(milliseconds: 10));
await tester.pump(const Duration(milliseconds: 10));
await tester.pump(const Duration(milliseconds: 10));
diff --git a/packages/flutter/test/widgets/scrollable_dispose_test.dart b/packages/flutter/test/widgets/scrollable_dispose_test.dart
index 24aa922..cd1d17b 100644
--- a/packages/flutter/test/widgets/scrollable_dispose_test.dart
+++ b/packages/flutter/test/widgets/scrollable_dispose_test.dart
@@ -13,11 +13,11 @@
for (int i = 0; i < 250; i++)
textWidgets.add(new Text('$i'));
await tester.pumpWidget(new FlipWidget(
- left: new ScrollView(children: textWidgets),
+ left: new ListView(children: textWidgets),
right: new Container()
));
- await tester.fling(find.byType(ScrollView), const Offset(0.0, -200.0), 1000.0);
+ await tester.fling(find.byType(ListView), const Offset(0.0, -200.0), 1000.0);
await tester.pump();
tester.state<FlipWidgetState>(find.byType(FlipWidget)).flip();
diff --git a/packages/flutter/test/widgets/scrollable_grid_test.dart b/packages/flutter/test/widgets/scrollable_grid_test.dart
index c44d204..35b89e7 100644
--- a/packages/flutter/test/widgets/scrollable_grid_test.dart
+++ b/packages/flutter/test/widgets/scrollable_grid_test.dart
@@ -7,23 +7,23 @@
import 'package:flutter/rendering.dart';
void main() {
- testWidgets('ScrollGrid default control', (WidgetTester tester) async {
+ testWidgets('GridView default control', (WidgetTester tester) async {
await tester.pumpWidget(new Center(
- child: new ScrollGrid.count(
+ child: new GridView.count(
crossAxisCount: 1,
),
));
});
// Tests https://github.com/flutter/flutter/issues/5522
- testWidgets('ScrollGrid displays correct children with nonzero padding', (WidgetTester tester) async {
+ testWidgets('GridView displays correct children with nonzero padding', (WidgetTester tester) async {
final EdgeInsets padding = const EdgeInsets.fromLTRB(0.0, 100.0, 0.0, 0.0);
Widget testWidget = new Align(
child: new SizedBox(
height: 800.0,
width: 300.0, // forces the grid children to be 300..300
- child: new ScrollGrid.count(
+ child: new GridView.count(
crossAxisCount: 1,
padding: padding,
children: new List<Widget>.generate(10, (int index) {
diff --git a/packages/flutter/test/widgets/semantics_debugger_test.dart b/packages/flutter/test/widgets/semantics_debugger_test.dart
index ce8be6f..676c4cd 100644
--- a/packages/flutter/test/widgets/semantics_debugger_test.dart
+++ b/packages/flutter/test/widgets/semantics_debugger_test.dart
@@ -126,7 +126,7 @@
await tester.pumpWidget(
new SemanticsDebugger(
child: new Material(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new RaisedButton(
onPressed: () {
@@ -160,7 +160,7 @@
await tester.pumpWidget(
new SemanticsDebugger(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Container(
key: childKey,
@@ -175,22 +175,22 @@
expect(tester.getTopLeft(find.byKey(childKey)).y, equals(0.0));
- await tester.fling(find.byType(ScrollView), const Offset(0.0, -200.0), 200.0);
+ await tester.fling(find.byType(ListView), const Offset(0.0, -200.0), 200.0);
await tester.pump();
expect(tester.getTopLeft(find.byKey(childKey)).y, equals(-480.0));
- await tester.fling(find.byType(ScrollView), const Offset(200.0, 0.0), 200.0);
+ await tester.fling(find.byType(ListView), const Offset(200.0, 0.0), 200.0);
await tester.pump();
expect(tester.getTopLeft(find.byKey(childKey)).y, equals(-480.0));
- await tester.fling(find.byType(ScrollView), const Offset(-200.0, 0.0), 200.0);
+ await tester.fling(find.byType(ListView), const Offset(-200.0, 0.0), 200.0);
await tester.pump();
expect(tester.getTopLeft(find.byKey(childKey)).y, equals(-480.0));
- await tester.fling(find.byType(ScrollView), const Offset(0.0, 200.0), 200.0);
+ await tester.fling(find.byType(ListView), const Offset(0.0, 200.0), 200.0);
await tester.pump();
expect(tester.getTopLeft(find.byKey(childKey)).y, equals(0.0));
@@ -247,7 +247,7 @@
await tester.pumpWidget(
new SemanticsDebugger(
child: new Material(
- child: new ScrollView(
+ child: new ListView(
children: <Widget>[
new Checkbox(
key: keyTop,