Commit e05dcc9c authored by Hans Muller's avatar Hans Muller Committed by GitHub

Remove extraneous gallery demo scrollable keys (#7098)

parent 60b19b20
...@@ -126,18 +126,15 @@ class TravelDestinationItem extends StatelessWidget { ...@@ -126,18 +126,15 @@ class TravelDestinationItem extends StatelessWidget {
} }
class CardsDemo extends StatelessWidget { class CardsDemo extends StatelessWidget {
static final GlobalKey<ScrollableState> _scrollableKey = new GlobalKey<ScrollableState>();
static const String routeName = '/cards'; static const String routeName = '/cards';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
scrollableKey: _scrollableKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Travel stream') title: new Text('Travel stream')
), ),
body: new ScrollableList( body: new ScrollableList(
scrollableKey: _scrollableKey,
itemExtent: TravelDestinationItem.height, itemExtent: TravelDestinationItem.height,
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0), padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
children: destinations.map((TravelDestination destination) { children: destinations.map((TravelDestination destination) {
......
...@@ -9,7 +9,6 @@ const double kColorItemHeight = 48.0; ...@@ -9,7 +9,6 @@ const double kColorItemHeight = 48.0;
class ColorSwatch { class ColorSwatch {
ColorSwatch({ this.name, this.colors, this.accentColors, this.threshold: 900}); ColorSwatch({ this.name, this.colors, this.accentColors, this.threshold: 900});
final GlobalKey<ScrollableState> scrollableKey = new GlobalKey<ScrollableState>();
final String name; final String name;
final Map<int, Color> colors; final Map<int, Color> colors;
final Map<int, Color> accentColors; final Map<int, Color> accentColors;
...@@ -102,7 +101,6 @@ class ColorSwatchTabView extends StatelessWidget { ...@@ -102,7 +101,6 @@ class ColorSwatchTabView extends StatelessWidget {
} }
return new ScrollableList( return new ScrollableList(
scrollableKey: swatch.scrollableKey,
itemExtent: kColorItemHeight, itemExtent: kColorItemHeight,
children: colorItems children: colorItems
); );
...@@ -119,26 +117,11 @@ class ColorsDemo extends StatefulWidget { ...@@ -119,26 +117,11 @@ class ColorsDemo extends StatefulWidget {
} }
class _ColorsDemoState extends State<ColorsDemo> { class _ColorsDemoState extends State<ColorsDemo> {
ColorSwatch _selectedSwatch;
@override
void initState() {
super.initState();
_selectedSwatch = colorSwatches.first;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new TabBarSelection<ColorSwatch>( return new TabBarSelection<ColorSwatch>(
values: colorSwatches, values: colorSwatches,
onChanged: (ColorSwatch value) {
setState(() {
_selectedSwatch = value;
});
},
child: new Scaffold( child: new Scaffold(
scrollableKey: _selectedSwatch.scrollableKey,
appBar: new AppBar( appBar: new AppBar(
elevation: 0, elevation: 0,
title: new Text('Colors'), title: new Text('Colors'),
......
...@@ -239,7 +239,6 @@ class GridListDemo extends StatefulWidget { ...@@ -239,7 +239,6 @@ class GridListDemo extends StatefulWidget {
} }
class GridListDemoState extends State<GridListDemo> { class GridListDemoState extends State<GridListDemo> {
static final GlobalKey<ScrollableState> _scrollableKey = new GlobalKey<ScrollableState>();
GridDemoTileStyle _tileStyle = GridDemoTileStyle.twoLine; GridDemoTileStyle _tileStyle = GridDemoTileStyle.twoLine;
List<Photo> photos = <Photo>[ List<Photo> photos = <Photo>[
...@@ -318,7 +317,6 @@ class GridListDemoState extends State<GridListDemo> { ...@@ -318,7 +317,6 @@ class GridListDemoState extends State<GridListDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Orientation orientation = MediaQuery.of(context).orientation; final Orientation orientation = MediaQuery.of(context).orientation;
return new Scaffold( return new Scaffold(
scrollableKey: _scrollableKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Grid list'), title: new Text('Grid list'),
actions: <Widget>[ actions: <Widget>[
...@@ -345,7 +343,6 @@ class GridListDemoState extends State<GridListDemo> { ...@@ -345,7 +343,6 @@ class GridListDemoState extends State<GridListDemo> {
children: <Widget>[ children: <Widget>[
new Expanded( new Expanded(
child: new ScrollableGrid( child: new ScrollableGrid(
scrollableKey: _scrollableKey,
delegate: new FixedColumnCountGridDelegate( delegate: new FixedColumnCountGridDelegate(
columnCount: (orientation == Orientation.portrait) ? 2 : 3, columnCount: (orientation == Orientation.portrait) ? 2 : 3,
rowSpacing: 4.0, rowSpacing: 4.0,
......
...@@ -39,7 +39,6 @@ class LeaveBehindDemo extends StatefulWidget { ...@@ -39,7 +39,6 @@ class LeaveBehindDemo extends StatefulWidget {
class LeaveBehindDemoState extends State<LeaveBehindDemo> { class LeaveBehindDemoState extends State<LeaveBehindDemo> {
static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); static final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
static final GlobalKey<ScrollableState> _scrollableKey = new GlobalKey<ScrollableState>();
DismissDirection _dismissDirection = DismissDirection.horizontal; DismissDirection _dismissDirection = DismissDirection.horizontal;
List<LeaveBehindItem> leaveBehindItems; List<LeaveBehindItem> leaveBehindItems;
...@@ -132,7 +131,6 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -132,7 +131,6 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
scrollableKey: _scrollableKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Swipe to dismiss'), title: new Text('Swipe to dismiss'),
actions: <Widget>[ actions: <Widget>[
...@@ -164,7 +162,6 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -164,7 +162,6 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
] ]
), ),
body: new Block( body: new Block(
scrollableKey: _scrollableKey,
children: leaveBehindItems.map(buildItem).toList() children: leaveBehindItems.map(buildItem).toList()
) )
); );
......
...@@ -15,7 +15,6 @@ class ListDemo extends StatefulWidget { ...@@ -15,7 +15,6 @@ class ListDemo extends StatefulWidget {
class ListDemoState extends State<ListDemo> { class ListDemoState extends State<ListDemo> {
static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>(); static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
static final GlobalKey<ScrollableState> _scrollableKey = new GlobalKey<ScrollableState>();
PersistentBottomSheetController<Null> _bottomSheet; PersistentBottomSheetController<Null> _bottomSheet;
MaterialListType _itemType = MaterialListType.threeLine; MaterialListType _itemType = MaterialListType.threeLine;
...@@ -172,7 +171,6 @@ class ListDemoState extends State<ListDemo> { ...@@ -172,7 +171,6 @@ class ListDemoState extends State<ListDemo> {
return new Scaffold( return new Scaffold(
key: scaffoldKey, key: scaffoldKey,
scrollableKey: _scrollableKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Scrolling list\n$itemTypeText$layoutText'), title: new Text('Scrolling list\n$itemTypeText$layoutText'),
actions: <Widget>[ actions: <Widget>[
...@@ -195,7 +193,6 @@ class ListDemoState extends State<ListDemo> { ...@@ -195,7 +193,6 @@ class ListDemoState extends State<ListDemo> {
), ),
body: new Scrollbar( body: new Scrollbar(
child: new MaterialList( child: new MaterialList(
scrollableKey: _scrollableKey,
type: _itemType, type: _itemType,
padding: new EdgeInsets.symmetric(vertical: _dense ? 4.0 : 8.0), padding: new EdgeInsets.symmetric(vertical: _dense ? 4.0 : 8.0),
children: listItems children: listItems
......
...@@ -78,7 +78,6 @@ class OverscrollDemoState extends State<OverscrollDemo> { ...@@ -78,7 +78,6 @@ class OverscrollDemoState extends State<OverscrollDemo> {
return new Scaffold( return new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
scrollableKey: _scrollableKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('$indicatorTypeText'), title: new Text('$indicatorTypeText'),
actions: <Widget>[ actions: <Widget>[
......
...@@ -293,7 +293,6 @@ class ShrineHome extends StatefulWidget { ...@@ -293,7 +293,6 @@ class ShrineHome extends StatefulWidget {
class _ShrineHomeState extends State<ShrineHome> { class _ShrineHomeState extends State<ShrineHome> {
static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>(debugLabel: 'Shrine Home'); static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>(debugLabel: 'Shrine Home');
static final GlobalKey<ScrollableState> scrollableKey = new GlobalKey<ScrollableState>();
static final GridDelegate gridDelegate = new ShrineGridDelegate(); static final GridDelegate gridDelegate = new ShrineGridDelegate();
Future<Null> showOrderPage(Product product) async { Future<Null> showOrderPage(Product product) async {
...@@ -318,11 +317,9 @@ class _ShrineHomeState extends State<ShrineHome> { ...@@ -318,11 +317,9 @@ class _ShrineHomeState extends State<ShrineHome> {
final Product featured = _products.firstWhere((Product product) => product.featureDescription != null); final Product featured = _products.firstWhere((Product product) => product.featureDescription != null);
return new ShrinePage( return new ShrinePage(
scaffoldKey: scaffoldKey, scaffoldKey: scaffoldKey,
scrollableKey: scrollableKey,
products: _products, products: _products,
shoppingCart: _shoppingCart, shoppingCart: _shoppingCart,
body: new ScrollableViewport( body: new ScrollableViewport(
scrollableKey: scrollableKey,
child: new RepaintBoundary( child: new RepaintBoundary(
child: new Column( child: new Column(
children: <Widget>[ children: <Widget>[
......
...@@ -135,7 +135,6 @@ class OrderPage extends StatefulWidget { ...@@ -135,7 +135,6 @@ class OrderPage extends StatefulWidget {
/// order to the shopping cart. /// order to the shopping cart.
class _OrderPageState extends State<OrderPage> { class _OrderPageState extends State<OrderPage> {
static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>(debugLabel: 'Shrine Order'); static final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>(debugLabel: 'Shrine Order');
static final GlobalKey<ScrollableState> scrollableKey = new GlobalKey<ScrollableState>();
Order get currentOrder => ShrineOrderRoute.of(context).order; Order get currentOrder => ShrineOrderRoute.of(context).order;
...@@ -161,7 +160,6 @@ class _OrderPageState extends State<OrderPage> { ...@@ -161,7 +160,6 @@ class _OrderPageState extends State<OrderPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ShrinePage( return new ShrinePage(
scaffoldKey: scaffoldKey, scaffoldKey: scaffoldKey,
scrollableKey: scrollableKey,
products: config.products, products: config.products,
shoppingCart: config.shoppingCart, shoppingCart: config.shoppingCart,
floatingActionButton: new FloatingActionButton( floatingActionButton: new FloatingActionButton(
...@@ -180,7 +178,6 @@ class _OrderPageState extends State<OrderPage> { ...@@ -180,7 +178,6 @@ class _OrderPageState extends State<OrderPage> {
) )
), ),
body: new Block( body: new Block(
scrollableKey: scrollableKey,
children: <Widget>[ children: <Widget>[
new OrderItem( new OrderItem(
product: config.order.product, product: config.order.product,
...@@ -211,7 +208,6 @@ class _OrderPageState extends State<OrderPage> { ...@@ -211,7 +208,6 @@ class _OrderPageState extends State<OrderPage> {
] ]
) )
); );
} }
} }
......
...@@ -17,7 +17,6 @@ class ShrinePage extends StatefulWidget { ...@@ -17,7 +17,6 @@ class ShrinePage extends StatefulWidget {
ShrinePage({ ShrinePage({
Key key, Key key,
this.scaffoldKey, this.scaffoldKey,
this.scrollableKey,
this.body, this.body,
this.floatingActionButton, this.floatingActionButton,
this.products, this.products,
...@@ -28,7 +27,6 @@ class ShrinePage extends StatefulWidget { ...@@ -28,7 +27,6 @@ class ShrinePage extends StatefulWidget {
} }
final GlobalKey<ScaffoldState> scaffoldKey; final GlobalKey<ScaffoldState> scaffoldKey;
final GlobalKey<ScrollableState> scrollableKey;
final Widget body; final Widget body;
final Widget floatingActionButton; final Widget floatingActionButton;
final List<Product> products; final List<Product> products;
...@@ -88,7 +86,6 @@ class ShrinePageState extends State<ShrinePage> { ...@@ -88,7 +86,6 @@ class ShrinePageState extends State<ShrinePage> {
final ShrineTheme theme = ShrineTheme.of(context); final ShrineTheme theme = ShrineTheme.of(context);
return new Scaffold( return new Scaffold(
key: config.scaffoldKey, key: config.scaffoldKey,
scrollableKey: config.scrollableKey,
appBar: new AppBar( appBar: new AppBar(
elevation: _appBarElevation, elevation: _appBarElevation,
backgroundColor: theme.appBarBackgroundColor, backgroundColor: theme.appBarBackgroundColor,
......
...@@ -9,7 +9,6 @@ import 'package:flutter/material.dart'; ...@@ -9,7 +9,6 @@ import 'package:flutter/material.dart';
class _Page { class _Page {
_Page({ this.label }); _Page({ this.label });
final GlobalKey<ScrollableState> scrollableKey = new GlobalKey<ScrollableState>();
final String label; final String label;
String get id => label[0]; String get id => label[0];
} }
...@@ -122,25 +121,11 @@ class TabsDemo extends StatefulWidget { ...@@ -122,25 +121,11 @@ class TabsDemo extends StatefulWidget {
} }
class _TabsDemoState extends State<TabsDemo> { class _TabsDemoState extends State<TabsDemo> {
_Page _selectedPage;
@override
void initState() {
super.initState();
_selectedPage = _allPages.keys.first;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new TabBarSelection<_Page>( return new TabBarSelection<_Page>(
values: _allPages.keys.toList(), values: _allPages.keys.toList(),
onChanged: (_Page value) {
setState(() {
_selectedPage = value;
});
},
child: new Scaffold( child: new Scaffold(
scrollableKey: _selectedPage.scrollableKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Tabs and scrolling'), title: new Text('Tabs and scrolling'),
bottom: new TabBar<_Page>( bottom: new TabBar<_Page>(
...@@ -152,7 +137,6 @@ class _TabsDemoState extends State<TabsDemo> { ...@@ -152,7 +137,6 @@ class _TabsDemoState extends State<TabsDemo> {
body: new TabBarView<_Page>( body: new TabBarView<_Page>(
children: _allPages.keys.map((_Page page) { children: _allPages.keys.map((_Page page) {
return new ScrollableList( return new ScrollableList(
scrollableKey: page.scrollableKey,
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0), padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
itemExtent: _CardDataItem.height, itemExtent: _CardDataItem.height,
children: _allPages[page].map((_CardData data) { children: _allPages[page].map((_CardData data) {
......
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