Skip to content

Commit 3b8d365

Browse files
committed
feat: remove EditableConnectionsExample and related imports; clean up unused connection spatial index logic and props in demos
1 parent 43700b3 commit 3b8d365

File tree

6 files changed

+16
-350
lines changed

6 files changed

+16
-350
lines changed

packages/demo/lib/embed_wrapper.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ class DeferredExampleLoader extends StatefulWidget {
1616
}
1717

1818
class _DeferredExampleLoaderState extends State<DeferredExampleLoader> {
19-
late Future<Widget> _loadFuture;
19+
late Future<void> _loadFuture;
2020

2121
@override
2222
void initState() {
2323
super.initState();
24-
_loadFuture = widget.example.load(context);
24+
_loadFuture = widget.example.load();
2525
}
2626

2727
@override
2828
void didUpdateWidget(DeferredExampleLoader oldWidget) {
2929
super.didUpdateWidget(oldWidget);
3030
if (oldWidget.example.id != widget.example.id) {
31-
_loadFuture = widget.example.load(context);
31+
_loadFuture = widget.example.load();
3232
}
3333
}
3434

@@ -40,14 +40,15 @@ class _DeferredExampleLoaderState extends State<DeferredExampleLoader> {
4040
}
4141

4242
// Otherwise show loading indicator while loading
43-
return FutureBuilder<Widget>(
43+
return FutureBuilder<void>(
4444
future: _loadFuture,
4545
builder: (context, snapshot) {
4646
if (snapshot.connectionState == ConnectionState.done) {
4747
if (snapshot.hasError) {
4848
return _ErrorView(error: snapshot.error.toString());
4949
}
50-
return snapshot.data!;
50+
// Build synchronously after async load completes
51+
return widget.example.build(context);
5152
}
5253
return const _LoadingView();
5354
},

packages/demo/lib/example_model.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ class Example {
2828
/// Whether this example has been loaded.
2929
bool get isLoaded => _cachedBuilder != null;
3030

31-
/// Loads the example and returns the widget.
32-
/// Caches the builder after first load.
33-
Future<Widget> load(BuildContext context) async {
31+
/// Loads the example's deferred library.
32+
/// After this completes, [build] can be called safely.
33+
Future<void> load() async {
3434
_cachedBuilder ??= await loader();
35-
return _cachedBuilder!(context);
3635
}
3736

3837
/// Builds the widget synchronously if already loaded.

packages/demo/lib/examples/editable_connections.dart

Lines changed: 0 additions & 316 deletions
This file was deleted.

packages/vyuh_node_flow/lib/src/editor/controller/node_api.dart

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,24 +1119,4 @@ extension NodeApi<T, C> on NodeFlowController<T, C> {
11191119
);
11201120
});
11211121
}
1122-
1123-
/// Rebuilds spatial index for a single connection using accurate path segments.
1124-
void _rebuildSingleConnectionSpatialIndex(Connection<C> connection) {
1125-
if (!isConnectionPainterInitialized || _theme == null) return;
1126-
1127-
final sourceNode = _nodes[connection.sourceNodeId];
1128-
final targetNode = _nodes[connection.targetNodeId];
1129-
if (sourceNode == null || targetNode == null) return;
1130-
1131-
final pathCache = _connectionPainter!.pathCache;
1132-
final connectionStyle = _theme!.connectionTheme.style;
1133-
1134-
final segments = pathCache.getOrCreateSegmentBounds(
1135-
connection: connection,
1136-
sourceNode: sourceNode,
1137-
targetNode: targetNode,
1138-
connectionStyle: connectionStyle,
1139-
);
1140-
_spatialIndex.updateConnection(connection, segments);
1141-
}
11421122
}

0 commit comments

Comments
 (0)