feat(studio): swap built-in flow editor for fai_studio_flow_editor package (v0.51.0)
Some checks failed
Security / Security check (push) Failing after 2s

The flow editor was internal to Studio (lib/pages/flow_editor.dart).
Per Stefan's review feedback ("austauschbar wäre schöner"),
extract it into its own Forgejo repo so the host can swap
the implementation without touching Studio.

New repo: https://git.flemming.ai/fai/studio-flow-editor

Studio's pubspec.yaml now references the package by git URL:

  dependencies:
    fai_studio_flow_editor:
      git:
        url: https://git.flemming.ai/fai/studio-flow-editor
        ref: main

To swap the editor:
  1. Fork (or write a new) fai/studio-flow-editor.
  2. Keep the FlowEditorPage(initialFlowName, locale, onRun)
     constructor signature — the stable host contract.
  3. Point the pubspec at your fork.
  4. Rebuild Studio.

Adapter pattern: _FlowEditorAdapter in main.dart resolves the
package's runtime dependencies (locale via Localizations,
onRun via HubService) from the BuildContext, then constructs
the package's FlowEditorPage. Same pattern in flows.dart for
the pencil → editor route push, so a future operator-side
locale switch propagates correctly.

The package brings its own copies of FaiSpace tokens, minimal
FaiEmptyState/FaiErrorBox widgets, and an inline EN+DE l10n
table — accepting a small amount of visual drift in exchange
for true package independence. flutter_code_editor +
highlight move from Studio's pubspec to the package's.

Deleted:
  lib/pages/flow_editor.dart  → package's lib/src/flow_editor_page.dart
  test/flow_editor_test.dart  → package's test/ (next commit there)

Bumped:
  pubspec.yaml version 0.50.0 → 0.51.0
  main.dart kStudioVersion 0.50.0 → 0.51.0
Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-30 14:36:54 +02:00
parent e522267ec1
commit 0183771689
6 changed files with 54 additions and 919 deletions

View file

@ -1,41 +0,0 @@
// Widget smoke-test for the FlowEditorPage.
//
// Platform.environment is read-only from inside the test
// isolate, so we can't redirect HOME to a temp directory.
// Instead this test pumps the page and verifies that the
// widget tree builds without throwing exercising the
// missing-directory empty-state path on hosts without
// ~/.fai/data/flows.
import 'package:fai_studio/l10n/app_localizations.dart';
import 'package:fai_studio/pages/flow_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
Widget wrap() {
return MaterialApp(
locale: const Locale('en'),
supportedLocales: const [Locale('en'), Locale('de')],
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
home: const FlowEditorPage(),
);
}
testWidgets('builds without throwing + shows expected toolbar buttons',
(tester) async {
await tester.pumpWidget(wrap());
await tester.pump(const Duration(milliseconds: 100));
expect(find.text('New flow'), findsOneWidget);
expect(find.text('Save'), findsOneWidget);
expect(find.text('Run'), findsOneWidget);
// Without an open file, the empty-state title shows.
expect(find.text('No flow open'), findsAtLeastNWidgets(1));
});
}