diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f7d2c4aed..f2a7a0ff1 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,17 +10,13 @@ - + android:value="false" /> diff --git a/android/app/src/main/res/values-land/flags.xml b/android/app/src/main/res/values-land/flags.xml new file mode 100644 index 000000000..637d33153 --- /dev/null +++ b/android/app/src/main/res/values-land/flags.xml @@ -0,0 +1,4 @@ + + + false + \ No newline at end of file diff --git a/android/app/src/main/res/values/flags.xml b/android/app/src/main/res/values/flags.xml new file mode 100644 index 000000000..a02d00023 --- /dev/null +++ b/android/app/src/main/res/values/flags.xml @@ -0,0 +1,4 @@ + + + true + \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 00fa4417c..8fcc5e55e 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,8 +1,6 @@ - diff --git a/lib/common/fake_app_bar.dart b/lib/common/fake_app_bar.dart new file mode 100644 index 000000000..ccbfece96 --- /dev/null +++ b/lib/common/fake_app_bar.dart @@ -0,0 +1,11 @@ +import 'package:flutter/widgets.dart'; + +class FakeAppBar extends StatelessWidget with PreferredSizeWidget { + @override + Widget build(BuildContext context) { + return SafeArea(child: SizedBox.shrink()); + } + + @override + Size get preferredSize => Size.zero; +} diff --git a/lib/main.dart b/lib/main.dart index a4b555a76..882ad9290 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:aves/common/fake_app_bar.dart'; import 'package:aves/model/image_fetcher.dart'; import 'package:aves/thumbnail_collection.dart'; import 'package:flutter/material.dart'; @@ -14,18 +15,14 @@ class MyApp extends StatelessWidget { title: 'Aves', theme: ThemeData( brightness: Brightness.dark, - primarySwatch: Colors.blue, + accentColor: Colors.amberAccent, ), - home: HomePage(title: 'Home'), + home: HomePage(), ); } } class HomePage extends StatefulWidget { - HomePage({Key key, this.title}) : super(key: key); - - final String title; - @override _HomePageState createState() => _HomePageState(); } @@ -47,15 +44,21 @@ class _HomePageState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(widget.title), + debugPrint('MediaQuery.of(context).viewInsets.bottom=${MediaQuery.of(context).viewInsets.bottom}'); + + return MediaQuery.removeViewInsets( + context: context, + // remove bottom view insets to paint underneath the translucent navigation bar + removeBottom: true, + child: Scaffold( + // fake app bar so that content is safe from status bar, even though we use a SliverAppBar + appBar: FakeAppBar(), + body: imageEntryList == null + ? Center( + child: CircularProgressIndicator(), + ) + : ThumbnailCollection(imageEntryList), ), - body: imageEntryList == null - ? Center( - child: CircularProgressIndicator(), - ) - : ThumbnailCollection(imageEntryList), ); } } diff --git a/lib/thumbnail_collection.dart b/lib/thumbnail_collection.dart index 753ff4c75..e286d04b0 100644 --- a/lib/thumbnail_collection.dart +++ b/lib/thumbnail_collection.dart @@ -42,27 +42,31 @@ class ThumbnailCollection extends StatelessWidget { controller: scrollController, child: CustomScrollView( controller: scrollController, - slivers: sections.keys - .map((sectionKey) => SliverStickyHeader( - header: SectionHeader(sectionKey), - sliver: SliverGrid( - delegate: SliverChildBuilderDelegate( - (context, index) { - var entries = sections[sectionKey]; - if (index >= entries.length) return null; - return Thumbnail( - entry: entries[index], - extent: extent, - ); - }, - childCount: sections[sectionKey].length, - ), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: columnCount, - ), + slivers: [ + SliverAppBar( + title: Text('Aves - All'), + floating: true, + ), + ...sections.keys.map((sectionKey) => SliverStickyHeader( + header: SectionHeader(sectionKey), + sliver: SliverGrid( + delegate: SliverChildBuilderDelegate( + (context, index) { + var entries = sections[sectionKey]; + if (index >= entries.length) return null; + return Thumbnail( + entry: entries[index], + extent: extent, + ); + }, + childCount: sections[sectionKey].length, ), - )) - .toList(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: columnCount, + ), + ), + )) + ], ), ); }