feat(app): section titles read as dividers; one Rendered/Raw switch per definition; schedule rows with labelled facts and a status pill

This commit is contained in:
2026-10-23 22:09:46 +01:00
parent c467872ee3
commit b44cecf35c
10 changed files with 355 additions and 77 deletions
+30 -14
View File
@@ -14,7 +14,6 @@ class MarkdownSourceView extends StatefulWidget {
/// The exact text as the screen already showed it.
final Widget raw;
@override
State<MarkdownSourceView> createState() => _MarkdownSourceViewState();
}
@@ -25,14 +24,39 @@ class _MarkdownSourceViewState extends State<MarkdownSourceView> {
void _set(bool raw) => setState(() => _raw = raw);
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MarkdownModeSwitch(raw: _raw, onChanged: _set),
const SizedBox(height: 8),
if (_raw) widget.raw else ChatMarkdownView(text: widget.text),
],
);
}
}
/// The Rendered | Raw switch for markdown text; one switch can govern a
/// whole page of fields.
class MarkdownModeSwitch extends StatelessWidget {
const MarkdownModeSwitch({
super.key,
required this.raw,
required this.onChanged,
});
final bool raw;
final ValueChanged<bool> onChanged;
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final control = cupertino
return cupertino
? CupertinoSlidingSegmentedControl<bool>(
key: const Key('markdown-source-mode'),
groupValue: _raw,
onValueChanged: (raw) => _set(raw ?? false),
groupValue: raw,
onValueChanged: (value) => onChanged(value ?? false),
children: const {false: Text('Rendered'), true: Text('Raw')},
)
: SegmentedButton<bool>(
@@ -42,16 +66,8 @@ class _MarkdownSourceViewState extends State<MarkdownSourceView> {
ButtonSegment(value: false, label: Text('Rendered')),
ButtonSegment(value: true, label: Text('Raw')),
],
selected: {_raw},
onSelectionChanged: (value) => _set(value.single),
selected: {raw},
onSelectionChanged: (value) => onChanged(value.single),
);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
control,
const SizedBox(height: 8),
if (_raw) widget.raw else ChatMarkdownView(text: widget.text),
],
);
}
}