diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 9e405089e..dae5ad074 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -90,6 +90,7 @@ "chipActionGoToCountryPage": "Show in Countries", "chipActionGoToPlacePage": "Show in Places", "chipActionGoToTagPage": "Show in Tags", + "chipActionGoToExplorerPage": "Show in Explorer", "chipActionFilterOut": "Filter out", "chipActionFilterIn": "Filter in", "chipActionHide": "Hide", diff --git a/lib/view/src/actions/chip.dart b/lib/view/src/actions/chip.dart index 6c6dcc6cc..75b0f5ed6 100644 --- a/lib/view/src/actions/chip.dart +++ b/lib/view/src/actions/chip.dart @@ -11,6 +11,7 @@ extension ExtraChipActionView on ChipAction { ChipAction.goToCountryPage => l10n.chipActionGoToCountryPage, ChipAction.goToPlacePage => l10n.chipActionGoToPlacePage, ChipAction.goToTagPage => l10n.chipActionGoToTagPage, + ChipAction.goToExplorerPage => l10n.chipActionGoToExplorerPage, ChipAction.ratingOrGreater || ChipAction.ratingOrLower => // different data depending on state @@ -30,6 +31,7 @@ extension ExtraChipActionView on ChipAction { ChipAction.goToCountryPage => AIcons.country, ChipAction.goToPlacePage => AIcons.place, ChipAction.goToTagPage => AIcons.tag, + ChipAction.goToExplorerPage => AIcons.explorer, ChipAction.ratingOrGreater || ChipAction.ratingOrLower => AIcons.rating, ChipAction.reverse => AIcons.reverse, ChipAction.hide => AIcons.hide, diff --git a/lib/widgets/common/identity/aves_filter_chip.dart b/lib/widgets/common/identity/aves_filter_chip.dart index c5c7b313b..d77e0c096 100644 --- a/lib/widgets/common/identity/aves_filter_chip.dart +++ b/lib/widgets/common/identity/aves_filter_chip.dart @@ -6,6 +6,7 @@ import 'package:aves/model/covers.dart'; import 'package:aves/model/filters/album.dart'; import 'package:aves/model/filters/filters.dart'; import 'package:aves/model/filters/location.dart'; +import 'package:aves/model/filters/path.dart'; import 'package:aves/model/filters/rating.dart'; import 'package:aves/model/filters/tag.dart'; import 'package:aves/model/settings/enums/accessibility_animations.dart'; @@ -104,6 +105,7 @@ class AvesFilterChip extends StatefulWidget { if ((filter is LocationFilter && filter.level == LocationLevel.country)) ChipAction.goToCountryPage, if ((filter is LocationFilter && filter.level == LocationLevel.place)) ChipAction.goToPlacePage, if (filter is TagFilter) ChipAction.goToTagPage, + if (filter is PathFilter) ChipAction.goToExplorerPage, if (filter is RatingFilter && 1 < filter.rating && filter.rating < 5) ...[ if (filter.op != RatingFilter.opOrGreater) ChipAction.ratingOrGreater, if (filter.op != RatingFilter.opOrLower) ChipAction.ratingOrLower, diff --git a/lib/widgets/explorer/explorer_page.dart b/lib/widgets/explorer/explorer_page.dart index cbe47cc44..8afe339b7 100644 --- a/lib/widgets/explorer/explorer_page.dart +++ b/lib/widgets/explorer/explorer_page.dart @@ -38,7 +38,9 @@ import 'package:provider/provider.dart'; class ExplorerPage extends StatefulWidget { static const routeName = '/explorer'; - const ExplorerPage({super.key}); + final String? path; + + const ExplorerPage({super.key, this.path}); @override State createState() => _ExplorerPageState(); @@ -61,9 +63,14 @@ class _ExplorerPageState extends State { @override void initState() { super.initState(); - final primaryVolume = _volumes.firstWhereOrNull((v) => v.isPrimary); - if (primaryVolume != null) { - _goTo(primaryVolume.path); + final path = widget.path; + if (path != null) { + _goTo(path); + } else { + final primaryVolume = _volumes.firstWhereOrNull((v) => v.isPrimary); + if (primaryVolume != null) { + _goTo(primaryVolume.path); + } } } diff --git a/lib/widgets/filter_grids/common/action_delegates/chip.dart b/lib/widgets/filter_grids/common/action_delegates/chip.dart index e9bfcff9f..d4cd709b5 100644 --- a/lib/widgets/filter_grids/common/action_delegates/chip.dart +++ b/lib/widgets/filter_grids/common/action_delegates/chip.dart @@ -1,5 +1,6 @@ import 'package:aves/model/filters/album.dart'; import 'package:aves/model/filters/filters.dart'; +import 'package:aves/model/filters/path.dart'; import 'package:aves/model/filters/rating.dart'; import 'package:aves/model/highlight.dart'; import 'package:aves/model/settings/settings.dart'; @@ -9,6 +10,7 @@ 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/dialogs/aves_dialog.dart'; +import 'package:aves/widgets/explorer/explorer_page.dart'; import 'package:aves/widgets/filter_grids/albums_page.dart'; import 'package:aves/widgets/filter_grids/countries_page.dart'; import 'package:aves/widgets/filter_grids/places_page.dart'; @@ -27,6 +29,7 @@ class ChipActionDelegate with FeedbackMixin, VaultAwareMixin { case ChipAction.goToCountryPage: case ChipAction.goToPlacePage: case ChipAction.goToTagPage: + case ChipAction.goToExplorerPage: case ChipAction.ratingOrGreater: case ChipAction.ratingOrLower: case ChipAction.reverse: @@ -49,6 +52,16 @@ class ChipActionDelegate with FeedbackMixin, VaultAwareMixin { _goTo(context, filter, PlaceListPage.routeName, (context) => const PlaceListPage()); case ChipAction.goToTagPage: _goTo(context, filter, TagListPage.routeName, (context) => const TagListPage()); + case ChipAction.goToExplorerPage: + if (filter is PathFilter) { + Navigator.maybeOf(context)?.pushAndRemoveUntil( + MaterialPageRoute( + settings: const RouteSettings(name: ExplorerPage.routeName), + builder: (context) => ExplorerPage(path: filter.path), + ), + (route) => false, + ); + } case ChipAction.ratingOrGreater: FilterNotification((filter as RatingFilter).copyWith(RatingFilter.opOrGreater)).dispatch(context); case ChipAction.ratingOrLower: diff --git a/plugins/aves_model/lib/src/actions/chip.dart b/plugins/aves_model/lib/src/actions/chip.dart index 46fc4cf10..a035ef5cf 100644 --- a/plugins/aves_model/lib/src/actions/chip.dart +++ b/plugins/aves_model/lib/src/actions/chip.dart @@ -3,6 +3,7 @@ enum ChipAction { goToCountryPage, goToPlacePage, goToTagPage, + goToExplorerPage, ratingOrGreater, ratingOrLower, reverse,