diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 7a43ebf..9e067c8 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":true,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"android":[{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":true,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_android-2.2.4/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.2/","native_build":true,"dependencies":[]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"macos":[{"name":"desktop_window","path":"/home/mr/.pub-cache/hosted/pub.dev/desktop_window-0.4.1/","native_build":true,"dependencies":[]},{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":true,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"linux":[{"name":"desktop_window","path":"/home/mr/.pub-cache/hosted/pub.dev/desktop_window-0.4.1/","native_build":true,"dependencies":[]},{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":false,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"windows":[{"name":"desktop_window","path":"/home/mr/.pub-cache/hosted/pub.dev/desktop_window-0.4.1/","native_build":true,"dependencies":[]},{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":false,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"web":[{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","dependencies":[]},{"name":"shared_preferences_web","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.1/","dependencies":[]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","dependencies":["device_info_plus"]}]},"dependencyGraph":[{"name":"desktop_window","dependencies":[]},{"name":"device_info_plus","dependencies":[]},{"name":"irondash_engine_context","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"super_native_extensions","dependencies":["irondash_engine_context","device_info_plus"]}],"date_created":"2025-02-17 10:27:14.942491","version":"3.24.3","swift_package_manager_enabled":false} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":true,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"android":[{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":true,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_android-2.2.4/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.2/","native_build":true,"dependencies":[]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"macos":[{"name":"desktop_window","path":"/home/mr/.pub-cache/hosted/pub.dev/desktop_window-0.4.1/","native_build":true,"dependencies":[]},{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":true,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"linux":[{"name":"desktop_window","path":"/home/mr/.pub-cache/hosted/pub.dev/desktop_window-0.4.1/","native_build":true,"dependencies":[]},{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":false,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"windows":[{"name":"desktop_window","path":"/home/mr/.pub-cache/hosted/pub.dev/desktop_window-0.4.1/","native_build":true,"dependencies":[]},{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","native_build":false,"dependencies":[]},{"name":"irondash_engine_context","path":"/home/mr/.pub-cache/hosted/pub.dev/irondash_engine_context-0.5.4/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/home/mr/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","native_build":true,"dependencies":["irondash_engine_context","device_info_plus"]}],"web":[{"name":"device_info_plus","path":"/home/mr/.pub-cache/hosted/pub.dev/device_info_plus-10.1.2/","dependencies":[]},{"name":"shared_preferences_web","path":"/home/mr/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.1/","dependencies":[]},{"name":"super_native_extensions","path":"/home/mr/.pub-cache/hosted/pub.dev/super_native_extensions-0.8.19/","dependencies":["device_info_plus"]}]},"dependencyGraph":[{"name":"desktop_window","dependencies":[]},{"name":"device_info_plus","dependencies":[]},{"name":"irondash_engine_context","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"super_native_extensions","dependencies":["irondash_engine_context","device_info_plus"]}],"date_created":"2025-02-18 14:03:02.303066","version":"3.24.3","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/lib/core/services/api_service.dart b/lib/core/services/api_service.dart index 6b18441..1a0165c 100644 --- a/lib/core/services/api_service.dart +++ b/lib/core/services/api_service.dart @@ -105,8 +105,7 @@ class APIService { BuildContext? context, Options? options) async { var err = ""; try { - var type = localStorage.getItem('tokenType') ?? "bearer"; - _dio.options.headers["Authorization"] = "${type[0].toUpperCase() + type.substring(1)} ${localStorage.getItem('accessToken') ?? ""}"; + _dio.options.headers["Authorization"] = "Bearer ${localStorage.getItem('accessToken') ?? ""}"; _dio.interceptors.clear(); var response = await _request(url, method, body, options); if (response.statusCode != null && response.statusCode! < 400) { @@ -145,9 +144,8 @@ class APIService { var err = ""; if (url != "") { try { - var type = localStorage.getItem('tokenType') ?? "bearer"; _dio.options.headers["Authorization"] = - "${type[0].toUpperCase() + type.substring(1)} ${localStorage.getItem('accessToken') ?? ""}"; + "Bearer ${localStorage.getItem('accessToken') ?? ""}"; _dio.interceptors.clear(); var response = await _request(url, method, body, null); if (response.statusCode != null && response.statusCode! < 400) { diff --git a/lib/core/services/auth.service.dart b/lib/core/services/auth.service.dart index 61aa3cc..da5b6b9 100644 --- a/lib/core/services/auth.service.dart +++ b/lib/core/services/auth.service.dart @@ -1,5 +1,4 @@ import 'package:localstorage/localstorage.dart'; -import 'package:oc_front/core/conf/conf_reader.dart'; import 'package:oc_front/core/services/api_service.dart'; import 'package:oc_front/core/services/perms_service.dart'; import 'package:oc_front/main.dart'; @@ -9,7 +8,7 @@ class AuthService { static var isAuth = const bool.fromEnvironment('AUTH_MODE', defaultValue: false); static const _clientID = String.fromEnvironment('CLIENT_ID', defaultValue: 'test-client'); static APIService service = APIService( - baseURL: AppConfig().get('AUTH_HOST', defaultValue: 'http://localhost:8080/auth'), + baseURL: const String.fromEnvironment('AUTH_HOST', defaultValue: 'http://localhost:8080/auth'), ); static Future init() async { diff --git a/lib/core/services/specialized_services/check_service.dart b/lib/core/services/specialized_services/check_service.dart deleted file mode 100644 index 00c709b..0000000 --- a/lib/core/services/specialized_services/check_service.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'package:flutter/widgets.dart'; -import 'package:oc_front/core/services/api_service.dart'; -import 'package:oc_front/core/services/specialized_services/abstract_service.dart'; -import 'package:oc_front/models/response.dart'; -import 'package:oc_front/models/workflow.dart'; - -class CheckService extends AbstractService { - @override - late final APIService service; - - @override - String subPath = "/check/"; - - CheckService() { - service = APIService( - baseURL: super - .conf - .get('CHECK_HOST', defaultValue: 'http://localhost:8080/check')); - } - - Future> search( - BuildContext? context, List words, Map params) { - return service.get("$subPath${words.join("/")}", true, context); - } - - @override - Future> all(BuildContext? context) { - throw UnimplementedError(); - } - - @override - Future> get(BuildContext? context, String id) { - throw UnimplementedError(); - } - - @override - Future> post(BuildContext? context, - Map body, Map params) { - throw UnimplementedError(); - } - - @override - Future> put(BuildContext? context, String id, - Map body, Map params) { - throw UnimplementedError(); - } - - @override - Future> delete( - BuildContext? context, String id, Map params) { - throw UnimplementedError(); - } -} diff --git a/lib/core/services/specialized_services/workflow_scheduler_service.dart b/lib/core/services/specialized_services/workflow_scheduler_service.dart index 04d5c4e..51c92e2 100644 --- a/lib/core/services/specialized_services/workflow_scheduler_service.dart +++ b/lib/core/services/specialized_services/workflow_scheduler_service.dart @@ -4,25 +4,25 @@ import 'package:oc_front/core/services/specialized_services/abstract_service.dar import 'package:oc_front/models/response.dart'; import 'package:oc_front/models/workflow.dart'; -class SchedulerService extends AbstractService { - @override APIService service = APIService( +class SchedulerService extends AbstractService { + @override APIService service = APIService( baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8080/scheduler') ); @override String subPath = "/"; - Future> schedule(BuildContext? context, String id, Map body, Map params) { - print("$subPath$id"); + Future> schedule(BuildContext? context, String id, Map body, Map params) { + print(body); return service.post("$subPath$id", body, context); } - @override Future> search(BuildContext? context, List words, Map params) { + @override Future> search(BuildContext? context, List words, Map params) { return throw UnimplementedError(); } - @override Future> post(BuildContext? context, Map body, Map params) { + @override Future> post(BuildContext? context, Map body, Map params) { return throw UnimplementedError(); } - @override Future> put(BuildContext? context, String id, Map body, Map params) { + @override Future> put(BuildContext? context, String id, Map body, Map params) { return throw UnimplementedError(); } } \ No newline at end of file diff --git a/lib/core/services/specialized_services/workflow_service.dart b/lib/core/services/specialized_services/workflow_service.dart index 1b75606..472ff72 100644 --- a/lib/core/services/specialized_services/workflow_service.dart +++ b/lib/core/services/specialized_services/workflow_service.dart @@ -1,8 +1,11 @@ +import 'package:flutter/material.dart'; import 'package:oc_front/core/services/api_service.dart'; import 'package:oc_front/core/services/specialized_services/abstract_service.dart'; +import 'package:oc_front/models/response.dart'; import 'package:oc_front/models/workflow.dart'; class WorflowService extends AbstractService { + late final APIService serviceCheck; @override late final APIService service; @override @@ -12,5 +15,13 @@ class WorflowService extends AbstractService { service = APIService( baseURL: super.conf.get('WORKFLOW_HOST', defaultValue: 'http://localhost:8080/workflow')); + serviceCheck = APIService( + baseURL: super.conf.get('WORKFLOW_HOST', + defaultValue: 'http://localhost:8080/workflow')); + } + + Future> check( + BuildContext? context, List words, Map params) { + return serviceCheck.get("${subPath}check/${words.join("/")}", true, context); } } diff --git a/lib/pages/map.dart b/lib/pages/map.dart index 453dcf6..70e3aa8 100644 --- a/lib/pages/map.dart +++ b/lib/pages/map.dart @@ -42,7 +42,7 @@ class MapPageWidgetState extends State { return FutureBuilder(future: widget._service.all(context), builder: (BuildContext context, AsyncSnapshot snapshot) { Map> coordinates = {}; List markerCoordinates = []; - if (snapshot.data != null&& snapshot.data!.data != null && snapshot.data!.data!.values.isNotEmpty) { + if (snapshot.data != null&& snapshot.data!.data != null) { for (var element in snapshot.data!.data!.values) { if (element["type"] == "storage") { StorageItem resource = StorageItem().deserialize(element); diff --git a/lib/widgets/forms/scheduler_forms.dart b/lib/widgets/forms/scheduler_forms.dart index 846c673..7b99048 100644 --- a/lib/widgets/forms/scheduler_forms.dart +++ b/lib/widgets/forms/scheduler_forms.dart @@ -18,7 +18,6 @@ import 'package:flutter_flow_chart/flutter_flow_chart.dart'; import 'package:oc_front/widgets/inputs/shallow_text_input.dart'; import 'package:oc_front/core/models/shared_workspace_local.dart'; import 'package:datetime_picker_formfield/datetime_picker_formfield.dart'; -import 'package:oc_front/core/services/specialized_services/check_service.dart'; import 'package:oc_front/core/services/specialized_services/workflow_service.dart'; // ignore: must_be_immutable @@ -40,9 +39,8 @@ class SchedulerFormsWidget extends StatefulWidget { @override SchedulerFormsWidgetState createState() => SchedulerFormsWidgetState(); } class SchedulerFormsWidgetState extends State { - CheckService check = CheckService(); + WorflowService check = WorflowService(); void save(List> formKeys) { - print("save"); widget.error = null; widget.errorEndDate = null; widget.errorCron = null; @@ -63,6 +61,7 @@ class SchedulerFormsWidgetState extends State { dash.error = "You need to link each processing element to a compute element"; } } + print("qdjqksdn ${dash.error}"); if (dash.error != null) { showAlertBanner( context, () {}, AlertAlertBannerChild(text: dash.error.toString()),// <-- Put any widget here you want! alertBannerLocation: AlertBannerLocation.bottom,); @@ -72,6 +71,7 @@ class SchedulerFormsWidgetState extends State { for (var k in formKeys) { if (k.currentState != null) { if (!k.currentState!.validate()) { + print("bwak"); return; } else { k.currentState!.save();} } @@ -84,7 +84,14 @@ class SchedulerFormsWidgetState extends State { } } Duration durationBefore = widget.schedule.start!.difference(DateTime.now().toUtc()) + Duration(seconds: 5); - widget._schedulerService.schedule(context, widget.item.id ?? "", widget.schedule.serialize(), {}).then((value) { + print("qdjqksdn ${widget.item.id}"); + widget._schedulerService.schedule(context, widget.item.id ?? "", widget.schedule.serialize(), {}).catchError( (e) { + print("THERE2"); + setState(() { + widget.error = e.toString(); + }); + }).then((value) { + print("THERE"); setState(() { widget.valid = true; }); Future.delayed(durationBefore, () { try { @@ -110,7 +117,7 @@ class SchedulerFormsWidgetState extends State { } else { e = widget.schedule.end!.toUtc().toIso8601String(); } - check.search(context, [widget.item.id ?? "", s.substring(0, 19), e.substring(0, 19)], {}).then( + check.check(context, [widget.item.id ?? "", s.substring(0, 19), e.substring(0, 19)], {}).then( (v) { if (v.data == null) { return; } widget.booking = v.data!.isAvailable; @@ -494,12 +501,11 @@ class SchedulerFormsWidgetState extends State { onTap: () { PermsService.getPerm(Perms.WORKFLOW_BOOKING) ? checkBooking(formKeys, null) : null; }, child: Container( margin: const EdgeInsets.only(bottom: 5, left: 10, right: 10), decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), - border: Border.all(color: widget.booking == null ? ( - PermsService.getPerm(Perms.WORKFLOW_BOOKING) && PermsService.getPerm(Perms.WORKFLOW_EDIT) ? Colors.black : Colors.grey) : ( + border: Border.all(color: widget.booking == null ? Colors.black : ( widget.booking == true ? Colors.green : redColor), width: 1)), width: 200, height: 30, child: Icon( Icons.verified_outlined, - color: widget.booking == null ? Colors.black : (widget.booking == true ? Colors.green : redColor)), + color: widget.booking == null ? Colors.black : (widget.booking == true ? Colors.green : redColor)), )) ): Container(), PermsService.getPerm(Perms.WORKFLOW_BOOKING) ? Tooltip( message: "book", child: InkWell( mouseCursor: SystemMouseCursors.click, @@ -507,7 +513,7 @@ class SchedulerFormsWidgetState extends State { setState(() { save(formKeys); }); }, child: Container( margin: const EdgeInsets.only(top: 5, bottom: 10, left: 10, right: 10), decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), - border: Border.all(color: dash.error != null ? Colors.red : ( PermsService.getPerm(Perms.WORKFLOW_BOOKING) ?(widget.valid ? Colors.green : Colors.black) : Colors.grey ))), + border: Border.all(color: dash.error != null ? Colors.red : (widget.valid ? Colors.green : Colors.black) )), width: 200, height: 30, child: Icon(Icons.schedule_send, color: dash.error != null ? Colors.red : (widget.valid ? Colors.green : Colors.black)), )) diff --git a/library/flutter_flow_chart/lib/src/flow_chart.dart b/library/flutter_flow_chart/lib/src/flow_chart.dart index 1d06592..5c8db79 100755 --- a/library/flutter_flow_chart/lib/src/flow_chart.dart +++ b/library/flutter_flow_chart/lib/src/flow_chart.dart @@ -313,27 +313,34 @@ class FlowChartState extends State { @override Widget build(BuildContext context) { + if (!widget.dashboard.isOpened && widget.onDashboardAlertOpened != null ) { if (widget.dashboard.id != null) { widget.dashboard.isOpened = true; - Future.delayed(Duration(milliseconds: 100), () => widget.dashboard.load!(widget.dashboard.id!) ); + Future.delayed(const Duration(milliseconds: 100), () => widget.dashboard.load!(widget.dashboard.id!) ); } else { - Future.delayed(Duration(milliseconds: 100), () { - if (!widget.dashboard.inDialog) { - widget.dashboard.inDialog = true; - 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)); - - }); - } - }); + try { + Future.delayed(const Duration(milliseconds: 100), () { + if (!widget.dashboard.inDialog) { + widget.dashboard.inDialog = true; + 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)); + + }); + } + }); + } catch (e) { + widget.dashboard.id = null; + widget.dashboard.name = ""; + widget.dashboard.isOpened = false; + } } } else { widget.dashboard.isOpened = true; @@ -816,9 +823,9 @@ class ChartWidgetState extends State { for (int i = 0; i < widget.dashboard.elements.length; i++) ElementWidget( key: UniqueKey(), - bottomLeftBadge: widget.flowChart.widget.itemLeftBottomBadges != null ? + bottomLeftBadge: widget.flowChart.widget.itemLeftBottomBadges != null && widget.dashboard.elements[i].element != null ? widget.flowChart.widget.itemLeftBottomBadges!(widget.dashboard.elements[i].element as T) : null, - topRightBadge: widget.flowChart.widget.itemrightTopBadges != null ? + topRightBadge: widget.flowChart.widget.itemrightTopBadges != null && widget.dashboard.elements[i].element != null ? widget.flowChart.widget.itemrightTopBadges!(widget.dashboard.elements[i].element as T) : null, dashboard: widget.dashboard, element: widget.dashboard.elements.elementAt(i), diff --git a/library/flutter_flow_chart/lib/src/flow_chart_menu.dart b/library/flutter_flow_chart/lib/src/flow_chart_menu.dart index fa8418c..f1b9626 100644 --- a/library/flutter_flow_chart/lib/src/flow_chart_menu.dart +++ b/library/flutter_flow_chart/lib/src/flow_chart_menu.dart @@ -23,19 +23,19 @@ class FlowChartMenuState extends State { return Row( mainAxisAlignment: MainAxisAlignment.end, children : [ Container( // SHORTCUT width: widget.width, height: 50, - padding: EdgeInsets.only(left: 20), + padding: const EdgeInsets.only(left: 20), color: widget.dashboard.dashColor, child: Row( children : [ Expanded(flex: 2, child: Row( children: [ widget.chart.widget.flowChart.widget.onDashboardAlertOpened == null ? Container() : Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( border: Border(right: BorderSide(color: Colors.white, width: 1)) ), child: Row( children: [ - Tooltip( message: "open file", child:Container( child: - Padding( padding: EdgeInsets.only(right: 15), + Tooltip( message: "open file", child: Padding( padding: const EdgeInsets.only(right: 15), child: InkWell( mouseCursor: SystemMouseCursors.click, onTap: () { - widget.dashboard.name = "graph_${DateTime.now().toString().replaceAll(" ", "_").substring(0, DateTime.now().toString().length - 7)}"; + widget.dashboard.id = null; + widget.dashboard.name = ""; widget.dashboard.isOpened = true; if (!widget.dashboard.inDialog) { widget.dashboard.inDialog = true; @@ -52,7 +52,7 @@ class FlowChartMenuState extends State { }); } }, - child: Icon(Icons.folder, color: Colors.white))))), + child: Icon(Icons.folder, color: Colors.white)))), ])), InkWell( mouseCursor: SystemMouseCursors.click, child: Container( decoration: BoxDecoration(