group fab; prevent empty filter grid scroll
This commit is contained in:
parent
4b87717cd2
commit
27879a900d
2 changed files with 31 additions and 23 deletions
|
@ -18,7 +18,6 @@ import 'package:aves/view/view.dart';
|
|||
import 'package:aves/widgets/common/action_mixins/feedback.dart';
|
||||
import 'package:aves/widgets/common/action_mixins/vault_aware.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/identity/aves_fab.dart';
|
||||
import 'package:aves/widgets/common/identity/aves_filter_chip.dart';
|
||||
import 'package:aves/widgets/common/identity/buttons/captioned_button.dart';
|
||||
import 'package:aves/widgets/common/identity/empty.dart';
|
||||
|
@ -190,8 +189,7 @@ class _AlbumPickPageState extends State<_AlbumPickPage> with FeedbackMixin, Vaul
|
|||
|
||||
Widget? _buildFab(BuildContext context) {
|
||||
return isPickingGroup
|
||||
? AvesFab(
|
||||
tooltip: context.l10n.groupPickerUseThisGroupButton,
|
||||
? FloatingActionButton.extended(
|
||||
onPressed: () {
|
||||
final groupUri = context.read<FilterGroupNotifier>().value;
|
||||
final filter = groupUri != null ? albumGrouping.uriToFilter(groupUri) : AlbumGroupFilter.root;
|
||||
|
@ -199,6 +197,8 @@ class _AlbumPickPageState extends State<_AlbumPickPage> with FeedbackMixin, Vaul
|
|||
_pickFilter(context, filter);
|
||||
}
|
||||
},
|
||||
icon: const Icon(AIcons.apply),
|
||||
label: Text(context.l10n.groupPickerUseThisGroupButton),
|
||||
)
|
||||
: null;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import 'package:aves/widgets/common/basic/scaffold.dart';
|
|||
import 'package:aves/widgets/common/behaviour/pop/double_back.dart';
|
||||
import 'package:aves/widgets/common/behaviour/pop/scope.dart';
|
||||
import 'package:aves/widgets/common/behaviour/pop/tv_navigation.dart';
|
||||
import 'package:aves/widgets/common/behaviour/sloppy_scroll_physics.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/extensions/media_query.dart';
|
||||
import 'package:aves/widgets/common/grid/item_tracker.dart';
|
||||
|
@ -683,30 +684,37 @@ class _FilterScrollView<T extends CollectionFilter> extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget _buildScrollView(BuildContext context) {
|
||||
return Selector<SectionedListLayout<FilterGridItem<T>>, bool>(
|
||||
selector: (context, layout) => layout.sections.isEmpty,
|
||||
builder: (context, isEmpty, child) {
|
||||
return CustomScrollView(
|
||||
key: scrollableKey,
|
||||
controller: scrollController,
|
||||
// workaround to prevent scrolling the app bar away
|
||||
// when there is no content and we use `SliverFillRemaining`
|
||||
physics: isEmpty
|
||||
? const NeverScrollableScrollPhysics()
|
||||
: SloppyScrollPhysics(
|
||||
gestureSettings: MediaQuery.gestureSettingsOf(context),
|
||||
parent: const AlwaysScrollableScrollPhysics(),
|
||||
),
|
||||
slivers: [
|
||||
appBar,
|
||||
AnimationLimiter(
|
||||
key: ValueKey(context.select<FilterGroupNotifier?, Uri?>((v) => v?.value)),
|
||||
child: Selector<SectionedListLayout<FilterGridItem<T>>, bool>(
|
||||
selector: (context, layout) => layout.sections.isEmpty,
|
||||
builder: (context, empty, child) {
|
||||
return empty
|
||||
// TODO TLAD [nested] prevent scrolling when empty (cf CollectionPage)
|
||||
child: isEmpty
|
||||
? SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: emptyBuilder(),
|
||||
)
|
||||
: SectionedListSliver<FilterGridItem<T>>();
|
||||
},
|
||||
),
|
||||
: SectionedListSliver<FilterGridItem<T>>(),
|
||||
),
|
||||
const NavBarPaddingSliver(),
|
||||
const BottomPaddingSliver(),
|
||||
const TvTileGridBottomPaddingSliver(),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue