debug workflow

This commit is contained in:
mr 2025-06-13 11:54:13 +02:00
parent 76821e757f
commit c4ea1541c4
12 changed files with 177 additions and 112 deletions

View File

@ -27,13 +27,18 @@ clean:
flutter clean flutter clean
docker: docker:
DOCKER_BUILDKIT=1 docker build -t oc/oc-front:0.0.1 --build-arg HOST=$(HOST) -f Dockerfile . DOCKER_BUILDKIT=1 docker build -t oc-front --build-arg HOST=$(HOST) -f Dockerfile .
docker tag oc/oc-front:0.0.1 oc/oc-front:latest docker tag oc-front:latest oc/oc-front:0.0.1
publish-kind: publish-kind:
kind load docker-image oc/oc-front:0.0.1 --name opencloud kind load docker-image oc/oc-front:0.0.1 --name opencloud | true
publish-registry: publish-registry:
@echo "TODO" @echo "TODO"
docker-deploy:
docker compose up -d
run-docker: docker publish-kind publish-registry docker-deploy
.PHONY: build run clean docker publish-kind publish-registry .PHONY: build run clean docker publish-kind publish-registry

View File

@ -335,7 +335,7 @@ class Graph extends SerializerDeserializer<Graph> {
// should find arrow env info and add it to the env // should find arrow env info and add it to the env
List<Param> extParams = []; List<Param> extParams = [];
var arrows = links.where( (e) => (e.source?.id?.contains(item.id ?? "") ?? false) || (e.destination?.id?.contains(item.id ?? "") ?? false)); var arrows = links.where( (e) => (e.source?.id?.contains(item.id ?? "") ?? false) || (e.destination?.id?.contains(item.id ?? "") ?? false));
for (var arrow in arrows) { /*for (var arrow in arrows) {
for (var info in arrow.infos) { for (var info in arrow.infos) {
var i = info as Map<String, dynamic>; var i = info as Map<String, dynamic>;
for (var entry in i.entries) { for (var entry in i.entries) {
@ -352,7 +352,7 @@ class Graph extends SerializerDeserializer<Graph> {
} }
} }
} }
} }*/
for ( var param in what) { for ( var param in what) {
if (param.attr == null) { continue; } if (param.attr == null) { continue; }
var varName = param.name != null && (param.name!.contains("LINK_") var varName = param.name != null && (param.name!.contains("LINK_")

View File

@ -66,7 +66,8 @@ final WorflowService _service = WorflowService();
var from = dash.getElement(arrow.fromID); var from = dash.getElement(arrow.fromID);
var to = dash.getElement(arrow.toID); var to = dash.getElement(arrow.toID);
if ((from?.element?.getType() == "storage" && to?.element?.getType() == "processing") if ((from?.element?.getType() == "storage" && to?.element?.getType() == "processing")
|| (from?.element?.getType() == "processing" && to?.element?.getType() == "storage")) { || (from?.element?.getType() == "processing" && to?.element?.getType() == "storage")
|| (from?.element?.getType() == "processing" && to?.element?.getType() == "processing")) {
return StorageProcessingLinkFormsWidget( dash: dash, item: arrow); return StorageProcessingLinkFormsWidget( dash: dash, item: arrow);
} }
return Container(); return Container();

View File

@ -20,14 +20,25 @@ class ContainerFormsWidgetState extends State<ContainerFormsWidget> {
List<Widget> widgets = []; List<Widget> widgets = [];
var instance = widget.item.getSelectedInstance(); var instance = widget.item.getSelectedInstance();
if (instance != null && instance is ProcessingInstance && instance.access?.container != null) { if (instance != null && instance is ProcessingInstance && instance.access?.container != null) {
List<SubExposeFormsWidget> exposes = [];
var container = instance.access!.container!; var container = instance.access!.container!;
for (var expose in container.exposes) {
exposes.add(SubExposeFormsWidget(
readOnly: false,
width: 180,
dash: widget.dash,
empty: false,
item: expose,
elementID: widget.elementID
));
}
widgets.add(Container( widgets.add(Container(
padding: const EdgeInsets.only(bottom: 10), padding: const EdgeInsets.only(bottom: 10),
width: 180, width: 180,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text("<CONTAINER>", style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center), const Text("<CONTAINER>", style: TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
SubTextInputWidget(subkey: "image", width: 180, empty: false, change: (value) { }, SubTextInputWidget(subkey: "image", width: 180, empty: false, change: (value) { },
initialValue: container.image, readOnly: true), initialValue: container.image, readOnly: true),
SubTextInputWidget(subkey: "command", width: 180, empty: false, change: (value) { SubTextInputWidget(subkey: "command", width: 180, empty: false, change: (value) {
@ -39,7 +50,7 @@ class ContainerFormsWidgetState extends State<ContainerFormsWidget> {
} }
} }
widget.dash.saveDash(widget.dash.id, context); widget.dash.saveDash(widget.dash.id, context);
}, initialValue: container.command, readOnly: false,), }, initialValue: container.command, readOnly: false),
SubTextInputWidget(subkey: "args", width: 180, empty: false, change: (value) { SubTextInputWidget(subkey: "args", width: 180, empty: false, change: (value) {
container.args = value; container.args = value;
for (var el in widget.dash.elements) { for (var el in widget.dash.elements) {
@ -54,7 +65,7 @@ class ContainerFormsWidgetState extends State<ContainerFormsWidget> {
],) ],)
)); ));
widgets.add(Container( widgets.add(Container(
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))), width: 200, decoration: const BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
)); ));
widgets.add(Container( widgets.add(Container(
padding: const EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
@ -86,19 +97,19 @@ class ContainerFormsWidgetState extends State<ContainerFormsWidget> {
setState(() {}); setState(() {});
}, child: }, child:
Container( margin: const EdgeInsets.only(left: 5, top: 5), Container( margin: const EdgeInsets.only(left: 5, top: 5),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.grey, width: 1)), decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(color: Colors.grey, width: 1)
),
width: 45, height: 30, width: 45, height: 30,
child: const Row( mainAxisAlignment: MainAxisAlignment.center, child: const Row( mainAxisAlignment: MainAxisAlignment.center,
children: [ Icon(Icons.delete, color: Colors.black) ]), children: [ Icon(Icons.delete, color: Colors.black) ]),
)
) )
]), )
],) ]),
...exposes
])
)); ));
for (var expose in container.exposes) {
widgets.add(SubExposeFormsWidget( readOnly: true, width: 180, dash: widget.dash, empty: widgets.isEmpty,
item: expose, elementID: widget.elementID));
}
} }
return Column(children: widgets); return Column(children: widgets);
} }

View File

@ -19,8 +19,8 @@ class CredentialsFormsWidgetState extends State<CredentialsFormsWidget> {
var instance = widget.item.getSelectedInstance(); var instance = widget.item.getSelectedInstance();
if (instance != null && instance.credential != null) { if (instance != null && instance.credential != null) {
var creds = instance.credential!; var creds = instance.credential!;
widgets.add(Container( margin: EdgeInsets.only(bottom: 15), widgets.add(Container( margin: const EdgeInsets.only(bottom: 15),
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))), width: 200, decoration: const BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
)); ));
widgets.add(Container( widgets.add(Container(
padding: const EdgeInsets.only(bottom: 10), padding: const EdgeInsets.only(bottom: 10),
@ -28,9 +28,9 @@ class CredentialsFormsWidgetState extends State<CredentialsFormsWidget> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text("<CREDENTIALS>", style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center), const Text("<CREDENTIALS>", style: TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
SubTextInputWidget(subkey: "login", width: 180, empty: false, change: (value) { SubTextInputWidget(subkey: "login", width: 180, empty: false, change: (value) {
creds.password = value; creds.login = value;
for (var el in widget.dash.elements) { for (var el in widget.dash.elements) {
if (el.id == widget.elementID) { if (el.id == widget.elementID) {
el.element = widget.item; el.element = widget.item;

View File

@ -1,6 +1,5 @@
import 'package:oc_front/main.dart'; import 'package:oc_front/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:oc_front/models/workflow.dart';
import 'package:oc_front/models/resources/resources.dart'; import 'package:oc_front/models/resources/resources.dart';
import 'package:oc_front/core/services/perms_service.dart'; import 'package:oc_front/core/services/perms_service.dart';
import 'package:oc_front/widgets/forms/credentials_forms.dart'; import 'package:oc_front/widgets/forms/credentials_forms.dart';
@ -37,7 +36,7 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
} }
} }
if (widgets.isNotEmpty) { if (widgets.isNotEmpty) {
widgets.add(SizedBox( width: 200, height: 15) ); widgets.add(const SizedBox( width: 200, height: 15) );
} }
return widgets; return widgets;
} }
@ -55,6 +54,7 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
@override Widget build(BuildContext context) { @override Widget build(BuildContext context) {
print("STATE");
List<Widget> instancesCat = []; List<Widget> instancesCat = [];
List<Widget> childrenReadOnly = getWidgets(widget.item.infos()); List<Widget> childrenReadOnly = getWidgets(widget.item.infos());
List<DropdownMenuItem<String>> dpItems = []; List<DropdownMenuItem<String>> dpItems = [];
@ -62,11 +62,11 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
dpItems.add(DropdownMenuItem(value: '$i', child: Text('${instance.name}', overflow: TextOverflow.ellipsis,))); dpItems.add(DropdownMenuItem(value: '$i', child: Text('${instance.name}', overflow: TextOverflow.ellipsis,)));
} }
if (dpItems.isNotEmpty) { if (dpItems.isNotEmpty) {
childrenReadOnly.add(Padding( padding: EdgeInsets.only(top: 20), childrenReadOnly.add(Padding( padding: const EdgeInsets.only(top: 20),
child : Container( child : Container(
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))), width: 200, decoration: const BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
))); )));
childrenReadOnly.add(Padding(padding: EdgeInsets.only(bottom: 15), child: childrenReadOnly.add(Padding(padding: const EdgeInsets.only(bottom: 15), child:
SubDropdownInputWidget( dropdownMenuEntries: dpItems, subkey: "", width: 180, empty: false, SubDropdownInputWidget( dropdownMenuEntries: dpItems, subkey: "", width: 180, empty: false,
initialValue: "${widget.item.selectedInstance}", change: (value) { initialValue: "${widget.item.selectedInstance}", change: (value) {
if (value != null) { setState(() { widget.item.selectedInstance = int.parse(value); }); } if (value != null) { setState(() { widget.item.selectedInstance = int.parse(value); }); }
@ -81,7 +81,7 @@ class ResourceFormsWidgetState extends State<ResourceFormsWidget> {
instancesCat.add(CredentialsFormsWidget(dash: widget.dash, item: widget.item, elementID: widget.elementID)); instancesCat.add(CredentialsFormsWidget(dash: widget.dash, item: widget.item, elementID: widget.elementID));
if (instancesCat.isNotEmpty) { if (instancesCat.isNotEmpty) {
instancesCat.add(Container( instancesCat.add(Container(
width: 200, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))), width: 200, decoration: const BoxDecoration( border: Border(bottom: BorderSide(color: Colors.grey))),
)); ));
} }
bool readOnly = !PermsService.getPerm(Perms.WORKFLOW_EDIT); bool readOnly = !PermsService.getPerm(Perms.WORKFLOW_EDIT);

View File

@ -38,7 +38,7 @@ class StorageProcessingLinkFormsWidgetState extends State<StorageProcessingLinkF
@override Widget build(BuildContext context) { @override Widget build(BuildContext context) {
List<Widget> children = [ List<Widget> children = [
Padding( padding: const EdgeInsets.only(top: 10), const Padding( padding: const EdgeInsets.only(top: 10),
child: Text("<ENV VARIABLES>", child: Text("<ENV VARIABLES>",
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center)), style: const TextStyle(fontSize: 13, fontWeight: FontWeight.bold), textAlign: TextAlign.center)),
]; ];
@ -54,9 +54,9 @@ class StorageProcessingLinkFormsWidgetState extends State<StorageProcessingLinkF
int count = 0; int count = 0;
for(var info in widget.item.infos) { for(var info in widget.item.infos) {
count++; count++;
inf.add(Padding( padding: EdgeInsets.only(top: 10, bottom: 5), inf.add(Padding( padding: const EdgeInsets.only(top: 10, bottom: 5),
child : Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ child : Row( crossAxisAlignment: CrossAxisAlignment.center, children: [
Padding(padding: EdgeInsets.only(left: 10, right: 10), child: Text("$count")), Padding(padding: const EdgeInsets.only(left: 10, right: 10), child: Text("$count")),
Container(width: 140, decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1)))) Container(width: 140, decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))))
]))); ])));
for (var key in (info as Map<String, dynamic>).keys) { for (var key in (info as Map<String, dynamic>).keys) {
@ -112,7 +112,7 @@ class StorageProcessingLinkFormsWidgetState extends State<StorageProcessingLinkF
...children, ...children,
Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [
InkWell( onTap: () { InkWell( onTap: () {
widget.item.infos.add({ widget.item.infos.add(<String, dynamic> {
"write": false, "write": false,
"source": null, "source": null,
"destination": null, "destination": null,
@ -125,7 +125,7 @@ class StorageProcessingLinkFormsWidgetState extends State<StorageProcessingLinkF
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
border: Border.all(color: Colors.grey, width: 1)), border: Border.all(color: Colors.grey, width: 1)),
width: 125, height: 30, width: 125, height: 30,
child: Row( mainAxisAlignment: MainAxisAlignment.center, child: const Row( mainAxisAlignment: MainAxisAlignment.center,
children: [ Padding( padding: EdgeInsets.only(right: 5), child: Icon(Icons.add, color: Colors.black,)), children: [ Padding( padding: EdgeInsets.only(right: 5), child: Icon(Icons.add, color: Colors.black,)),
Text("link infos", Text("link infos",
style: TextStyle( color: Colors.black))]), style: TextStyle( color: Colors.black))]),

View File

@ -18,14 +18,38 @@ class SubExposeFormsWidget extends StatefulWidget {
} }
class SubExposeFormsWidgetState extends State<SubExposeFormsWidget> { class SubExposeFormsWidgetState extends State<SubExposeFormsWidget> {
@override Widget build(BuildContext context) { @override Widget build(BuildContext context) {
print("qsfqs");
try {
var w = SubTextInputWidget(subkey: "reference port", readOnly: widget.readOnly,
initialValue: widget.item.port != null ? '${widget.item.port}' : null,
width: widget.width,
empty: widget.empty,
change: (value) {
try {
widget.item.port = int.parse(value);
Future.delayed(const Duration(seconds: 2), () {
if (widget.item.port == int.parse(value) && int.parse(value) != 0) {
widget.dash.saveDash(widget.dash.id, context);
}
});
} catch (e) { widget.item.port = null; }
var el = widget.dash.getElement(widget.elementID);
el!.element = widget.item as dynamic;
});
} catch (e,s) {
print(e);
print(s);
}
return Column( children : [ return Column( children : [
Container( margin: const EdgeInsets.only(left: 10, right: 10, top: 5), Container( margin: const EdgeInsets.only(left: 10, right: 10, top: 15),
decoration: BoxDecoration(border: Border.all(color: Colors.grey, width: 1)), decoration: const BoxDecoration(border: Border( top: BorderSide(color: Colors.grey, width: 1))),
width: 180 width: 180
), ),
SubTextInputWidget(subkey: "reference port", readOnly: widget.readOnly, SubTextInputWidget(subkey: "reference port", readOnly: widget.readOnly,
initialValue: widget.item.port != null ? '${widget.item.port}' : null, initialValue: widget.item.port != null ? '${widget.item.port}' : null,
width: widget.width, empty: widget.empty, change: (value) { width: 180,
empty: widget.empty,
change: (value) {
try { try {
widget.item.port = int.parse(value); widget.item.port = int.parse(value);
Future.delayed(const Duration(seconds: 2), () { Future.delayed(const Duration(seconds: 2), () {

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:oc_front/widgets/dialog/alert.dart'; import 'package:oc_front/widgets/dialog/alert.dart';
// ignore: must_be_immutable
class SubTextInputWidget extends StatefulWidget { class SubTextInputWidget extends StatefulWidget {
String subkey; String subkey;
String? initialValue; String? initialValue;
@ -12,10 +13,9 @@ class SubTextInputWidget extends StatefulWidget {
bool readOnly = false; bool readOnly = false;
bool copyLabel = false; bool copyLabel = false;
void Function(String) change = (value) {}; void Function(String) change = (value) {};
SubTextInputWidget ({ Key? key, SubTextInputWidget ({ super.key,
required this.subkey, this.readOnly = false, this.noLabel = false, this.copyLabel = false, required this.subkey, this.readOnly = false, this.noLabel = false, this.copyLabel = false,
this.initialValue, required this.width, required this.empty, required this.change }): this.initialValue, required this.width, required this.empty, required this.change });
super(key: key);
@override SubTextInputWidgetState createState() => SubTextInputWidgetState(); @override SubTextInputWidgetState createState() => SubTextInputWidgetState();
} }
class SubTextInputWidgetState extends State<SubTextInputWidget> { class SubTextInputWidgetState extends State<SubTextInputWidget> {
@ -24,12 +24,13 @@ class SubTextInputWidgetState extends State<SubTextInputWidget> {
if (widget.readOnly && widget.initialValue == null) { if (widget.readOnly && widget.initialValue == null) {
return Container(); return Container();
} }
TextEditingController ctrl = TextEditingController(text: widget.initialValue);
return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Tooltip( message: widget.subkey, return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Tooltip( message: widget.subkey,
child: Container( margin: EdgeInsets.only(top: widget.empty ? 0 : 15), child: Container( margin: EdgeInsets.only(top: widget.empty ? 0 : 15),
width: widget.width - (widget.readOnly ? 40 : 0), height: 30, width: widget.width - (widget.readOnly ? 40 : 0), height: 30,
child: TextFormField( textAlign: TextAlign.start, child: TextFormField( textAlign: TextAlign.start,
enabled: !widget.readOnly, enabled: !widget.readOnly,
initialValue: widget.initialValue, controller: ctrl,
onChanged: widget.change, onChanged: widget.change,
style: const TextStyle(fontSize: 12), style: const TextStyle(fontSize: 12),
decoration: InputDecoration( decoration: InputDecoration(

View File

@ -743,18 +743,22 @@ class ChartWidgetState<T extends FlowData> extends State<ChartWidget> {
onTapDown: (details) { onTapDown: (details) {
hoverImportant = false; hoverImportant = false;
tapDownPos = details.localPosition; tapDownPos = details.localPosition;
for (var arr in widget.dashboard.arrows) { for (var arr in widget.dashboard.arrows) {
if (arr.isLine(tapDownPos)) { if (arr.isLine(tapDownPos)) {
hoverImportant = true; hoverImportant = true;
for (var arr in widget.dashboard.arrows) {
arr.isSelected = false;
}
arr.isSelected = !arr.isSelected; arr.isSelected = !arr.isSelected;
for (var sel in widget.dashboard.elements) { for (var sel in widget.dashboard.elements) {
sel.isSelected = false; sel.isSelected = false;
} }
Future.delayed(Duration(milliseconds: 100), () { Future.delayed(const Duration(milliseconds: 100), () {
widget.dashboard.selectedMenuKey.currentState?.setState(() {}); widget.dashboard.selectedMenuKey.currentState?.setState(() {});
DrawingArrow.instance.notifyListeners(); DrawingArrow.instance.notifyListeners();
}); });
break;
} }
} }
if (!hoverImportant) { if (!hoverImportant) {

View File

@ -79,9 +79,8 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
widget.dashboard.infoLinkWidget!(widget.dashboard.arrowsSelected.first) : Container(), widget.dashboard.infoLinkWidget!(widget.dashboard.arrowsSelected.first) : Container(),
widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container( widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container(
width: 200, width: 200,
margin: EdgeInsets.only(top: 15), margin: const EdgeInsets.only(top: 15),
decoration: BoxDecoration(border: Border( decoration: const BoxDecoration(border: Border(top: BorderSide(color: Colors.grey, width: 1))),
top: BorderSide(color: Colors.grey, width: 1))),
child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
Tooltip( message: "remove", Tooltip( message: "remove",
child: InkWell( mouseCursor: SystemMouseCursors.click, child: InkWell( mouseCursor: SystemMouseCursors.click,
@ -92,13 +91,13 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
} }
return element.isSelected; return element.isSelected;
}, context); }, context);
Future.delayed(Duration(milliseconds: 100), () { Future.delayed( const Duration(milliseconds: 100), () {
widget.dashboard.flutterChartKey.currentState?.setState(() { }); widget.dashboard.flutterChartKey.currentState?.setState(() { });
}); });
}, child: Container( margin: EdgeInsets.all(10), }, child: Container( margin: const EdgeInsets.all(10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)), decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)),
width: 200, height: 30, width: 200, height: 30,
child: Icon(Icons.delete_outline, color: Colors.black), child: const Icon(Icons.delete_outline, color: Colors.black),
)) ))
), ),
]) ])
@ -118,22 +117,22 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
height: widget.height, height: widget.height,
color: widget.dashboard.midDashColor, color: widget.dashboard.midDashColor,
child: Column( children: [ child: Column( children: [
Container( padding: EdgeInsets.all(10), width: 200, height: 60, Container( padding: const EdgeInsets.all(10), width: 200, height: 60,
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))), decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [
Text("STYLE ${widget.dashboard.elementSelected.isNotEmpty ? "ELEMENT" : "ARROW"}", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), textAlign: TextAlign.center), Text("STYLE ${widget.dashboard.elementSelected.isNotEmpty ? "ELEMENT" : "ARROW"}", style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), textAlign: TextAlign.center),
Text("<${widget.dashboard.arrowsSelected.isEmpty && widget.dashboard.elementSelected.isEmpty ? "general" : "selected"}>", style: TextStyle(fontSize: 12), textAlign: TextAlign.center), Text("<${widget.dashboard.arrowsSelected.isEmpty && widget.dashboard.elementSelected.isEmpty ? "general" : "selected"}>", style: TextStyle(fontSize: 12), textAlign: TextAlign.center),
])), ])),
SizedBox( width: 200, height: widget.height - 60, child: SingleChildScrollView( child: Column( children: [ SizedBox( width: 200, height: widget.height - 60, child: SingleChildScrollView( child: Column( children: [
widget.dashboard.elementSelected.isNotEmpty ? Container() : Container( padding: EdgeInsets.symmetric(horizontal: 10, vertical: 20), widget.dashboard.elementSelected.isNotEmpty ? Container() : Container( padding: EdgeInsets.symmetric(horizontal: 10, vertical: 20),
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))), decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
child: Column( children: [ child: Column( children: [
Row( children: [ Row( children: [
InkWell( mouseCursor: SystemMouseCursors.click, InkWell( mouseCursor: SystemMouseCursors.click,
child: Padding( padding: EdgeInsets.only(left: 10, right: 10), child: Padding( padding: const EdgeInsets.only(left: 10, right: 10),
child: PopupMenuButton<ArrowDash>( child: PopupMenuButton<ArrowDash>(
tooltip: "line defaults", tooltip: "line defaults",
constraints: BoxConstraints(maxWidth: 100), constraints: const BoxConstraints(maxWidth: 100),
initialValue: null, initialValue: null,
onSelected: (ArrowDash value) { onSelected: (ArrowDash value) {
if (widget.dashboard.elementSelected.isEmpty) { if (widget.dashboard.elementSelected.isEmpty) {
@ -199,14 +198,14 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
dashSpace: widget.dashboard.defaultDashSpace, dashSpace: widget.dashboard.defaultDashSpace,
color: Colors.black color: Colors.black
), ),
SizedBox(height: 25, width: 10), const SizedBox(height: 25, width: 10),
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ]) const Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ])
), ),
) )
), ),
PopupMenuButton<void>( PopupMenuButton<void>(
tooltip: "color picker", tooltip: "color picker",
constraints: BoxConstraints(maxWidth: 664), constraints: const BoxConstraints(maxWidth: 664),
initialValue: null, initialValue: null,
onSelected: (void value) {}, onSelected: (void value) {},
itemBuilder: (BuildContext context) => <PopupMenuEntry<void>>[ itemBuilder: (BuildContext context) => <PopupMenuEntry<void>>[
@ -222,12 +221,12 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
], ],
child: Row( children: [ child: Row( children: [
Container(width: 15, height: 15, color: widget.dashboard.defaultColor), Container(width: 15, height: 15, color: widget.dashboard.defaultColor),
SizedBox(height: 25, width: 5), const SizedBox(height: 25, width: 5),
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ]) const Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ])
), ),
Tooltip( message: "stroke width", Tooltip( message: "stroke width",
child: Container( child: Container(
margin: EdgeInsets.only(left: 10), margin: const EdgeInsets.only(left: 10),
width: 55, height: 25, width: 55, height: 25,
child: TextFormField( textAlign: TextAlign.center, child: TextFormField( textAlign: TextAlign.center,
readOnly: widget.dashboard.defaultDashWidth <= 0, readOnly: widget.dashboard.defaultDashWidth <= 0,
@ -239,8 +238,8 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
} }
setState(() { widget.dashboard.defaultStroke = double.parse(value); }); setState(() { widget.dashboard.defaultStroke = double.parse(value); });
}, },
style: TextStyle(fontSize: 12), style: const TextStyle(fontSize: 12),
decoration: InputDecoration( decoration: const InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
filled: true, filled: true,
labelText: "stroke", labelText: "stroke",
@ -266,7 +265,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
]), ]),
Row(children: [ Row(children: [
InkWell( mouseCursor: SystemMouseCursors.click, child: Padding( InkWell( mouseCursor: SystemMouseCursors.click, child: Padding(
padding: EdgeInsets.only(left: 10, top: 10, right: 10), padding: const EdgeInsets.only(left: 10, top: 10, right: 10),
child: PopupMenuButton<ArrowStyle>( child: PopupMenuButton<ArrowStyle>(
initialValue: null, initialValue: null,
onSelected: (ArrowStyle value) { onSelected: (ArrowStyle value) {
@ -279,7 +278,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
}, },
tooltip: "line styles", tooltip: "line styles",
itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowStyle>>[ itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowStyle>>[
PopupMenuItem<ArrowStyle>( const PopupMenuItem<ArrowStyle>(
value: ArrowStyle.segmented, value: ArrowStyle.segmented,
child: Row( children: [ child: Row( children: [
Icon(Icons.turn_slight_left), Icon(Icons.turn_slight_left),
@ -287,7 +286,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
child: Text('straight', textAlign: TextAlign.center,)) child: Text('straight', textAlign: TextAlign.center,))
]), ]),
), ),
PopupMenuItem<ArrowStyle>( const PopupMenuItem<ArrowStyle>(
value: ArrowStyle.curve, value: ArrowStyle.curve,
child: Row( children: [ child: Row( children: [
Icon(Icons.roundabout_left), Icon(Icons.roundabout_left),
@ -295,7 +294,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
child: Text('curved', textAlign: TextAlign.center,)) child: Text('curved', textAlign: TextAlign.center,))
]), ]),
), ),
PopupMenuItem<ArrowStyle>( const PopupMenuItem<ArrowStyle>(
value: ArrowStyle.rectangular, value: ArrowStyle.rectangular,
child: Row( children: [ child: Row( children: [
Icon(Icons.turn_sharp_left_outlined), Icon(Icons.turn_sharp_left_outlined),
@ -307,13 +306,13 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
child: child:
Row( children: [ Icon(widget.dashboard.defaultArrowStyle == ArrowStyle.segmented ? Icons.turn_slight_left : widget.dashboard.defaultArrowStyle == ArrowStyle.curve ? Icons.roundabout_left : Icons.turn_sharp_left_outlined Row( children: [ Icon(widget.dashboard.defaultArrowStyle == ArrowStyle.segmented ? Icons.turn_slight_left : widget.dashboard.defaultArrowStyle == ArrowStyle.curve ? Icons.roundabout_left : Icons.turn_sharp_left_outlined
, color: Colors.black), , color: Colors.black),
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ]) const Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ])
) )
) )
), ),
Tooltip( message: "space dash", Tooltip( message: "space dash",
child: Container( child: Container(
margin: EdgeInsets.only(top: 10), margin: const EdgeInsets.only(top: 10),
width: 105 / 2, height: 25, width: 105 / 2, height: 25,
child: TextFormField( textAlign: TextAlign.center, child: TextFormField( textAlign: TextAlign.center,
readOnly: widget.dashboard.defaultDashWidth <= 0, readOnly: widget.dashboard.defaultDashWidth <= 0,
@ -325,14 +324,14 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
} }
setState(() { widget.dashboard.defaultDashWidth = double.parse(value); }); setState(() { widget.dashboard.defaultDashWidth = double.parse(value); });
}, },
style: TextStyle(fontSize: 12), style: const TextStyle(fontSize: 12),
decoration: InputDecoration( decoration: InputDecoration(
fillColor: widget.dashboard.defaultDashWidth <= 0 ? widget.dashboard.midDashColor : Colors.white, fillColor: widget.dashboard.defaultDashWidth <= 0 ? widget.dashboard.midDashColor : Colors.white,
filled: true, filled: true,
labelText: "dash", labelText: "dash",
labelStyle: TextStyle(fontSize: 10), labelStyle: const TextStyle(fontSize: 10),
border: OutlineInputBorder(), border: const OutlineInputBorder(),
contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
), ),
inputFormatters: [ inputFormatters: [
NumberTextInputFormatter( NumberTextInputFormatter(
@ -351,7 +350,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
))), ))),
Tooltip( message: "space width", Tooltip( message: "space width",
child: Container( child: Container(
margin: EdgeInsets.only(left: 10, top: 10), margin: const EdgeInsets.only(left: 10, top: 10),
width: 105 / 2, height: 25, width: 105 / 2, height: 25,
child: TextFormField( textAlign: TextAlign.center, child: TextFormField( textAlign: TextAlign.center,
initialValue: "${widget.dashboard.defaultDashSpace}", initialValue: "${widget.dashboard.defaultDashSpace}",
@ -362,14 +361,14 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
} }
setState(() { widget.dashboard.defaultDashSpace = double.parse(value); }); setState(() { widget.dashboard.defaultDashSpace = double.parse(value); });
}, },
style: TextStyle(fontSize: 12), style: const TextStyle(fontSize: 12),
decoration: InputDecoration( decoration: InputDecoration(
fillColor: widget.dashboard.defaultDashWidth <= 0 ? widget.dashboard.midDashColor : Colors.white, fillColor: widget.dashboard.defaultDashWidth <= 0 ? widget.dashboard.midDashColor : Colors.white,
filled: true, filled: true,
labelText: "space", labelText: "space",
labelStyle: TextStyle(fontSize: 10), labelStyle: const TextStyle(fontSize: 10),
border: OutlineInputBorder(), border: const OutlineInputBorder(),
contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
), ),
inputFormatters: [ inputFormatters: [
NumberTextInputFormatter( NumberTextInputFormatter(
@ -389,12 +388,12 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
]), ]),
])), ])),
widget.dashboard.elementSelected.isNotEmpty ? Container() : widget.dashboard.elementSelected.isNotEmpty ? Container() :
Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 20, top: 15), Container( padding: const EdgeInsets.only(left: 10, right: 10, bottom: 20, top: 15),
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))), decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
child: Column( children: [ child: Column( children: [
Row( mainAxisAlignment: MainAxisAlignment.center, children : [ Row( mainAxisAlignment: MainAxisAlignment.center, children : [
InkWell( mouseCursor: SystemMouseCursors.click, InkWell( mouseCursor: SystemMouseCursors.click,
child: Padding( padding: EdgeInsets.symmetric(horizontal: 10), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 10),
child: PopupMenuButton<ArrowDirection>( child: PopupMenuButton<ArrowDirection>(
initialValue: null, initialValue: null,
onSelected: (ArrowDirection value) { onSelected: (ArrowDirection value) {
@ -407,7 +406,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
}, },
tooltip: widget.dashboard.defaultArrowDirection == ArrowDirection.forward ? 'forward' : widget.dashboard.defaultArrowDirection == ArrowDirection.backward ? 'backward' : 'bidirectionnal', tooltip: widget.dashboard.defaultArrowDirection == ArrowDirection.forward ? 'forward' : widget.dashboard.defaultArrowDirection == ArrowDirection.backward ? 'backward' : 'bidirectionnal',
itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowDirection>>[ itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowDirection>>[
PopupMenuItem<ArrowDirection>( const PopupMenuItem<ArrowDirection>(
value: ArrowDirection.forward, value: ArrowDirection.forward,
child: Row( children: [ child: Row( children: [
Icon(Icons.arrow_forward), Icon(Icons.arrow_forward),
@ -415,7 +414,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
child: Text('forward', textAlign: TextAlign.center,)) child: Text('forward', textAlign: TextAlign.center,))
]), ]),
), ),
PopupMenuItem<ArrowDirection>( const PopupMenuItem<ArrowDirection>(
value: ArrowDirection.backward, value: ArrowDirection.backward,
child: Row( children: [ child: Row( children: [
Icon(Icons.arrow_back), Icon(Icons.arrow_back),
@ -423,7 +422,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
child: Text('curved', textAlign: TextAlign.center,)) child: Text('curved', textAlign: TextAlign.center,))
]), ]),
), ),
PopupMenuItem<ArrowDirection>( const PopupMenuItem<ArrowDirection>(
value: ArrowDirection.bidirectionnal, value: ArrowDirection.bidirectionnal,
child: Row( children: [ child: Row( children: [
Icon(Icons.sync_alt_outlined), Icon(Icons.sync_alt_outlined),
@ -435,16 +434,16 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
child: child:
Row( children: [ Row( children: [
Icon(widget.dashboard.defaultArrowDirection == ArrowDirection.forward ? Icons.arrow_forward : widget.dashboard.defaultArrowDirection == ArrowDirection.backward ? Icons.arrow_back : Icons.sync_alt_outlined, color: Colors.black), Icon(widget.dashboard.defaultArrowDirection == ArrowDirection.forward ? Icons.arrow_forward : widget.dashboard.defaultArrowDirection == ArrowDirection.backward ? Icons.arrow_back : Icons.sync_alt_outlined, color: Colors.black),
Padding( padding: EdgeInsets.symmetric(horizontal: 10), Padding( padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(widget.dashboard.defaultArrowDirection == ArrowDirection.forward ? 'forward' : widget.dashboard.defaultArrowDirection == ArrowDirection.backward ? 'backward' : 'bidirectionnal')), child: Text(widget.dashboard.defaultArrowDirection == ArrowDirection.forward ? 'forward' : widget.dashboard.defaultArrowDirection == ArrowDirection.backward ? 'backward' : 'bidirectionnal')),
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ]) const Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ])
),) ),)
), ),
]), ]),
Row(children: [ Row(children: [
Tooltip( message: "forward size", Tooltip( message: "forward size",
child: Container( child: Container(
margin: EdgeInsets.only(top: 10), margin: const EdgeInsets.only(top: 10),
width: 150, height: 25, width: 150, height: 25,
child: TextFormField( textAlign: TextAlign.center, child: TextFormField( textAlign: TextAlign.center,
initialValue: "${widget.dashboard.defaultForwardWidth}", initialValue: "${widget.dashboard.defaultForwardWidth}",
@ -467,14 +466,14 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
} }
}); });
}, },
style: TextStyle(fontSize: 12), style: const TextStyle(fontSize: 12),
decoration: InputDecoration( decoration: InputDecoration(
fillColor: widget.dashboard.defaultDashWidth <= 0 ? widget.dashboard.midDashColor : Colors.white, fillColor: widget.dashboard.defaultDashWidth <= 0 ? widget.dashboard.midDashColor : Colors.white,
filled: true, filled: true,
labelText: "forward size", labelText: "forward size",
labelStyle: TextStyle(fontSize: 10), labelStyle: const TextStyle(fontSize: 10),
border: OutlineInputBorder(), border: const OutlineInputBorder(),
contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
), ),
inputFormatters: [ inputFormatters: [
NumberTextInputFormatter( NumberTextInputFormatter(
@ -491,12 +490,12 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
], ],
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
))), ))),
Padding( padding: EdgeInsets.only(top: 10, left: 5), child: Icon(Icons.arrow_forward, color: Colors.black)) const Padding( padding: EdgeInsets.only(top: 10, left: 5), child: Icon(Icons.arrow_forward, color: Colors.black))
]), ]),
Row(children: [ Row(children: [
Tooltip( message: "back size", Tooltip( message: "back size",
child: Container( child: Container(
margin: EdgeInsets.only(top: 10), margin: const EdgeInsets.only(top: 10),
width: 150, height: 25, width: 150, height: 25,
child: TextFormField( textAlign: TextAlign.center, child: TextFormField( textAlign: TextAlign.center,
initialValue: "${widget.dashboard.defaultBackWidth}", initialValue: "${widget.dashboard.defaultBackWidth}",
@ -519,14 +518,14 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
} }
}); });
}, },
style: TextStyle(fontSize: 12), style: const TextStyle(fontSize: 12),
decoration: InputDecoration( decoration: InputDecoration(
fillColor: widget.dashboard.defaultDashWidth <= 0 ? widget.dashboard.midDashColor : Colors.white, fillColor: widget.dashboard.defaultDashWidth <= 0 ? widget.dashboard.midDashColor : Colors.white,
filled: true, filled: true,
labelText: "back size", labelText: "back size",
labelStyle: TextStyle(fontSize: 10), labelStyle: const TextStyle(fontSize: 10),
border: OutlineInputBorder(), border: const OutlineInputBorder(),
contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
), ),
inputFormatters: [ inputFormatters: [
NumberTextInputFormatter( NumberTextInputFormatter(
@ -543,12 +542,12 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
], ],
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
))), ))),
Padding( padding: EdgeInsets.only(top: 10, left: 5), child: Icon(Icons.arrow_back, color: Colors.black)) const Padding( padding: EdgeInsets.only(top: 10, left: 5), child: Icon(Icons.arrow_back, color: Colors.black))
]) ])
])), ])),
widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container( widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container(
width: 200, width: 200,
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))), decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
Tooltip( message: "remove", Tooltip( message: "remove",
child: InkWell( mouseCursor: SystemMouseCursors.click, child: InkWell( mouseCursor: SystemMouseCursors.click,
@ -559,13 +558,13 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
} }
return element.isSelected; return element.isSelected;
}, context); }, context);
Future.delayed(Duration(milliseconds: 100), () { Future.delayed(const Duration(milliseconds: 100), () {
widget.dashboard.flutterChartKey.currentState?.setState(() { }); widget.dashboard.flutterChartKey.currentState?.setState(() { });
}); });
}, child: Container( margin: EdgeInsets.all(10), }, child: Container( margin: const EdgeInsets.all(10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)), decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)),
width: 200, height: 30, width: 200, height: 30,
child: Icon(Icons.delete_outline, color: Colors.black), child: const Icon(Icons.delete_outline, color: Colors.black),
)) ))
), ),
Tooltip( message: "copy", Tooltip( message: "copy",
@ -573,15 +572,15 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
onTap: () { onTap: () {
for (var sel in widget.dashboard.elementSelected) { for (var sel in widget.dashboard.elementSelected) {
widget.dashboard.addElement(FlowElement.fromMap(widget.dashboard, sel.toMap()), context); widget.dashboard.addElement(FlowElement.fromMap(widget.dashboard, sel.toMap()), context);
widget.dashboard.elements.last.position += Offset(50, 50); widget.dashboard.elements.last.position += const Offset(50, 50);
} }
Future.delayed(Duration(milliseconds: 100), () { Future.delayed( const Duration(milliseconds: 100), () {
widget.dashboard.chartKey.currentState?.setState(() { }); widget.dashboard.chartKey.currentState?.setState(() { });
}); });
}, child: Container( margin: EdgeInsets.only(left: 10, right: 10, bottom: 10), }, child: Container( margin: const EdgeInsets.only(left: 10, right: 10, bottom: 10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)), decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)),
width: 200, height: 30, width: 200, height: 30,
child: Icon(Icons.copy, color: Colors.black), child: const Icon(Icons.copy, color: Colors.black),
)) ))
), ),
]) ])
@ -594,15 +593,15 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
Container( // SHORTCUT Container( // SHORTCUT
width: 200, height: 50, width: 200, height: 50,
decoration: BoxDecoration(color: widget.dashboard.midDashColor, decoration: BoxDecoration(color: widget.dashboard.midDashColor,
border: Border(bottom: BorderSide(color: Colors.grey, width: 1))), border: const Border(bottom: BorderSide(color: Colors.grey, width: 1))),
child: Row( children: [ child: Row( children: [
Tooltip( message: "dashboard information", Tooltip( message: "dashboard information",
child: InkWell( onTap: () => setState(() {widget.isDashboardInfo = true; }), child: InkWell( onTap: () => setState(() {widget.isDashboardInfo = true; }),
mouseCursor: SystemMouseCursors.click, mouseCursor: SystemMouseCursors.click,
child: Container( alignment: Alignment.center, child: Container( alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
color: widget.isDashboardInfo ? Colors.grey : widget.dashboard.midDashColor, color: widget.isDashboardInfo ? Colors.grey : widget.dashboard.midDashColor,
width: 200 / 2, child: Icon(Icons.info, color: Colors.white)) width: 200 / 2, child: const Icon(Icons.info, color: Colors.white))
) )
), ),
Tooltip( Tooltip(
@ -610,9 +609,9 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
child: InkWell( onTap: () => setState(() {widget.isDashboardInfo = false; }), child: InkWell( onTap: () => setState(() {widget.isDashboardInfo = false; }),
mouseCursor: SystemMouseCursors.click, mouseCursor: SystemMouseCursors.click,
child: Container( alignment: Alignment.center, child: Container( alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
color: !widget.isDashboardInfo ? Colors.grey : widget.dashboard.midDashColor, color: !widget.isDashboardInfo ? Colors.grey : widget.dashboard.midDashColor,
width: 200 / 2, child: Icon(Icons.format_paint, color: Colors.white)), width: 200 / 2, child: const Icon(Icons.format_paint, color: Colors.white)),
) )
) )
] ]
@ -620,7 +619,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
), ),
widget.dashboard.error != null ? Container( width: 200, color: Colors.red, padding: EdgeInsets.all(10), widget.dashboard.error != null ? Container( width: 200, color: Colors.red, padding: EdgeInsets.all(10),
child: Center( child: Text(widget.dashboard.error!, child: Center( child: Text(widget.dashboard.error!,
style: TextStyle(color: Colors.white, fontSize: 15), textAlign: TextAlign.center))) : Container(), style: const TextStyle(color: Colors.white, fontSize: 15), textAlign: TextAlign.center))) : Container(),
w w
]); ]);
} }

View File

@ -744,8 +744,28 @@ class ArrowPainter extends CustomPainter {
return _dashedPathProperties.path; return _dashedPathProperties.path;
} }
bool isLine(Offset point) {
bool isLine(Offset position) { final metrics = path.computeMetrics(forceClosed: false);
for (final metric in metrics) {
final length = metric.length;
const steps = 100;
for(int i = 0; i <= steps; i++) {
final distance = length * i / steps;
final tangent = metric.getTangentForOffset(distance);
if (tangent != null) {
final position = tangent.position;
if ((position - point).distance <= 10) {
return true;
}
}
}
}
return false;
}
/*
bool isLine(Offset position, String name) {
position = Offset(position.dx, position.dy + 10);
print("${position.dx} ${position.dy}");
for (double i=-5; i < 5; i++) { for (double i=-5; i < 5; i++) {
for (double y=-5; y < 5; y++) { for (double y=-5; y < 5; y++) {
var pos = position + Offset(i, y); var pos = position + Offset(i, y);
@ -756,7 +776,7 @@ class ArrowPainter extends CustomPainter {
} }
return false; return false;
} }
*/
@override @override
bool? hitTest(Offset position) { bool? hitTest(Offset position) {
/* graphkey?.currentState?.widget.isShowed = isLine(position); /* graphkey?.currentState?.widget.isShowed = isLine(position);