From a25f81f35956805d0f99942e9d16249b7ec0bc9d Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Tue, 30 Jul 2019 23:55:17 +0900 Subject: [PATCH] album: improved bottom insets handling --- lib/thumbnail_collection.dart | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/lib/thumbnail_collection.dart b/lib/thumbnail_collection.dart index 7e39db4fd..27e0d9779 100644 --- a/lib/thumbnail_collection.dart +++ b/lib/thumbnail_collection.dart @@ -30,13 +30,10 @@ class ThumbnailCollection extends StatelessWidget { ), ); } + final bottomInsets = MediaQuery.of(context).viewInsets.bottom; + final sectionKeys = sections.keys.toList(); return SafeArea( child: DraggableScrollbar.arrows( - labelTextBuilder: (double offset) => Text( - "${offset ~/ 1}", - style: TextStyle(color: Colors.blueGrey), - ), - controller: scrollController, child: CustomScrollView( controller: scrollController, slivers: [ @@ -44,13 +41,28 @@ class ThumbnailCollection extends StatelessWidget { title: Text('Aves - All'), floating: true, ), - ...sections.keys.map((sectionKey) => SectionSliver( - entries: entries, - sections: sections, - sectionKey: sectionKey, - )), + ...sectionKeys.map((sectionKey) { + Widget sliver = SectionSliver( + entries: entries, + sections: sections, + sectionKey: sectionKey, + ); + if (sectionKey == sectionKeys.last) { + sliver = SliverPadding( + padding: EdgeInsets.only(bottom: bottomInsets), + sliver: sliver, + ); + } + return sliver; + }), ], ), + controller: scrollController, + padding: EdgeInsets.only(bottom: bottomInsets), + labelTextBuilder: (double offset) => Text( + "${offset ~/ 1}", + style: TextStyle(color: Colors.blueGrey), + ), ), ); }