From 6b362d77f06f6a8cabfe15dca1085e9c4e8fa9e3 Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 5 Feb 2025 14:48:23 +0100 Subject: [PATCH] Debug --- lib/widgets/items/item.dart | 6 ++++-- .../flutter_flow_chart/lib/src/dashboard.dart | 8 ++++++-- .../flutter_flow_chart/lib/src/flow_chart.dart | 7 ++++++- .../lib/src/flow_chart_selected_menu.dart | 18 ++++++++---------- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/widgets/items/item.dart b/lib/widgets/items/item.dart index 90da22a..688afae 100644 --- a/lib/widgets/items/item.dart +++ b/lib/widgets/items/item.dart @@ -57,7 +57,7 @@ class ItemWidgetState extends State { widgetsInstance.add(Container(height: 20, width: getWidth(context) / 2,)); var count = 0; for (var info in instance.infos().keys) { - if (instance.infos()[info] == null || instance.infos()[info] is List) { continue; } + if (instance.infos()[info] == null || instance.infos()[info] is List || instance.infos()[info] is Map) { continue; } count++; widgetsInstance.add(Center(child: Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [ Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("${info.toUpperCase().replaceAll("_", " ")} :", style: TextStyle(fontSize: 15, color: Colors.grey))), @@ -82,7 +82,9 @@ class ItemWidgetState extends State { width: getMainWidth(context), alignment: Alignment.center, height: 100, - decoration: BoxDecoration(border: Border(bottom: BorderSide(color: midColor))), + decoration: BoxDecoration( + color: Colors.white, + border: Border(bottom: BorderSide(color: midColor))), padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 50), child: Text(widget.item.description!.length > 350 ? "${widget.item.description!.substring(0, 347)}..." : widget.item.description!, style: TextStyle(fontSize: 15, color: Colors.grey, fontWeight: FontWeight.w500))), diff --git a/library/flutter_flow_chart/lib/src/dashboard.dart b/library/flutter_flow_chart/lib/src/dashboard.dart index 5cdc3b4..205b843 100755 --- a/library/flutter_flow_chart/lib/src/dashboard.dart +++ b/library/flutter_flow_chart/lib/src/dashboard.dart @@ -712,6 +712,7 @@ class Dashboard extends ChangeNotifier { elements.removeWhere((element) { if (element.id == id) { elementId = element.id; + arrows.removeWhere((a) => a.fromID.contains(elementId) || a.toID.contains(elementId)); } return element.id == id; }); @@ -733,10 +734,13 @@ class Dashboard extends ChangeNotifier { var found = false; final elementId = element.id; elements.removeWhere((e) { - if (e.id == element.id) found = true; + if (e.id == element.id) { + found = true; + + } return e.id == element.id; }); - + arrows.removeWhere( (e) => e.fromID.contains(elementId) || e.toID.contains(elementId)); // remove all connections to the element for (final e in elements) { e.next.removeWhere( diff --git a/library/flutter_flow_chart/lib/src/flow_chart.dart b/library/flutter_flow_chart/lib/src/flow_chart.dart index c3b2ca0..1d06592 100755 --- a/library/flutter_flow_chart/lib/src/flow_chart.dart +++ b/library/flutter_flow_chart/lib/src/flow_chart.dart @@ -386,7 +386,12 @@ class FlowChartState extends State { } if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.delete) { change = true; - widget.dashboard.removeElements( (el) => el.isSelected, context ); + widget.dashboard.removeElements((element) { + if (element.isSelected) { + widget.dashboard.arrows.removeWhere( (e) => e.toID.contains(element.id) || e.fromID.contains(element.id)); + } + return element.isSelected; + }, context); for (var arrow in widget.dashboard.arrowsSelected) { for (var el in widget.dashboard.elements.where((element) => element.id == arrow.fromID.split("_")[0])) { el.next.removeAt(int.parse(arrow.fromID.split("_")[1])); diff --git a/library/flutter_flow_chart/lib/src/flow_chart_selected_menu.dart b/library/flutter_flow_chart/lib/src/flow_chart_selected_menu.dart index ea57a60..a3ccdc2 100644 --- a/library/flutter_flow_chart/lib/src/flow_chart_selected_menu.dart +++ b/library/flutter_flow_chart/lib/src/flow_chart_selected_menu.dart @@ -30,14 +30,13 @@ class FlowChartSelectedMenuState extends State { child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ Tooltip( message: "remove", child: InkWell( mouseCursor: SystemMouseCursors.click, - onTap: () { - widget.dashboard.removeArrows((element) { - if (element.isSelected && element.elementIndex != null && element.connIndex != null) { - widget.dashboard.elements[element.elementIndex!].next.removeAt(element.connIndex!); + onTap: () { + widget.dashboard.removeElements((element) { + if (element.isSelected) { + widget.dashboard.arrows.removeWhere( (e) => e.toID.contains(element.id) || e.fromID.contains(element.id)); } return element.isSelected; }, context); - widget.dashboard.removeElements((element) => element.isSelected, context); Future.delayed(Duration(milliseconds: 100), () { widget.dashboard.flutterChartKey.currentState?.setState(() { }); }); @@ -551,13 +550,12 @@ class FlowChartSelectedMenuState extends State { Tooltip( message: "remove", child: InkWell( mouseCursor: SystemMouseCursors.click, onTap: () { - widget.dashboard.removeArrows((element) { - if (element.isSelected && element.elementIndex != null && element.connIndex != null) { - widget.dashboard.elements[element.elementIndex!].next.removeAt(element.connIndex!); + widget.dashboard.removeElements((element) { + if (element.isSelected) { + widget.dashboard.arrows.removeWhere( (e) => e.toID.contains(element.id) || e.fromID.contains(element.id)); } return element.isSelected; - }, context); - widget.dashboard.removeElements((element) => element.isSelected, context); + }, context); Future.delayed(Duration(milliseconds: 100), () { widget.dashboard.flutterChartKey.currentState?.setState(() { }); });