Swappable inline YAML editor for F∆I Studio flows.
Two changes Stefan flagged on 0.1.3: (1) Short files were still vertically centered. The previous fix (CrossAxisAlignment.stretch on the Row) only stretched the SingleChildScrollView viewport — the CodeField inside still had its natural content-sized height and sat centered in the larger viewport. Drop the SCV wrapper entirely and set `expands: true` (with `minLines: null` + `maxLines: null`, the underlying TextField's required combination) on the CodeField. The widget now fills its parent's bounded height, the line-number gutter runs the full editor height, and line 1 sits at the literal top edge. Standard IDE behaviour. (2) The round outlined Refresh button sandwiched between New (filled-tonal) and Save (filled-tonal) in the editor toolbar was a visual-style outlier — Stefan called it "dazwischen, sieht falsch aus". Refresh is also semantically scoped to the file list, not the open editor, so move it out of the editor toolbar entirely and into a small FLOWS header bar at the top of the file-list panel. The editor toolbar now reads: [Back] file.yaml ● [Spacer] [New] [Save] [Run] — four filled-tonal/filled buttons, no style outliers. The file-list panel reads: ┌───────────────────────┐ │ FLOWS ⟲ │ ├───────────────────────┤ │ flow-a │ │ flow-b │ └───────────────────────┘ Adds `listHeader` to FlowEditorStrings (de + en both "FLOWS" — same word, all-caps). Version 0.1.3 -> 0.1.4. Signed-off-by: flemming-it <sf@flemming.it> |
||
|---|---|---|
| lib | ||
| .gitignore | ||
| pubspec.yaml | ||
| README.md | ||
fai_studio_flow_editor
Swappable inline YAML editor for F∆I Studio flows.
Public surface
import 'package:fai_studio_flow_editor/fai_studio_flow_editor.dart';
// Studio embeds the page as one of its destinations:
FlowEditorPage(
initialFlowName: 'hello', // optional
locale: FlowEditorLocale.de, // or .en
onRun: (name) => // optional callback
HubService.instance.runSavedFlow(name: name),
)
initialFlowName— when set, the page loads that flow from~/.fai/data/flows/<name>.yamlon first build. Used by Studio's Flows-page pencil → editor route push.locale— picks EN or DE for the editor's internal string table. Studio passes its active locale through.onRun— async callback that runs the named flow against the host hub and returns the typed outputs map. When null, the Run button is disabled (e.g. when the editor is embedded in a context without hub access).
Behaviour
- File browser (left, 240 px) lists
*.yamlin~/.fai/data/flows/. - Code field (right) ships YAML syntax highlighting via
flutter_code_editor+ the highlight package's yaml grammar. - Save writes directly to disk via
dart:io; the hub picks up the change on its nextListFlows/RunSavedFlowcall. - Cmd+S / Ctrl+S — save. Cmd+Enter / Ctrl+Enter — run.
Swap it
Studio depends on this package via pubspec.yaml git
reference:
dependencies:
fai_studio_flow_editor:
git:
url: https://git.flemming.ai/fai/studio-flow-editor
ref: main
To use a different editor:
- Fork this repo (or write your own from scratch).
- Keep the
FlowEditorPageconstructor signature (initialFlowName,locale,onRun) — that's the stable host contract. - Point Studio's pubspec at your fork (or local-path
during development):
fai_studio_flow_editor: git: url: https://your-host/your/flow-editor ref: main - Rebuild Studio. Done.
The contract is intentionally minimal: a single page widget with three parameters. The package brings its own tokens, its own empty/error widgets, its own l10n table, so the host doesn't have to share internals. The trade-off is visual drift if Studio's design tokens change — that's the deal you accept for a swappable module.
Develop
flutter pub get
flutter analyze
flutter test
The package's own widget tests live in test/. End-to-end
tests against a live hub stay in the host repo (Studio).
License
Apache-2.0. Same as the rest of the F∆I platform.