Shared WS
This commit is contained in:
@@ -30,6 +30,7 @@ class Dashboard extends ChangeNotifier {
|
||||
List<Map<String, dynamic>> tempHistory = [];
|
||||
List<Map<String, dynamic>> history = [];
|
||||
Map<String, dynamic> scheduler = {};
|
||||
Map<String, dynamic> info = {};
|
||||
bool scheduleActive = false;
|
||||
String? id;
|
||||
String name;
|
||||
@@ -231,6 +232,7 @@ class Dashboard extends ChangeNotifier {
|
||||
void deserialize(Map<String, dynamic> graph) {
|
||||
elements = [];
|
||||
arrows = [];
|
||||
info["shared"] = graph["shared"] ?? [];
|
||||
scheduler = graph['schedule'] ?? {};
|
||||
scheduleActive = graph['schedule_active'] ?? false;
|
||||
setZoomFactor(graph["graph"]?["zoom"] ?? 1.0);
|
||||
|
||||
@@ -55,6 +55,7 @@ class FlowChart<T extends FlowData> extends StatefulWidget {
|
||||
this.categories = const [],
|
||||
required this.draggableItemBuilder,
|
||||
this.onDashboardAlertOpened,
|
||||
this.menuWidget,
|
||||
this.menuExtension,
|
||||
}) {}
|
||||
final List<String> categories;
|
||||
@@ -63,6 +64,7 @@ class FlowChart<T extends FlowData> extends StatefulWidget {
|
||||
final double innerMenuWidth;
|
||||
|
||||
Widget Function()? menuExtension;
|
||||
Widget Function(Dashboard data)? menuWidget;
|
||||
|
||||
double itemWidth = 80;
|
||||
double zoom = 1;
|
||||
@@ -416,6 +418,7 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
child: ChartWidget<T>(
|
||||
key: widget.dashboard.chartKey,
|
||||
flowChart: this,
|
||||
menuWidget: widget.menuWidget,
|
||||
dashboard: widget.dashboard,
|
||||
onNewConnection: widget.onNewConnection,
|
||||
onDashboardTapped: widget.onDashboardLongTapped,
|
||||
@@ -437,7 +440,7 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
String newID = const Uuid().v4();
|
||||
double ratio = 1;
|
||||
if (e.getWidth() != null && e.getHeight() != null) {
|
||||
ratio = (e.getHeight()! / (e.getWidth()! - 30));
|
||||
ratio = (e.getHeight()! / (e.getWidth()!));
|
||||
}
|
||||
FlowElement<T> el = FlowElement<T>(
|
||||
dashboard: widget.dashboard,
|
||||
@@ -579,10 +582,13 @@ class ChartWidget<T extends FlowData> extends StatefulWidget {
|
||||
this.onScaleUpdate,
|
||||
required this.dashboard,
|
||||
this.onNewConnection,
|
||||
this.menuWidget,
|
||||
}) : super(key: key);
|
||||
|
||||
FlowChartState flowChart;
|
||||
|
||||
Widget Function(Dashboard dash)? menuWidget;
|
||||
|
||||
final void Function(BuildContext context, Offset position)? onDashboardTapped;
|
||||
|
||||
/// callback for long tap on dashboard
|
||||
@@ -905,6 +911,7 @@ class ChartWidgetState<T extends FlowData> extends State<ChartWidget> {
|
||||
Positioned(top: 0, right: 0, child: FlowChartMenu(
|
||||
key: widget.dashboard.chartMenuKey,
|
||||
chart: this,
|
||||
menuExtension: widget.menuWidget != null ? widget.menuWidget!(widget.dashboard) : null,
|
||||
dashboard: widget.dashboard,
|
||||
width: MediaQuery.of(context).size.width)
|
||||
),
|
||||
|
||||
@@ -11,8 +11,9 @@ class FlowChartMenu extends StatefulWidget {
|
||||
ChartWidgetState chart;
|
||||
Dashboard dashboard;
|
||||
double width = 100;
|
||||
Widget? menuExtension;
|
||||
|
||||
FlowChartMenu ({ super.key, required this.chart, required this.dashboard, this.width = 100 });
|
||||
FlowChartMenu ({ super.key, required this.chart, required this.dashboard, this.width = 100, this.menuExtension });
|
||||
@override FlowChartMenuState createState() => FlowChartMenuState();
|
||||
}
|
||||
class FlowChartMenuState extends State<FlowChartMenu> {
|
||||
@@ -22,7 +23,7 @@ class FlowChartMenuState extends State<FlowChartMenu> {
|
||||
return Container( // SHORTCUT
|
||||
width: widget.width,
|
||||
height: 50,
|
||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
color: const Color.fromRGBO(38, 166, 154, 1),
|
||||
child: Row( children : [ Expanded(flex: 2, child: Row( children: [
|
||||
widget.chart.widget.flowChart.widget.onDashboardAlertOpened == null ? Container() : Container(
|
||||
@@ -240,6 +241,12 @@ class FlowChartMenuState extends State<FlowChartMenu> {
|
||||
style: TextStyle(color: Colors.white, fontSize: 14), textAlign: TextAlign.start),
|
||||
padding: EdgeInsets.symmetric(horizontal: 20))),
|
||||
])),
|
||||
widget.menuExtension != null && MediaQuery.of(context).size.width > 600 ? Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(left: BorderSide(color: Colors.white, width: 1))
|
||||
),
|
||||
child: widget.menuExtension
|
||||
) : Container()
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
Widget? w;
|
||||
if (widget.isDashboardInfo && widget.dashboard.elementSelected.length == 1) {
|
||||
w = Container(
|
||||
width: 200,
|
||||
width: 250,
|
||||
height: widget.height,
|
||||
color: Colors.grey.shade300,
|
||||
child: Column( children: [ ...widget.dashboard.infoItemWidget != null ?
|
||||
widget.dashboard.infoItemWidget!(widget.dashboard.elementSelected.first.element)
|
||||
: [],
|
||||
widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container(
|
||||
width: 200,
|
||||
width: 250,
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
decoration: BoxDecoration(border: Border(
|
||||
top: BorderSide(color: Colors.grey, width: 1),
|
||||
@@ -45,7 +45,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),
|
||||
))
|
||||
),
|
||||
@@ -61,7 +61,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.copy, color: Colors.black),
|
||||
))
|
||||
),
|
||||
@@ -71,24 +71,24 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
);
|
||||
} else if (widget.isDashboardInfo && widget.dashboard.infoWidget != null) {
|
||||
w = Container(
|
||||
width: 200,
|
||||
width: 250,
|
||||
height: widget.height,
|
||||
color: Colors.grey.shade300,
|
||||
child: Column( children: widget.dashboard.infoWidget != null ? widget.dashboard.infoWidget!() : [])
|
||||
);
|
||||
} else {
|
||||
w = Container( // SHORTCUT
|
||||
width: 200,
|
||||
width: 250,
|
||||
height: widget.height,
|
||||
color: Colors.grey.shade300,
|
||||
child: Column( children: [
|
||||
Container( padding: EdgeInsets.all(10), width: 200, height: 60,
|
||||
Container( padding: EdgeInsets.all(10), width: 250, height: 60,
|
||||
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
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("<${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: [
|
||||
Container( width: 250, 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: [
|
||||
@@ -293,7 +293,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
},
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
fillColor: widget.dashboard.defaultDashWidth <= 0 ? Colors.grey.shade200 : Colors.white,
|
||||
fillColor: widget.dashboard.defaultDashWidth <= 0 ? Colors.grey.shade300 : Colors.white,
|
||||
filled: true,
|
||||
labelText: "dash",
|
||||
labelStyle: TextStyle(fontSize: 10),
|
||||
@@ -330,7 +330,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
},
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
fillColor: widget.dashboard.defaultDashWidth <= 0 ? Colors.grey.shade200 : Colors.white,
|
||||
fillColor: widget.dashboard.defaultDashWidth <= 0 ? Colors.grey.shade300 : Colors.white,
|
||||
filled: true,
|
||||
labelText: "space",
|
||||
labelStyle: TextStyle(fontSize: 10),
|
||||
@@ -438,7 +438,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
},
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
fillColor: widget.dashboard.defaultDashWidth <= 0 ? Colors.grey.shade200 : Colors.white,
|
||||
fillColor: widget.dashboard.defaultDashWidth <= 0 ? Colors.grey.shade300 : Colors.white,
|
||||
filled: true,
|
||||
labelText: "forward size",
|
||||
labelStyle: TextStyle(fontSize: 10),
|
||||
@@ -490,7 +490,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
},
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
fillColor: widget.dashboard.defaultDashWidth <= 0 ? Colors.grey.shade200 : Colors.white,
|
||||
fillColor: widget.dashboard.defaultDashWidth <= 0 ? Colors.grey.shade300 : Colors.white,
|
||||
filled: true,
|
||||
labelText: "back size",
|
||||
labelStyle: TextStyle(fontSize: 10),
|
||||
@@ -516,7 +516,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
])
|
||||
])),
|
||||
widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container(
|
||||
width: 200,
|
||||
width: 250,
|
||||
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
Tooltip( message: "remove",
|
||||
@@ -562,7 +562,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
}
|
||||
return Column( children: [
|
||||
Container( // SHORTCUT
|
||||
width: 200,
|
||||
width: 250,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(color: Colors.grey.shade300, border: Border(bottom: BorderSide(color: Colors.grey, width: 1))),
|
||||
child: Row( children: [
|
||||
@@ -573,7 +573,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
child: Container( alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
color: widget.isDashboardInfo ? Colors.grey : Colors.grey.shade300,
|
||||
width: 100, child: Icon(Icons.info, color: Colors.white))
|
||||
width: 125, child: Icon(Icons.info, color: Colors.white))
|
||||
)
|
||||
),
|
||||
Tooltip(
|
||||
@@ -583,7 +583,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
|
||||
child: Container( alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 10),
|
||||
color: !widget.isDashboardInfo ? Colors.grey : Colors.grey.shade300,
|
||||
width: 100, child: Icon(Icons.format_paint, color: Colors.white)),
|
||||
width: 125, child: Icon(Icons.format_paint, color: Colors.white)),
|
||||
))
|
||||
])),
|
||||
w
|
||||
|
||||
Reference in New Issue
Block a user