album: improved bottom insets handling

This commit is contained in:
Thibault Deckers 2019-07-30 23:55:17 +09:00
parent 8c57970947
commit a25f81f359

View file

@ -30,13 +30,10 @@ class ThumbnailCollection extends StatelessWidget {
), ),
); );
} }
final bottomInsets = MediaQuery.of(context).viewInsets.bottom;
final sectionKeys = sections.keys.toList();
return SafeArea( return SafeArea(
child: DraggableScrollbar.arrows( child: DraggableScrollbar.arrows(
labelTextBuilder: (double offset) => Text(
"${offset ~/ 1}",
style: TextStyle(color: Colors.blueGrey),
),
controller: scrollController,
child: CustomScrollView( child: CustomScrollView(
controller: scrollController, controller: scrollController,
slivers: [ slivers: [
@ -44,13 +41,28 @@ class ThumbnailCollection extends StatelessWidget {
title: Text('Aves - All'), title: Text('Aves - All'),
floating: true, floating: true,
), ),
...sections.keys.map((sectionKey) => SectionSliver( ...sectionKeys.map((sectionKey) {
entries: entries, Widget sliver = SectionSliver(
sections: sections, entries: entries,
sectionKey: sectionKey, 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),
),
), ),
); );
} }