#178 pick mode: allow nav from filter pages
This commit is contained in:
parent
b9ef030001
commit
6c145d5bb5
7 changed files with 16 additions and 14 deletions
|
@ -1,11 +1,11 @@
|
||||||
enum AppMode { main, pickExternal, pickInternal, view }
|
enum AppMode { main, pickMediaExternal, pickMediaInternal, pickFilterInternal, view }
|
||||||
|
|
||||||
extension ExtraAppMode on AppMode {
|
extension ExtraAppMode on AppMode {
|
||||||
bool get canSearch => this == AppMode.main || this == AppMode.pickExternal;
|
bool get canSearch => this == AppMode.main || this == AppMode.pickMediaExternal;
|
||||||
|
|
||||||
bool get canSelect => this == AppMode.main;
|
bool get canSelect => this == AppMode.main;
|
||||||
|
|
||||||
bool get hasDrawer => this == AppMode.main || this == AppMode.pickExternal;
|
bool get hasDrawer => this == AppMode.main || this == AppMode.pickMediaExternal;
|
||||||
|
|
||||||
bool get isPicking => this == AppMode.pickExternal || this == AppMode.pickInternal;
|
bool get isPickingMedia => this == AppMode.pickMediaExternal || this == AppMode.pickMediaInternal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
|
||||||
return AnimatedBuilder(
|
return AnimatedBuilder(
|
||||||
animation: collection.filterChangeNotifier,
|
animation: collection.filterChangeNotifier,
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
final removableFilters = appMode != AppMode.pickInternal;
|
final removableFilters = appMode != AppMode.pickMediaInternal;
|
||||||
return Selector<Query, bool>(
|
return Selector<Query, bool>(
|
||||||
selector: (context, query) => query.enabled,
|
selector: (context, query) => query.enabled,
|
||||||
builder: (context, queryEnabled, child) {
|
builder: (context, queryEnabled, child) {
|
||||||
|
@ -185,7 +185,7 @@ class _CollectionAppBarState extends State<CollectionAppBar> with SingleTickerPr
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
final appMode = context.watch<ValueNotifier<AppMode>>().value;
|
final appMode = context.watch<ValueNotifier<AppMode>>().value;
|
||||||
Widget title = Text(appMode.isPicking ? l10n.collectionPickPageTitle : l10n.collectionPageTitle);
|
Widget title = Text(appMode.isPickingMedia ? l10n.collectionPickPageTitle : l10n.collectionPageTitle);
|
||||||
if (appMode == AppMode.main) {
|
if (appMode == AppMode.main) {
|
||||||
title = SourceStateAwareAppBarTitle(
|
title = SourceStateAwareAppBarTitle(
|
||||||
title: title,
|
title: title,
|
||||||
|
|
|
@ -43,12 +43,13 @@ class InteractiveTile extends StatelessWidget {
|
||||||
_goToViewer(context);
|
_goToViewer(context);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AppMode.pickExternal:
|
case AppMode.pickMediaExternal:
|
||||||
ViewerService.pick(entry.uri);
|
ViewerService.pick(entry.uri);
|
||||||
break;
|
break;
|
||||||
case AppMode.pickInternal:
|
case AppMode.pickMediaInternal:
|
||||||
Navigator.pop(context, entry);
|
Navigator.pop(context, entry);
|
||||||
break;
|
break;
|
||||||
|
case AppMode.pickFilterInternal:
|
||||||
case AppMode.view:
|
case AppMode.view:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class _ItemPickDialogState extends State<ItemPickDialog> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final liveFilter = collection.filters.firstWhereOrNull((v) => v is QueryFilter && v.live) as QueryFilter?;
|
final liveFilter = collection.filters.firstWhereOrNull((v) => v is QueryFilter && v.live) as QueryFilter?;
|
||||||
return ListenableProvider<ValueNotifier<AppMode>>.value(
|
return ListenableProvider<ValueNotifier<AppMode>>.value(
|
||||||
value: ValueNotifier(AppMode.pickInternal),
|
value: ValueNotifier(AppMode.pickMediaInternal),
|
||||||
child: MediaQueryDataProvider(
|
child: MediaQueryDataProvider(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
body: SelectionProvider<AvesEntry>(
|
body: SelectionProvider<AvesEntry>(
|
||||||
|
|
|
@ -65,7 +65,7 @@ class _AlbumPickPageState extends State<_AlbumPickPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListenableProvider<ValueNotifier<AppMode>>.value(
|
return ListenableProvider<ValueNotifier<AppMode>>.value(
|
||||||
value: ValueNotifier(AppMode.pickInternal),
|
value: ValueNotifier(AppMode.pickFilterInternal),
|
||||||
child: Selector<Settings, Tuple2<AlbumChipGroupFactor, ChipSortFactor>>(
|
child: Selector<Settings, Tuple2<AlbumChipGroupFactor, ChipSortFactor>>(
|
||||||
selector: (context, s) => Tuple2(s.albumGroupFactor, s.albumSortFactor),
|
selector: (context, s) => Tuple2(s.albumGroupFactor, s.albumSortFactor),
|
||||||
builder: (context, s, child) {
|
builder: (context, s, child) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ class _InteractiveFilterTileState<T extends CollectionFilter> extends State<Inte
|
||||||
final appMode = context.read<ValueNotifier<AppMode>>().value;
|
final appMode = context.read<ValueNotifier<AppMode>>().value;
|
||||||
switch (appMode) {
|
switch (appMode) {
|
||||||
case AppMode.main:
|
case AppMode.main:
|
||||||
|
case AppMode.pickMediaExternal:
|
||||||
final selection = context.read<Selection<FilterGridItem<T>>>();
|
final selection = context.read<Selection<FilterGridItem<T>>>();
|
||||||
if (selection.isSelecting) {
|
if (selection.isSelecting) {
|
||||||
selection.toggleSelection(gridItem);
|
selection.toggleSelection(gridItem);
|
||||||
|
@ -58,10 +59,10 @@ class _InteractiveFilterTileState<T extends CollectionFilter> extends State<Inte
|
||||||
_goToCollection(context, filter);
|
_goToCollection(context, filter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AppMode.pickInternal:
|
case AppMode.pickFilterInternal:
|
||||||
Navigator.pop<T>(context, filter);
|
Navigator.pop<T>(context, filter);
|
||||||
break;
|
break;
|
||||||
case AppMode.pickExternal:
|
case AppMode.pickMediaInternal:
|
||||||
case AppMode.view:
|
case AppMode.view:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ class _HomePageState extends State<HomePage> {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'pick':
|
case 'pick':
|
||||||
appMode = AppMode.pickExternal;
|
appMode = AppMode.pickMediaExternal;
|
||||||
// TODO TLAD apply pick mimetype(s)
|
// TODO TLAD apply pick mimetype(s)
|
||||||
// some apps define multiple types, separated by a space (maybe other signs too, like `,` `;`?)
|
// some apps define multiple types, separated by a space (maybe other signs too, like `,` `;`?)
|
||||||
String? pickMimeTypes = intentData['mimeType'];
|
String? pickMimeTypes = intentData['mimeType'];
|
||||||
|
@ -199,7 +199,7 @@ class _HomePageState extends State<HomePage> {
|
||||||
|
|
||||||
String routeName;
|
String routeName;
|
||||||
Set<CollectionFilter?>? filters;
|
Set<CollectionFilter?>? filters;
|
||||||
if (appMode == AppMode.pickExternal) {
|
if (appMode == AppMode.pickMediaExternal) {
|
||||||
routeName = CollectionPage.routeName;
|
routeName = CollectionPage.routeName;
|
||||||
} else {
|
} else {
|
||||||
routeName = _shortcutRouteName ?? settings.homePage.routeName;
|
routeName = _shortcutRouteName ?? settings.homePage.routeName;
|
||||||
|
|
Loading…
Reference in a new issue