fixed switching to browsing mode after album deletion

This commit is contained in:
Thibault Deckers 2023-01-23 11:28:33 +01:00
parent fda5865e26
commit d889a26e62
3 changed files with 12 additions and 10 deletions

View file

@ -243,9 +243,8 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
} }
} }
void _leaveSelectionMode(BuildContext context) { void _browse(BuildContext context) {
final selection = context.read<Selection<AvesEntry>?>(); context.read<Selection<AvesEntry>?>()?.browse();
selection?.browse();
} }
Set<AvesEntry> _getTargetItems(BuildContext context) { Set<AvesEntry> _getTargetItems(BuildContext context) {
@ -278,7 +277,7 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
final collection = context.read<CollectionLens>(); final collection = context.read<CollectionLens>();
collection.source.analyze(controller, entries: entries); collection.source.analyze(controller, entries: entries);
_leaveSelectionMode(context); _browse(context);
} }
Future<void> _delete(BuildContext context) async { Future<void> _delete(BuildContext context) async {
@ -329,14 +328,14 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
}, },
); );
_leaveSelectionMode(context); _browse(context);
} }
Future<void> _move(BuildContext context, {required MoveType moveType}) async { Future<void> _move(BuildContext context, {required MoveType moveType}) async {
final entries = _getTargetItems(context); final entries = _getTargetItems(context);
await doMove(context, moveType: moveType, entries: entries); await doMove(context, moveType: moveType, entries: entries);
_leaveSelectionMode(context); _browse(context);
} }
Future<void> _rename(BuildContext context) async { Future<void> _rename(BuildContext context) async {
@ -358,7 +357,7 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
})).whereNotNullValue(); })).whereNotNullValue();
await rename(context, entriesToNewName: entriesToNewName, persist: true); await rename(context, entriesToNewName: entriesToNewName, persist: true);
_leaveSelectionMode(context); _browse(context);
} }
Future<void> _toggleFavourite(BuildContext context) async { Future<void> _toggleFavourite(BuildContext context) async {
@ -369,7 +368,7 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
await favourites.add(entries); await favourites.add(entries);
} }
_leaveSelectionMode(context); _browse(context);
} }
Future<void> _edit( Future<void> _edit(
@ -437,7 +436,7 @@ class EntrySetActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAware
} }
}, },
); );
_leaveSelectionMode(context); _browse(context);
} }
Future<Set<AvesEntry>?> _getEditableTargetItems( Future<Set<AvesEntry>?> _getEditableTargetItems(

View file

@ -230,6 +230,7 @@ mixin EntryStorageMixin on FeedbackMixin, PermissionAwareMixin, SizeAwareMixin {
context, context,
moveType: moveType, moveType: moveType,
entriesByDestination: entriesByDestination, entriesByDestination: entriesByDestination,
onSuccess: onSuccess,
); );
} }

View file

@ -206,7 +206,9 @@ abstract class ChipSetActionDelegate<T extends CollectionFilter> with FeedbackMi
} }
} }
void _browse(BuildContext context) => context.read<Selection<FilterGridItem<T>>>().browse(); void _browse(BuildContext context) {
context.read<Selection<FilterGridItem<T>>?>()?.browse();
}
Iterable<AvesEntry> _selectedEntries(BuildContext context, Set<dynamic> filters) { Iterable<AvesEntry> _selectedEntries(BuildContext context, Set<dynamic> filters) {
final source = context.read<CollectionSource>(); final source = context.read<CollectionSource>();