New local front deployment + new args
This commit is contained in:
@@ -23,7 +23,6 @@ typedef ConnectionListener = void Function(
|
||||
/// It notifies changes to [FlowChart]
|
||||
//
|
||||
class Dashboard extends ChangeNotifier {
|
||||
bool shouldSave = true;
|
||||
GlobalKey<FlowChartSelectedMenuState> selectedMenuKey = GlobalKey<FlowChartSelectedMenuState>();
|
||||
GlobalKey<FlowChartLeftMenuState> selectedLeftMenuKey = GlobalKey<FlowChartLeftMenuState>();
|
||||
GlobalKey<FlowChartMenuState> chartMenuKey = GlobalKey<FlowChartMenuState>();
|
||||
@@ -46,10 +45,11 @@ class Dashboard extends ChangeNotifier {
|
||||
double defaultBackWidth = 10;
|
||||
double defaultForwardWidth = 10;
|
||||
Future<void> Function(String? id)? save;
|
||||
List<Widget> Function(FlowData? obj)? infoItemWidget;
|
||||
List<Widget> Function(FlowData? obj, String id)? infoItemWidget;
|
||||
List<Widget> Function()? infoWidget;
|
||||
FlowData? Function(Map<String, dynamic> json)? transformToData;
|
||||
bool addChange = false;
|
||||
bool shouldSave = true;
|
||||
///
|
||||
Dashboard({
|
||||
this.id,
|
||||
@@ -175,8 +175,7 @@ class Dashboard extends ChangeNotifier {
|
||||
|
||||
/// The current elements in the dashboard
|
||||
List<FlowElement> elements;
|
||||
List<FlowElement> get elementSelected =>
|
||||
elements.where((element) => element.isSelected).toList();
|
||||
List<FlowElement> get elementSelected => elements.where((element) => element.isSelected).toList();
|
||||
|
||||
Offset _dashboardPosition;
|
||||
|
||||
@@ -202,15 +201,11 @@ class Dashboard extends ChangeNotifier {
|
||||
|
||||
///
|
||||
bool blockDefaultZoomGestures;
|
||||
|
||||
/// minimum zoom factor allowed
|
||||
/// default is 0.25
|
||||
/// setting it to 1 will prevent zooming out
|
||||
/// setting it to 0 will remove the limit
|
||||
double minimumZoomFactor;
|
||||
|
||||
final List<ConnectionListener> _connectionListeners = [];
|
||||
|
||||
|
||||
|
||||
Map<String, dynamic> serialize() {
|
||||
Map<String, dynamic> d = {};
|
||||
Map<String, dynamic> graph = {};
|
||||
@@ -264,7 +259,6 @@ class Dashboard extends ChangeNotifier {
|
||||
} catch (e) { print(e); }
|
||||
elements.add(flow);
|
||||
}
|
||||
print("DASH " + name);
|
||||
selectedMenuKey.currentState?.setState(() { });
|
||||
chartMenuKey.currentState?.setState(() { });
|
||||
addToHistory();
|
||||
@@ -292,6 +286,10 @@ class Dashboard extends ChangeNotifier {
|
||||
handlerFeedbackOffset = offset;
|
||||
}
|
||||
|
||||
List<ArrowPainter> GetArrowByElementID(String id, bool isinput) {
|
||||
return arrows.where((element) => (isinput && element.toID.contains(id)) || (!isinput && element.fromID.contains(id))).toList();
|
||||
}
|
||||
|
||||
void addArrows(ArrowPainter f) {
|
||||
arrows.add(f);
|
||||
addChange = true;
|
||||
@@ -385,7 +383,10 @@ class Dashboard extends ChangeNotifier {
|
||||
}
|
||||
|
||||
FlowElement? getElement(String id, {bool notify = true}) {
|
||||
try { return elements.firstWhere((element) => element.id == id); }
|
||||
try { return elements.firstWhere((element) {
|
||||
print(element.id + " - " + id);
|
||||
return element.id == id;
|
||||
}); }
|
||||
catch (e) { return null; }
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ abstract class FlowData {
|
||||
double? getWidth();
|
||||
double? getHeight();
|
||||
|
||||
Map<String, dynamic> setVariable(List<String> keys, dynamic value, Map<String, dynamic> map);
|
||||
dynamic getVariable(List<String> keys, Map<String, dynamic> map);
|
||||
Map<String, dynamic> serialize();
|
||||
FlowData deserialize(Map<String, dynamic> data);
|
||||
}
|
||||
@@ -344,7 +346,7 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
focusNode: node,
|
||||
onKeyEvent: (event) {
|
||||
bool change = false;
|
||||
if ((event is KeyDownEvent || event is KeyRepeatEvent) && event.logicalKey == LogicalKeyboardKey.arrowUp) {
|
||||
/*if ((event is KeyDownEvent || event is KeyRepeatEvent) && event.logicalKey == LogicalKeyboardKey.arrowUp) {
|
||||
change = true;
|
||||
for (var el in widget.dashboard.elements) {
|
||||
if (el.isSelected) {
|
||||
@@ -375,7 +377,7 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
el.position = Offset(el.position.dx + 10, el.position.dy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.add) {
|
||||
change = true;
|
||||
|
||||
@@ -20,14 +20,13 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
width: 250,
|
||||
height: widget.height,
|
||||
color: Colors.grey.shade300,
|
||||
child: SingleChildScrollView( child: Column( children: [ ...widget.dashboard.infoItemWidget != null ?
|
||||
widget.dashboard.infoItemWidget!(widget.dashboard.elementSelected.first.element) : [],
|
||||
child: Column( children: [ ...widget.dashboard.infoItemWidget != null ?
|
||||
widget.dashboard.infoItemWidget!(widget.dashboard.elementSelected.first.element, widget.dashboard.elementSelected.first.id) : [],
|
||||
widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container(
|
||||
width: 250,
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
decoration: BoxDecoration(border: Border(
|
||||
top: BorderSide(color: Colors.grey, width: 1),
|
||||
bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
top: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
Tooltip( message: "remove",
|
||||
child: InkWell( mouseCursor: SystemMouseCursors.click,
|
||||
@@ -67,7 +66,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
])
|
||||
) : Container()
|
||||
])
|
||||
));
|
||||
);
|
||||
} else if (widget.isDashboardInfo && widget.dashboard.infoWidget != null) {
|
||||
w = Container(
|
||||
width: 250,
|
||||
@@ -533,7 +532,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
});
|
||||
}, child: Container( margin: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)),
|
||||
width: 140, height: 30,
|
||||
width: 200, height: 30,
|
||||
child: Icon(Icons.delete_outline, color: Colors.black),
|
||||
))
|
||||
),
|
||||
@@ -547,9 +546,9 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
Future.delayed(Duration(milliseconds: 100), () {
|
||||
widget.dashboard.chartKey.currentState?.setState(() { });
|
||||
});
|
||||
}, child: Container( margin: EdgeInsets.all(10),
|
||||
}, child: Container( margin: EdgeInsets.only(left: 10, right: 10, bottom: 10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)),
|
||||
width: 140, height: 30,
|
||||
width: 200, height: 30,
|
||||
child: Icon(Icons.copy, color: Colors.black),
|
||||
))
|
||||
),
|
||||
|
||||
@@ -420,9 +420,7 @@ class ArrowInfoWidgetState extends State<ArrowInfoWidget> {
|
||||
/// [ArrowParams.startArrowPosition] and
|
||||
/// [ArrowParams.endArrowPosition] alignment.
|
||||
class ArrowPainter extends CustomPainter {
|
||||
String fromID;
|
||||
String toID;
|
||||
bool isSelected = false;
|
||||
|
||||
///
|
||||
ArrowPainter({
|
||||
this.elementIndex,
|
||||
@@ -439,12 +437,13 @@ class ArrowPainter extends CustomPainter {
|
||||
///
|
||||
ArrowParams params;
|
||||
///
|
||||
Offset from;
|
||||
int? elementIndex;
|
||||
int? connIndex;
|
||||
///
|
||||
String toID;
|
||||
String fromID;
|
||||
Offset to;
|
||||
|
||||
Offset from;
|
||||
int? connIndex;
|
||||
int? elementIndex;
|
||||
bool isSelected = false;
|
||||
///
|
||||
Path path = Path();
|
||||
Path dashed = Path();
|
||||
|
||||
Reference in New Issue
Block a user