Commit c7e2e8ae authored by Hans Muller's avatar Hans Muller

Remove Scaffold scrollableKey use in gallery demos (#3406)

* Remove Scaffold scrollable_key demo usage
parent 6e0c76f4
...@@ -77,7 +77,6 @@ class FlexibleSpaceDemo extends StatefulWidget { ...@@ -77,7 +77,6 @@ class FlexibleSpaceDemo extends StatefulWidget {
class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> { class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final double _appBarHeight = 256.0; final double _appBarHeight = 256.0;
final Key _scrollableKey = new UniqueKey();
AppBarBehavior _appBarBehavior = AppBarBehavior.scroll; AppBarBehavior _appBarBehavior = AppBarBehavior.scroll;
@override @override
...@@ -90,7 +89,6 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> { ...@@ -90,7 +89,6 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
), ),
child: new Scaffold( child: new Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
scrollableKey: _scrollableKey,
appBarBehavior: _appBarBehavior, appBarBehavior: _appBarBehavior,
appBar: new AppBar( appBar: new AppBar(
expandedHeight: _appBarHeight, expandedHeight: _appBarHeight,
...@@ -132,7 +130,6 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> { ...@@ -132,7 +130,6 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
) )
), ),
body: new Block( body: new Block(
scrollableKey: _scrollableKey,
padding: new EdgeInsets.only(top: _appBarHeight + statusBarHeight), padding: new EdgeInsets.only(top: _appBarHeight + statusBarHeight),
children: <Widget>[ children: <Widget>[
new _ContactCategory( new _ContactCategory(
......
...@@ -45,7 +45,6 @@ class TabsDemoState extends State<TabsDemo> { ...@@ -45,7 +45,6 @@ class TabsDemoState extends State<TabsDemo> {
}); });
}, },
child: new Scaffold( child: new Scaffold(
scrollableKey: _selectedPage.key,
appBarBehavior: AppBarBehavior.under, appBarBehavior: AppBarBehavior.under,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Tabs and scrolling'), title: new Text('Tabs and scrolling'),
......
...@@ -75,7 +75,6 @@ class GalleryHome extends StatefulWidget { ...@@ -75,7 +75,6 @@ class GalleryHome extends StatefulWidget {
class GalleryHomeState extends State<GalleryHome> { class GalleryHomeState extends State<GalleryHome> {
final Key _homeKey = new ValueKey<String>("Gallery Home"); final Key _homeKey = new ValueKey<String>("Gallery Home");
final Key _listKey = new ValueKey<String>("Gallery List");
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -98,12 +97,10 @@ class GalleryHomeState extends State<GalleryHome> { ...@@ -98,12 +97,10 @@ class GalleryHomeState extends State<GalleryHome> {
background: new GalleryHeader() background: new GalleryHeader()
) )
), ),
scrollableKey: _listKey,
appBarBehavior: AppBarBehavior.under, appBarBehavior: AppBarBehavior.under,
body: new TwoLevelList( body: new TwoLevelList(
padding: new EdgeInsets.only(top: _kFlexibleSpaceMaxHeight + statusBarHight), padding: new EdgeInsets.only(top: _kFlexibleSpaceMaxHeight + statusBarHight),
type: MaterialListType.oneLine, type: MaterialListType.oneLine,
scrollableKey: _listKey,
children: <Widget>[ children: <Widget>[
new TwoLevelSublist( new TwoLevelSublist(
leading: new Icon(icon: Icons.star), leading: new Icon(icon: Icons.star),
......
...@@ -487,8 +487,10 @@ class ScaffoldState extends State<Scaffold> { ...@@ -487,8 +487,10 @@ class ScaffoldState extends State<Scaffold> {
double _floatingAppBarHeight = 0.0; double _floatingAppBarHeight = 0.0;
bool _handleScrollNotification(ScrollNotification notification) { bool _handleScrollNotification(ScrollNotification notification) {
if (config.scrollableKey == null || config.scrollableKey == notification.scrollable.config.key) { final ScrollableState scrollable = notification.scrollable;
final double newScrollOffset = notification.scrollable.scrollOffset; if ((scrollable.config.scrollDirection == Axis.vertical) &&
(config.scrollableKey == null || config.scrollableKey == scrollable.config.key)) {
final double newScrollOffset = scrollable.scrollOffset;
setState(() { setState(() {
_scrollOffsetDelta = _scrollOffset - newScrollOffset; _scrollOffsetDelta = _scrollOffset - newScrollOffset;
_scrollOffset = newScrollOffset; _scrollOffset = newScrollOffset;
......
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