feat: editor project chip wiring (multi-project stage 2 host side)
Some checks failed
Security / Security check (push) Failing after 2s
Some checks failed
Security / Security check (push) Failing after 2s
FlowsPage passes the active workspace to the editor and switches the workspace when the operator accepts a file-wins mismatch. Rebuilds the chip live on workspace change. Editor package bumped to 0.22.0. Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
parent
2592a23cc0
commit
984c91f91d
3 changed files with 42 additions and 15 deletions
|
|
@ -16,6 +16,7 @@ import 'package:flutter/material.dart';
|
|||
import '../data/error_presentation.dart';
|
||||
import '../data/flow_run_driver.dart';
|
||||
import '../data/hub.dart';
|
||||
import '../data/workspace.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
class FlowsPage extends StatefulWidget {
|
||||
|
|
@ -149,20 +150,30 @@ class _FlowsPageState extends State<FlowsPage> {
|
|||
final editorLocale = locale.languageCode == 'de'
|
||||
? FlowEditorLocale.de
|
||||
: FlowEditorLocale.en;
|
||||
return FutureBuilder<List<String>>(
|
||||
future: _capabilities,
|
||||
builder: (context, snap) {
|
||||
final caps = snap.data ?? const <String>[];
|
||||
return FlowEditorPage(
|
||||
initialFlowName: widget.initialFlowName,
|
||||
locale: editorLocale,
|
||||
runDriver: _driver,
|
||||
availableCapabilities: caps,
|
||||
storeCapabilities: _storeCaps,
|
||||
onInstallCapability: _onInstallCapability,
|
||||
onAddModuleSource: _onAddModuleSource,
|
||||
);
|
||||
},
|
||||
// Rebuild the editor's project chip when the workspace changes,
|
||||
// so a mismatch banner appears/clears live.
|
||||
return ListenableBuilder(
|
||||
listenable: Workspace.instance,
|
||||
builder: (context, _) => FutureBuilder<List<String>>(
|
||||
future: _capabilities,
|
||||
builder: (context, snap) {
|
||||
final caps = snap.data ?? const <String>[];
|
||||
return FlowEditorPage(
|
||||
initialFlowName: widget.initialFlowName,
|
||||
locale: editorLocale,
|
||||
runDriver: _driver,
|
||||
availableCapabilities: caps,
|
||||
storeCapabilities: _storeCaps,
|
||||
onInstallCapability: _onInstallCapability,
|
||||
onAddModuleSource: _onAddModuleSource,
|
||||
activeProject: Workspace.instance.activeSlug,
|
||||
// The file wins for the run; accepting the switch only
|
||||
// aligns the workspace view to the file's project.
|
||||
onSwitchToFileProject: (slug) =>
|
||||
Workspace.instance.setActive(slug),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue