This commit is contained in:
mr
2024-09-24 11:42:12 +02:00
parent 40a44848a8
commit dacda3b3a6
13 changed files with 32 additions and 30 deletions

View File

@@ -34,8 +34,7 @@ class Dashboard extends ChangeNotifier {
Map<String, dynamic> info = {};
bool scheduleActive = false;
String? id;
String name;
String defaultName = "";
String name = "";
bool isMenu = true;
bool isInfo = true;
bool isOpened = false;
@@ -76,7 +75,6 @@ class Dashboard extends ChangeNotifier {
// This is a workaround to set the handlerFeedbackOffset
// to improve the user experience on devices with touch screens
// This will prevent the handler being covered by user's finger
defaultName = name;
if (loadedGraph != null) { deserialize(loadedGraph!); }
if (handlerFeedbackOffset != null) {
this.handlerFeedbackOffset = handlerFeedbackOffset;
@@ -266,6 +264,7 @@ class Dashboard extends ChangeNotifier {
} catch (e) { print(e); }
elements.add(flow);
}
print("DASH " + name);
selectedMenuKey.currentState?.setState(() { });
chartMenuKey.currentState?.setState(() { });
addToHistory();
@@ -336,7 +335,10 @@ class Dashboard extends ChangeNotifier {
if (tempHistory.length >= 50) { tempHistory.removeAt(0); }
tempHistory.add(toMap());
history = tempHistory.map((e) => e).toList();
chartMenuKey.currentState?.setState(() { });
Future.delayed(Duration(seconds: 1), () {
chartMenuKey.currentState?.setState(() { });
});
;
}
bool isBack = false;
void back() {

View File

@@ -107,7 +107,6 @@ class FlowElement<T extends FlowData> extends ChangeNotifier {
return false;
}
factory FlowElement.fromMap(Dashboard dashboard, Map<String, dynamic> map) {
print("FlowElement.fromMap ${map}");
final e = FlowElement<T>(
element: (dashboard.transformToData != null
? dashboard.transformToData!(map['element'] ?? {})

View File

@@ -36,8 +36,15 @@ class FlowChartLeftMenuState<T extends FlowData> extends State<FlowChartLeftMenu
child: Stack( children: [
widget.dashboard.isMenu && widget.innerMenuWidth < 200 ? Wrap( alignment: WrapAlignment.start,
children: widget.getDraggable(items))
: ExpansionTile(
shape: const ContinuousRectangleBorder(side: BorderSide(color: Colors.transparent)),
: Theme(
data: Theme.of(context).copyWith(dividerColor: Colors.grey.shade300),
child: ExpansionTile(
collapsedShape: RoundedRectangleBorder(
side: BorderSide.none,
),
shape: RoundedRectangleBorder(
side: BorderSide.none,
),
initiallyExpanded: true,
title: SizedBox(
child : Row( children: [
@@ -57,7 +64,7 @@ class FlowChartLeftMenuState<T extends FlowData> extends State<FlowChartLeftMenu
child : Wrap( alignment: WrapAlignment.center,
children: widget.getDraggable(items))
)],
)
))
]
))
);

View File

@@ -35,7 +35,7 @@ class FlowChartMenuState extends State<FlowChartMenu> {
Padding( padding: EdgeInsets.only(right: 15),
child: InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () {
widget.dashboard.defaultName = "graph_${DateTime.now().toString().replaceAll(" ", "_").substring(0, DateTime.now().toString().length - 7)}";
widget.dashboard.name = "graph_${DateTime.now().toString().replaceAll(" ", "_").substring(0, DateTime.now().toString().length - 7)}";
widget.dashboard.isOpened = true;
showDialog(
barrierDismissible: false,

View File

@@ -21,8 +21,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
height: widget.height,
color: Colors.grey.shade300,
child: SingleChildScrollView( child: Column( children: [ ...widget.dashboard.infoItemWidget != null ?
widget.dashboard.infoItemWidget!(widget.dashboard.elementSelected.first.element)
: [],
widget.dashboard.infoItemWidget!(widget.dashboard.elementSelected.first.element) : [],
widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container(
width: 250,
margin: EdgeInsets.only(top: 15),
@@ -59,7 +58,7 @@ class FlowChartSelectedMenuState extends State<FlowChartSelectedMenu> {
Future.delayed(Duration(milliseconds: 100), () {
widget.dashboard.chartKey.currentState?.setState(() { });
});
}, child: Container( margin: EdgeInsets.only(left: 10, right: 10),
}, child: Container( margin: EdgeInsets.only(left: 10, right: 10, bottom: 10),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)),
width: 200, height: 30,
child: Icon(Icons.copy, color: Colors.black),