From ab593a45b9b77402905af639494d447d1af9ec11 Mon Sep 17 00:00:00 2001 From: mr Date: Fri, 13 Jun 2025 13:33:24 +0200 Subject: [PATCH] test --- lib/core/sections/header/header.dart | 16 +- lib/core/services/auth.service.dart | 2 +- lib/core/services/router.dart | 3 +- lib/models/logs.dart | 3 +- lib/models/workflow.dart | 2 +- lib/pages/datacenter.dart | 6 +- lib/pages/map.dart | 9 +- lib/pages/scheduler.dart | 6 +- lib/widgets/catalog.dart | 1 + lib/widgets/forms/scheduler_forms.dart | 14 +- lib/widgets/forms/sub_expose_forms.dart | 22 --- .../inputs/shallow_dropdown_input.dart | 5 +- lib/widgets/inputs/shallow_text_input.dart | 5 +- lib/widgets/inputs/sub_dropdown_input .dart | 1 + lib/widgets/items/item.dart | 36 +++-- lib/widgets/items/shallow_item_row.dart | 63 ++++---- lib/widgets/logs.dart | 12 +- lib/widgets/sheduler_items/schedule.dart | 11 +- .../sheduler_items/scheduler_calendar.dart | 1 - .../flutter_flow_chart/lib/src/dashboard.dart | 4 +- .../lib/src/flow_chart.dart | 152 ++++++++++-------- .../lib/src/flow_chart_left_menu.dart | 19 +-- .../lib/src/flow_chart_selected_menu.dart | 37 +++-- .../lib/src/ui/element_widget.dart | 6 +- .../lib/src/ui/handler_widget.dart | 1 + .../lib/src/ui/resize_widget.dart | 3 +- 26 files changed, 219 insertions(+), 221 deletions(-) diff --git a/lib/core/sections/header/header.dart b/lib/core/sections/header/header.dart index 8b7f9b5..4741f54 100644 --- a/lib/core/sections/header/header.dart +++ b/lib/core/sections/header/header.dart @@ -42,14 +42,14 @@ class HeaderConstants { static setTitle(String? v) { title = v; - Future.delayed(Duration(milliseconds: 100), () { + Future.delayed(const Duration(milliseconds: 100), () { HeaderConstants.headerWidget?.setState(() {}); }); } static setDescription(String? v) { description = v; - Future.delayed(Duration(milliseconds: 100), () { + Future.delayed(const Duration(milliseconds: 100), () { HeaderConstants.headerWidget?.setState(() {}); }); } @@ -70,7 +70,7 @@ class HeaderWidgetState extends State { return Container(); } if (AppRouter.currentRoute.factory.searchFill()) { - return DefaultWidget(); + return const DefaultWidget(); } HeaderConstants.height = HeaderConstants.isNoHeader(AppRouter.currentRoute.route) || !AppRouter.currentRoute.factory.searchFill() ? 50 : 100; return Column( children: [ @@ -78,7 +78,7 @@ class HeaderWidgetState extends State { height: 50, width: getMainWidth(context), decoration: BoxDecoration( color: midColor, - border: Border(bottom: BorderSide(color: Colors.white, width: 1),) + border: const Border(bottom: BorderSide(color: Colors.white, width: 1),) ), child: Row(crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisAlignment: MainAxisAlignment.end, @@ -89,7 +89,7 @@ class HeaderWidgetState extends State { child: Container(width: 50, height: 50, color: Colors.black, - child: Center(child: Icon(Icons.keyboard_backspace, color: Colors.white)) + child: const Center(child: Icon(Icons.keyboard_backspace, color: Colors.white)) ), ), ShallowTextInputWidget( @@ -112,10 +112,10 @@ class HeaderWidgetState extends State { AppRouter.currentRoute.factory.search(context, true); } : null, ), - Container( padding: EdgeInsets.only(left: 50), - decoration: BoxDecoration( border: Border( left: BorderSide( color: Colors.white ))), + Container( padding: const EdgeInsets.only(left: 50), + decoration: const BoxDecoration( border: Border( left: BorderSide( color: Colors.white ))), child: ShallowDropdownInputWidget( - prefixIcon: Padding( padding: EdgeInsets.only(right: 10), child: Icon(Icons.shopping_cart, color: Colors.grey)), + prefixIcon: const Padding( padding: EdgeInsets.only(right: 10), child: Icon(Icons.shopping_cart, color: Colors.grey)), current: WorkspaceLocal.current, width: 350, all: () async => WorkspaceLocal.getWorkspacesShallow(), diff --git a/lib/core/services/auth.service.dart b/lib/core/services/auth.service.dart index 6efdafd..7139afd 100644 --- a/lib/core/services/auth.service.dart +++ b/lib/core/services/auth.service.dart @@ -101,7 +101,7 @@ class AuthService { 'expiresIn', DateTime.now() .add(Duration(seconds: token.data?.value['expires_in']) - - Duration(seconds: 10)) + const Duration(seconds: 10)) .toIso8601String()); } }); diff --git a/lib/core/services/router.dart b/lib/core/services/router.dart index 2d1892b..1cc28b0 100644 --- a/lib/core/services/router.dart +++ b/lib/core/services/router.dart @@ -17,7 +17,7 @@ import 'package:go_router/go_router.dart'; GlobalKey routerKey = GlobalKey(); class RouterWidget extends StatefulWidget { - const RouterWidget({Key? key}) : super(key: key); + const RouterWidget({super.key}); @override RouterWidgetState createState() => RouterWidgetState(); } @@ -94,7 +94,6 @@ class AppRouter { 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(); diff --git a/lib/models/logs.dart b/lib/models/logs.dart index cae1b95..b883204 100644 --- a/lib/models/logs.dart +++ b/lib/models/logs.dart @@ -72,7 +72,6 @@ class Log extends SerializerDeserializer { String getMessage(String mess) { var jsonString = mess; - print(mess); try { var j = JsonString(mess.replaceAll("\\", "")).decodedValue as Map; map = j; @@ -81,7 +80,7 @@ class Log extends SerializerDeserializer { } else { jsonString = "${j["Name"]} : [${j["Namespace"]}] ${j["Status"]} ${j["Progress"]} (${j["Duration"].toString()})\nCreated at ${j["Created"].toString().replaceAllMapped(RegExp(r'\(\w+\)'), (match) { return ''; }).replaceAllMapped(RegExp(r'\+\w+'), (match) { return ''; })}; Started at ${j["Created"].toString().replaceAllMapped(RegExp(r'\(\w+\)'), (match) { return ''; }).replaceAllMapped(RegExp(r'\+\w+'), (match) { return ''; })}"; } - } on JsonFormatException catch (e) { /* */ } + } on JsonFormatException catch (_) { /* */ } message = jsonString; return jsonString; } diff --git a/lib/models/workflow.dart b/lib/models/workflow.dart index 28da539..d2a94db 100644 --- a/lib/models/workflow.dart +++ b/lib/models/workflow.dart @@ -334,7 +334,7 @@ class Graph extends SerializerDeserializer { } // should find arrow env info and add it to the env List extParams = []; - var arrows = links.where( (e) => (e.source?.id?.contains(item.id ?? "") ?? false) || (e.destination?.id?.contains(item.id ?? "") ?? false)); + // var arrows = links.where( (e) => (e.source?.id?.contains(item.id ?? "") ?? false) || (e.destination?.id?.contains(item.id ?? "") ?? false)); /*for (var arrow in arrows) { for (var info in arrow.infos) { var i = info as Map; diff --git a/lib/pages/datacenter.dart b/lib/pages/datacenter.dart index 421aaa7..0bbcc3d 100644 --- a/lib/pages/datacenter.dart +++ b/lib/pages/datacenter.dart @@ -1,7 +1,6 @@ import 'package:datetime_picker_formfield/datetime_picker_formfield.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -import 'package:oc_front/core/services/specialized_services/booking_service.dart'; import 'package:oc_front/main.dart'; import 'package:intl/intl.dart' as intl; import 'package:oc_front/pages/abstract_page.dart'; @@ -22,7 +21,6 @@ class ComputePageWidget extends StatefulWidget { bool isList = true; DateTime start = DateTime.now(); DateTime end = DateTime.now().add(const Duration(days: 180)); - final BookingExecutionService _service = BookingExecutionService(); ComputePageWidget () : super(key: DatacenterFactory.key); @override ComputePageWidgetState createState() => ComputePageWidgetState(); @@ -66,7 +64,7 @@ class ComputePageWidgetState extends State { cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), colorScheme: ColorScheme.light( - background: midColor, + surface: midColor, tertiary: Colors.grey, secondary: Colors.grey, primary: Colors.black), @@ -124,7 +122,7 @@ class ComputePageWidgetState extends State { cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), colorScheme: ColorScheme.light( - background: midColor, + surface: midColor, tertiary: Colors.grey, secondary: Colors.grey, primary: Colors.black), diff --git a/lib/pages/map.dart b/lib/pages/map.dart index 9d0f32e..ffa9759 100644 --- a/lib/pages/map.dart +++ b/lib/pages/map.dart @@ -6,7 +6,6 @@ import 'package:go_router/go_router.dart'; import 'package:latlong2/latlong.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:oc_front/core/services/specialized_services/datacenter_service.dart'; -import 'package:oc_front/main.dart'; import 'package:oc_front/models/resources/compute.dart'; import 'package:oc_front/models/resources/resources.dart'; import 'package:oc_front/models/resources/storage.dart'; @@ -24,6 +23,7 @@ class MapFactory implements AbstractFactory { @override void search(BuildContext context, bool special) { } } double menuSize = 0; +// ignore: must_be_immutable class MapPageWidget extends StatefulWidget { bool isShowed = false; final DatacenterService _service = DatacenterService(); @@ -77,8 +77,6 @@ class MapPageWidgetState extends State { )); } } - Rect rect = Rect.fromCenter( center: MediaQuery.of(context).size.center(Offset.zero), - width: selected ? menuSize : 0, height: (getMainHeight(context) - 50) > 0 ? (getMainHeight(context) - 50) : 0); return Expanded( child : FlutterMap( mapController: _mapController, @@ -113,6 +111,7 @@ class HoverMenuController { } } +// ignore: must_be_immutable class HoverMenu extends StatefulWidget { final Widget title; final double? width; @@ -122,12 +121,12 @@ class HoverMenu extends StatefulWidget { HoverMenu({ - Key? key, + super.key, required this.title, this.items = const [], this.width, this.controller, - }) : super(key: key); + }); @override HoverMenuState createState() => HoverMenuState(); diff --git a/lib/pages/scheduler.dart b/lib/pages/scheduler.dart index 6bd816e..91c16c5 100644 --- a/lib/pages/scheduler.dart +++ b/lib/pages/scheduler.dart @@ -2,7 +2,6 @@ import 'package:datetime_picker_formfield/datetime_picker_formfield.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart' as intl; import 'package:go_router/go_router.dart'; -import 'package:oc_front/core/services/specialized_services/workflow_execution_service.dart'; import 'package:oc_front/main.dart'; import 'package:oc_front/pages/abstract_page.dart'; import 'package:oc_front/widgets/sheduler_items/schedule.dart'; @@ -22,7 +21,6 @@ class SchedulerPageWidget extends StatefulWidget { bool isList = true; DateTime start = DateTime.now(); DateTime end = DateTime.now().add(const Duration(days: 180)); - final WorkflowExecutionService _service = WorkflowExecutionService(); SchedulerPageWidget(): super(key: SchedulerFactory.key); @override SchedulerPageWidgetState createState() => SchedulerPageWidgetState(); static void search(BuildContext context) { } @@ -62,7 +60,7 @@ class SchedulerPageWidgetState extends State { cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), colorScheme: ColorScheme.light( - background: midColor, + surface: midColor, tertiary: Colors.grey, secondary: Colors.grey, primary: Colors.black), @@ -120,7 +118,7 @@ class SchedulerPageWidgetState extends State { cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), colorScheme: ColorScheme.light( - background: midColor, + surface: midColor, tertiary: Colors.grey, secondary: Colors.grey, primary: Colors.black), diff --git a/lib/widgets/catalog.dart b/lib/widgets/catalog.dart index 15fdbc9..79bbfa3 100644 --- a/lib/widgets/catalog.dart +++ b/lib/widgets/catalog.dart @@ -4,6 +4,7 @@ import 'package:oc_front/widgets/items/item_row.dart'; import 'package:oc_front/models/resources/resources.dart'; import 'package:oc_front/core/models/workspace_local.dart'; +// ignore: must_be_immutable class CatalogWidget extends StatefulWidget { double? itemWidth; bool readOnly = false; diff --git a/lib/widgets/forms/scheduler_forms.dart b/lib/widgets/forms/scheduler_forms.dart index c30a768..b20ac4b 100644 --- a/lib/widgets/forms/scheduler_forms.dart +++ b/lib/widgets/forms/scheduler_forms.dart @@ -252,7 +252,7 @@ class SchedulerFormsWidgetState extends State { cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), colorScheme: ColorScheme.light( - background: midColor, + surface: midColor, tertiary: Colors.grey, secondary: Colors.grey, primary: Colors.black), @@ -353,7 +353,7 @@ class SchedulerFormsWidgetState extends State { cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), colorScheme: ColorScheme.light( - background: midColor, + surface: midColor, tertiary: Colors.grey, secondary: Colors.grey, primary: Colors.black), @@ -391,7 +391,7 @@ class SchedulerFormsWidgetState extends State { cardTheme: CardTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), dialogTheme: DialogTheme(elevation: 0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0))), colorScheme: ColorScheme.light( - background: midColor, + surface: midColor, tertiary: Colors.grey, secondary: Colors.grey, primary: Colors.black), @@ -470,15 +470,15 @@ class SchedulerFormsWidgetState extends State { filled: true, hintText: "enter cron command...", labelText: "cron", - errorStyle: TextStyle(height: 0), - hintStyle: TextStyle(fontSize: 10), - labelStyle: TextStyle(fontSize: 10), + errorStyle: const TextStyle(height: 0), + hintStyle: const TextStyle(fontSize: 10), + labelStyle: const TextStyle(fontSize: 10), focusedErrorBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.black)), errorBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.black)), focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.black)), enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.grey)), border: OutlineInputBorder(borderSide: BorderSide(color: widget.errorCron != null ? Colors.red : Colors.grey)), - contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), ), ))), Container( diff --git a/lib/widgets/forms/sub_expose_forms.dart b/lib/widgets/forms/sub_expose_forms.dart index e80dc3c..8ed0381 100644 --- a/lib/widgets/forms/sub_expose_forms.dart +++ b/lib/widgets/forms/sub_expose_forms.dart @@ -18,28 +18,6 @@ class SubExposeFormsWidget extends StatefulWidget { } class SubExposeFormsWidgetState extends State { @override Widget build(BuildContext context) { - print("qsfqs"); - try { - var w = SubTextInputWidget(subkey: "reference port", readOnly: widget.readOnly, - initialValue: widget.item.port != null ? '${widget.item.port}' : null, - width: widget.width, - empty: widget.empty, - change: (value) { - try { - widget.item.port = int.parse(value); - Future.delayed(const Duration(seconds: 2), () { - if (widget.item.port == int.parse(value) && int.parse(value) != 0) { - widget.dash.saveDash(widget.dash.id, context); - } - }); - } catch (e) { widget.item.port = null; } - var el = widget.dash.getElement(widget.elementID); - el!.element = widget.item as dynamic; - }); - } catch (e,s) { - print(e); - print(s); - } return Column( children : [ Container( margin: const EdgeInsets.only(left: 10, right: 10, top: 15), decoration: const BoxDecoration(border: Border( top: BorderSide(color: Colors.grey, width: 1))), diff --git a/lib/widgets/inputs/shallow_dropdown_input.dart b/lib/widgets/inputs/shallow_dropdown_input.dart index f4b47e3..d105728 100644 --- a/lib/widgets/inputs/shallow_dropdown_input.dart +++ b/lib/widgets/inputs/shallow_dropdown_input.dart @@ -3,6 +3,7 @@ import 'package:oc_front/main.dart'; import 'package:oc_front/models/response.dart'; import 'package:oc_front/pages/shared.dart'; +// ignore: must_be_immutable class ShallowDropdownInputWidget extends StatefulWidget { double? width; double? height; @@ -30,10 +31,10 @@ class ShallowDropdownInputWidget extends StatefulWidget { bool deletion = false; - ShallowDropdownInputWidget ({ Key? key, this.width, this.current, required this.all, this.prefixIcon, + ShallowDropdownInputWidget ({ super.key, this.width, this.current, required this.all, this.prefixIcon, this.iconLoad, this.iconRemove, this.hint, this.filled, this.hintColor, this.color, this.height, this.tooltipLoad, this.tooltipRemove, this.deletion = false, this.maptoDropdown, this.label, - required this.type, this.canLoad, this.canRemove, this.load, this.remove, this.change }): super(key: key); + required this.type, this.canLoad, this.canRemove, this.load, this.remove, this.change }); @override ShallowDropdownInputWidgetState createState() => ShallowDropdownInputWidgetState(); } class ShallowDropdownInputWidgetState extends State { diff --git a/lib/widgets/inputs/shallow_text_input.dart b/lib/widgets/inputs/shallow_text_input.dart index a5fc360..396e2cc 100644 --- a/lib/widgets/inputs/shallow_text_input.dart +++ b/lib/widgets/inputs/shallow_text_input.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:oc_front/main.dart'; import 'package:oc_front/pages/shared.dart'; +// ignore: must_be_immutable class ShallowTextInputWidget extends StatefulWidget { double? width; CollaborativeAreaType type = CollaborativeAreaType.workspace; @@ -31,11 +32,11 @@ class ShallowTextInputWidget extends StatefulWidget { String? attr; - ShallowTextInputWidget ({ Key? key, this.width, this.current, this.attr, this.readOnly = false, this.alignment = MainAxisAlignment.start, + ShallowTextInputWidget ({ super.key, this.width, this.current, this.attr, this.readOnly = false, this.alignment = MainAxisAlignment.start, this.iconLoad, this.iconRemove, this.hint, this.forms = const [], this.loadStr, this.tooltipLoad = "", this.tooltipRemove = "", this.filled, this.hintColor, this.color, - required this.type, this.canLoad, this.canRemove, this.load, this.remove, this.change }): super(key: key); + required this.type, this.canLoad, this.canRemove, this.load, this.remove, this.change }); @override ShallowTextInputWidgetState createState() => ShallowTextInputWidgetState(); Map serialize() { diff --git a/lib/widgets/inputs/sub_dropdown_input .dart b/lib/widgets/inputs/sub_dropdown_input .dart index df46433..520e4e1 100644 --- a/lib/widgets/inputs/sub_dropdown_input .dart +++ b/lib/widgets/inputs/sub_dropdown_input .dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; +// ignore: must_be_immutable class SubDropdownInputWidget extends StatefulWidget { String subkey; double width; diff --git a/lib/widgets/items/item.dart b/lib/widgets/items/item.dart index 688afae..5f2bbcb 100644 --- a/lib/widgets/items/item.dart +++ b/lib/widgets/items/item.dart @@ -4,7 +4,6 @@ import 'package:oc_front/models/resources/resources.dart'; import 'package:oc_front/models/response.dart'; import 'package:oc_front/pages/shared.dart'; import 'package:oc_front/widgets/inputs/shallow_dropdown_input.dart'; -import 'package:oc_front/widgets/inputs/sub_dropdown_input%20.dart'; // ignore: must_be_immutable class ItemWidget extends StatefulWidget { @@ -15,25 +14,26 @@ class ItemWidget extends StatefulWidget { class ItemWidgetState extends State { @override Widget build(BuildContext context) { List widgets = [ - Container( margin: EdgeInsets.only(bottom: 20), + Container( margin: const EdgeInsets.only(bottom: 20), decoration: BoxDecoration(border: Border(bottom: BorderSide(color: midColor))), width: getMainWidth(context) / 2, - child: Center(child: Padding( padding: EdgeInsets.only(bottom: 20), + child: const Center(child: Padding( padding: EdgeInsets.only(bottom: 20), child: Text("RESOURCE INFORMATIONS", style: TextStyle(fontSize: 18, color: Colors.grey, fontWeight: FontWeight.w500))))) ]; var infos = widget.item.infos(); var count = 0; for (var info in infos.keys) { count++; - widgets.add(Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [ - Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("${info.toUpperCase().replaceAll("_", " ")} :", style: TextStyle(fontSize: 15, color: Colors.grey))), + widgets.add(Padding( padding: const EdgeInsets.symmetric(vertical: 5), child : Row(children: [ + Padding( padding: const EdgeInsets.only(left: 50, right: 10), child : Text("${info.toUpperCase().replaceAll("_", " ")} :", + style: const TextStyle(fontSize: 15, color: Colors.grey))), Text("${infos[info] is bool ? (infos[info] == true ? "yes" : "no") : infos[info] ?? "unknown"}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500)) + style: const TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500)) ]))); } if (count == 0 ) { - widgets.add(Center(child: Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [ + widgets.add(const Center(child: Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [ Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("NO INFORMATION", style: TextStyle(fontSize: 15, color: Colors.grey))), ])))); } @@ -43,7 +43,7 @@ class ItemWidgetState extends State { dpItems.add(Shallow(id: "$i", name: instance.name ?? "")); } if (dpItems.isNotEmpty) { - widgetsInstance.add(Center( child: Padding(padding: EdgeInsets.only(bottom: 15), child: + widgetsInstance.add(Center( child: Padding(padding: const EdgeInsets.only(bottom: 15), child: ShallowDropdownInputWidget( all: () async => dpItems, width: (getWidth(context) / 2) - 25, label: "instances", type: CollaborativeAreaType.resource, height: 65, current: "${widget.item.selectedInstance}", change: (value) { @@ -54,21 +54,27 @@ class ItemWidgetState extends State { } if (widget.item.instances.length > widget.item.selectedInstance) { var instance = widget.item.instances[widget.item.selectedInstance]; - widgetsInstance.add(Container(height: 20, width: getWidth(context) / 2,)); + widgetsInstance.add(SizedBox(height: 20, width: getWidth(context) / 2,)); var count = 0; for (var info in instance.infos().keys) { if (instance.infos()[info] == null || instance.infos()[info] is List || instance.infos()[info] is Map) { continue; } count++; - widgetsInstance.add(Center(child: Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [ - Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("${info.toUpperCase().replaceAll("_", " ")} :", style: TextStyle(fontSize: 15, color: Colors.grey))), + widgetsInstance.add(Center(child: Padding( padding: const EdgeInsets.symmetric(vertical: 5), child : Row(children: [ + Padding( padding: const EdgeInsets.only(left: 50, right: 10), + child : Text("${info.toUpperCase().replaceAll("_", " ")} :", + style: const TextStyle(fontSize: 15, color: Colors.grey))), Text("${instance.infos()[info] is bool ? (instance.infos()[info] == true ? "yes" : "no") : instance.infos()[info] ?? "unknown"}", overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500)) + style: const TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500)) ])))); } if (count == 0 ) { - widgetsInstance.add(Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [ - Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("NO INSTANCE INFORMATION", style: TextStyle(fontSize: 15, color: Colors.grey))), + widgetsInstance.add(const Padding( + padding: EdgeInsets.symmetric(vertical: 5), + child : Row(children: [ + Padding( padding: EdgeInsets.only(left: 50, right: 10), + child : Text("NO INSTANCE INFORMATION", + style: TextStyle(fontSize: 15, color: Colors.grey))), ]))); } } @@ -87,7 +93,7 @@ class ItemWidgetState extends State { border: Border(bottom: BorderSide(color: midColor))), padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 50), child: Text(widget.item.description!.length > 350 ? "${widget.item.description!.substring(0, 347)}..." : widget.item.description!, - style: TextStyle(fontSize: 15, color: Colors.grey, fontWeight: FontWeight.w500))), + style: const TextStyle(fontSize: 15, color: Colors.grey, fontWeight: FontWeight.w500))), Row( children: [ Container(padding: const EdgeInsets.symmetric(vertical: 20), height: getHeight(context) - 300, diff --git a/lib/widgets/items/shallow_item_row.dart b/lib/widgets/items/shallow_item_row.dart index 5b9d20e..e3e879c 100644 --- a/lib/widgets/items/shallow_item_row.dart +++ b/lib/widgets/items/shallow_item_row.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:flutter/material.dart'; import 'package:flutter_flow_chart/flutter_flow_chart.dart'; import 'package:oc_front/main.dart'; @@ -43,7 +41,7 @@ class ShallowItemRowWidgetState extends State { child: Row( children: [ Padding( padding: const EdgeInsets.only(right: 5), child: widget.edit == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click, - onTap: () => widget.edit!(widget.item.getID() + "~" + widget.item.getName()), child: const Icon(Icons.edit, color: Colors.grey,))), + onTap: () => widget.edit!( "${widget.item.getID()}~${widget.item.getName()}"), child: const Icon(Icons.edit, color: Colors.grey,))), Padding( padding: const EdgeInsets.only(right: 5), child: widget.delete == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click, onTap: () => widget.delete!(widget.item.getID()), child: const Icon(Icons.delete, color: Colors.grey,))), @@ -52,21 +50,19 @@ class ShallowItemRowWidgetState extends State { Column( children: [ widget.low || widget.icon == null ? Container( padding: const EdgeInsets.only(left: 10),) : Container( padding: const EdgeInsets.all(10), constraints: BoxConstraints(maxWidth: widget.contextWidth, minWidth: widget.contextWidth), - child: Icon( widget.icon!, size: widget.contextWidth / 1.9, color: const Color(0xFFF67C0B9),)), - Container( - child: Padding(padding: widget.contextWidth != getMainWidth(context) ? - const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, children: [ - Row( children: [ - Expanded( child: Center( child: Text(widget.item.getName().toUpperCase(), - style: const TextStyle(fontSize: 15, - overflow: TextOverflow.ellipsis, - fontWeight: FontWeight.w600, color: Colors.grey)), - )) - ]), - ],) - ) + child: Icon( widget.icon!, size: widget.contextWidth / 1.9, color: const Color(0xfff67c0b9),)), + Padding(padding: widget.contextWidth != getMainWidth(context) ? + const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ + Row( children: [ + Expanded( child: Center( child: Text(widget.item.getName().toUpperCase(), + style: const TextStyle(fontSize: 15, + overflow: TextOverflow.ellipsis, + fontWeight: FontWeight.w600, color: Colors.grey)), + )) + ]), + ],) ), ]) ])))); @@ -76,6 +72,7 @@ class ShallowItemRowWidgetState extends State { } } +// ignore: must_be_immutable class ShallowItemFlowDataRowWidget extends StatefulWidget { bool readOnly = false; double contextWidth = 0; @@ -114,7 +111,7 @@ class ShallowItemFlowDataRowWidgetState extends State widget.edit!(widget.item.getID() + "~" + widget.item.getName()), child: const Icon(Icons.edit, color: Colors.grey,))), + onTap: () => widget.edit!("${widget.item.getID()}~${widget.item.getName()}"), child: const Icon(Icons.edit, color: Colors.grey,))), Padding( padding: const EdgeInsets.only(right: 5), child: widget.delete == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click, onTap: () => widget.delete!(widget.item.getID()), child: const Icon(Icons.delete, color: Colors.grey,))), @@ -126,21 +123,19 @@ class ShallowItemFlowDataRowWidgetState extends State valid = {}; +// ignore: must_be_immutable class LogsWidget extends StatefulWidget { String? level; String search = ""; WorkflowExecution? exec; List logs = []; - LogsWidget ({ Key? key, this.search = "", this.level, this.exec }): super(key: key); + LogsWidget ({ super.key, this.search = "", this.level, this.exec }); @override LogsWidgetState createState() => LogsWidgetState(); } @@ -73,12 +74,12 @@ class LogsWidgetState extends State { List itemRows = logs.where((element) => (element.message?.toLowerCase().contains(widget.search.toLowerCase()) ?? true) && (widget.level?.contains(element.level ?? "") ?? true) ).map((e) => LogWidget(item: e)).toList(); if (isLoading) { - return Container( height: getMainHeight(context) - 100, - child: Center( child: CircularProgressIndicator()) ); + return SizedBox( height: getMainHeight(context) - 100, + child: const Center( child: CircularProgressIndicator()) ); } return Stack( children: [ SingleChildScrollView( child: itemRows.isEmpty ? - Container( height: getMainHeight(context) - 100, + SizedBox( height: getMainHeight(context) - 100, child: const Center( child: Text("no log registered", style: TextStyle(color: Colors.grey, fontSize: 25 ),))) : Column( children: [...itemRows, Container(height: 50,) ] ) ), ]); @@ -88,10 +89,11 @@ class LogsWidgetState extends State { } } +// ignore: must_be_immutable class LogWidget extends StatefulWidget { final Log item; bool expanded = false; - LogWidget ({ Key? key, required this.item }): super(key: key); + LogWidget ({ super.key, required this.item }); @override LogWidgetState createState() => LogWidgetState(); } class LogWidgetState extends State { diff --git a/lib/widgets/sheduler_items/schedule.dart b/lib/widgets/sheduler_items/schedule.dart index 8dc8ca3..b7b3456 100644 --- a/lib/widgets/sheduler_items/schedule.dart +++ b/lib/widgets/sheduler_items/schedule.dart @@ -44,7 +44,6 @@ 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; } @@ -211,11 +210,11 @@ class ScheduleWidgetState extends State { borderSide: BorderSide(color: midColor, width: 0)), ), items: [ - DropdownMenuItem(value: "debug,warning,error,info", child: Row( children: [ Container( width: 10, height: 15, color: Colors.grey), Text(" all", style: TextStyle(fontSize: 12, color: Colors.black)) ])), - DropdownMenuItem(value: "debug", child: Row( children: [ Container( width: 10, height: 15, color: Colors.blue), Text(" debug", style: TextStyle(fontSize: 12, color: Colors.black)) ])), - DropdownMenuItem(value: "warning", child: Row( children: [ Container( width: 10, height: 15, color: Colors.orange), Text(" warning", style: TextStyle(fontSize: 12, color: Colors.black)) ])), - DropdownMenuItem(value: "error", child: Row( children: [ Container( width: 10, height: 15, color: redColor), Text(" error", style: TextStyle(fontSize: 12, color: Colors.black)) ])), - DropdownMenuItem(value: "info", child: Row( children: [ Container( width: 10, height: 15, color: Colors.green), Text(" info", style: TextStyle(fontSize: 12, color: Colors.black)) ])), + DropdownMenuItem(value: "debug,warning,error,info", child: Row( children: [ Container( width: 10, height: 15, color: Colors.grey), const Text(" all", style: TextStyle(fontSize: 12, color: Colors.black)) ])), + DropdownMenuItem(value: "debug", child: Row( children: [ Container( width: 10, height: 15, color: Colors.blue), const Text(" debug", style: TextStyle(fontSize: 12, color: Colors.black)) ])), + DropdownMenuItem(value: "warning", child: Row( children: [ Container( width: 10, height: 15, color: Colors.orange), const Text(" warning", style: TextStyle(fontSize: 12, color: Colors.black)) ])), + DropdownMenuItem(value: "error", child: Row( children: [ Container( width: 10, height: 15, color: redColor), const Text(" error", style: TextStyle(fontSize: 12, color: Colors.black)) ])), + DropdownMenuItem(value: "info", child: Row( children: [ Container( width: 10, height: 15, color: Colors.green), const Text(" info", style: TextStyle(fontSize: 12, color: Colors.black)) ])), ], onChanged: (value) { setState(() { diff --git a/lib/widgets/sheduler_items/scheduler_calendar.dart b/lib/widgets/sheduler_items/scheduler_calendar.dart index b4964cc..1e365e0 100644 --- a/lib/widgets/sheduler_items/scheduler_calendar.dart +++ b/lib/widgets/sheduler_items/scheduler_calendar.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:oc_front/core/sections/header/header.dart'; import 'package:oc_front/main.dart'; import 'package:oc_front/models/workflow.dart'; import 'package:oc_front/widgets/sheduler_items/schedule.dart'; diff --git a/library/flutter_flow_chart/lib/src/dashboard.dart b/library/flutter_flow_chart/lib/src/dashboard.dart index f954d1f..908c308 100755 --- a/library/flutter_flow_chart/lib/src/dashboard.dart +++ b/library/flutter_flow_chart/lib/src/dashboard.dart @@ -371,7 +371,7 @@ class Dashboard extends ChangeNotifier { bool noHistory = false; void addToHistory() { if (noHistory) { - Future.delayed(Duration(seconds: 2), () { + Future.delayed(const Duration(seconds: 2), () { noHistory = false; }); return; @@ -379,7 +379,7 @@ class Dashboard extends ChangeNotifier { if (tempHistory.length >= 50) { tempHistory.removeAt(0); } tempHistory.add(toMap()); history = tempHistory.map((e) => e).toList(); - Future.delayed(Duration(seconds: 1), () { + Future.delayed(const Duration(seconds: 1), () { chartMenuKey.currentState?.setState(() { }); }); } diff --git a/library/flutter_flow_chart/lib/src/flow_chart.dart b/library/flutter_flow_chart/lib/src/flow_chart.dart index 606bcd7..43b4bff 100755 --- a/library/flutter_flow_chart/lib/src/flow_chart.dart +++ b/library/flutter_flow_chart/lib/src/flow_chart.dart @@ -26,6 +26,7 @@ abstract class FlowData { FlowData deserialize(Map data); } +// ignore: must_be_immutable class FlowChart extends StatefulWidget { FlowChart({ required this.dashboard, @@ -60,7 +61,7 @@ class FlowChart extends StatefulWidget { this.menuExtension, this.itemLeftBottomBadges, this.itemrightTopBadges, - }) {} + }); final String? current; final List categories; final double width; @@ -170,7 +171,7 @@ class FlowChart extends StatefulWidget { /// Trigger for the scale change final void Function(double scale)? onScaleUpdate; - + bool dashboardSelected = true; @override State createState() => FlowChartState(); } @@ -182,6 +183,7 @@ class HoverMenuController { currentState?.hideSubMenu(); } } +// ignore: must_be_immutable class HoverMenu extends StatefulWidget { final Widget title; final double? width; @@ -191,12 +193,12 @@ class HoverMenu extends StatefulWidget { HoverMenu({ - Key? key, + super.key, required this.title, this.items = const [], this.width, this.controller, - }) : super(key: key); + }); @override HoverMenuState createState() => HoverMenuState(); @@ -324,6 +326,7 @@ class FlowChartState extends State { widget.dashboard.inDialog = true; showDialog( barrierDismissible: false, + // ignore: use_build_context_synchronously context: context, builder: (context) { return AlertDialog( titlePadding: EdgeInsets.zero, @@ -364,63 +367,63 @@ class FlowChartState extends State { autofocus: true, onKeyEvent: (event) { bool change = false; - if (event.logicalKey == LogicalKeyboardKey.controlLeft && event is KeyDownEvent) { - print("CTRL true"); - isCtrl = true; - } - 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) { - widget.dashboard.addElement(FlowElement( - element: el.element as T, - dashboard: widget.dashboard, - id: const Uuid().v4(), - position: el.position + const Offset(100, 100), - size: el.size, - text: el.text, - widget: el.widget, - kind: el.kind, - handlers: el.handlers, - handlerSize: el.handlerSize, - ), context); - } - } - if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.delete) { - change = true; - widget.dashboard.removeElements((element) { - if (element.isSelected) { - widget.dashboard.arrows.removeWhere( (e) => e.toID.contains(element.id) || e.fromID.contains(element.id)); - } - return element.isSelected; - }, context); - for (var arrow in widget.dashboard.arrowsSelected) { - for (var el in widget.dashboard.elements.where((element) => element.id == arrow.fromID.split("_")[0])) { - el.next.removeAt(int.parse(arrow.fromID.split("_")[1])); + if (widget.dashboardSelected) { + if (event.logicalKey == LogicalKeyboardKey.controlLeft && event is KeyDownEvent) { + isCtrl = true; + } + if (event.logicalKey == LogicalKeyboardKey.controlLeft && event is KeyUpEvent) { + 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) { + widget.dashboard.addElement(FlowElement( + element: el.element as T, + dashboard: widget.dashboard, + id: const Uuid().v4(), + position: el.position + const Offset(100, 100), + size: el.size, + text: el.text, + widget: el.widget, + kind: el.kind, + handlers: el.handlers, + handlerSize: el.handlerSize, + ), context); } } - widget.dashboard.removeArrows( (el) => el.isSelected, context ); - } - if (change) { - DrawingArrow.instance.notifyListeners(); - widget.dashboard.chartKey.currentState?.setState(() { }); - node.requestFocus(); + if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.delete) { + change = true; + widget.dashboard.removeElements((element) { + if (element.isSelected) { + widget.dashboard.arrows.removeWhere( (e) => e.toID.contains(element.id) || e.fromID.contains(element.id)); + } + return element.isSelected; + }, context); + for (var arrow in widget.dashboard.arrowsSelected) { + for (var el in widget.dashboard.elements.where((element) => element.id == arrow.fromID.split("_")[0])) { + el.next.removeAt(int.parse(arrow.fromID.split("_")[1])); + } + } + widget.dashboard.removeArrows( (el) => el.isSelected, context ); + } + if (change) { + DrawingArrow.instance.notifyListeners(); + widget.dashboard.chartKey.currentState?.setState(() { }); + node.requestFocus(); + } } }, child: ClipRect( child: Stack( clipBehavior: Clip.none, children: [ - Stack(children: [ + Stack(children: [ // Draw the grid DragTarget( builder: ( @@ -428,7 +431,15 @@ class FlowChartState extends State { List accepted, List rejected, ) { - return SizedBox( + return MouseRegion( + onEnter: (ev) { + print("sqfdsfd"); + widget.dashboardSelected = true; + }, + onExit: (ev) { + widget.dashboardSelected = false; + }, + child: SizedBox( width: widget.width, height: widget.height, child: ChartWidget( @@ -449,7 +460,7 @@ class FlowChartState extends State { onHandlerPressed: widget.onHandlerLongPressed, onHandlerLongPressed: widget.onHandlerLongPressed, onPivotSecondaryPressed: widget.onPivotSecondaryPressed, - )); + ))); }, onAcceptWithDetails: (DragTargetDetails details) { var e = details.data; @@ -479,24 +490,24 @@ class FlowChartState extends State { ); widget.dashboard.addElement(el, context); }, - )] + )] ), widget.dashboard.isMenu ? Positioned(top: 50, child: FlowChartSelectedMenu( key: widget.dashboard.selectedMenuKey, dashboard: widget.dashboard, - height: widget.height - 50) ) : Container(), + height: widget.height - 50)) : Container(), widget.dashboard.isInfo ? Positioned(top: 50, right: 0, child: FlowChartLeftMenu( - key: widget.dashboard.selectedLeftMenuKey, - dashboard: widget.dashboard, - menuExtension: widget.menuExtension, - categories: widget.categories, - height: widget.height, - innerMenuWidth: widget.innerMenuWidth, - itemWidth: widget.itemWidth, - draggableItemBuilder: widget.draggableItemBuilder as List Function(String cat), - getDraggable: getDraggable, - )) : Container() + key: widget.dashboard.selectedLeftMenuKey, + dashboard: widget.dashboard, + menuExtension: widget.menuExtension, + categories: widget.categories, + height: widget.height, + innerMenuWidth: widget.innerMenuWidth, + itemWidth: widget.itemWidth, + draggableItemBuilder: widget.draggableItemBuilder as List Function(String cat), + getDraggable: getDraggable, + )) : Container() ]) )); } @@ -576,8 +587,9 @@ class _DrawingArrowWidgetState extends State { } } +// ignore: must_be_immutable class ChartWidget extends StatefulWidget { - ChartWidget ({ Key? key, + ChartWidget ({ super.key, required this.flowChart, this.onElementPressed, this.onElementSecondaryTapped, @@ -597,7 +609,7 @@ class ChartWidget extends StatefulWidget { required this.dashboard, this.onNewConnection, this.menuWidget, - }) : super(key: key); + }); FlowChartState flowChart; @@ -764,7 +776,7 @@ class ChartWidgetState extends State { if (!hoverImportant) { for (var sel in widget.dashboard.elements) { sel.isSelected = false; } for (var sel in widget.dashboard.arrows) { sel.isSelected = false; } - Future.delayed(Duration(milliseconds: 100), () { + Future.delayed(const Duration(milliseconds: 100), () { widget.dashboard.selectedMenuKey.currentState?.setState(() {}); DrawingArrow.instance.notifyListeners(); }); diff --git a/library/flutter_flow_chart/lib/src/flow_chart_left_menu.dart b/library/flutter_flow_chart/lib/src/flow_chart_left_menu.dart index 047ced3..35bb946 100644 --- a/library/flutter_flow_chart/lib/src/flow_chart_left_menu.dart +++ b/library/flutter_flow_chart/lib/src/flow_chart_left_menu.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_flow_chart/flutter_flow_chart.dart'; +// ignore: must_be_immutable class FlowChartLeftMenu extends StatefulWidget { Dashboard dashboard; List categories; @@ -39,10 +40,10 @@ class FlowChartLeftMenuState extends State extends State extends State extends State { width: 200, height: widget.height, color: widget.dashboard.midDashColor, - child: SingleChildScrollView( child: Column( children: [ ...widget.dashboard.infoItemWidget != null ? + child: SingleChildScrollView( child: Column( children: [ + ...widget.dashboard.infoItemWidget != null ? widget.dashboard.infoItemWidget!(widget.dashboard.elementSelected.first.element, widget.dashboard.elementSelected.first.id) : [], widget.dashboard.arrowsSelected.isNotEmpty || widget.dashboard.elementSelected.isNotEmpty ? Container( width: 200, - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration(border: Border( + margin: const EdgeInsets.only(top: 15), + decoration: const BoxDecoration(border: Border( top: BorderSide(color: Colors.grey, width: 1))), child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ Tooltip( message: "remove", @@ -38,13 +40,13 @@ class FlowChartSelectedMenuState extends State { } return element.isSelected; }, context); - Future.delayed(Duration(milliseconds: 100), () { + Future.delayed( const Duration(milliseconds: 100), () { widget.dashboard.flutterChartKey.currentState?.setState(() { }); }); - }, child: Container( margin: EdgeInsets.all(10), + }, child: Container( margin: const EdgeInsets.all(10), decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.black, width: 1)), width: 200, height: 30, - child: Icon(Icons.delete_outline, color: Colors.black), + child: const Icon(Icons.delete_outline, color: Colors.black), )) ), Tooltip( message: "copy", @@ -52,17 +54,17 @@ class FlowChartSelectedMenuState extends State { onTap: () { for (var sel in widget.dashboard.elementSelected) { var el =FlowElement.fromMap(widget.dashboard, sel.toMap()); - el.id = Uuid().v8(); + el.id = const Uuid().v8(); widget.dashboard.addElement(FlowElement.fromMap(widget.dashboard, sel.toMap()), context); - widget.dashboard.elements.last.position += Offset(50, 50); + widget.dashboard.elements.last.position += const Offset(50, 50); } - Future.delayed(Duration(milliseconds: 100), () { + Future.delayed( const Duration(milliseconds: 100), () { widget.dashboard.chartKey.currentState?.setState(() { }); }); - }, child: Container( margin: EdgeInsets.only(left: 10, right: 10, bottom: 10), + }, child: Container( margin: const 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), + child: const Icon(Icons.copy, color: Colors.black), )) ), ]) @@ -120,11 +122,14 @@ class FlowChartSelectedMenuState extends State { Container( padding: const EdgeInsets.all(10), width: 200, height: 60, decoration: const 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), + Text("STYLE ${widget.dashboard.elementSelected.isNotEmpty ? "ELEMENT" : "ARROW"}", + style: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold), textAlign: TextAlign.center), + Text("<${widget.dashboard.arrowsSelected.isEmpty && widget.dashboard.elementSelected.isEmpty ? "general" : "selected"}>", + style: const TextStyle(fontSize: 12), textAlign: TextAlign.center), ])), SizedBox( width: 200, height: widget.height - 60, child: SingleChildScrollView( child: Column( children: [ - widget.dashboard.elementSelected.isNotEmpty ? Container() : Container( padding: EdgeInsets.symmetric(horizontal: 10, vertical: 20), + widget.dashboard.elementSelected.isNotEmpty ? Container() : Container( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 20), decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey, width: 1))), child: Column( children: [ Row( children: [ @@ -617,7 +622,9 @@ class FlowChartSelectedMenuState extends State { ] ) ), - widget.dashboard.error != null ? Container( width: 200, color: Colors.red, padding: EdgeInsets.all(10), + widget.dashboard.error != null ? Container( width: 200, + color: Colors.red, + padding: const EdgeInsets.all(10), child: Center( child: Text(widget.dashboard.error!, style: const TextStyle(color: Colors.white, fontSize: 15), textAlign: TextAlign.center))) : Container(), w 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 c3e5db0..dc6bc81 100755 --- a/library/flutter_flow_chart/lib/src/ui/element_widget.dart +++ b/library/flutter_flow_chart/lib/src/ui/element_widget.dart @@ -177,7 +177,7 @@ class ElementWidgetState extends State { childWhenDragging: const SizedBox.shrink(), feedback: Material( color: Colors.transparent, - child: Padding( padding: EdgeInsets.all(6), + child: Padding( padding: const EdgeInsets.all(6), child: Container( decoration: BoxDecoration(border: Border.all( color: Colors.red, width: 2)), width: widget.element.size.width - 12, @@ -262,7 +262,7 @@ class ElementWidgetState extends State { children: (!widget.isHovered ? [] : [ IconButton(tooltip: "remove element", onPressed: () { widget.dashboard.removeElement(widget.element, context); - }, icon: Icon(Icons.delete_outline)), + }, icon: const Icon(Icons.delete_outline)), IconButton(tooltip: "copy element", onPressed: () { FlowElement newElement = FlowElement( element: widget.element.element as T?, @@ -273,7 +273,7 @@ class ElementWidgetState extends State { widget: widget.element.widget, ); widget.dashboard.addElement(newElement, context); - }, icon: Icon(Icons.copy, size: 20)), + }, icon: const Icon(Icons.copy, size: 20)), ])) ), ]) diff --git a/library/flutter_flow_chart/lib/src/ui/handler_widget.dart b/library/flutter_flow_chart/lib/src/ui/handler_widget.dart index 41f4c4e..3567ff2 100755 --- a/library/flutter_flow_chart/lib/src/ui/handler_widget.dart +++ b/library/flutter_flow_chart/lib/src/ui/handler_widget.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; /// The arrow tip. +// ignore: must_be_immutable class HandlerWidget extends StatelessWidget { /// HandlerWidget({ diff --git a/library/flutter_flow_chart/lib/src/ui/resize_widget.dart b/library/flutter_flow_chart/lib/src/ui/resize_widget.dart index a2bcbcc..83c28b7 100644 --- a/library/flutter_flow_chart/lib/src/ui/resize_widget.dart +++ b/library/flutter_flow_chart/lib/src/ui/resize_widget.dart @@ -4,6 +4,7 @@ import 'package:flutter_flow_chart/src/ui/element_widget.dart'; import 'package:flutter_flow_chart/src/ui/handler_widget.dart'; /// The widget to press and drag to resize the element +// ignore: must_be_immutable class ResizeWidget extends StatefulWidget { Widget? bottomLeftBadge; Widget? bottomRightBadge; @@ -23,7 +24,7 @@ class ResizeWidget extends StatefulWidget { super.key, }); - Color handlerColor = Color.fromRGBO(38, 166, 154, 1); + Color handlerColor = const Color.fromRGBO(38, 166, 154, 1); final ElementWidgetState comp; /// final Dashboard dashboard;