feat(studyset): the material in tabs, each saying how many it holds
The Material part stacked the flashcards, notes and files as sections, the first three of each behind Show all, as Vaia stacks them. With hundreds of cards that kept the list a tap away, repeated each list's tools and pushed the files far down. They are tabs again, Flashcards, Notes and Files, each with its count, each list whole with its tools at the end of the tabs' row; Progress and the Study plan stay. The tab is kept as the part the studyset was left on, while the material shows, and opened for the first time it opens on a tab with something in it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
ceb7ca1a1e
commit
cf6d58aae7
1 changed files with 336 additions and 219 deletions
|
|
@ -613,33 +613,41 @@ void main() {
|
|||
stored('japanese', 'Japanese');
|
||||
await openFromLibrary(tester, 'Japanese');
|
||||
|
||||
for (final (part, icon, title, how) in [
|
||||
for (final (part, tab, icon, title, how) in [
|
||||
(
|
||||
'Material',
|
||||
'Flashcards',
|
||||
LucideIcons.layers,
|
||||
'No flashcards yet',
|
||||
'"Add material → Create flashcards"',
|
||||
),
|
||||
(
|
||||
'Material',
|
||||
'Notes',
|
||||
LucideIcons.notebookPen,
|
||||
'No notes yet',
|
||||
'"Add material → Create a note"',
|
||||
),
|
||||
(
|
||||
'Material',
|
||||
'Files',
|
||||
LucideIcons.folder,
|
||||
'No files yet',
|
||||
'"Add material → Upload a PDF"',
|
||||
),
|
||||
(
|
||||
'Study plan',
|
||||
null,
|
||||
LucideIcons.route,
|
||||
'No paths yet',
|
||||
'"Add material → Create a path"',
|
||||
),
|
||||
]) {
|
||||
await openPart(tester, part);
|
||||
if (tab != null) {
|
||||
await tester.tap(find.widgetWithText(Tab, tab));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
// The box that says so, around its icon, title and hint.
|
||||
final box = find.ancestor(
|
||||
of: find.text(title),
|
||||
|
|
@ -1493,6 +1501,39 @@ void main() {
|
|||
);
|
||||
});
|
||||
|
||||
testWidgets("the material's tabs say how many each holds, and each "
|
||||
'holds its whole list', (tester) async {
|
||||
stored('japanese', 'Japanese');
|
||||
for (final front in ['猫', '犬', '鳥', '魚', '馬']) {
|
||||
await card('japanese', front);
|
||||
}
|
||||
final notes = NoteRepository(noteGateway);
|
||||
addTearDown(notes.dispose);
|
||||
await notes.create(
|
||||
'japanese',
|
||||
NoteContent(title: 'Particles', body: RichContent.empty()),
|
||||
);
|
||||
await openFromLibrary(tester, 'Japanese');
|
||||
await openPart(tester, 'Material');
|
||||
|
||||
String? countOn(String tab) => tester
|
||||
.widgetList<Text>(
|
||||
find.descendant(
|
||||
of: find.widgetWithText(Tab, tab),
|
||||
matching: find.byType(Text),
|
||||
),
|
||||
)
|
||||
.map((text) => text.data)
|
||||
.where((data) => data != tab)
|
||||
.singleOrNull;
|
||||
expect(countOn('Flashcards'), '5');
|
||||
expect(countOn('Notes'), '1');
|
||||
expect(countOn('Files'), '0');
|
||||
// All five, no Show all.
|
||||
expect(find.text('馬'), findsOneWidget);
|
||||
expect(find.text('Show all'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('tapping the open part again goes back to its top', (
|
||||
tester,
|
||||
) async {
|
||||
|
|
@ -1506,13 +1547,11 @@ void main() {
|
|||
);
|
||||
}
|
||||
await openFromLibrary(tester, 'Japanese');
|
||||
// On screen, not merely built.
|
||||
// On screen, not merely built; on the notes' tab, the only one with
|
||||
// anything in it.
|
||||
final first = find.text('Note 1').hitTestable();
|
||||
expect(first, findsOneWidget);
|
||||
// The first three, until all show.
|
||||
expect(find.text('Note 4'), findsNothing);
|
||||
await tester.tap(find.text('Show all'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Note 4'), findsOneWidget);
|
||||
|
||||
await tester.drag(find.text('Note 3'), const Offset(0, -600));
|
||||
await tester.pumpAndSettle();
|
||||
|
|
|
|||
Loading…
Reference in a new issue