groups: fixed default view selection when in group
This commit is contained in:
parent
2ef03f1592
commit
244c1a293d
1 changed files with 26 additions and 3 deletions
|
@ -1,9 +1,10 @@
|
|||
import 'package:aves/app_mode.dart';
|
||||
import 'package:aves/model/covers.dart';
|
||||
import 'package:aves/model/entry/entry.dart';
|
||||
import 'package:aves/model/filters/container/set_or.dart';
|
||||
import 'package:aves/model/filters/covered/stored_album.dart';
|
||||
import 'package:aves/model/filters/filters.dart';
|
||||
import 'package:aves/model/filters/container/set_or.dart';
|
||||
import 'package:aves/model/grouping/common.dart';
|
||||
import 'package:aves/model/query.dart';
|
||||
import 'package:aves/model/selection.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
|
@ -20,6 +21,7 @@ import 'package:aves/widgets/common/action_mixins/permission_aware.dart';
|
|||
import 'package:aves/widgets/common/action_mixins/size_aware.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/providers/filter_group_provider.dart';
|
||||
import 'package:aves/widgets/common/search/route.dart';
|
||||
import 'package:aves/widgets/common/tile_extent_controller.dart';
|
||||
import 'package:aves/widgets/dialogs/aves_dialog.dart';
|
||||
|
@ -240,8 +242,29 @@ abstract class ChipSetActionDelegate<T extends CollectionFilter> with FeedbackMi
|
|||
Iterable<AvesEntry> _selectedEntries(BuildContext context) {
|
||||
final source = context.read<CollectionSource>();
|
||||
final visibleEntries = source.visibleEntries;
|
||||
final filters = getSelectedFilters(context);
|
||||
return filters.isEmpty ? visibleEntries : visibleEntries.where((entry) => filters.any((f) => f.test(entry)));
|
||||
|
||||
final filters = <CollectionFilter>{};
|
||||
// use user selected filters, if any
|
||||
filters.addAll(getSelectedFilters(context));
|
||||
|
||||
if (filters.isEmpty) {
|
||||
// use current group filters, if any
|
||||
final groupUri = context.read<FilterGroupNotifier?>()?.value;
|
||||
if (groupUri != null) {
|
||||
final grouping = FilterGrouping.forUri(groupUri);
|
||||
if (grouping != null) {
|
||||
final groupContent = grouping.getDirectChildren(groupUri);
|
||||
filters.addAll(groupContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (filters.isNotEmpty) {
|
||||
return visibleEntries.where((entry) => filters.any((f) => f.test(entry)));
|
||||
}
|
||||
|
||||
// default to all content
|
||||
return visibleEntries;
|
||||
}
|
||||
|
||||
Future<void> configureView(BuildContext context) async {
|
||||
|
|
Loading…
Reference in a new issue