UI debugging + git ignore
This commit is contained in:
@@ -30,8 +30,7 @@ class Dashboard extends ChangeNotifier {
|
||||
List<Map<String, dynamic>> tempHistory = [];
|
||||
List<Map<String, dynamic>> history = [];
|
||||
Map<String, dynamic> scheduler = {};
|
||||
Map<String, bool> schedulerState = {};
|
||||
bool schedulerSave = false;
|
||||
bool scheduleActive = false;
|
||||
String? id;
|
||||
String name;
|
||||
String defaultName = "";
|
||||
@@ -108,6 +107,7 @@ class Dashboard extends ChangeNotifier {
|
||||
map['defaultArrowDirection'] as int? ?? 0],
|
||||
defaultArrowStyle: ArrowStyle.values[map['arrowStyle'] as int? ?? 0],
|
||||
);
|
||||
d..scheduleActive = map['schedule_active'] as bool? ?? false;
|
||||
d..arrows = List<ArrowPainter>.from(
|
||||
(map['arrows'] as List<dynamic>).map<ArrowPainter>(
|
||||
(x) => ArrowPainter.fromMap(x as Map<String, dynamic>),
|
||||
@@ -137,6 +137,7 @@ class Dashboard extends ChangeNotifier {
|
||||
}
|
||||
|
||||
void copyFromMap(Map<String, dynamic> map) {
|
||||
scheduleActive = map['schedule_active'] as bool? ?? false;
|
||||
scheduler = map['schedule'] as Map<String, String>? ?? {};
|
||||
defaultArrowStyle = ArrowStyle.values[map['arrowStyle'] as int? ?? 0];
|
||||
defaultDashSpace = map['defaultDashSpace'] as double? ?? 0;
|
||||
@@ -222,17 +223,16 @@ class Dashboard extends ChangeNotifier {
|
||||
d["id"]=id;
|
||||
d["name"]=name;
|
||||
d["graph"]=graph;
|
||||
if (schedulerSave) {
|
||||
d["schedule"]=scheduler;
|
||||
}
|
||||
d["schedule"]=scheduler;
|
||||
d["schedule_active"]=scheduleActive;
|
||||
return d;
|
||||
}
|
||||
|
||||
void deserialize(Map<String, dynamic> graph) {
|
||||
elements = [];
|
||||
arrows = [];
|
||||
print(graph['schedule']);
|
||||
scheduler = graph['schedule'] ?? {};
|
||||
scheduleActive = graph['schedule_active'] ?? false;
|
||||
setZoomFactor(graph["graph"]?["zoom"] ?? 1.0);
|
||||
for(var el in graph['graph']?['elements'] ?? []) {
|
||||
List<ConnectionParams> nexts = [];
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
|
||||
import 'package:flutter_flow_chart/src/dashboard.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
/// Kinf od element
|
||||
|
||||
@@ -19,6 +19,9 @@ import 'package:uuid/uuid.dart';
|
||||
abstract class FlowData {
|
||||
String getID();
|
||||
String getName();
|
||||
double? getWidth();
|
||||
double? getHeight();
|
||||
|
||||
Map<String, dynamic> serialize();
|
||||
FlowData deserialize(Map<String, dynamic> data);
|
||||
}
|
||||
@@ -297,6 +300,20 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!widget.dashboard.isOpened && widget.onDashboardAlertOpened != null ) {
|
||||
Future.delayed(Duration(milliseconds: 100), () {
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
titlePadding: EdgeInsets.zero,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
backgroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0)),
|
||||
title: widget.onDashboardAlertOpened!(context, widget.dashboard));
|
||||
|
||||
}); });
|
||||
}
|
||||
/// get dashboard position after first frame is drawn
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
if (mounted) {
|
||||
@@ -379,9 +396,6 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
if (change) {
|
||||
DrawingArrow.instance.notifyListeners();
|
||||
widget.dashboard.chartKey.currentState?.setState(() { });
|
||||
/*Future.delayed(Duration(milliseconds: 10), () {
|
||||
node.requestFocus();
|
||||
});*/
|
||||
}
|
||||
},
|
||||
child: ClipRect(
|
||||
@@ -421,12 +435,16 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
onAcceptWithDetails: (DragTargetDetails<T> details) {
|
||||
var e = details.data;
|
||||
String newID = const Uuid().v4();
|
||||
double ratio = 1;
|
||||
if (e.getWidth() != null && e.getHeight() != null) {
|
||||
ratio = (e.getHeight()! / (e.getWidth()! - 30));
|
||||
}
|
||||
FlowElement<T> el = FlowElement<T>(
|
||||
dashboard: widget.dashboard,
|
||||
id: newID,
|
||||
element: e,
|
||||
position: details.offset,
|
||||
size: const Size(100, 100),
|
||||
size: Size(100, 100 * ratio),
|
||||
text: '${widget.dashboard.elements.length}',
|
||||
handlerSize: 15,
|
||||
widget: widget.itemWidget(e),
|
||||
@@ -477,33 +495,22 @@ class FlowChartState<T extends FlowData> extends State<FlowChart> {
|
||||
onDragEnd: (d) => node.requestFocus(),
|
||||
childWhenDragging: Opacity(opacity: .5,
|
||||
child: Padding( padding: const EdgeInsets.all(10),
|
||||
child: Container( height: realSize - 20, child: widget.itemWidget(e) ))),
|
||||
feedback: Container( height: realSize, child: widget.itemWidget(e) ),
|
||||
child: Container( child: widget.itemWidget(e),
|
||||
constraints: BoxConstraints(maxHeight: realSize - 20, maxWidth: realSize - 20), ))),
|
||||
feedback: Container( constraints: BoxConstraints(maxHeight: realSize, maxWidth: realSize),
|
||||
child: widget.itemWidget(e) ),
|
||||
child: InkWell( mouseCursor: SystemMouseCursors.grab, child: Padding( padding: const EdgeInsets.all(10),
|
||||
child: widget.itemWidgetTooltip != null ? HoverMenu( key: hoverKey, width: 400, title: Container(
|
||||
height: realSize - 20, child: widget.itemWidget(e) ),
|
||||
constraints: BoxConstraints( maxHeight: realSize - 20, maxWidth: realSize - 20),
|
||||
child: widget.itemWidget(e) ),
|
||||
items: [
|
||||
Container(child: widget.itemWidgetTooltip!(e)),
|
||||
]
|
||||
) : Container(
|
||||
height: realSize - 20, child: widget.itemWidget(e)
|
||||
constraints: BoxConstraints(maxHeight: realSize - 20, maxWidth: realSize - 20), child: widget.itemWidget(e)
|
||||
)
|
||||
) )));
|
||||
}
|
||||
if (!widget.dashboard.isOpened && widget.onDashboardAlertOpened != null ) {
|
||||
Future.delayed(Duration(milliseconds: 100), () {
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
titlePadding: EdgeInsets.zero,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
backgroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0)),
|
||||
title: widget.onDashboardAlertOpened!(context, widget.dashboard));
|
||||
|
||||
}); });
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user