Rules on dashboard + Permissions
This commit is contained in:
@@ -28,8 +28,10 @@ class Dashboard extends ChangeNotifier {
|
||||
GlobalKey<FlowChartMenuState> chartMenuKey = GlobalKey<FlowChartMenuState>();
|
||||
GlobalKey<ChartWidgetState> chartKey = GlobalKey<ChartWidgetState>();
|
||||
GlobalKey<FlowChartState> flutterChartKey = GlobalKey<FlowChartState>();
|
||||
|
||||
List<Map<String, dynamic>> tempHistory = [];
|
||||
List<Map<String, dynamic>> history = [];
|
||||
|
||||
Map<String, dynamic> scheduler = {};
|
||||
Map<String, dynamic> info = {};
|
||||
bool scheduleActive = false;
|
||||
@@ -58,7 +60,10 @@ class Dashboard extends ChangeNotifier {
|
||||
/// This is used to move the dashboard on the screen
|
||||
double widthOffset = 0;
|
||||
double heightOffset = 0;
|
||||
///
|
||||
List<bool Function(Dashboard)> saveRules = [];
|
||||
|
||||
String? error;
|
||||
|
||||
Dashboard({
|
||||
this.id,
|
||||
this.widthOffset = 0,
|
||||
@@ -104,7 +109,20 @@ class Dashboard extends ChangeNotifier {
|
||||
tempHistory = [];
|
||||
history = [];
|
||||
}
|
||||
|
||||
Future<void> saveDash(String? id) async {
|
||||
shouldSave = true;
|
||||
for (var element in saveRules) {
|
||||
if (element(this)) {
|
||||
shouldSave = true;
|
||||
} else {
|
||||
shouldSave = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (save != null && shouldSave) {
|
||||
save!(id);
|
||||
}
|
||||
}
|
||||
Future<void> Function(String cat)? load;
|
||||
|
||||
///
|
||||
@@ -305,23 +323,17 @@ class Dashboard extends ChangeNotifier {
|
||||
void addArrows(ArrowPainter f) {
|
||||
arrows.add(f);
|
||||
addChange = true;
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
}
|
||||
|
||||
void removeArrows(bool Function(ArrowPainter) f) {
|
||||
arrows.removeWhere((element) => f(element));
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
}
|
||||
|
||||
void removeElements(bool Function(FlowElement<FlowData>) f) {
|
||||
elements.removeWhere((element) => f(element));
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
@@ -388,9 +400,7 @@ class Dashboard extends ChangeNotifier {
|
||||
bool notify = true,
|
||||
}) {
|
||||
element.isResizing = resizable;
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
if (notify) notifyListeners();
|
||||
}
|
||||
|
||||
@@ -409,9 +419,7 @@ class Dashboard extends ChangeNotifier {
|
||||
element.setScale(1, gridBackgroundParams.scale);
|
||||
elements.add(element);
|
||||
addChange = true;
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
if (notify) {
|
||||
notifyListeners();
|
||||
}
|
||||
@@ -534,9 +542,7 @@ class Dashboard extends ChangeNotifier {
|
||||
void removeAllElements({bool notify = true}) {
|
||||
elements.clear();
|
||||
if (notify) notifyListeners();
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
}
|
||||
|
||||
/// remove the [handler] connection of [element]
|
||||
@@ -579,9 +585,7 @@ class Dashboard extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
if (notify) notifyListeners();
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
}
|
||||
|
||||
/// dissect an element connection
|
||||
@@ -674,9 +678,7 @@ class Dashboard extends ChangeNotifier {
|
||||
void removeElementConnections(FlowElement element, {bool notify = true}) {
|
||||
element.next.clear();
|
||||
if (notify) notifyListeners();
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
}
|
||||
|
||||
/// remove all the elements with [id] from the dashboard
|
||||
@@ -697,9 +699,7 @@ class Dashboard extends ChangeNotifier {
|
||||
});
|
||||
}
|
||||
if (notify) notifyListeners();
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
}
|
||||
|
||||
/// remove element
|
||||
@@ -720,9 +720,7 @@ class Dashboard extends ChangeNotifier {
|
||||
);
|
||||
}
|
||||
if (notify) notifyListeners();
|
||||
if (save != null) {
|
||||
save!(id);
|
||||
}
|
||||
saveDash(id);
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,94 +86,89 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
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),
|
||||
])),
|
||||
Container( 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),
|
||||
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Column( children: [
|
||||
Row( children: [
|
||||
InkWell( mouseCursor: SystemMouseCursors.click, child: Container(
|
||||
child: Padding( padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: PopupMenuButton<ArrowDash>(
|
||||
tooltip: "line defaults",
|
||||
constraints: BoxConstraints(maxWidth: 100),
|
||||
child: Row( children: [
|
||||
MySeparator(
|
||||
width: 35,
|
||||
dashWidth: widget.dashboard.defaultDashWidth,
|
||||
dashSpace: widget.dashboard.defaultDashSpace,
|
||||
color: Colors.black
|
||||
),
|
||||
SizedBox(height: 25, width: 10),
|
||||
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ]),
|
||||
initialValue: null,
|
||||
onSelected: (ArrowDash value) {
|
||||
if (widget.dashboard.elementSelected.isEmpty) {
|
||||
for(var sel in widget.dashboard.arrowsSelected) {
|
||||
sel.params.dashSpace = spaceArrowDash(value);
|
||||
sel.params.dashWidth = widthArrowDash(value);
|
||||
}
|
||||
widget.dashboard.chartKey.currentState?.setState(() { });
|
||||
InkWell( mouseCursor: SystemMouseCursors.click,
|
||||
child: Padding( padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: PopupMenuButton<ArrowDash>(
|
||||
tooltip: "line defaults",
|
||||
constraints: BoxConstraints(maxWidth: 100),
|
||||
initialValue: null,
|
||||
onSelected: (ArrowDash value) {
|
||||
if (widget.dashboard.elementSelected.isEmpty) {
|
||||
for(var sel in widget.dashboard.arrowsSelected) {
|
||||
sel.params.dashSpace = spaceArrowDash(value);
|
||||
sel.params.dashWidth = widthArrowDash(value);
|
||||
}
|
||||
widget.dashboard.defaultDashSpace = spaceArrowDash(value);
|
||||
widget.dashboard.defaultDashWidth = widthArrowDash(value);
|
||||
setState(() {});
|
||||
},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowDash>>[
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.line,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.line),
|
||||
dashSpace: spaceArrowDash(ArrowDash.line),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.largeDash,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.largeDash), dashSpace: spaceArrowDash(ArrowDash.largeDash),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.mediumDash,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.mediumDash), dashSpace: spaceArrowDash(ArrowDash.mediumDash),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.smallDash,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.smallDash), dashSpace: spaceArrowDash(ArrowDash.smallDash),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.heavyDotted,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.heavyDotted), dashSpace: spaceArrowDash(ArrowDash.heavyDotted),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.mediumDotted,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.mediumDotted), dashSpace: spaceArrowDash(ArrowDash.mediumDotted),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.lightDotted,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.lightDotted), dashSpace: spaceArrowDash(ArrowDash.lightDotted),)
|
||||
]),
|
||||
),
|
||||
]
|
||||
widget.dashboard.chartKey.currentState?.setState(() { });
|
||||
}
|
||||
widget.dashboard.defaultDashSpace = spaceArrowDash(value);
|
||||
widget.dashboard.defaultDashWidth = widthArrowDash(value);
|
||||
setState(() {});
|
||||
},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowDash>>[
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.line,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.line),
|
||||
dashSpace: spaceArrowDash(ArrowDash.line),)
|
||||
]),
|
||||
),
|
||||
)
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.largeDash,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.largeDash), dashSpace: spaceArrowDash(ArrowDash.largeDash),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.mediumDash,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.mediumDash), dashSpace: spaceArrowDash(ArrowDash.mediumDash),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.smallDash,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.smallDash), dashSpace: spaceArrowDash(ArrowDash.smallDash),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.heavyDotted,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.heavyDotted), dashSpace: spaceArrowDash(ArrowDash.heavyDotted),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.mediumDotted,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.mediumDotted), dashSpace: spaceArrowDash(ArrowDash.mediumDotted),)
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDash>(
|
||||
value: ArrowDash.lightDotted,
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
MySeparator(width: 25, dashWidth: widthArrowDash(ArrowDash.lightDotted), dashSpace: spaceArrowDash(ArrowDash.lightDotted),)
|
||||
]),
|
||||
),
|
||||
],
|
||||
child: Row( children: [
|
||||
MySeparator(
|
||||
width: 35,
|
||||
dashWidth: widget.dashboard.defaultDashWidth,
|
||||
dashSpace: widget.dashboard.defaultDashSpace,
|
||||
color: Colors.black
|
||||
),
|
||||
SizedBox(height: 25, width: 10),
|
||||
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ])
|
||||
),
|
||||
)
|
||||
),
|
||||
PopupMenuButton<void>(
|
||||
tooltip: "color picker",
|
||||
constraints: BoxConstraints(maxWidth: 664),
|
||||
child: Row( children: [
|
||||
Container(width: 15, height: 15, color: widget.dashboard.defaultColor),
|
||||
Container(height: 25, width: 5),
|
||||
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ]),
|
||||
initialValue: null,
|
||||
onSelected: (void value) {},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<void>>[
|
||||
@@ -186,7 +181,11 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
setState(() { widget.dashboard.defaultColor = value; });
|
||||
},),
|
||||
),
|
||||
]
|
||||
],
|
||||
child: Row( children: [
|
||||
Container(width: 15, height: 15, color: widget.dashboard.defaultColor),
|
||||
SizedBox(height: 25, width: 5),
|
||||
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ])
|
||||
),
|
||||
Tooltip( message: "stroke width",
|
||||
child: Container(
|
||||
@@ -228,50 +227,49 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
)))
|
||||
]),
|
||||
Row(children: [
|
||||
InkWell( mouseCursor: SystemMouseCursors.click, child: Container(
|
||||
child: Padding( padding: EdgeInsets.only(left: 10, top: 10, right: 10),
|
||||
child: PopupMenuButton<ArrowStyle>(
|
||||
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
|
||||
, color: Colors.black),
|
||||
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ]),
|
||||
initialValue: null,
|
||||
onSelected: (ArrowStyle value) {
|
||||
if (widget.dashboard.elementSelected.isEmpty) {
|
||||
for(var sel in widget.dashboard.arrowsSelected) { sel.params.style = value; }
|
||||
widget.dashboard.chartKey.currentState?.setState(() { });
|
||||
}
|
||||
widget.dashboard.defaultArrowStyle = value;
|
||||
setState(() {});
|
||||
},
|
||||
tooltip: "line styles",
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowStyle>>[
|
||||
PopupMenuItem<ArrowStyle>(
|
||||
value: ArrowStyle.segmented,
|
||||
child: Row( children: [
|
||||
Icon(Icons.turn_slight_left),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('straight', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowStyle>(
|
||||
value: ArrowStyle.curve,
|
||||
child: Row( children: [
|
||||
Icon(Icons.roundabout_left),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('curved', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowStyle>(
|
||||
value: ArrowStyle.rectangular,
|
||||
child: Row( children: [
|
||||
Icon(Icons.turn_sharp_left_outlined),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('rectangular', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
]
|
||||
)
|
||||
InkWell( mouseCursor: SystemMouseCursors.click, child: Padding(
|
||||
padding: EdgeInsets.only(left: 10, top: 10, right: 10),
|
||||
child: PopupMenuButton<ArrowStyle>(
|
||||
initialValue: null,
|
||||
onSelected: (ArrowStyle value) {
|
||||
if (widget.dashboard.elementSelected.isEmpty) {
|
||||
for(var sel in widget.dashboard.arrowsSelected) { sel.params.style = value; }
|
||||
widget.dashboard.chartKey.currentState?.setState(() { });
|
||||
}
|
||||
widget.dashboard.defaultArrowStyle = value;
|
||||
setState(() {});
|
||||
},
|
||||
tooltip: "line styles",
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowStyle>>[
|
||||
PopupMenuItem<ArrowStyle>(
|
||||
value: ArrowStyle.segmented,
|
||||
child: Row( children: [
|
||||
Icon(Icons.turn_slight_left),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('straight', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowStyle>(
|
||||
value: ArrowStyle.curve,
|
||||
child: Row( children: [
|
||||
Icon(Icons.roundabout_left),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('curved', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowStyle>(
|
||||
value: ArrowStyle.rectangular,
|
||||
child: Row( children: [
|
||||
Icon(Icons.turn_sharp_left_outlined),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('rectangular', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
],
|
||||
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
|
||||
, color: Colors.black),
|
||||
Icon(Icons.arrow_drop_down, size: 10, color: Colors.black) ])
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -352,60 +350,57 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
)))
|
||||
]),
|
||||
])),
|
||||
widget.dashboard.elementSelected.isNotEmpty && widget.dashboard.elementSelected.length == 1 ? Container(
|
||||
// TODO : TEST OMG
|
||||
) : Container(),
|
||||
widget.dashboard.elementSelected.isNotEmpty ? Container() : Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 20, top: 15),
|
||||
widget.dashboard.elementSelected.isNotEmpty ? Container() :
|
||||
Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 20, top: 15),
|
||||
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Column( children: [
|
||||
Row( mainAxisAlignment: MainAxisAlignment.center, children : [
|
||||
InkWell( mouseCursor: SystemMouseCursors.click, child: Container(
|
||||
child: Padding( padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
child: PopupMenuButton<ArrowDirection>(
|
||||
child:
|
||||
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),
|
||||
Padding( padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
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) ]),
|
||||
initialValue: null,
|
||||
onSelected: (ArrowDirection value) {
|
||||
if (widget.dashboard.elementSelected.isEmpty) {
|
||||
for(var sel in widget.dashboard.arrowsSelected) { sel.params.direction = value; }
|
||||
widget.dashboard.chartKey.currentState?.setState(() { });
|
||||
}
|
||||
widget.dashboard.defaultArrowDirection = value;
|
||||
setState(() {});
|
||||
},
|
||||
tooltip: widget.dashboard.defaultArrowDirection == ArrowDirection.forward ? 'forward' : widget.dashboard.defaultArrowDirection == ArrowDirection.backward ? 'backward' : 'bidirectionnal',
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowDirection>>[
|
||||
PopupMenuItem<ArrowDirection>(
|
||||
value: ArrowDirection.forward,
|
||||
child: Row( children: [
|
||||
Icon(Icons.arrow_forward),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('forward', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDirection>(
|
||||
value: ArrowDirection.backward,
|
||||
child: Row( children: [
|
||||
Icon(Icons.arrow_back),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('curved', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDirection>(
|
||||
value: ArrowDirection.bidirectionnal,
|
||||
child: Row( children: [
|
||||
Icon(Icons.sync_alt_outlined),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('bidirectionnal', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
]
|
||||
),)
|
||||
)
|
||||
InkWell( mouseCursor: SystemMouseCursors.click,
|
||||
child: Padding( padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
child: PopupMenuButton<ArrowDirection>(
|
||||
initialValue: null,
|
||||
onSelected: (ArrowDirection value) {
|
||||
if (widget.dashboard.elementSelected.isEmpty) {
|
||||
for(var sel in widget.dashboard.arrowsSelected) { sel.params.direction = value; }
|
||||
widget.dashboard.chartKey.currentState?.setState(() { });
|
||||
}
|
||||
widget.dashboard.defaultArrowDirection = value;
|
||||
setState(() {});
|
||||
},
|
||||
tooltip: widget.dashboard.defaultArrowDirection == ArrowDirection.forward ? 'forward' : widget.dashboard.defaultArrowDirection == ArrowDirection.backward ? 'backward' : 'bidirectionnal',
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<ArrowDirection>>[
|
||||
PopupMenuItem<ArrowDirection>(
|
||||
value: ArrowDirection.forward,
|
||||
child: Row( children: [
|
||||
Icon(Icons.arrow_forward),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('forward', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDirection>(
|
||||
value: ArrowDirection.backward,
|
||||
child: Row( children: [
|
||||
Icon(Icons.arrow_back),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('curved', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
PopupMenuItem<ArrowDirection>(
|
||||
value: ArrowDirection.bidirectionnal,
|
||||
child: Row( children: [
|
||||
Icon(Icons.sync_alt_outlined),
|
||||
Padding( padding: EdgeInsets.only(left: 10),
|
||||
child: Text('bidirectionnal', textAlign: TextAlign.center,))
|
||||
]),
|
||||
),
|
||||
],
|
||||
child:
|
||||
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),
|
||||
Padding( padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
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) ])
|
||||
),)
|
||||
),
|
||||
]),
|
||||
Row(children: [
|
||||
@@ -560,46 +555,51 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
}
|
||||
return Column( children: [
|
||||
Container( // SHORTCUT
|
||||
width: 200,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Row( children: [
|
||||
Tooltip(
|
||||
message: "dashboard information",
|
||||
child: InkWell( onTap: () => setState(() {widget.isDashboardInfo = true; }),
|
||||
mouseCursor: SystemMouseCursors.click,
|
||||
child: Container( alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
color: widget.isDashboardInfo ? Colors.grey : widget.dashboard.midDashColor,
|
||||
width: 200 / 2, child: Icon(Icons.info, color: Colors.white))
|
||||
)
|
||||
),
|
||||
Tooltip(
|
||||
message: "element style",
|
||||
child: InkWell( onTap: () => setState(() {widget.isDashboardInfo = false; }),
|
||||
mouseCursor: SystemMouseCursors.click,
|
||||
child: Container( alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
color: !widget.isDashboardInfo ? Colors.grey : widget.dashboard.midDashColor,
|
||||
width: 200 / 2, child: Icon(Icons.format_paint, color: Colors.white)),
|
||||
))
|
||||
])),
|
||||
width: 200, height: 50,
|
||||
decoration: BoxDecoration(color: widget.dashboard.midDashColor,
|
||||
border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Row( children: [
|
||||
Tooltip( message: "dashboard information",
|
||||
child: InkWell( onTap: () => setState(() {widget.isDashboardInfo = true; }),
|
||||
mouseCursor: SystemMouseCursors.click,
|
||||
child: Container( alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
color: widget.isDashboardInfo ? Colors.grey : widget.dashboard.midDashColor,
|
||||
width: 200 / 2, child: Icon(Icons.info, color: Colors.white))
|
||||
)
|
||||
),
|
||||
Tooltip(
|
||||
message: "element style",
|
||||
child: InkWell( onTap: () => setState(() {widget.isDashboardInfo = false; }),
|
||||
mouseCursor: SystemMouseCursors.click,
|
||||
child: Container( alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
color: !widget.isDashboardInfo ? Colors.grey : widget.dashboard.midDashColor,
|
||||
width: 200 / 2, child: Icon(Icons.format_paint, color: Colors.white)),
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
widget.dashboard.error != null ? Container( width: 200, color: Colors.red, padding: EdgeInsets.all(10),
|
||||
child: Center( child: Text(widget.dashboard.error!,
|
||||
style: TextStyle(color: Colors.white, fontSize: 15), textAlign: TextAlign.center))) : Container(),
|
||||
w
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MySeparator extends StatelessWidget {
|
||||
double width = 1; double dashWidth = 10; double dashSpace = 10;
|
||||
MySeparator({Key? key, this.width = 1, this.dashSpace = 10, this.dashWidth = 10,
|
||||
this.height = 1, this.color = Colors.black})
|
||||
: super(key: key);
|
||||
MySeparator({super.key, this.width = 1, this.dashSpace = 10, this.dashWidth = 10,
|
||||
this.height = 1, this.color = Colors.black});
|
||||
final double height;
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container( width: width, child: dashSpace == 0 ?
|
||||
return SizedBox( width: width, child: dashSpace == 0 ?
|
||||
Divider( thickness: 2, color: color )
|
||||
: DottedLine(
|
||||
dashLength: dashWidth,
|
||||
|
||||
Reference in New Issue
Block a user