Filters: three-way hidden files and external storage

Hidden: hide / only hidden / all + hidden. External: cloud only / only
external / all + external; with 'all' Files shows the external items in a
collapsible section. Old show-hidden bool prefs are still read as fallback.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Ayushya Amitabh
2026-10-05 22:34:11 -04:00
co-authored by Claude Sonnet 5.5
parent 944b87b054
commit 3c60f8c709
9 changed files with 634 additions and 160 deletions
+76
View File
@@ -0,0 +1,76 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:noo/providers/files_controller.dart';
import 'package:noo/widgets/filter_mode_rows.dart';
import 'noo/noo_test_utils.dart';
void main() {
setUpNooTests();
group('HiddenFilesFilterRow', () {
testNooWidgets(
'only the selected option shows its label, tapping another reports it',
(tester, theme, c) async {
var value = HiddenFilesFilter.hide;
await pumpNoo(
tester,
StatefulBuilder(
builder: (context, setState) => SizedBox(
width: 360,
child: HiddenFilesFilterRow(
value: value,
onChanged: (v) => setState(() => value = v),
),
),
),
theme: theme,
);
expect(find.text('Hidden files'), findsOneWidget);
expect(find.text('Hide'), findsOneWidget);
expect(find.text('Only hidden'), findsNothing);
await tester.tap(find.byIcon(LucideIcons.layers));
await tester.pumpAndSettle();
expect(value, HiddenFilesFilter.include);
expect(find.text('All + hidden'), findsOneWidget);
},
);
});
group('StorageScopeRow', () {
testNooWidgets('offers cloud only / only external / all + external', (
tester,
theme,
c,
) async {
var value = StorageScope.cloud;
await pumpNoo(
tester,
StatefulBuilder(
builder: (context, setState) => SizedBox(
width: 360,
child: StorageScopeRow(
value: value,
onChanged: (v) => setState(() => value = v),
),
),
),
theme: theme,
);
expect(find.text('External storage'), findsOneWidget);
expect(find.text('Cloud only'), findsOneWidget);
await tester.tap(find.byIcon(LucideIcons.hardDrive).last);
await tester.pumpAndSettle();
expect(value, StorageScope.external);
expect(find.text('Only external'), findsOneWidget);
await tester.tap(find.byIcon(LucideIcons.layers));
await tester.pumpAndSettle();
expect(value, StorageScope.all);
expect(find.text('All + external'), findsOneWidget);
});
});
}