collection: fixed scrolling when there is no content
This commit is contained in:
parent
fc014a6274
commit
c8b8d9c897
2 changed files with 7 additions and 5 deletions
|
@ -6,7 +6,7 @@ class EmptyContent extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
const color = Color(0xFF607D8B);
|
||||
return Align(
|
||||
alignment: const FractionalOffset(.5, .4),
|
||||
alignment: const FractionalOffset(.5, .3),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: const [
|
||||
|
|
|
@ -50,13 +50,15 @@ class ThumbnailCollection extends StatelessWidget {
|
|||
final scrollView = CustomScrollView(
|
||||
key: _scrollableKey,
|
||||
primary: true,
|
||||
// workaround to prevent scrolling the app bar away
|
||||
// when there is no content and we use `SliverFillRemaining`
|
||||
physics: collection.isEmpty ? const NeverScrollableScrollPhysics() : null,
|
||||
slivers: [
|
||||
if (appBar != null) appBar,
|
||||
if (collection.isEmpty && emptyBuilder != null)
|
||||
SliverFillViewport(
|
||||
delegate: SliverChildListDelegate.fixed(
|
||||
[emptyBuilder(context)],
|
||||
),
|
||||
SliverFillRemaining(
|
||||
child: emptyBuilder(context),
|
||||
hasScrollBody: false,
|
||||
),
|
||||
...sectionKeys.map((sectionKey) => SectionSliver(
|
||||
collection: collection,
|
||||
|
|
Loading…
Reference in a new issue