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(
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),
),
),
);
}