diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index f2334ad..3c660ac 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-19 08:16:56.698121","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-20 15:37:10.805438","version":"3.24.3","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 004f867..eef5d87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,15 @@ FROM debian:latest AS build-env RUN apt-get update RUN apt-get install -y curl git unzip -ARG WORKSPACE_HOST="http://localhost:8089/oc" -ARG WORKFLOW_HOST="http://localhost:8088/oc" -ARG ITEM_HOST="http://localhost:8087/oc" -ARG SCHEDULER_HOST="http://localhost:8090/oc" -ARG LOGS_HOST="http://localhost:3100" -ARG PEER_HOST="http://localhost:8093/oc" -ARG DATACENTER_HOST="http://localhost:8092/oc" -ARG COLLABORATIVE_AREA_HOST="http://localhost:8091/oc" +ARG WORKSPACE_HOST=${WORKSPACE_HOST:-"http://localhost:8000/workspace"} +ARG WORKFLOW_HOST=${WORKFLOW_HOST:-"http://localhost:8000/workflow"} +ARG ITEM_HOST=${ITEM_HOST:-"http://localhost:8000/catalog"} +ARG SCHEDULER_HOST=${SCHEDULER_HOST:-"http://localhost:8000/scheduler"} +ARG LOGS_HOST=${LOGS_HOST:-"http://localhost:8000/tools/loki"} +ARG PEER_HOST=${PEER_HOST:-"http://localhost:8000/peer"} +ARG DATACENTER_HOST=${DATACENTER_HOST:-"http://localhost:8000/datacenter"} +ARG COLLABORATIVE_AREA_HOST=${COLLABORATIVE_AREA_HOST:-"http://localhost:8000/shared"} +ARG AUTH_HOST=${AUTH_HOST:-"http://localhost:8000/auth"} ARG AUTH_MODE=true # define variables ARG FLUTTER_SDK=/usr/local/flutter diff --git a/assets/config/front.json b/assets/config/front.json index 20059e8..6fe52f0 100644 --- a/assets/config/front.json +++ b/assets/config/front.json @@ -1,12 +1,12 @@ { -"WORKSPACE_HOST": "http://localhost:8089/oc", -"WORKFLOW_HOST": "http://localhost:8088/oc", -"ITEM_HOST": "http://localhost:8087/oc", -"SCHEDULER_HOST": "http://localhost:8090/oc", -"LOGS_HOST": "http://localhost:3100", -"PEER_HOST": "http://localhost:8093/oc", -"DATACENTER_HOST": "http://localhost:8092/oc", -"COLLABORATIVE_AREA_HOST": "http://localhost:8091/oc", -"HOST": "http://localhost:8089/oc", -"AUTH_HOST": "http://localhost:8080/auth" +"WORKSPACE_HOST": "http://localhost:8000/workspace", +"WORKFLOW_HOST": "http://localhost:8000/workflow", +"ITEM_HOST": "http://localhost:8000/catalog", +"SCHEDULER_HOST": "http://localhost:8000/scheduler", +"LOGS_HOST": "http://localhost:8000/tools/loki", +"PEER_HOST": "http://localhost:8000/peer", +"DATACENTER_HOST": "http://localhost:8000/datacenter", +"COLLABORATIVE_AREA_HOST": "http://localhost:8000/shared", +"HOST": "http://localhost:8000", +"AUTH_HOST": "http://localhost:8000/auth" } diff --git a/docker-compose.yml b/docker-compose.yml index e4569a0..4b56cd3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,14 @@ services: - 8080:80 networks: - catalog + labels: + - "traefik.enable=true" + - "traefik.http.routers.front.entrypoints=web" + - "traefik.http.routers.front.rule=PathPrefix(`/`)" + - "traefik.http.services.front.loadbalancer.server.port=80" + - "traefik.http.middlewares.front-stripprefix.stripprefix.prefixes=/" + - "traefik.http.routers.front.middlewares=front-stripprefix" + - "traefik.http.middlewares.front.forwardauth.address=http://oc-auth:8080/oc/forward" networks: catalog: external: true \ No newline at end of file diff --git a/lib/core/conf/conf_reader.dart b/lib/core/conf/conf_reader.dart index e33e62f..1e473a8 100644 --- a/lib/core/conf/conf_reader.dart +++ b/lib/core/conf/conf_reader.dart @@ -12,7 +12,6 @@ class AppConfig { Future loadConfig() async { final response = await rootBundle.loadString('assets/config/front.json'); _config = Map.from(json.decode(response)); - print('Config loaded: $_config'); } String get(String key, {String defaultValue = ''}) { diff --git a/lib/core/models/workspace_local.dart b/lib/core/models/workspace_local.dart index 5524c23..0a576c7 100644 --- a/lib/core/models/workspace_local.dart +++ b/lib/core/models/workspace_local.dart @@ -29,6 +29,7 @@ class WorkspaceLocal { static List items = []; static Future init(BuildContext? context, bool changeCurrent) async { + WorkspaceLocal.createWorkspace("default workspace", null); var value = await _service.all(context); if (value.data != null && value.data!.values.isNotEmpty ) { var vals = value.data!.values; @@ -47,8 +48,6 @@ class WorkspaceLocal { fill(); HeaderConstants.headerKey.currentState?.setState(() {}); } - } else { - await WorkspaceLocal.createWorkspace("default workspace", null); } } @@ -108,7 +107,7 @@ class WorkspaceLocal { WorkflowFactory.key.currentState?.setState(() {}); HeaderConstants.headerKey.currentState?.setState(() {}); } - }); + }).catchError( (e) {}); } static void changeWorkspaceByName(String name) { diff --git a/lib/core/services/api_service.dart b/lib/core/services/api_service.dart index 1a0165c..2a26274 100644 --- a/lib/core/services/api_service.dart +++ b/lib/core/services/api_service.dart @@ -18,7 +18,7 @@ class APIService { Dio _dio = Dio( BaseOptions( - baseUrl: const String.fromEnvironment('HOST', defaultValue: 'http://localhost:8080'), // you can keep this blank + baseUrl: const String.fromEnvironment('HOST', defaultValue: 'http://localhost:8000'), // you can keep this blank headers: { 'Content-Type': 'application/json; charset=UTF-8', 'Access-Control-Allow-Origin': '*' }, ), )..interceptors.add(LogInterceptor( diff --git a/lib/core/services/auth.service.dart b/lib/core/services/auth.service.dart index da5b6b9..74ab1ac 100644 --- a/lib/core/services/auth.service.dart +++ b/lib/core/services/auth.service.dart @@ -5,10 +5,10 @@ import 'package:oc_front/main.dart'; import 'package:oc_front/models/response.dart'; class AuthService { - static var isAuth = const bool.fromEnvironment('AUTH_MODE', defaultValue: false); + static var isAuth = const bool.fromEnvironment('AUTH_MODE', defaultValue: true); static const _clientID = String.fromEnvironment('CLIENT_ID', defaultValue: 'test-client'); static APIService service = APIService( - baseURL: const String.fromEnvironment('AUTH_HOST', defaultValue: 'http://localhost:8080/auth'), + baseURL: const String.fromEnvironment('AUTH_HOST', defaultValue: 'http://localhost:8000/auth'), ); static Future init() async { diff --git a/lib/core/services/enum_service.dart b/lib/core/services/enum_service.dart index 6644d5d..f78545b 100644 --- a/lib/core/services/enum_service.dart +++ b/lib/core/services/enum_service.dart @@ -4,7 +4,7 @@ import 'package:oc_front/core/services/api_service.dart'; class EnumService { static final APIService _service = APIService( baseURL: const String.fromEnvironment('ITEM_HOST', - defaultValue: 'http://localhost:8080/catalog') + defaultValue: 'http://localhost:8000/catalog') ); static String subPath = "/enum/"; static Map> enums = {}; diff --git a/lib/core/services/perms_service.dart b/lib/core/services/perms_service.dart index 203049c..3be9fc8 100644 --- a/lib/core/services/perms_service.dart +++ b/lib/core/services/perms_service.dart @@ -71,7 +71,6 @@ class PermsService { try { var what = json.decode(foo); what = what["session"]["access_token"] as Map; - for (var w in perms.keys) { if (what.keys.contains(perms[w])) { _perms[w] = true; diff --git a/lib/core/services/router.dart b/lib/core/services/router.dart index 1771b99..2d1892b 100644 --- a/lib/core/services/router.dart +++ b/lib/core/services/router.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:oc_front/core/sections/header/header.dart'; import 'package:oc_front/main.dart'; import 'package:oc_front/pages/abstract_page.dart'; @@ -42,7 +44,8 @@ class RouterItem { void go(BuildContext context, Map params) { AppRouter.currentRoute = this; - var newPath = "$path"; + var newPath = path; + AppRouter.setRouteCookie(newPath, params, context); for (var arg in args) { newPath = newPath.replaceAll(":$arg", params[arg] ?? ""); } Future.delayed( const Duration(seconds: 1), () { HeaderConstants.setTitle(null); @@ -87,6 +90,29 @@ class AppRouter { }); } + static verifyRoute(context) async { + var url = await getRouteCookie(); + if (url != null && url != "") { + for (var zone in zones) { + print("URL: $url ${zone.route}"); + if (zone.route == url.replaceAll("/", "")) { + Map params = {}; + var srcParams = await getRouteParamsCookie(); + for (var key in srcParams.keys) { + params[key] = "${srcParams[key]}"; + } + zone.go(context, params); + return; + } + } + } + } + + static Future> getRouteParamsCookie() async { + final SharedPreferences prefs = await SharedPreferences.getInstance(); + return prefs.getString("params") != null && prefs.getString("params") != "" ? json.decode(prefs.getString("params")!) : {}; + } + static Future getRouteCookie() async { final SharedPreferences prefs = await SharedPreferences.getInstance(); return prefs.getString("url") != "" ? prefs.getString("url") : null; @@ -95,11 +121,13 @@ class AppRouter { static removeRouteCookie() async { final SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.remove("url"); + prefs.remove("params"); } - static setRouteCookie( String path , BuildContext context ) async { + static setRouteCookie( String path, Map params, BuildContext context ) async { final SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.setString("url", path); + prefs.setString("params", params.toString()); if (realHistory.isNotEmpty && realHistory.last != path || realHistory.isEmpty) { try { var index = history.indexOf(realHistory.last); @@ -122,7 +150,6 @@ class AppRouter { final SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.setString("url", realHistory.last); prefs.setString("history", realHistory.join(",")); - var splitted = realHistory.last.split(":"); routerKey.currentState?.setState(() { }); scaffoldKey.currentState?.setState(() {}); } @@ -139,7 +166,6 @@ class AppRouter { realHistory.add(history[index + 1]); final SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.setString("url", realHistory.last); - var splitted = realHistory.last.split(":"); prefs.setString("history", realHistory.join(",")); routerKey.currentState?.setState(() { }); scaffoldKey.currentState?.setState(() {}); diff --git a/lib/core/services/specialized_services/booking_service.dart b/lib/core/services/specialized_services/booking_service.dart index 95f0314..6761164 100644 --- a/lib/core/services/specialized_services/booking_service.dart +++ b/lib/core/services/specialized_services/booking_service.dart @@ -6,7 +6,7 @@ import 'package:oc_front/models/workflow.dart'; class BookingExecutionService extends AbstractService { @override APIService service = APIService( - baseURL: const String.fromEnvironment('DATACENTER_HOST', defaultValue: 'http://localhost:8080/datacenter') + baseURL: const String.fromEnvironment('DATACENTER_HOST', defaultValue: 'http://localhost:8000/datacenter') ); @override String subPath = "/booking/"; diff --git a/lib/core/services/specialized_services/datacenter_service.dart b/lib/core/services/specialized_services/datacenter_service.dart index ade9525..c4ef324 100644 --- a/lib/core/services/specialized_services/datacenter_service.dart +++ b/lib/core/services/specialized_services/datacenter_service.dart @@ -6,7 +6,7 @@ import 'package:oc_front/models/response.dart'; class DatacenterService extends AbstractService { @override APIService service = APIService( - baseURL: const String.fromEnvironment('DATACENTER_HOST', defaultValue: 'http://localhost:8080/datacenter') + baseURL: const String.fromEnvironment('DATACENTER_HOST', defaultValue: 'http://localhost:8000/datacenter') ); @override String subPath = "/"; diff --git a/lib/core/services/specialized_services/logs_service.dart b/lib/core/services/specialized_services/logs_service.dart index 8c9be00..e44ade8 100644 --- a/lib/core/services/specialized_services/logs_service.dart +++ b/lib/core/services/specialized_services/logs_service.dart @@ -11,10 +11,9 @@ class LogsService extends AbstractService { @override String subPath = "/loki/api/v1/"; - LogService() { + LogsService() { service = APIService( - baseURL: - super.conf.get('LOGS_HOST', defaultValue: 'http://localhost:3100')); + baseURL: super.conf.get('LOGS_HOST', defaultValue: 'http://localhost:8000/tools/loki')); } @override diff --git a/lib/core/services/specialized_services/peer_service.dart b/lib/core/services/specialized_services/peer_service.dart index 3465a07..93bdee7 100644 --- a/lib/core/services/specialized_services/peer_service.dart +++ b/lib/core/services/specialized_services/peer_service.dart @@ -12,6 +12,6 @@ class PeerService extends AbstractService { service = APIService( baseURL: super .conf - .get('PEER_HOST', defaultValue: 'http://localhost:8080/peer')); + .get('PEER_HOST', defaultValue: 'http://localhost:8000/peer')); } } diff --git a/lib/core/services/specialized_services/resource_service.dart b/lib/core/services/specialized_services/resource_service.dart index ae8b937..04f74a9 100644 --- a/lib/core/services/specialized_services/resource_service.dart +++ b/lib/core/services/specialized_services/resource_service.dart @@ -15,7 +15,7 @@ class ResourceService extends AbstractService { service = APIService( baseURL: super .conf - .get('ITEM_HOST', defaultValue: 'http://localhost:8080/catalog')); + .get('ITEM_HOST', defaultValue: 'http://localhost:8000/catalog')); } @override diff --git a/lib/core/services/specialized_services/shared_service.dart b/lib/core/services/specialized_services/shared_service.dart index ccf2c0a..37e3cf0 100644 --- a/lib/core/services/specialized_services/shared_service.dart +++ b/lib/core/services/specialized_services/shared_service.dart @@ -14,7 +14,7 @@ class SharedService extends AbstractService { SharedService() { service = APIService( baseURL: super.conf.get('COLLABORATIVE_AREA_HOST', - defaultValue: 'http://localhost:8080/shared')); + defaultValue: 'http://localhost:8000/shared')); } Future> addWorkspace( diff --git a/lib/core/services/specialized_services/workflow_execution_service.dart b/lib/core/services/specialized_services/workflow_execution_service.dart index 1a3c203..0070400 100644 --- a/lib/core/services/specialized_services/workflow_execution_service.dart +++ b/lib/core/services/specialized_services/workflow_execution_service.dart @@ -6,14 +6,14 @@ import 'package:oc_front/models/workflow.dart'; class WorkflowExecutionService extends AbstractService { @override APIService service = APIService( - baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8080/scheduler') + baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8000/scheduler') ); @override String subPath = "/execution/"; WorkflowExecutionService() { service = APIService( baseURL: super.conf.get('SCHEDULER_HOST', - defaultValue: 'http://localhost:8080/scheduler')); + defaultValue: 'http://localhost:8000/scheduler')); } @override Future> search( diff --git a/lib/core/services/specialized_services/workflow_scheduler_service.dart b/lib/core/services/specialized_services/workflow_scheduler_service.dart index 51c92e2..1f2d869 100644 --- a/lib/core/services/specialized_services/workflow_scheduler_service.dart +++ b/lib/core/services/specialized_services/workflow_scheduler_service.dart @@ -6,12 +6,11 @@ import 'package:oc_front/models/workflow.dart'; class SchedulerService extends AbstractService { @override APIService service = APIService( - baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8080/scheduler') + baseURL: const String.fromEnvironment('SCHEDULER_HOST', defaultValue: 'http://localhost:8000/scheduler') ); @override String subPath = "/"; Future> schedule(BuildContext? context, String id, Map body, Map params) { - print(body); return service.post("$subPath$id", body, context); } diff --git a/lib/core/services/specialized_services/workflow_service.dart b/lib/core/services/specialized_services/workflow_service.dart index 472ff72..76d41f5 100644 --- a/lib/core/services/specialized_services/workflow_service.dart +++ b/lib/core/services/specialized_services/workflow_service.dart @@ -14,10 +14,10 @@ class WorflowService extends AbstractService { WorflowService() { service = APIService( baseURL: super.conf.get('WORKFLOW_HOST', - defaultValue: 'http://localhost:8080/workflow')); + defaultValue: 'http://localhost:8000/workflow')); serviceCheck = APIService( baseURL: super.conf.get('WORKFLOW_HOST', - defaultValue: 'http://localhost:8080/workflow')); + defaultValue: 'http://localhost:8000/workflow')); } Future> check( diff --git a/lib/core/services/specialized_services/workspace_service.dart b/lib/core/services/specialized_services/workspace_service.dart index 907a6fc..241d54d 100644 --- a/lib/core/services/specialized_services/workspace_service.dart +++ b/lib/core/services/specialized_services/workspace_service.dart @@ -12,6 +12,6 @@ class WorkspaceService extends AbstractService { WorkspaceService() { service = APIService( baseURL: super.conf.get('WORKSPACE_HOST', - defaultValue: 'http://localhost:8080/workspace')); + defaultValue: 'http://localhost:8000/workspace')); } } diff --git a/lib/main.dart b/lib/main.dart index bb7eec9..f10b9ef 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,9 +1,10 @@ import 'dart:async'; +import 'dart:ui'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:go_router/go_router.dart'; import 'package:localstorage/localstorage.dart'; -import 'package:oc_front/core/models/shared_workspace_local.dart'; import 'package:oc_front/core/models/workspace_local.dart'; import 'package:oc_front/core/sections/header/header.dart'; import 'package:oc_front/core/sections/header/menu.dart'; @@ -14,7 +15,6 @@ import 'package:oc_front/core/services/router.dart'; import 'package:oc_front/core/sections/end_drawer.dart'; import 'package:oc_front/widgets/dialog/login.dart'; import 'package:oc_front/core/conf/conf_reader.dart'; - void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -35,6 +35,7 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { + AppRouter.verifyRoute(context); AuthService.init(); EnumService.init(); SearchConstants.clear(); @@ -88,7 +89,6 @@ double getMainWidth(BuildContext context) { } bool loginIsSet = false; class MainPageState extends State { - bool isCtrl = false; final FocusNode node = FocusNode(); @override void initState() { @@ -106,13 +106,13 @@ class MainPageState extends State { // fast, so that you can just rebuild anything that needs updating rather // than having to individually change instances of widgets.i scaffoldKey = GlobalKey(); - isCtrl = false; if (!AuthService.isConnected() && !loginIsSet) { Future.delayed(const Duration(milliseconds: 500), () { loginIsSet = true; showDialog( barrierDismissible: false, - context: context ?? context, builder: (context) { + // ignore: use_build_context_synchronously + context: context, builder: (context) { return AlertDialog( insetPadding: EdgeInsets.zero, backgroundColor: Colors.white, @@ -137,23 +137,20 @@ class MainPageState extends State { Container( padding: const EdgeInsets.symmetric(vertical: 30), decoration: BoxDecoration( color: darkColor), width: 50, height: getHeight(context) - 50, - child: SingleChildScrollView( child: LeftMenuWidget() )), + child: const SingleChildScrollView( child: LeftMenuWidget() )), SizedBox( width: getMainWidth(context), height: getHeight(context) - 50, child: KeyboardListener( focusNode: node, onKeyEvent: (event) async { - if ( event.logicalKey == LogicalKeyboardKey.controlLeft ) { - isCtrl = (event is KeyDownEvent); - node.requestFocus(); - } else if( (event is KeyDownEvent) && event.logicalKey == LogicalKeyboardKey.enter) { - AppRouter.currentRoute.factory.search(context, isCtrl); + if( (event is KeyDownEvent) && event.logicalKey == LogicalKeyboardKey.enter) { + AppRouter.currentRoute.factory.search(context, false); node.requestFocus(); } }, child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - HeaderWidget(), + const HeaderWidget(), widget.page ?? Container() // CatalogPageWidget(), ], ), diff --git a/lib/models/logs.dart b/lib/models/logs.dart index 4617927..cae1b95 100644 --- a/lib/models/logs.dart +++ b/lib/models/logs.dart @@ -72,6 +72,7 @@ class Log extends SerializerDeserializer { String getMessage(String mess) { var jsonString = mess; + print(mess); try { var j = JsonString(mess.replaceAll("\\", "")).decodedValue as Map; map = j; @@ -87,9 +88,8 @@ class Log extends SerializerDeserializer { @override deserialize(dynamic json) { try { json = json as List; - } catch (e) { return Log(); } - var l = Log( - timestamp: json.isNotEmpty ? DateTime.fromMillisecondsSinceEpoch(int.parse(json[0]) ~/ 1000) : null, + } catch (e) { return Log(); } var l = Log( + timestamp: json.isNotEmpty ? DateTime.fromMillisecondsSinceEpoch(int.parse(json[0]) ~/ 1000, isUtc : true) : null, message: json.length > 1 ? getMessage(json[1].toString()) : null, rawMessage : json.length > 1 ? json[1].toString() : null, ); diff --git a/lib/pages/map.dart b/lib/pages/map.dart index 70e3aa8..9d0f32e 100644 --- a/lib/pages/map.dart +++ b/lib/pages/map.dart @@ -67,9 +67,9 @@ class MapPageWidgetState extends State { height: 30, point: coordinates[topic]![coord]!, child: HoverMenu( width: 110, title: Container( alignment: Alignment.center, - constraints: BoxConstraints( maxHeight: 100, maxWidth: 100 ), + constraints: const BoxConstraints( maxHeight: 100, maxWidth: 100 ), child: Icon(FontAwesomeIcons.locationDot, - shadows: [Shadow(color: Color.fromRGBO(0, 0, 0, 1), blurRadius: 10.0)], + shadows: const [Shadow(color: Color.fromRGBO(0, 0, 0, 1), blurRadius: 10.0)], color: getColor(topic)) ), items: [ Container(color: Colors.white, child: ItemRowWidget(low: true, contextWidth: 290, item: coord)) ] diff --git a/lib/widgets/forms/scheduler_forms.dart b/lib/widgets/forms/scheduler_forms.dart index 7b99048..c30a768 100644 --- a/lib/widgets/forms/scheduler_forms.dart +++ b/lib/widgets/forms/scheduler_forms.dart @@ -61,7 +61,6 @@ 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,); @@ -71,7 +70,6 @@ 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,14 +82,11 @@ class SchedulerFormsWidgetState extends State { } } Duration durationBefore = widget.schedule.start!.difference(DateTime.now().toUtc()) + Duration(seconds: 5); - 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 { @@ -222,12 +217,11 @@ class SchedulerFormsWidgetState extends State { ); }); } : null, - ); - shallow.change =(p0) => Future.delayed( const Duration(seconds: 2), () async { - if (shallow.compare == p0) { - await WorflowService().put(context, widget.item.id ?? "", { "name" : p0 }, {}); - } else { - shallow.compare = p0; + ); + shallow.change =(p0) => Future.delayed( const Duration(milliseconds: 100), () async { + if (shallow.current == p0) { + dash.name = p0 ?? dash.name; + await WorflowService().put(context, widget.item.id ?? "", { "name" : dash.name }, {}); } }); return Column( children: [ @@ -243,7 +237,7 @@ class SchedulerFormsWidgetState extends State { bottom: const BorderSide(color: Colors.grey))), child: shallow ), const SizedBox(height: 20, width: 200 ), - isService ? Text("Warning a processing is a service, if no end execution it will run forever.") : Container(), + isService ? const Text("Warning a processing is a service, if no end execution it will run forever.") : Container(), Tooltip( message: "start executions", child: Container( height: 40, margin: const EdgeInsets.only(top: 5), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10), diff --git a/lib/widgets/logs.dart b/lib/widgets/logs.dart index b2ef98c..09f21d8 100644 --- a/lib/widgets/logs.dart +++ b/lib/widgets/logs.dart @@ -27,8 +27,8 @@ class LogsWidgetState extends State { try { setState(() { }); } catch (e) { /**/ } }); - return Container( height: getMainHeight(context) - 100, - child: Center( child: CircularProgressIndicator()) ); + return SizedBox( height: getMainHeight(context) - 100, + child: const Center( child: CircularProgressIndicator()) ); } if (widget.exec == null) { return Container(); @@ -53,11 +53,7 @@ class LogsWidgetState extends State { end = (DateTime.parse(widget.exec!.startDate!).add( const Duration(days: 14)).microsecondsSinceEpoch).toString(); } } catch(e) { /* */ } - Future.delayed(const Duration(minutes: 1), () { - try { setState(() {}); - } catch (e) { /**/ } - }); - return FutureBuilder(future: LogsService().search(context, [], { + return FutureBuilder(future: LogsService().search(null, [], { "workflow_execution_id": widget.exec!.id, "start": start, "end": end diff --git a/lib/widgets/sheduler_items/schedule.dart b/lib/widgets/sheduler_items/schedule.dart index 07c0ab3..8dc8ca3 100644 --- a/lib/widgets/sheduler_items/schedule.dart +++ b/lib/widgets/sheduler_items/schedule.dart @@ -44,6 +44,7 @@ class ScheduleWidgetState extends State { "${widget.end.year}-${widget.end.month > 9 ? widget.end.month : "0${widget.end.month}"}-${widget.end.day > 9 ? widget.end.day : "0${widget.end.day}"}"], {}), builder: (ctx, as) { Map> data = {}; + DateTime? firstDate; if (as.hasData && as.data!.data != null) { for (var element in as.data!.data!.executions) { if (element.startDate == null) { continue; } @@ -52,9 +53,20 @@ class ScheduleWidgetState extends State { var str = "${date.toIso8601String()}Z"; if (data[str] == null) { data[str] = []; } data[str]!.add(element); - data[str]!.sort((a, b) => DateTime.parse(a.startDate!).compareTo(DateTime.parse(b.startDate!))); + data[str]!.sort((a, b) => DateTime.parse(a.startDate!).compareTo(DateTime.parse(b.startDate!))); } } + List vals = []; + for (var val in data.values) { + vals.addAll(val); + } + if (vals.isNotEmpty) { + try { + Future.delayed(const Duration(minutes: 1), () { + setState(() {}); + }); + } catch (e) { /* */ } + } bool isInfo = getMainWidth(context) <= 600 && selected != null && widget.isBox; double w = selected != null && widget.isBox ? getMainWidth(context) - menuSize : getMainWidth(context); List children = []; diff --git a/lib/widgets/sheduler_items/scheduler_item.dart b/lib/widgets/sheduler_items/scheduler_item.dart index 58b5fb3..1161b72 100644 --- a/lib/widgets/sheduler_items/scheduler_item.dart +++ b/lib/widgets/sheduler_items/scheduler_item.dart @@ -34,7 +34,6 @@ class SchedulerItemWidgetState extends State { selected = selected != element || ev.startDate != selectedReal ? element : null; widget.parent!.widget.selectedID = selected; selectedReal = selected == null ? null : ev.startDate; - print("there"); if (selectedReal == null) { widget.parent!.widget.isDayPlanner = true; } diff --git a/library/flutter_flow_chart/lib/src/dashboard.dart b/library/flutter_flow_chart/lib/src/dashboard.dart index c21c6d9..f954d1f 100755 --- a/library/flutter_flow_chart/lib/src/dashboard.dart +++ b/library/flutter_flow_chart/lib/src/dashboard.dart @@ -9,7 +9,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter_flow_chart/flutter_flow_chart.dart'; import 'package:flutter_flow_chart/src/flow_chart_menu.dart'; import 'package:flutter_flow_chart/src/flow_chart_selected_menu.dart'; -import 'package:flutter_flow_chart/src/ui/draw_arrow.dart'; import 'package:flutter_flow_chart/src/ui/segment_handler.dart'; /// Listener definition for a new connection @@ -842,7 +841,6 @@ class Dashboard extends ChangeNotifier { } if (found == 0) { - debugPrint('Element with $destId id not found!'); return; } if (notify) { diff --git a/library/flutter_flow_chart/lib/src/flow_chart.dart b/library/flutter_flow_chart/lib/src/flow_chart.dart index 5c8db79..9905801 100755 --- a/library/flutter_flow_chart/lib/src/flow_chart.dart +++ b/library/flutter_flow_chart/lib/src/flow_chart.dart @@ -296,9 +296,9 @@ class HoverMenuState extends State { } } +bool isCtrl = false; class FlowChartState extends State { var node = FocusNode(); - bool isCtrl = false; @override void initState() { node.requestFocus(); @@ -313,7 +313,6 @@ 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; @@ -365,15 +364,20 @@ class FlowChartState extends State { autofocus: true, onKeyEvent: (event) { bool change = false; - if (event.logicalKey == LogicalKeyboardKey.controlLeft) { - isCtrl = event is KeyDownEvent || event is KeyRepeatEvent; + if (event.logicalKey == LogicalKeyboardKey.controlLeft && event is KeyDownEvent) { + print("CTRL true"); + isCtrl = true; } - /*if ((event is KeyDownEvent || event.logicalKey == LogicalKeyboardKey.keyZ) && isCtrl) { + if (event.logicalKey == LogicalKeyboardKey.controlLeft && event is KeyUpEvent) { + print("CTRL false"); + isCtrl = false; + } + if ((event is KeyDownEvent || event.logicalKey == LogicalKeyboardKey.keyZ) && isCtrl) { widget.dashboard.back(); } if ((event is KeyDownEvent || event.logicalKey == LogicalKeyboardKey.keyY) && isCtrl) { widget.dashboard.forward(); - }*/ + } if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.add) { change = true; for (var el in widget.dashboard.elementSelected) { @@ -418,7 +422,7 @@ class FlowChartState extends State { children: [ Stack(children: [ // Draw the grid - Container( child: DragTarget( + DragTarget( builder: ( BuildContext context, List accepted, @@ -475,7 +479,7 @@ class FlowChartState extends State { ); widget.dashboard.addElement(el, context); }, - ))] + )] ), widget.dashboard.isMenu ? Positioned(top: 50, child: FlowChartSelectedMenu( key: widget.dashboard.selectedMenuKey, @@ -729,9 +733,10 @@ class ChartWidgetState extends State { final gridKey = GlobalKey(); var tapDownPos = Offset.zero; var secondaryTapDownPos = Offset.zero; - for (int i = 0; i < widget.dashboard.elements.length; i++) + for (int i = 0; i < widget.dashboard.elements.length; i++) { widget.dashboard.elements[i].next.removeWhere((element) => widget.dashboard.findElementIndexById(element.destElementId) < 0); + } return Stack( children: [ Positioned.fill( child: GestureDetector( 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 f1b9626..86c02cd 100644 --- a/library/flutter_flow_chart/lib/src/flow_chart_menu.dart +++ b/library/flutter_flow_chart/lib/src/flow_chart_menu.dart @@ -240,12 +240,12 @@ class FlowChartMenuState extends State { ])), Expanded( - child: Padding( child: Text("current workflow : ${widget.dashboard.name}", overflow: TextOverflow.ellipsis, - style: TextStyle(color: Colors.white, fontSize: 14), textAlign: TextAlign.start), - padding: EdgeInsets.symmetric(horizontal: 20))), + child: Padding( padding: const EdgeInsets.symmetric(horizontal: 20), + child: Text("current workflow : ${widget.dashboard.name}", overflow: TextOverflow.ellipsis, + style: const TextStyle(color: Colors.white, fontSize: 14), textAlign: TextAlign.start))), ])), widget.menuExtension != null && widget.chart.widget.flowChart.widget.width > 600 ? Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( border: Border(left: BorderSide(color: Colors.white, width: 1)) ), child: widget.menuExtension diff --git a/library/flutter_flow_chart/lib/src/ui/draw_arrow.dart b/library/flutter_flow_chart/lib/src/ui/draw_arrow.dart index f7d73c5..c20a71b 100755 --- a/library/flutter_flow_chart/lib/src/ui/draw_arrow.dart +++ b/library/flutter_flow_chart/lib/src/ui/draw_arrow.dart @@ -3,8 +3,6 @@ import 'dart:convert'; import 'dart:ui' as ui; import 'dart:math' as math; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_flow_chart/flutter_flow_chart.dart'; import 'package:flutter_flow_chart/src/ui/segment_handler.dart'; @@ -257,6 +255,7 @@ class DrawingArrow extends ChangeNotifier { /// Draw arrow from [srcElement] to [destElement] /// using [arrowParams] parameters +// ignore: must_be_immutable class DrawArrow extends StatefulWidget { ChartWidgetState flow; /// @@ -377,14 +376,15 @@ class DrawArrowState extends State { } } +// ignore: must_be_immutable class GraphParamsWidget extends StatefulWidget { ChartWidgetState comp; bool isShowed = false; Offset? position; FlowElement element; int index; - GraphParamsWidget({ Key? key, required this.element, required this.comp, - required this.index }): super(key: key); + GraphParamsWidget({ super.key, required this.element, required this.comp, + required this.index }); @override GraphParamsWidgetState createState() => GraphParamsWidgetState(); } class GraphParamsWidgetState extends State { @@ -393,32 +393,32 @@ class GraphParamsWidgetState extends State { top: (widget.position?.dy ?? 0) - 5, left: (widget.position?.dx ?? 0) - 5, child: MouseRegion( cursor: SystemMouseCursors.click, onHover: (event) => setState(() { widget.isShowed = true; }), - child: Container( child: Row(children: [ IconButton(onPressed: () { widget.comp.setState(() { widget.comp.widget.dashboard.removeArrows((el) => el.fromID == "${widget.element.id}${widget.index}", context); widget.element.next.removeAt(widget.index); }); - }, icon: Icon(Icons.delete)) - ],)))); + }, icon: const Icon(Icons.delete)) + ],))); } } +// ignore: must_be_immutable class ArrowInfoWidget extends StatefulWidget { Dashboard dashboard; - ArrowInfoWidget ({ Key? key, required this.dashboard }): super(key: key); + ArrowInfoWidget ({ super.key, required this.dashboard }); @override ArrowInfoWidgetState createState() => ArrowInfoWidgetState(); } class ArrowInfoWidgetState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( child: Column(children: [ Container(height: 50, - decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: Border(bottom: BorderSide(color: Colors.grey, width: 1))), - child: Center( child: Text(" Style", style: TextStyle(fontSize: 20)))), + decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: const Border(bottom: BorderSide(color: Colors.grey, width: 1))), + child: const Center( child: Text(" Style", style: TextStyle(fontSize: 20)))), Container(height: 50, - decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: Border(bottom: BorderSide(color: Colors.grey, width: 1))), - child: Row(children: [],) + decoration: BoxDecoration(color: widget.dashboard.midDashColor, border: const Border(bottom: BorderSide(color: Colors.grey, width: 1))), + child: const Row(children: [],) ), ],) ); } diff --git a/library/flutter_flow_chart/lib/src/ui/element_widget.dart b/library/flutter_flow_chart/lib/src/ui/element_widget.dart index 718e348..c3e5db0 100755 --- a/library/flutter_flow_chart/lib/src/ui/element_widget.dart +++ b/library/flutter_flow_chart/lib/src/ui/element_widget.dart @@ -136,32 +136,27 @@ class ElementWidgetState extends State { if (widget.element.widget == null) { element = RectangleWidget(element: widget.element); } else { element = AnyWidget(element: widget.element); } } - var tapLocation = Offset.zero; var secondaryTapDownPos = Offset.zero; - - - Widget w = GestureDetector( + Widget w = InkWell( onTapDown: (details) => tapLocation = details.globalPosition, onSecondaryTapDown: (details) => secondaryTapDownPos = details.globalPosition, onTap: () { setState(() { - if (!(widget.dashboard.flutterChartKey.currentState?.isCtrl ?? true)) { + if (!isCtrl) { for (var element in widget.dashboard.elements) { element.isSelected = false; element.dashboard.chartKey.currentState?. setState(() { }); widget.dashboard.selectedMenuKey.currentState?. setState(() { }); } } - Future.delayed(Duration(milliseconds: 100), () { - DrawingArrow.instance.notifyListeners(); - widget.element.isSelected = !widget.element.isSelected; - for (var sel in widget.dashboard.arrows) { sel.isSelected = false; } - widget.dashboard.selectedMenuKey.currentState?. setState(() { }); - }); + DrawingArrow.instance.notifyListeners(); + widget.isHovered = false; + widget.element.isSelected = !widget.element.isSelected; + for (var sel in widget.dashboard.arrows) { sel.isSelected = false; } + widget.dashboard.selectedMenuKey.currentState?. setState(() { }); }); - widget.onElementPressed?.call(context, tapLocation); }, onSecondaryTap: () { widget.onElementSecondaryTapped?.call(context, secondaryTapDownPos); @@ -169,9 +164,9 @@ class ElementWidgetState extends State { onLongPress: () { widget.onElementLongPressed?.call(context, tapLocation); }, - onSecondaryLongPress: () { + /*onSecondaryLongPress: () { widget.onElementSecondaryLongTapped?.call(context, secondaryTapDownPos); - }, + },*/ child: Listener( onPointerDown: (event) { delta = event.localPosition; @@ -198,7 +193,7 @@ class ElementWidgetState extends State { onHandlerLongPressed: widget.onHandlerLongPressed, onHandlerSecondaryLongTapped: widget.onHandlerSecondaryLongTapped, child: Container( - margin: EdgeInsets.all(10), // why some change + margin: const EdgeInsets.all(10), // why some change decoration: BoxDecoration( border: Border.all(color: widget.element.isSelected ? Colors.red : widget.dashboard.midDashColor, width: widget.element.isSelected ? 2 : 1), diff --git a/library/flutter_flow_chart/lib/src/ui/grid_background.dart b/library/flutter_flow_chart/lib/src/ui/grid_background.dart index c845888..8d26344 100755 --- a/library/flutter_flow_chart/lib/src/ui/grid_background.dart +++ b/library/flutter_flow_chart/lib/src/ui/grid_background.dart @@ -195,7 +195,6 @@ class _GridBackgroundPainter extends CustomPainter { @override bool shouldRepaint(_GridBackgroundPainter oldDelegate) { - debugPrint('shouldRepaint ${oldDelegate.dx} $dx ${oldDelegate.dy} $dy'); return oldDelegate.dx != dx || oldDelegate.dy != dy; } }