go to explorer from path filter
This commit is contained in:
parent
5651d035e7
commit
97e05506a3
6 changed files with 30 additions and 4 deletions
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<ExplorerPage> createState() => _ExplorerPageState();
|
||||
|
@ -61,11 +63,16 @@ class _ExplorerPageState extends State<ExplorerPage> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final path = widget.path;
|
||||
if (path != null) {
|
||||
_goTo(path);
|
||||
} else {
|
||||
final primaryVolume = _volumes.firstWhereOrNull((v) => v.isPrimary);
|
||||
if (primaryVolume != null) {
|
||||
_goTo(primaryVolume.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -3,6 +3,7 @@ enum ChipAction {
|
|||
goToCountryPage,
|
||||
goToPlacePage,
|
||||
goToTagPage,
|
||||
goToExplorerPage,
|
||||
ratingOrGreater,
|
||||
ratingOrLower,
|
||||
reverse,
|
||||
|
|
Loading…
Reference in a new issue