This commit is contained in:
mr 2025-02-05 14:48:23 +01:00
parent 57c6d74ff5
commit 6b362d77f0
4 changed files with 24 additions and 15 deletions

View File

@ -57,7 +57,7 @@ class ItemWidgetState extends State<ItemWidget> {
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<ItemWidget> {
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))),

View File

@ -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(

View File

@ -386,7 +386,12 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
}
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]));

View File

@ -30,14 +30,13 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
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<FlowChartSelectedMenu> {
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(() { });
});