todo-app/lib/ui/note_form_chrome_gate.dart
Krzysztof kuhy Rudnicki 3a747c2e51
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
file-length / file length <= 250 lines (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Report errors and slow waits to the board
crdt_sync_flutter 0.9.0's installAppErrors in main(): uncaught errors and
every spinner shown over 1 s (WaitWatch: sync.run, mirror.test) upload to
RTDB /todo/errors/<device> with the versionCode, where the PC app-errors
ingest files board tickets (kuhyx/utils DOCS-app-errors.md).

The app moves to material_ui first: sync_settings_ui 0.8.x and
design_system 0.4.x sit on it, and Flutter 3.50 deprecates
flutter/material. Pins: crdt_sync 0.14.1, csf 0.9.0, ssui 0.8.3,
gda 0.5.1, design_system 0.4.1, image 4.13.1, mcp_dart 2.4.4.
file_picker stays 13.3.3, held by data_transfer_flutter 0.2.2
(allowlisted, self-clearing).

appRoute takes a route name so each report names its screen; the
release build passes APP_BUILD/APP_VERSION. Nothing new on screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 23:07:58 +01:00

59 lines
2.0 KiB
Dart

/// Decides whether a note form's chrome (the priority/status row) is visible.
///
/// This is the one piece of state capture and the detail screen used to keep
/// separately, in copy-pasted form -- which is how the two drifted apart. It
/// lives here so both surfaces resolve visibility by the same rule.
library;
import 'package:material_ui/material_ui.dart';
/// Holds the editor's chrome-visibility signal and resolves it against
/// advanced mode.
///
/// Decides visibility and nothing else: it neither builds the metadata row nor
/// the editor. [builder] receives the resolved answer plus the callback to
/// hand to `NoteEditor.onChromeVisibleChanged`.
class NoteFormChromeGate extends StatefulWidget {
/// Creates a gate resolving visibility against [advancedMode].
const NoteFormChromeGate({
required this.advancedMode,
required this.builder,
super.key,
});
/// When false the chrome is never shown, whatever the editor reports --
/// casual capture needs neither the metadata row nor the mode toggle.
final bool advancedMode;
/// Built with the resolved visibility and the editor's visibility callback.
final Widget Function(
BuildContext context, {
required bool chromeVisible,
required ValueChanged<bool> onChromeVisibleChanged,
})
builder;
@override
State<NoteFormChromeGate> createState() => _NoteFormChromeGateState();
}
class _NoteFormChromeGateState extends State<NoteFormChromeGate> {
/// What the editor last reported. Starts true because a freshly mounted
/// editor shows its chrome until Guided (wizard or bare stepper) takes over.
bool _editorChromeVisible = true;
void _setEditorChromeVisible(bool visible) {
if (visible == _editorChromeVisible) return;
setState(() => _editorChromeVisible = visible);
}
@override
Widget build(BuildContext context) {
return widget.builder(
context,
chromeVisible: widget.advancedMode && _editorChromeVisible,
onChromeVisibleChanged: _setEditorChromeVisible,
);
}
}