flutter_flow_chart
flutter_flow_chart copied to clipboard
fix: Line isnt drawn programmatically
Description
When using addNextById to connect two elements, the "end dot" appears but the line is not drawn between the two element.
Steps To Reproduce
import 'package:flutter/material.dart';
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
/// Minimal reproducible example for flutter_flow_chart connection bug
class FlowChartWidget extends StatelessWidget {
const FlowChartWidget({super.key});
@override
Widget build(BuildContext context) {
final dashboard = Dashboard();
final nodeA = FlowElement(
position: const Offset(100, 200),
size: const Size(160, 60),
text: 'A',
kind: ElementKind.rectangle,
handlers: [
Handler.leftCenter,
Handler.rightCenter,
Handler.topCenter,
Handler.bottomCenter,
],
);
final nodeB = FlowElement(
position: const Offset(400, 200),
size: const Size(160, 60),
text: 'B',
kind: ElementKind.rectangle,
handlers: [
Handler.leftCenter,
Handler.rightCenter,
Handler.topCenter,
Handler.bottomCenter,
],
);
dashboard.addElement(nodeA);
dashboard.addElement(nodeB);
// Try several connection styles
dashboard.addNextById(
nodeA,
nodeB.id,
ArrowParams(
thickness: 8,
color: Colors.red,
startArrowPosition: Alignment.centerRight,
endArrowPosition: Alignment.centerLeft,
),
);
return Scaffold(
appBar: AppBar(title: const Text('Flow Chart Bug Demo')),
body: Center(
child: SizedBox(
width: 600,
height: 300,
child: FlowChart(
dashboard: dashboard,
),
),
),
);
}
}
Expected Behavior
It is expected that a line be drawn from element A to B. Dragging in the UI works without issue.
Additional Context
Flutter 3.24.3 flutter_flow_chart 3.2.3