feat: add built-in markdown editor with search jump and typing helpers

This commit is contained in:
randogoth 2026-10-13 10:47:34 +03:00
parent db27f64e42
commit ed2de5e67f
16 changed files with 1146 additions and 561 deletions

View file

@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_code_editor/flutter_code_editor.dart';
import 'themes//markdown.dart';
import 'markdown_editing.dart';
import 'markdown_view.dart';
import 'themes/day.dart';
import 'themes/night.dart';
import 'codefield.dart'; // Ensure this includes WrappedCodeField
class ReadOnlyPage extends StatelessWidget {
final String title;
@ -18,7 +17,12 @@ class ReadOnlyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = isDarkMode ? nightTheme : dayTheme;
final view = MarkdownView(
controller: MarkdownController(
text: content,
theme: isDarkMode ? nightTheme : dayTheme,
),
);
return Scaffold(
appBar: AppBar(title: Text(title)),
@ -33,35 +37,11 @@ class ReadOnlyPage extends StatelessWidget {
width: 200,
)
),
CodeTheme(
data: CodeThemeData(styles: theme),
child: SingleChildScrollView(
child: WrappedCodeField(
controller: CodeController(
text: content,
language: markdown,
),
wrap: true,
readOnly: true,
),
),
),
Expanded(child: view),
]
)
: CodeTheme(
data: CodeThemeData(styles: theme),
child: SingleChildScrollView(
child: WrappedCodeField(
controller: CodeController(
text: content,
language: markdown,
),
wrap: true,
readOnly: true,
),
),
),
: view,
),
);
}
}
}