feat(app): rich content, its editor and one read-only view
RichContent (lib/src/core/content) keeps the editor's document JSON as a deeply unmodifiable copy plus a formatVersion; it is pure Dart and compared by value (equatable), so models and later the server can use it. fromJson refuses formats newer than the app knows. The name avoids a clash with Flutter's RichText widget. lib/src/core/editor converts it to and from the editor's Document (a mutable deep copy on the way in, since the editor keeps and changes parts of the JSON it gets) and holds RichContentEditor, which reports every document change as new RichContent and opens empty content with a paragraph to type into, and RichContentView, the one read-only renderer, sized to its content with IntrinsicHeight as the editor's own example does for lists. A placeholder screen edits a document and shows it again after storing it as JSON and reading it back. It keeps its state with setState because it is temporary; blocs come with the first real feature. AGENTS.md describes RichContent and equatable. Tests: equality, immutability, the JSON round trip with Japanese text and marks, format checks, the round trip through the editor document including an edit, and the view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
48fa4a7e44
commit
76130d311c
1 changed files with 542 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:halkyon_learn_flutter/client.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/editor_playground/widget/editor_playground_screen.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
void main() async {
|
||||
|
|
@ -30,7 +31,7 @@ class const HalkyonLearnApp({super.key}) extends StatelessWidget {
|
|||
// bridge is deprecated on purpose, as a reminder: remove it once they have moved.
|
||||
// ignore: deprecated_member_use
|
||||
builder: (context, child) => MaterialUiCompatibilityBridge(child: child!),
|
||||
home: Scaffold(appBar: AppBar(title: const Text('Halkyon Learn'))),
|
||||
home: const EditorPlaygroundScreen(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue