feat(studyset): Material, Progress and Study plan in place of the tabs
All checks were successful
CI / check (push) Successful in 15m14s
CI / deploy (push) Successful in 1m17s

The studyset's four tabs become three parts, as Vaia has them, chosen
with a switch in the header that ticks as the navigation bar does: below
expanded windows in a line of its own under the title, above the path
and Topics; from there on at the end of the path's line, which the
topics leave free there.

- Material: the flashcards, notes and files one below the other, the
  first three of each with Show all; Browse, the tag filter (where all
  cards show, or while they are narrowed) and Reorder in each section's
  header; an outlined box where a section is empty.
- Progress, once anything in the studyset was studied (a card rated, a
  path finished): how much is learnt (mature cards), how many studied
  cards are due today, and how long it was studied this week on this
  device, with a line of the seven days (StudysetActivityCubit, from the
  reviews' durations).
- Study plan: a ring of the paths finished, Next up (study the cards due,
  go on with the first path not finished), then the paths.

It opens on the part it was left on; a tab kept before counts as its
part. Opened for the first time, it opens on the study plan while a path
is unfinished, else on the material. Material added lands in its part.

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:
Tizian 「ティツィアーン」 2026-10-12 13:48:11 +02:00
commit 246c9dc143
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -6,6 +6,7 @@ import 'package:halkyon_learn_flutter/src/core/router/route_paths.dart';
import 'package:halkyon_learn_flutter/src/feature/card/data/card_repository.dart';
import 'package:halkyon_learn_flutter/src/feature/note/data/note_repository.dart';
import 'package:halkyon_learn_flutter/src/feature/note/model/note_content.dart';
import 'package:halkyon_learn_flutter/src/feature/studyset/bloc/content_tab_cubit.dart';
import 'package:halkyon_learn_flutter/src/feature/studyset/data/studyset_payload.dart';
import 'package:halkyon_learn_flutter/src/feature/studyset/data/studyset_repository.dart';
import 'package:halkyon_learn_flutter/src/feature/studyset/model/studyset_content.dart';
@ -33,11 +34,6 @@ void main() {
noteGateway = FakeNoteGateway();
});
/// The index of the studyset's content tab shown: 0 paths, 1 flashcards,
/// 2 notes.
int shownTab(WidgetTester tester) =>
tester.widget<TabBar>(find.byType(TabBar)).controller!.index;
/// A note in the studyset, so that it opens on its notes.
Future<void> withNote() async {
final notes = NoteRepository(noteGateway);
@ -206,31 +202,33 @@ void main() {
expect(await repository.all(), isEmpty);
});
testWidgets('shows the flashcards after a deck came into this studyset, '
'whatever tab was open', (tester) async {
await withNote();
await startImport(tester, fixture('anki_latest.apkg'));
testWidgets('shows the material after a deck came into this studyset, '
'whatever part was open', (tester) async {
files.next = (name: 'japanese.apkg', bytes: fixture('anki_latest.apkg'));
await showStudyset(tester);
await openPart(tester, 'Study plan');
await chooseImport(tester);
await tester.tap(find.text('Tag cards by subdeck'));
await tester.pump();
await tester.tap(find.widgetWithText(FilledButton, 'Import'));
await tester.pumpAndSettle();
expect(shownTab(tester), 1);
expect(shownPart(tester), StudysetPart.material);
});
testWidgets('leaves the tab as it was when the subdecks became '
testWidgets('leaves the part as it was when the subdecks became '
'sub-studysets', (tester) async {
await withNote();
files.next = (name: 'japanese.apkg', bytes: fixture('anki_latest.apkg'));
await showStudyset(tester);
expect(shownTab(tester), 2);
await openPart(tester, 'Study plan');
await chooseImport(tester);
await tester.tap(find.text('Recreate as sub-studysets'));
await tester.pump();
await tester.tap(find.widgetWithText(FilledButton, 'Import'));
await tester.pumpAndSettle();
expect(shownTab(tester), 2);
expect(shownPart(tester), StudysetPart.plan);
});
testWidgets('warns when the files may not fit in the room left', (