Commit 7b2f6604 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Stablize gallery status bar height computation (#5485)

parent 6e9bbca4
...@@ -105,12 +105,6 @@ class GalleryHomeState extends State<GalleryHome> { ...@@ -105,12 +105,6 @@ class GalleryHomeState extends State<GalleryHome> {
void initState() { void initState() {
super.initState(); super.initState();
// The first item in the list just exists to occupy the space behind
// the flexible app bar. As it's scrolled out of the way, the app bar's
// height will shrink.
final double statusBarHeight = (MediaQuery.of(context)?.padding ?? EdgeInsets.zero).top;
_listItems.add(new SizedBox(height: _kFlexibleSpaceMaxHeight + statusBarHeight));
final ThemeData themeData = Theme.of(context); final ThemeData themeData = Theme.of(context);
final TextStyle headerStyle = themeData.textTheme.body2.copyWith(color: themeData.accentColor); final TextStyle headerStyle = themeData.textTheme.body2.copyWith(color: themeData.accentColor);
String category; String category;
...@@ -134,6 +128,7 @@ class GalleryHomeState extends State<GalleryHome> { ...@@ -134,6 +128,7 @@ class GalleryHomeState extends State<GalleryHome> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double statusBarHeight = MediaQuery.of(context).padding.top;
return new Scaffold( return new Scaffold(
key: _homeKey, key: _homeKey,
scrollableKey: _scrollableKey, scrollableKey: _scrollableKey,
...@@ -159,8 +154,12 @@ class GalleryHomeState extends State<GalleryHome> { ...@@ -159,8 +154,12 @@ class GalleryHomeState extends State<GalleryHome> {
) )
), ),
appBarBehavior: AppBarBehavior.under, appBarBehavior: AppBarBehavior.under,
// The block's padding just exists to occupy the space behind the flexible app bar.
// As the block's padded region is scrolled upwards, the app bar's height will
// shrink keep it above the block content's and over the padded region.
body: new Block( body: new Block(
scrollableKey: _scrollableKey, scrollableKey: _scrollableKey,
padding: new EdgeInsets.only(top: _kFlexibleSpaceMaxHeight + statusBarHeight),
children: _listItems children: _listItems
) )
); );
......
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