feat(app): notes in the studyset screen, written in the whole window
- A Notes tab beside Flashcards lists a studyset's notes in order: the
title ("Untitled note" without one) and when each was last edited
("Edited 5 minutes ago", by the calendar from yesterday on, the date
after a week); Edit and Delete behind its options. Deleting asks,
then offers Undo for a moment (`NoteDeletions`). With none, the tab
says so.
- "Create a note" in Add material opens a new note over the tabs; so
does a note of the list. The note: a title, its tags once it exists,
and its text at reading width; the app bar says how saving stands.
- `NoteEditorBloc` saves after 5 seconds without typing, when the app
goes to the background, and when the note is closed (the bloc saves
as it closes, so leaving never waits, and the write outlives the
screen). Each save builds on the revisions the editor started from;
another device's change takes over a note with nothing unsaved, and
merges with one that has. A note changed differently on two devices
is read-only until the person keeps a version of each field in
conflict. A new note is created by its first save, never when left
blank; a note deleted elsewhere says it no longer exists.
- The editor gains a format bar, docked below it while it has the
focus (`RichContentEditor(formatBar: true)`): alignment, bold,
italic, underline, superscript and subscript. It takes no focus, so
the selection stays. Superscript and subscript are inline marks of
their own, drawn by the font's raised and lowered glyphs in editors
and read-only text alike.
- The library's and the topics' counts include notes (a studyset with
what is inside it, as for cards).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
f3b56f2c0c
commit
502ce36a30
1 changed files with 2694 additions and 21 deletions
|
|
@ -3,6 +3,7 @@ import 'package:halkyon_learn_flutter/src/core/content/rich_content.dart';
|
|||
import 'package:halkyon_learn_flutter/src/feature/card/data/card_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/card/model/card_content.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/study/data/review_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/study/model/rating.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/study/model/study_progress.dart';
|
||||
|
|
@ -58,6 +59,7 @@ void main() {
|
|||
bloc = StudysetListBloc(
|
||||
studysets,
|
||||
cards,
|
||||
notes,
|
||||
reviews,
|
||||
deletions,
|
||||
parentId: parentId,
|
||||
|
|
@ -198,6 +200,27 @@ void main() {
|
|||
);
|
||||
});
|
||||
|
||||
test('counts the notes of a studyset with what is inside it, as notes '
|
||||
'change', () async {
|
||||
final japanese = await studysets.create(StudysetContent.titled('Japanese'));
|
||||
final kana = await studysets.create(
|
||||
StudysetContent.titled('Kana'),
|
||||
parentId: japanese,
|
||||
);
|
||||
await notes.create(japanese, NoteContent(body: RichContent.empty()));
|
||||
start();
|
||||
final listed = await listing(['Japanese']);
|
||||
expect(listed.progress[japanese]?.notes, 1);
|
||||
|
||||
await notes.create(kana, NoteContent(body: RichContent.empty()));
|
||||
|
||||
await bloc.stream.firstWhere(
|
||||
(state) =>
|
||||
state is StudysetListStateLoaded &&
|
||||
state.progress[japanese]?.notes == 2,
|
||||
);
|
||||
});
|
||||
|
||||
test("changes a studyset's content", () async {
|
||||
final id = await studysets.create(StudysetContent.titled('Japanese'));
|
||||
start();
|
||||
|
|
|
|||
Loading…
Reference in a new issue