From 99924c1e62053f72286afd7b50417eabbbe58605 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 10:27:17 +0300 Subject: [PATCH 01/10] Refactor color management and UI components for consistency - Updated color references in various widgets to use the new `opaquePrimary` color for better visual consistency. - Refactored `ColorsManager` to improve color definitions and removed redundant color declarations. - Enhanced UI elements across multiple dialogs and widgets to ensure a cohesive design language. This change promotes maintainability and aligns with the updated color scheme. --- lib/common/dialog_dropdown.dart | 12 +- lib/common/edit_chip.dart | 9 +- lib/common/tag_dialog_textfield_dropdown.dart | 8 +- lib/common/widgets/search_bar.dart | 2 +- .../presentation/view/booking_page.dart | 34 ++-- .../view/widgets/booking_sidebar.dart | 25 +-- .../screens/setup_bookable_spaces_dialog.dart | 21 +- ...okable_space_switch_activation_widget.dart | 18 +- .../bottom_pagination_part_widget.dart | 12 +- .../widgets/points_part_widget.dart | 9 +- .../search_unbookable_spaces_widget.dart | 5 +- .../widgets/stepper_part_widget.dart | 4 +- .../helpers/range_of_aqi_charts_helper.dart | 2 +- .../widgets/aqi_distribution_chart.dart | 2 +- .../air_quality/widgets/aqi_gauge.dart | 2 +- .../widgets/aqi_location_info_cell.dart | 2 +- .../widgets/aqi_sub_value_widget.dart | 2 +- .../widgets/aqi_type_dropdown.dart | 2 +- .../widgets/range_of_aqi_chart.dart | 2 +- .../widgets/month_picker_widget.dart | 6 +- .../sidebar/analytics_space_tree_view.dart | 2 +- .../analytics/widgets/year_picker_widget.dart | 6 +- .../energy_management_charts_helper.dart | 2 +- .../widgets/analytics_device_dropdown.dart | 2 +- .../energy_consumption_by_phases_chart.dart | 3 +- .../occupancy/widgets/heat_map_tooltip.dart | 4 +- .../occupancy/widgets/occupancy_chart.dart | 2 +- lib/pages/auth/view/login_web_page.dart | 41 ++-- .../common/buttons/search_reset_buttons.dart | 2 +- lib/pages/common/curtain_toggle.dart | 2 +- lib/pages/common/custom_table.dart | 37 ++-- .../batch_control_list/batch_ac_mode.dart | 6 +- .../batch_control_list/batch_fan_speed.dart | 10 +- .../ac/view/control_list/ac_mode.dart | 6 +- .../ac/view/control_list/ac_toggle.dart | 2 +- .../ac/view/control_list/fan_speed.dart | 10 +- .../view/device_managment_page.dart | 23 ++- .../widgets/device_managment_body.dart | 27 ++- .../widgets/accurate_calibrating_dialog.dart | 2 +- .../widgets/accurate_calibration_dialog.dart | 2 +- .../widgets/calibrate_completed_dialog.dart | 2 +- .../widgets/curtain_action_widget.dart | 2 +- .../widgets/curtain_movment_widget.dart | 2 +- .../widgets/pref_revers_card_widget.dart | 5 +- .../widgets/prefrences_dialog.dart | 2 +- .../widgets/quick_calibrating_dialog.dart | 2 +- .../widgets/quick_calibration_dialog.dart | 2 +- .../device_setting/device_settings_panel.dart | 36 ++-- .../device_setting/sub_space_dialog.dart | 2 +- .../gateway/view/gateway_view.dart | 3 +- .../power_clamp/view/power_chart.dart | 2 +- .../power_clamp/view/power_info_card.dart | 2 +- .../view/smart_power_device_control.dart | 15 +- .../schedule_control_button.dart | 2 +- .../schedule_widgets/schedule_header.dart | 2 +- .../shared/batch_control/factory_reset.dart | 4 +- .../shared/icon_name_status_container.dart | 2 +- .../sensors_widgets/presence_space_type.dart | 8 +- .../shared/toggle_widget.dart | 2 +- .../widgets/cieling_light.dart | 6 +- .../three_gang_switch/widgets/spot_light.dart | 6 +- .../three_gang_switch/widgets/wall_light.dart | 6 +- .../helper/add_schedule_dialog_helper.dart | 12 +- .../view/popup_menu_filter.dart | 2 +- .../add_user_dialog/view/role_dropdown.dart | 2 +- .../view/roles_and_permission.dart | 19 +- .../view/creation_date_filter.dart | 12 +- .../users_table/view/de_activate_filter.dart | 12 +- .../users_table/view/name_filter.dart | 2 +- .../users_table/view/user_table.dart | 10 +- .../users_table/view/users_page.dart | 28 ++- .../roles_and_permission/view/role_card.dart | 6 +- .../view/roles_and_permission_page.dart | 6 +- .../roles_and_permission/view/roles_page.dart | 2 +- .../create_new_routines/commu_dropdown.dart | 6 +- .../create_new_routines/space_dropdown.dart | 9 +- .../routines/helper/save_routine_helper.dart | 54 +++--- .../view/create_new_routine_view.dart | 4 +- .../routines/widgets/condition_toggle.dart | 14 +- lib/pages/routines/widgets/delete_scene.dart | 5 +- lib/pages/routines/widgets/dialog_footer.dart | 6 +- lib/pages/routines/widgets/dialog_header.dart | 2 +- lib/pages/routines/widgets/dragable_card.dart | 32 +-- lib/pages/routines/widgets/if_container.dart | 34 ++-- .../main_routine_view/routine_view_card.dart | 18 +- .../routine_dialog_selection_list_tile.dart | 4 +- .../widgets/routine_dialogs/ac_dialog.dart | 34 ++-- .../routine_dialogs/curtain_dialog.dart | 17 +- .../one_gang_switch_dialog.dart | 24 +-- .../routine_dialogs/setting_dialog.dart | 183 ++++++++++++------ .../three_gang_switch_dialog.dart | 30 +-- .../two_gang_switch_dialog.dart | 47 ++--- .../widgets/routine_search_and_buttons.dart | 64 +++--- lib/pages/routines/widgets/value_display.dart | 4 +- .../shared/widgets/community_dialog.dart | 4 +- .../widgets/community_structure_header.dart | 2 +- .../widgets/plus_button_widget.dart | 2 +- .../main_module/widgets/space_cell.dart | 4 +- .../space_management_templates_view.dart | 2 +- .../widgets/delete_space_dialog.dart | 34 ++-- .../widgets/delete_space_dialog_form.dart | 27 +-- .../widgets/space_details_action_buttons.dart | 2 +- .../widgets/space_details_devices_box.dart | 6 +- .../widgets/space_details_dialog.dart | 4 +- .../widgets/space_details_form.dart | 2 +- .../widgets/space_icon_selection_dialog.dart | 2 +- .../presentation/widgets/subspace_chip.dart | 2 +- .../widgets/subspace_name_display_widget.dart | 2 +- .../widgets/add_device_type_widget.dart | 2 +- .../widgets/product_tag_field.dart | 2 +- .../widgets/product_type_card.dart | 2 +- .../space_tree/view/custom_expansion.dart | 2 +- .../space_tree/view/space_tree_view.dart | 28 ++- .../views/add_device_type_widget.dart | 17 +- .../widgets/device_type_tile_widget.dart | 2 +- .../widgets/add_device_type_widget.dart | 31 ++- .../widgets/blank_community_widget.dart | 3 +- .../community_structure_header_widget.dart | 7 +- .../widgets/community_structure_widget.dart | 32 ++- .../devices_part_widget.dart | 5 +- .../space_model_linking_widget.dart | 6 +- .../widgets/dialogs/create_space_dialog.dart | 47 ++--- .../widgets/dialogs/delete_dialogue.dart | 20 +- .../dialogs/icon_selection_dialog.dart | 9 +- .../all_spaces/widgets/hoverable_button.dart | 4 +- .../widgets/plus_button_widget.dart | 2 +- .../selected_products_button_widget.dart | 2 +- .../widgets/space_container_widget.dart | 4 +- .../all_spaces/widgets/space_widget.dart | 2 +- .../assign_tag/views/assign_tag_dialog.dart | 2 +- .../widgets/save_add_device_row_widget.dart | 13 +- .../views/assign_tag_models_dialog.dart | 9 +- .../views/widgets/RowOfCancelSaveWidget.dart | 17 +- .../view/create_community_dialog.dart | 8 +- .../views/create_subspace_model_dialog.dart | 2 +- .../widgets/ok_cancel_sub_space_widget.dart | 6 +- .../views/create_subspace_model_dialog.dart | 2 +- .../create_subspace_model_footer_buttons.dart | 2 +- .../widgets/subspace_chip.dart | 2 +- .../view/link_space_model_dialog.dart | 6 +- .../space_model/view/space_model_page.dart | 13 +- .../widgets/add_space_model_widget.dart | 2 +- .../widgets/dialog/confirm_merge_dialog.dart | 4 +- .../dialog/confirm_overwrite_dialog.dart | 4 +- .../dialog/create_space_model_dialog.dart | 90 +++++---- .../dialog/delete_space_model_dialog.dart | 4 +- .../link_space_model_spaces_dialog.dart | 20 +- .../dialog/linking_attention_dialog.dart | 2 +- .../widgets/dialog/linking_successful.dart | 2 +- .../widgets/subspace_name_label_widget.dart | 5 +- .../widgets/tag_chips_display_widget.dart | 2 +- .../views/add_device_type_model_widget.dart | 17 +- .../widgets/device_type_tile_widget.dart | 2 +- .../view/add_device_dialog.dart | 32 ++- .../view/visitor_password_dialog.dart | 20 +- lib/utils/color_manager.dart | 27 ++- lib/utils/extension/app_snack_bar.dart | 2 +- lib/utils/extension/build_context_x.dart | 8 +- lib/utils/snack_bar.dart | 14 +- lib/utils/style.dart | 4 +- lib/utils/theme/responsive_text_theme.dart | 2 +- lib/utils/theme/theme.dart | 10 +- lib/utils/user_drop_down_menu.dart | 38 ++-- lib/web_layout/web_app_bar.dart | 2 +- 164 files changed, 911 insertions(+), 997 deletions(-) diff --git a/lib/common/dialog_dropdown.dart b/lib/common/dialog_dropdown.dart index 7274b3c0..360b3738 100644 --- a/lib/common/dialog_dropdown.dart +++ b/lib/common/dialog_dropdown.dart @@ -66,7 +66,7 @@ class _DialogDropdownState extends State { child: Material( elevation: 4.0, child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, constraints: const BoxConstraints( maxHeight: 200.0, // Set max height for dropdown ), @@ -87,12 +87,10 @@ class _DialogDropdownState extends State { child: ListTile( title: Text( item, - style: Theme.of(context) - .textTheme - .bodyMedium - ?.copyWith( - color: ColorsManager.textPrimaryColor, - ), + style: + Theme.of(context).textTheme.bodyMedium?.copyWith( + color: ColorsManager.textPrimaryColor, + ), ), onTap: () { widget.onSelected(item); diff --git a/lib/common/edit_chip.dart b/lib/common/edit_chip.dart index 1643b414..cbb91fbe 100644 --- a/lib/common/edit_chip.dart +++ b/lib/common/edit_chip.dart @@ -14,7 +14,7 @@ class EditChip extends StatelessWidget { this.label = 'Edit', required this.onTap, this.labelColor = ColorsManager.spaceColor, - this.backgroundColor = ColorsManager.whiteColors, + this.backgroundColor = ColorsManager.white, this.borderColor = ColorsManager.spaceColor, this.borderRadius = 16.0, }) : super(key: key); @@ -24,10 +24,9 @@ class EditChip extends StatelessWidget { return GestureDetector( onTap: onTap, child: Chip( - label: Text( - label, - style: Theme.of(context).textTheme.bodySmall!.copyWith(color: labelColor) - ), + label: Text(label, + style: + Theme.of(context).textTheme.bodySmall!.copyWith(color: labelColor)), backgroundColor: backgroundColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(borderRadius), diff --git a/lib/common/tag_dialog_textfield_dropdown.dart b/lib/common/tag_dialog_textfield_dropdown.dart index 9fa85284..0636c9ce 100644 --- a/lib/common/tag_dialog_textfield_dropdown.dart +++ b/lib/common/tag_dialog_textfield_dropdown.dart @@ -17,8 +17,7 @@ class TagDialogTextfieldDropdown extends StatefulWidget { }) : super(key: key); @override - _DialogTextfieldDropdownState createState() => - _DialogTextfieldDropdownState(); + _DialogTextfieldDropdownState createState() => _DialogTextfieldDropdownState(); } class _DialogTextfieldDropdownState extends State { @@ -97,7 +96,7 @@ class _DialogTextfieldDropdownState extends State { child: Material( elevation: 4.0, child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, constraints: const BoxConstraints(maxHeight: 200.0), child: StatefulBuilder( builder: (context, setStateDropdown) { @@ -122,8 +121,7 @@ class _DialogTextfieldDropdownState extends State { .textTheme .bodyMedium ?.copyWith( - color: ColorsManager - .textPrimaryColor)), + color: ColorsManager.textPrimaryColor)), onTap: () { _controller.text = tag.tag ?? ''; widget.onSelected(tag); diff --git a/lib/common/widgets/search_bar.dart b/lib/common/widgets/search_bar.dart index a99ac510..da185369 100644 --- a/lib/common/widgets/search_bar.dart +++ b/lib/common/widgets/search_bar.dart @@ -34,7 +34,7 @@ class _CustomSearchBarState extends State { Widget build(BuildContext context) { return Container( decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.2), diff --git a/lib/pages/access_management/booking_system/presentation/view/booking_page.dart b/lib/pages/access_management/booking_system/presentation/view/booking_page.dart index 904d7e9c..57d26455 100644 --- a/lib/pages/access_management/booking_system/presentation/view/booking_page.dart +++ b/lib/pages/access_management/booking_system/presentation/view/booking_page.dart @@ -1,6 +1,7 @@ +import 'package:calendar_view/calendar_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:calendar_view/calendar_view.dart'; +import 'package:syncrow_web/pages/access_management/booking_system/data/services/memory_bookable_space_service.dart'; import 'package:syncrow_web/pages/access_management/booking_system/data/services/remote_calendar_service.dart'; import 'package:syncrow_web/pages/access_management/booking_system/domain/LoadEventsParam.dart'; import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/calendar/events_bloc.dart'; @@ -8,7 +9,6 @@ import 'package:syncrow_web/pages/access_management/booking_system/presentation/ import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/date_selection/date_selection_event.dart'; import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/date_selection/date_selection_state.dart'; import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/selected_bookable_space_bloc/selected_bookable_space_bloc.dart'; -import 'package:syncrow_web/pages/access_management/booking_system/data/services/memory_bookable_space_service.dart'; import 'package:syncrow_web/pages/access_management/booking_system/presentation/view/widgets/booking_sidebar.dart'; import 'package:syncrow_web/pages/access_management/booking_system/presentation/view/widgets/custom_calendar_page.dart'; import 'package:syncrow_web/pages/access_management/booking_system/presentation/view/widgets/icon_text_button.dart'; @@ -114,7 +114,7 @@ class _BookingPageContentState extends State<_BookingPageContent> { Expanded( child: Container( decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, boxShadow: [ BoxShadow( color: ColorsManager.blackColor.withOpacity(0.1), @@ -142,8 +142,7 @@ class _BookingPageContentState extends State<_BookingPageContent> { ), ), Expanded( - child: - BlocBuilder( + child: BlocBuilder( builder: (context, dateState) { return CustomCalendarPage( selectedDate: dateState.selectedDate, @@ -152,8 +151,9 @@ class _BookingPageContentState extends State<_BookingPageContent> { context .read() .add(SelectDate(newDate)); - context.read().add( - SelectDateFromSidebarCalendar(newDate)); + context + .read() + .add(SelectDateFromSidebarCalendar(newDate)); }, ); }, @@ -193,8 +193,7 @@ class _BookingPageContentState extends State<_BookingPageContent> { BlocBuilder( builder: (context, state) { final weekStart = state.weekStart; - final weekEnd = - weekStart.add(const Duration(days: 6)); + final weekEnd = weekStart.add(const Duration(days: 6)); return WeekNavigation( weekStart: weekStart, weekEnd: weekEnd, @@ -204,9 +203,7 @@ class _BookingPageContentState extends State<_BookingPageContent> { .add(PreviousWeek()); }, onNextWeek: () { - context - .read() - .add(NextWeek()); + context.read().add(NextWeek()); }, ); }, @@ -219,8 +216,7 @@ class _BookingPageContentState extends State<_BookingPageContent> { child: BlocBuilder( builder: (context, roomState) { - final selectedRoom = - roomState.selectedBookableSpace; + final selectedRoom = roomState.selectedBookableSpace; return BlocBuilder( builder: (context, dateState) { @@ -228,12 +224,10 @@ class _BookingPageContentState extends State<_BookingPageContent> { CalendarEventState>( builder: (context, eventState) { return WeeklyCalendarPage( - key: ValueKey( - selectedRoom?.uuid ?? 'no-room'), - startTime: selectedRoom - ?.bookableConfig.startTime, - endTime: - selectedRoom?.bookableConfig.endTime, + key: ValueKey(selectedRoom?.uuid ?? 'no-room'), + startTime: + selectedRoom?.bookableConfig.startTime, + endTime: selectedRoom?.bookableConfig.endTime, weekStart: dateState.weekStart, selectedDate: dateState.selectedDate, eventController: _eventController, diff --git a/lib/pages/access_management/booking_system/presentation/view/widgets/booking_sidebar.dart b/lib/pages/access_management/booking_system/presentation/view/widgets/booking_sidebar.dart index bd051a94..6d9f79b7 100644 --- a/lib/pages/access_management/booking_system/presentation/view/widgets/booking_sidebar.dart +++ b/lib/pages/access_management/booking_system/presentation/view/widgets/booking_sidebar.dart @@ -80,7 +80,7 @@ class __SidebarContentState extends State<_SidebarContent> { padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), child: Container( decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, boxShadow: [ BoxShadow( color: ColorsManager.blackColor.withOpacity(0.1), @@ -94,7 +94,7 @@ class __SidebarContentState extends State<_SidebarContent> { ), Container( decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, boxShadow: [ BoxShadow( color: ColorsManager.blackColor.withOpacity(0.1), @@ -108,8 +108,8 @@ class __SidebarContentState extends State<_SidebarContent> { padding: const EdgeInsets.all(8.0), child: Container( child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, vertical: 8.0), + padding: + const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), child: Container( decoration: BoxDecoration( color: ColorsManager.counterBackgroundColor, @@ -119,12 +119,10 @@ class __SidebarContentState extends State<_SidebarContent> { children: [ Expanded( child: TextField( - style: Theme.of(context) - .textTheme - .bodyMedium - ?.copyWith( - color: ColorsManager.blackColor, - ), + style: + Theme.of(context).textTheme.bodyMedium?.copyWith( + color: ColorsManager.blackColor, + ), controller: searchController, onChanged: _handleSearch, decoration: InputDecoration( @@ -174,8 +172,7 @@ class __SidebarContentState extends State<_SidebarContent> { Expanded( child: ListView.builder( controller: _scrollController, - itemCount: - state.displayedRooms.length + (state.hasMore ? 1 : 0), + itemCount: state.displayedRooms.length + (state.hasMore ? 1 : 0), itemBuilder: (context, index) { if (index == state.displayedRooms.length) { return _buildLoadMoreIndicator(state); @@ -186,9 +183,7 @@ class __SidebarContentState extends State<_SidebarContent> { room: room, isSelected: state.selectedRoomId == room.uuid, onTap: () { - context - .read() - .add(SelectRoomEvent(room.uuid)); + context.read().add(SelectRoomEvent(room.uuid)); widget.onRoomSelected(room); }, ); diff --git a/lib/pages/access_management/manage_bookable_spaces/presentation/screens/setup_bookable_spaces_dialog.dart b/lib/pages/access_management/manage_bookable_spaces/presentation/screens/setup_bookable_spaces_dialog.dart index 07be929f..114afca9 100644 --- a/lib/pages/access_management/manage_bookable_spaces/presentation/screens/setup_bookable_spaces_dialog.dart +++ b/lib/pages/access_management/manage_bookable_spaces/presentation/screens/setup_bookable_spaces_dialog.dart @@ -52,21 +52,20 @@ class _SetupBookableSpacesDialogState extends State { ), )..add( LoadUnBookableSpacesEvent( - nonBookableSpacesParams: - NonBookableSpacesParams(currentPage: 1), + nonBookableSpacesParams: NonBookableSpacesParams(currentPage: 1), ), ), ), BlocProvider( create: widget.editingBookableSpace == null - ? (context) => SetupBookableSpacesBloc( - RemoteNonBookableSpaces(HTTPService())) - : (context) => SetupBookableSpacesBloc( - RemoteNonBookableSpaces(HTTPService())) - ..add( - EditModeSelected( - editingBookableSpace: widget.editingBookableSpace!), - ), + ? (context) => + SetupBookableSpacesBloc(RemoteNonBookableSpaces(HTTPService())) + : (context) => + SetupBookableSpacesBloc(RemoteNonBookableSpaces(HTTPService())) + ..add( + EditModeSelected( + editingBookableSpace: widget.editingBookableSpace!), + ), ), BlocProvider( create: (context) => SendBookableSpacesBloc( @@ -75,7 +74,7 @@ class _SetupBookableSpacesDialogState extends State { ) ], child: AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, contentPadding: EdgeInsets.zero, title: Center( child: Text( diff --git a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/bookable_space_switch_activation_widget.dart b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/bookable_space_switch_activation_widget.dart index 738a2ecc..7744837b 100644 --- a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/bookable_space_switch_activation_widget.dart +++ b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/bookable_space_switch_activation_widget.dart @@ -21,16 +21,14 @@ class BookableSpaceSwitchActivationWidget extends StatelessWidget { return Center( child: Transform.scale( scale: 0.7, - child: - BlocConsumer( + child: BlocConsumer( listener: (context, updateState) { if (updateState is UpdateBookableSpaceSuccess) { context.read().add( InsertUpdatedSpaceEvent( bookableSpaces: bookableSpaces, bookableSpace: space, - updatedBookableSpaceConfig: - updateState.bookableSpaceConfig, + updatedBookableSpaceConfig: updateState.bookableSpaceConfig, ), ); } @@ -42,16 +40,16 @@ class BookableSpaceSwitchActivationWidget extends StatelessWidget { return const Center(child: CircularProgressIndicator()); } return Switch( - trackOutlineColor: WidgetStateProperty.resolveWith( - (Set states) { - return ColorsManager.whiteColors; + trackOutlineColor: + WidgetStateProperty.resolveWith((Set states) { + return ColorsManager.white; }), value: space.spaceConfig!.availability, activeTrackColor: ColorsManager.dialogBlueTitle, inactiveTrackColor: ColorsManager.grayBorder, - thumbColor: WidgetStateProperty.resolveWith( - (Set states) { - return ColorsManager.whiteColors; + thumbColor: + WidgetStateProperty.resolveWith((Set states) { + return ColorsManager.white; }), onChanged: (value) { context.read().add( diff --git a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/main_manage_bookable_widgets/bottom_pagination_part_widget.dart b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/main_manage_bookable_widgets/bottom_pagination_part_widget.dart index b41fe106..ea01f683 100644 --- a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/main_manage_bookable_widgets/bottom_pagination_part_widget.dart +++ b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/main_manage_bookable_widgets/bottom_pagination_part_widget.dart @@ -68,7 +68,7 @@ class PaginationButtonsWidget extends StatelessWidget { decoration: BoxDecoration( color: i == currentPage ? ColorsManager.dialogBlueTitle - : ColorsManager.whiteColors, + : ColorsManager.white, borderRadius: BorderRadius.circular(8), border: Border.all( color: ColorsManager.lightGrayBorderColor, @@ -77,9 +77,8 @@ class PaginationButtonsWidget extends StatelessWidget { '$i', style: TextStyle( color: i == currentPage ? Colors.white : Colors.black, - fontWeight: i == currentPage - ? FontWeight.bold - : FontWeight.normal, + fontWeight: + i == currentPage ? FontWeight.bold : FontWeight.normal, ), ), ), @@ -129,8 +128,7 @@ class PaginationButtonsWidget extends StatelessWidget { ); } - Widget _buildArrowButton( - {required String label, required VoidCallback onTap}) { + Widget _buildArrowButton({required String label, required VoidCallback onTap}) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 4), child: GestureDetector( @@ -140,7 +138,7 @@ class PaginationButtonsWidget extends StatelessWidget { height: 30, alignment: Alignment.center, decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(8), border: Border.all( color: ColorsManager.lightGrayBorderColor, diff --git a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/points_part_widget.dart b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/points_part_widget.dart index 3df5343d..9602f552 100644 --- a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/points_part_widget.dart +++ b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/points_part_widget.dart @@ -62,16 +62,13 @@ class _PointsPartWidgetState extends State { scale: 0.7, child: Switch( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - trackOutlineColor: - WidgetStateProperty.all(ColorsManager.whiteColors), + trackOutlineColor: WidgetStateProperty.all(ColorsManager.white), activeTrackColor: ColorsManager.dialogBlueTitle, inactiveTrackColor: ColorsManager.lightGrayBorderColor, - thumbColor: - WidgetStateProperty.all(ColorsManager.whiteColors), + thumbColor: WidgetStateProperty.all(ColorsManager.white), value: isSwitchOn, onChanged: (value) { - final toggleCubit = - context.read(); + final toggleCubit = context.read(); final bloc = context.read(); final updatedCost = value ? -1 : 0; diff --git a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/search_unbookable_spaces_widget.dart b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/search_unbookable_spaces_widget.dart index ba7cea57..3e8326db 100644 --- a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/search_unbookable_spaces_widget.dart +++ b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/search_unbookable_spaces_widget.dart @@ -36,12 +36,11 @@ class SearchUnbookableSpacesWidget extends StatelessWidget { height: height ?? 40, padding: const EdgeInsets.only(top: 4), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(raduis ?? 15), boxShadow: [ BoxShadow( - color: - ColorsManager.shadowOfSearchTextfield.withValues(alpha: 0.15), + color: ColorsManager.shadowOfSearchTextfield.withValues(alpha: 0.15), offset: Offset.zero, blurRadius: blur ?? 5, spreadRadius: 0, diff --git a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/stepper_part_widget.dart b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/stepper_part_widget.dart index 89f9d1c5..de3c221a 100644 --- a/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/stepper_part_widget.dart +++ b/lib/pages/access_management/manage_bookable_spaces/presentation/widgets/stepper_part_widget.dart @@ -33,7 +33,7 @@ class StepperPartWidget extends StatelessWidget { const CircleTitleStepperWidget( title: 'Settings', titleColor: ColorsManager.softGray, - circleColor: ColorsManager.whiteColors, + circleColor: ColorsManager.white, borderColor: ColorsManager.textGray, ) ], @@ -49,7 +49,7 @@ class StepperPartWidget extends StatelessWidget { titleColor: ColorsManager.softGray, cicleIcon: Icon( Icons.check, - color: ColorsManager.whiteColors, + color: ColorsManager.white, size: 12, ), circleColor: ColorsManager.trueIconGreen, diff --git a/lib/pages/analytics/modules/air_quality/helpers/range_of_aqi_charts_helper.dart b/lib/pages/analytics/modules/air_quality/helpers/range_of_aqi_charts_helper.dart index f46f2708..4beb214b 100644 --- a/lib/pages/analytics/modules/air_quality/helpers/range_of_aqi_charts_helper.dart +++ b/lib/pages/analytics/modules/air_quality/helpers/range_of_aqi_charts_helper.dart @@ -104,7 +104,7 @@ abstract final class RangeOfAqiChartsHelper { ) { return LineTouchData( touchTooltipData: LineTouchTooltipData( - getTooltipColor: (touchTooltipItem) => ColorsManager.whiteColors, + getTooltipColor: (touchTooltipItem) => ColorsManager.white, tooltipBorder: const BorderSide( color: ColorsManager.semiTransparentBlack, ), diff --git a/lib/pages/analytics/modules/air_quality/widgets/aqi_distribution_chart.dart b/lib/pages/analytics/modules/air_quality/widgets/aqi_distribution_chart.dart index 20365325..b41f30da 100644 --- a/lib/pages/analytics/modules/air_quality/widgets/aqi_distribution_chart.dart +++ b/lib/pages/analytics/modules/air_quality/widgets/aqi_distribution_chart.dart @@ -77,7 +77,7 @@ class AqiDistributionChart extends StatelessWidget { BarTouchData _barTouchData(BuildContext context) { return BarTouchData( touchTooltipData: BarTouchTooltipData( - getTooltipColor: (_) => ColorsManager.whiteColors, + getTooltipColor: (_) => ColorsManager.white, tooltipBorder: const BorderSide( color: ColorsManager.semiTransparentBlack, ), diff --git a/lib/pages/analytics/modules/air_quality/widgets/aqi_gauge.dart b/lib/pages/analytics/modules/air_quality/widgets/aqi_gauge.dart index fc7f923a..e50da514 100644 --- a/lib/pages/analytics/modules/air_quality/widgets/aqi_gauge.dart +++ b/lib/pages/analytics/modules/air_quality/widgets/aqi_gauge.dart @@ -65,7 +65,7 @@ class AqiGauge extends StatelessWidget { pointer: GaugePointer.circle( position: const GaugePointerPosition.surface(), radius: MediaQuery.sizeOf(context).width * 0.004, - color: ColorsManager.whiteColors, + color: ColorsManager.white, border: GaugePointerBorder( width: 6, color: statusColor, diff --git a/lib/pages/analytics/modules/air_quality/widgets/aqi_location_info_cell.dart b/lib/pages/analytics/modules/air_quality/widgets/aqi_location_info_cell.dart index 00233ad3..da35f390 100644 --- a/lib/pages/analytics/modules/air_quality/widgets/aqi_location_info_cell.dart +++ b/lib/pages/analytics/modules/air_quality/widgets/aqi_location_info_cell.dart @@ -20,7 +20,7 @@ class AqiLocationInfoCell extends StatelessWidget { return Expanded( child: Container( decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(12), ), child: Stack( diff --git a/lib/pages/analytics/modules/air_quality/widgets/aqi_sub_value_widget.dart b/lib/pages/analytics/modules/air_quality/widgets/aqi_sub_value_widget.dart index 5a8e6e6c..a8868752 100644 --- a/lib/pages/analytics/modules/air_quality/widgets/aqi_sub_value_widget.dart +++ b/lib/pages/analytics/modules/air_quality/widgets/aqi_sub_value_widget.dart @@ -62,7 +62,7 @@ class AqiSubValueWidget extends StatelessWidget { child: Container( padding: const EdgeInsetsDirectional.all(10), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(12), ), child: Row( diff --git a/lib/pages/analytics/modules/air_quality/widgets/aqi_type_dropdown.dart b/lib/pages/analytics/modules/air_quality/widgets/aqi_type_dropdown.dart index 8233fe5a..5a621023 100644 --- a/lib/pages/analytics/modules/air_quality/widgets/aqi_type_dropdown.dart +++ b/lib/pages/analytics/modules/air_quality/widgets/aqi_type_dropdown.dart @@ -46,7 +46,7 @@ class _AqiTypeDropdownState extends State { value: widget.selectedAqiType, isDense: true, borderRadius: BorderRadius.circular(16), - dropdownColor: ColorsManager.whiteColors, + dropdownColor: ColorsManager.white, underline: const SizedBox.shrink(), icon: const RotatedBox( quarterTurns: 1, diff --git a/lib/pages/analytics/modules/air_quality/widgets/range_of_aqi_chart.dart b/lib/pages/analytics/modules/air_quality/widgets/range_of_aqi_chart.dart index 0914eab3..06c53482 100644 --- a/lib/pages/analytics/modules/air_quality/widgets/range_of_aqi_chart.dart +++ b/lib/pages/analytics/modules/air_quality/widgets/range_of_aqi_chart.dart @@ -107,7 +107,7 @@ class RangeOfAqiChart extends StatelessWidget { show: true, getDotPainter: (_, __, ___, ____) => FlDotCirclePainter( radius: 2, - color: ColorsManager.whiteColors, + color: ColorsManager.white, strokeWidth: 2, strokeColor: color, ), diff --git a/lib/pages/analytics/modules/analytics/widgets/month_picker_widget.dart b/lib/pages/analytics/modules/analytics/widgets/month_picker_widget.dart index 57133b02..096d09f5 100644 --- a/lib/pages/analytics/modules/analytics/widgets/month_picker_widget.dart +++ b/lib/pages/analytics/modules/analytics/widgets/month_picker_widget.dart @@ -45,7 +45,7 @@ class _MonthPickerWidgetState extends State { @override Widget build(BuildContext context) { return Dialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, child: Container( padding: const EdgeInsetsDirectional.all(20), width: 320, @@ -108,7 +108,7 @@ class _MonthPickerWidgetState extends State { style: context.textTheme.titleSmall?.copyWith( fontSize: 14, fontWeight: FontWeight.w600, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), ), @@ -217,7 +217,7 @@ class _MonthPickerWidgetState extends State { style: context.textTheme.titleSmall?.copyWith( fontSize: 12, color: isSelected - ? ColorsManager.whiteColors + ? ColorsManager.white : isFutureMonth ? ColorsManager.blackColor.withValues(alpha: 0.3) : ColorsManager.blackColor.withValues(alpha: 0.8), diff --git a/lib/pages/analytics/modules/analytics/widgets/sidebar/analytics_space_tree_view.dart b/lib/pages/analytics/modules/analytics/widgets/sidebar/analytics_space_tree_view.dart index f900a040..a18e99fd 100644 --- a/lib/pages/analytics/modules/analytics/widgets/sidebar/analytics_space_tree_view.dart +++ b/lib/pages/analytics/modules/analytics/widgets/sidebar/analytics_space_tree_view.dart @@ -59,7 +59,7 @@ class _AnalyticsSpaceTreeViewState extends State { : state.communityList; return Container( height: MediaQuery.sizeOf(context).height, - decoration: const BoxDecoration(color: ColorsManager.whiteColors), + decoration: const BoxDecoration(color: ColorsManager.white), child: state is SpaceTreeLoadingState ? const Center(child: CircularProgressIndicator()) : Column( diff --git a/lib/pages/analytics/modules/analytics/widgets/year_picker_widget.dart b/lib/pages/analytics/modules/analytics/widgets/year_picker_widget.dart index 22eb6646..dca992af 100644 --- a/lib/pages/analytics/modules/analytics/widgets/year_picker_widget.dart +++ b/lib/pages/analytics/modules/analytics/widgets/year_picker_widget.dart @@ -33,7 +33,7 @@ class _YearPickerWidgetState extends State { @override Widget build(BuildContext context) { return Dialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, child: Container( padding: const EdgeInsetsDirectional.all(20), width: 320, @@ -92,7 +92,7 @@ class _YearPickerWidgetState extends State { style: context.textTheme.titleSmall?.copyWith( fontSize: 14, fontWeight: FontWeight.w600, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), ), @@ -144,7 +144,7 @@ class _YearPickerWidgetState extends State { style: context.textTheme.titleSmall?.copyWith( fontSize: 12, color: isSelected - ? ColorsManager.whiteColors + ? ColorsManager.white : ColorsManager.blackColor.withValues(alpha: 0.8), fontWeight: FontWeight.w500, ), diff --git a/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart b/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart index 6b44e125..157157ba 100644 --- a/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart +++ b/lib/pages/analytics/modules/energy_management/helpers/energy_management_charts_helper.dart @@ -81,7 +81,7 @@ abstract final class EnergyManagementChartsHelper { static LineTouchTooltipData lineTouchTooltipData() { return LineTouchTooltipData( - getTooltipColor: (touchTooltipItem) => ColorsManager.whiteColors, + getTooltipColor: (touchTooltipItem) => ColorsManager.white, tooltipBorder: const BorderSide(color: ColorsManager.semiTransparentBlack), tooltipRoundedRadius: 16, showOnTopOfTheChartBoxArea: false, diff --git a/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart b/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart index 055e9675..708f59e0 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/analytics_device_dropdown.dart @@ -72,7 +72,7 @@ class AnalyticsDeviceDropdown extends StatelessWidget { value: state.selectedDevice, isDense: true, borderRadius: BorderRadius.circular(16), - dropdownColor: ColorsManager.whiteColors, + dropdownColor: ColorsManager.white, underline: const SizedBox.shrink(), icon: const RotatedBox( quarterTurns: 1, diff --git a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_by_phases_chart.dart b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_by_phases_chart.dart index 52c6f591..6479f91f 100644 --- a/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_by_phases_chart.dart +++ b/lib/pages/analytics/modules/energy_management/widgets/energy_consumption_by_phases_chart.dart @@ -18,7 +18,6 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget { Widget build(BuildContext context) { return BarChart( BarChartData( - gridData: EnergyManagementChartsHelper.gridData().copyWith( checkToShowHorizontalLine: (value) => true, horizontalInterval: 250, @@ -74,7 +73,7 @@ class EnergyConsumptionByPhasesChart extends StatelessWidget { BarTouchData _barTouchData(BuildContext context) { return BarTouchData( touchTooltipData: BarTouchTooltipData( - getTooltipColor: (touchTooltipItem) => ColorsManager.whiteColors, + getTooltipColor: (touchTooltipItem) => ColorsManager.white, tooltipBorder: const BorderSide( color: ColorsManager.semiTransparentBlack, ), diff --git a/lib/pages/analytics/modules/occupancy/widgets/heat_map_tooltip.dart b/lib/pages/analytics/modules/occupancy/widgets/heat_map_tooltip.dart index 66612a3e..c0fbdee6 100644 --- a/lib/pages/analytics/modules/occupancy/widgets/heat_map_tooltip.dart +++ b/lib/pages/analytics/modules/occupancy/widgets/heat_map_tooltip.dart @@ -34,7 +34,7 @@ class HeatMapTooltip extends StatelessWidget { style: context.textTheme.bodySmall?.copyWith( fontSize: 12, fontWeight: FontWeight.w700, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), const Divider(height: 2, thickness: 1), @@ -43,7 +43,7 @@ class HeatMapTooltip extends StatelessWidget { style: context.textTheme.bodySmall?.copyWith( fontSize: 10, fontWeight: FontWeight.w500, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), ], diff --git a/lib/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart b/lib/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart index 23cc527d..3db95e72 100644 --- a/lib/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart +++ b/lib/pages/analytics/modules/occupancy/widgets/occupancy_chart.dart @@ -64,7 +64,7 @@ class OccupancyChart extends StatelessWidget { BarTouchData _barTouchData(BuildContext context) { return BarTouchData( touchTooltipData: BarTouchTooltipData( - getTooltipColor: (touchTooltipItem) => ColorsManager.whiteColors, + getTooltipColor: (touchTooltipItem) => ColorsManager.white, tooltipBorder: const BorderSide( color: ColorsManager.semiTransparentBlack, ), diff --git a/lib/pages/auth/view/login_web_page.dart b/lib/pages/auth/view/login_web_page.dart index a6de87cf..9ff1f884 100644 --- a/lib/pages/auth/view/login_web_page.dart +++ b/lib/pages/auth/view/login_web_page.dart @@ -121,7 +121,8 @@ class _LoginWebPageState extends State with HelperResponsiveLayout const Spacer(), Expanded( flex: 2, - child: _buildLoginFormFields(context, loginBloc, size), + child: + _buildLoginFormFields(context, loginBloc, size), ), const Spacer(), ], @@ -147,8 +148,8 @@ class _LoginWebPageState extends State with HelperResponsiveLayout child: Form( key: loginBloc.loginFormKey, child: Padding( - padding: - EdgeInsets.symmetric(horizontal: size.width * 0.02, vertical: size.width * 0.003), + padding: EdgeInsets.symmetric( + horizontal: size.width * 0.02, vertical: size.width * 0.003), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, @@ -303,10 +304,8 @@ class _LoginWebPageState extends State with HelperResponsiveLayout decoration: textBoxDecoration()!.copyWith( errorStyle: const TextStyle(height: 0), hintText: 'Enter your email address', - hintStyle: Theme.of(context) - .textTheme - .bodySmall! - .copyWith(color: ColorsManager.grayColor, fontWeight: FontWeight.w400)), + hintStyle: Theme.of(context).textTheme.bodySmall!.copyWith( + color: ColorsManager.grayColor, fontWeight: FontWeight.w400)), style: const TextStyle(color: Colors.black), ), ), @@ -338,7 +337,7 @@ class _LoginWebPageState extends State with HelperResponsiveLayout controller: loginBloc.loginPasswordController, onFieldSubmitted: (value) { if (loginBloc.loginFormKey.currentState!.validate()) { - loginBloc.add(LoginButtonPressed( + loginBloc.add(LoginButtonPressed( username: loginBloc.loginEmailController.text, password: value, )); @@ -348,17 +347,18 @@ class _LoginWebPageState extends State with HelperResponsiveLayout }, decoration: textBoxDecoration()!.copyWith( hintText: 'At least 8 characters', - hintStyle: Theme.of(context) - .textTheme - .bodySmall! - .copyWith(color: ColorsManager.grayColor, fontWeight: FontWeight.w400), + hintStyle: Theme.of(context).textTheme.bodySmall!.copyWith( + color: ColorsManager.grayColor, fontWeight: FontWeight.w400), suffixIcon: IconButton( onPressed: () { - loginBloc.add(PasswordVisibleEvent(newValue: loginBloc.obscureText)); + loginBloc + .add(PasswordVisibleEvent(newValue: loginBloc.obscureText)); }, icon: SizedBox( child: SvgPicture.asset( - loginBloc.obscureText ? Assets.visiblePassword : Assets.invisiblePassword, + loginBloc.obscureText + ? Assets.visiblePassword + : Assets.invisiblePassword, height: 15, width: 15, ), @@ -386,10 +386,8 @@ class _LoginWebPageState extends State with HelperResponsiveLayout }, child: Text( "Forgot Password?", - style: Theme.of(context) - .textTheme - .bodySmall! - .copyWith(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w400), + style: Theme.of(context).textTheme.bodySmall!.copyWith( + color: Colors.black, fontSize: 14, fontWeight: FontWeight.w400), ), ), ], @@ -466,8 +464,8 @@ class _LoginWebPageState extends State with HelperResponsiveLayout style: Theme.of(context).textTheme.labelLarge!.copyWith( fontSize: 14, color: loginBloc.checkValidate - ? ColorsManager.whiteColors - : ColorsManager.whiteColors.withOpacity(0.2), + ? ColorsManager.white + : ColorsManager.white.withOpacity(0.2), )), onPressed: () { if (loginBloc.loginFormKey.currentState!.validate()) { @@ -494,7 +492,8 @@ class _LoginWebPageState extends State with HelperResponsiveLayout SizedBox( child: Text( loginBloc.validate, - style: const TextStyle(fontWeight: FontWeight.w700, color: ColorsManager.red), + style: const TextStyle( + fontWeight: FontWeight.w700, color: ColorsManager.red), ), ) ], diff --git a/lib/pages/common/buttons/search_reset_buttons.dart b/lib/pages/common/buttons/search_reset_buttons.dart index 6fdbfd2a..7a83266a 100644 --- a/lib/pages/common/buttons/search_reset_buttons.dart +++ b/lib/pages/common/buttons/search_reset_buttons.dart @@ -56,7 +56,7 @@ class SearchResetButtons extends StatelessWidget { decoration: containerDecoration, child: Center( child: DefaultButton( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, borderRadius: 9, onPressed: onReset, child: Text( diff --git a/lib/pages/common/curtain_toggle.dart b/lib/pages/common/curtain_toggle.dart index 7b1551c5..4efed29f 100644 --- a/lib/pages/common/curtain_toggle.dart +++ b/lib/pages/common/curtain_toggle.dart @@ -35,7 +35,7 @@ class CurtainToggle extends StatelessWidget { children: [ ClipOval( child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: SvgPicture.asset( Assets.curtainIcon, width: 60, diff --git a/lib/pages/common/custom_table.dart b/lib/pages/common/custom_table.dart index 6c02e889..394c976d 100644 --- a/lib/pages/common/custom_table.dart +++ b/lib/pages/common/custom_table.dart @@ -127,13 +127,11 @@ class _DynamicTableState extends State { controller: _horizontalScrollController, thumbVisibility: true, trackVisibility: true, - notificationPredicate: (notif) => - notif.metrics.axis == Axis.horizontal, + notificationPredicate: (notif) => notif.metrics.axis == Axis.horizontal, child: SingleChildScrollView( controller: _horizontalScrollController, scrollDirection: Axis.horizontal, - physics: - widget.isEmpty ? const NeverScrollableScrollPhysics() : null, + physics: widget.isEmpty ? const NeverScrollableScrollPhysics() : null, child: SizedBox( width: _totalTableWidth, child: Column( @@ -195,29 +193,25 @@ class _DynamicTableState extends State { widget.headers[colIndex] == 'Settings' ? buildSettingsIcon( width: _settingsColumnWidth, - onTap: () => widget - .onSettingsPressed + onTap: () => widget.onSettingsPressed ?.call(rowIndex), ) : _buildTableCell( row[colIndex].toString(), - width: widget.headers[ - colIndex] == + width: widget.headers[colIndex] == 'Settings' ? _settingsColumnWidth : (_totalTableWidth - (widget.withCheckBox ? _checkboxColumnWidth : 0) - - (widget.headers - .contains( - 'Settings') + (widget.headers.contains( + 'Settings') ? _settingsColumnWidth : 0)) / (widget.headers.length - - (widget.headers - .contains( - 'Settings') + (widget.headers.contains( + 'Settings') ? 1 : 0)), rowIndex: rowIndex, @@ -241,7 +235,7 @@ class _DynamicTableState extends State { Widget _buildEmptyState() => Container( height: widget.size.height, - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -281,9 +275,8 @@ class _DynamicTableState extends State { ), child: Checkbox( value: _selectAll, - onChanged: widget.withSelectAll && widget.data.isNotEmpty - ? _toggleSelectAll - : null, + onChanged: + widget.withSelectAll && widget.data.isNotEmpty ? _toggleSelectAll : null, ), ); } @@ -300,7 +293,7 @@ class _DynamicTableState extends State { width: 1.0, ), ), - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), alignment: Alignment.centerLeft, child: Center( @@ -341,9 +334,7 @@ class _DynamicTableState extends State { } Widget _buildTableCell(String content, - {required double width, - required int rowIndex, - required int columnIndex}) { + {required double width, required int rowIndex, required int columnIndex}) { bool isBatteryLevel = content.endsWith('%'); double? batteryLevel; @@ -415,7 +406,7 @@ class _DynamicTableState extends State { height: _fixedRowHeight, padding: const EdgeInsets.only(left: 15, top: 10, bottom: 10), decoration: const BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, border: Border( bottom: BorderSide( color: ColorsManager.boxDivider, diff --git a/lib/pages/device_managment/ac/view/batch_control_list/batch_ac_mode.dart b/lib/pages/device_managment/ac/view/batch_control_list/batch_ac_mode.dart index 81f0685d..a472fe46 100644 --- a/lib/pages/device_managment/ac/view/batch_control_list/batch_ac_mode.dart +++ b/lib/pages/device_managment/ac/view/batch_control_list/batch_ac_mode.dart @@ -27,8 +27,8 @@ class BatchAcMode extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - _buildIconContainer(context, TempModes.cold, Assets.freezing, - value == TempModes.cold), + _buildIconContainer( + context, TempModes.cold, Assets.freezing, value == TempModes.cold), _buildIconContainer( context, TempModes.hot, Assets.acSun, value == TempModes.hot), _buildIconContainer(context, TempModes.wind, Assets.acAirConditioner, @@ -56,7 +56,7 @@ class BatchAcMode extends StatelessWidget { height: 50, decoration: BoxDecoration( shape: BoxShape.circle, - color: ColorsManager.whiteColors, + color: ColorsManager.white, border: Border.all( color: isSelected ? Colors.blue : Colors.transparent, width: 2.0, diff --git a/lib/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart b/lib/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart index 4d7eb449..eb19ad6b 100644 --- a/lib/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart +++ b/lib/pages/device_managment/ac/view/batch_control_list/batch_fan_speed.dart @@ -32,8 +32,8 @@ class BatchFanSpeedControl extends StatelessWidget { children: [ _buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto, value == FanSpeeds.auto), - _buildIconContainer(context, FanSpeeds.low, Assets.acFanLow, - value == FanSpeeds.low), + _buildIconContainer( + context, FanSpeeds.low, Assets.acFanLow, value == FanSpeeds.low), ], ), const SizedBox(height: 8), @@ -52,8 +52,8 @@ class BatchFanSpeedControl extends StatelessWidget { ); } - Widget _buildIconContainer(BuildContext context, FanSpeeds speed, - String assetPath, bool isSelected) { + Widget _buildIconContainer( + BuildContext context, FanSpeeds speed, String assetPath, bool isSelected) { return GestureDetector( onTap: () { context.read().add( @@ -69,7 +69,7 @@ class BatchFanSpeedControl extends StatelessWidget { height: 50, decoration: BoxDecoration( shape: BoxShape.circle, - color: ColorsManager.whiteColors, + color: ColorsManager.white, border: Border.all( color: isSelected ? Colors.blue : Colors.transparent, width: 2.0, diff --git a/lib/pages/device_managment/ac/view/control_list/ac_mode.dart b/lib/pages/device_managment/ac/view/control_list/ac_mode.dart index 91ca0f8c..cbfa93b9 100644 --- a/lib/pages/device_managment/ac/view/control_list/ac_mode.dart +++ b/lib/pages/device_managment/ac/view/control_list/ac_mode.dart @@ -27,8 +27,8 @@ class AcMode extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - _buildIconContainer(context, TempModes.cold, Assets.freezing, - value == TempModes.cold), + _buildIconContainer( + context, TempModes.cold, Assets.freezing, value == TempModes.cold), _buildIconContainer( context, TempModes.hot, Assets.acSun, value == TempModes.hot), _buildIconContainer(context, TempModes.wind, Assets.acAirConditioner, @@ -56,7 +56,7 @@ class AcMode extends StatelessWidget { height: 50, decoration: BoxDecoration( shape: BoxShape.circle, - color: ColorsManager.whiteColors, + color: ColorsManager.white, border: Border.all( color: isSelected ? Colors.blue : Colors.transparent, width: 2.0, diff --git a/lib/pages/device_managment/ac/view/control_list/ac_toggle.dart b/lib/pages/device_managment/ac/view/control_list/ac_toggle.dart index 4e81ec09..a231e1ab 100644 --- a/lib/pages/device_managment/ac/view/control_list/ac_toggle.dart +++ b/lib/pages/device_managment/ac/view/control_list/ac_toggle.dart @@ -38,7 +38,7 @@ class AcToggle extends StatelessWidget { height: 60, decoration: const BoxDecoration( shape: BoxShape.circle, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), padding: const EdgeInsets.all(8), child: ClipOval( diff --git a/lib/pages/device_managment/ac/view/control_list/fan_speed.dart b/lib/pages/device_managment/ac/view/control_list/fan_speed.dart index 09ca80cb..57c5b012 100644 --- a/lib/pages/device_managment/ac/view/control_list/fan_speed.dart +++ b/lib/pages/device_managment/ac/view/control_list/fan_speed.dart @@ -31,8 +31,8 @@ class FanSpeedControl extends StatelessWidget { children: [ _buildIconContainer(context, FanSpeeds.auto, Assets.acFanAuto, value == FanSpeeds.auto), - _buildIconContainer(context, FanSpeeds.low, Assets.acFanLow, - value == FanSpeeds.low), + _buildIconContainer( + context, FanSpeeds.low, Assets.acFanLow, value == FanSpeeds.low), ], ), const SizedBox(height: 8), @@ -51,8 +51,8 @@ class FanSpeedControl extends StatelessWidget { ); } - Widget _buildIconContainer(BuildContext context, FanSpeeds speed, - String assetPath, bool isSelected) { + Widget _buildIconContainer( + BuildContext context, FanSpeeds speed, String assetPath, bool isSelected) { return GestureDetector( onTap: () { context.read().add( @@ -68,7 +68,7 @@ class FanSpeedControl extends StatelessWidget { height: 50, decoration: BoxDecoration( shape: BoxShape.circle, - color: ColorsManager.whiteColors, + color: ColorsManager.white, border: Border.all( color: isSelected ? Colors.blue : Colors.transparent, width: 2.0, diff --git a/lib/pages/device_managment/all_devices/view/device_managment_page.dart b/lib/pages/device_managment/all_devices/view/device_managment_page.dart index 17650f36..316432ae 100644 --- a/lib/pages/device_managment/all_devices/view/device_managment_page.dart +++ b/lib/pages/device_managment/all_devices/view/device_managment_page.dart @@ -35,8 +35,7 @@ class _DeviceManagementPageState extends State { return MultiBlocProvider( providers: [ BlocProvider( - create: (context) => - DeviceManagementBloc()..add(FetchDevices(context)), + create: (context) => DeviceManagementBloc()..add(FetchDevices(context)), ), ], child: WebScaffold( @@ -59,8 +58,9 @@ class _DeviceManagementPageState extends State { BlocProvider.of(context) .add(const ResetSelectedEvent()); - context.read().add( - const TriggerSwitchTabsEvent(isRoutineTab: false)); + context + .read() + .add(const TriggerSwitchTabsEvent(isRoutineTab: false)); context .read() .add(FetchDevices(context)); @@ -69,7 +69,7 @@ class _DeviceManagementPageState extends State { 'Devices', style: context.textTheme.titleMedium?.copyWith( color: !state.routineTab - ? ColorsManager.whiteColors + ? ColorsManager.white : ColorsManager.grayColor, fontWeight: !state.routineTab ? FontWeight.w700 : FontWeight.w400, @@ -86,17 +86,17 @@ class _DeviceManagementPageState extends State { BlocProvider.of(context) .add(const ResetSelectedEvent()); - context.read().add( - const TriggerSwitchTabsEvent(isRoutineTab: true)); + context + .read() + .add(const TriggerSwitchTabsEvent(isRoutineTab: true)); }, child: Text( 'Workflow Automation', style: context.textTheme.titleMedium?.copyWith( color: state.routineTab - ? ColorsManager.whiteColors + ? ColorsManager.white : ColorsManager.grayColor, - fontWeight: - state.routineTab ? FontWeight.w700 : FontWeight.w400, + fontWeight: state.routineTab ? FontWeight.w700 : FontWeight.w400, ), ), ), @@ -120,8 +120,7 @@ class _DeviceManagementPageState extends State { } else if (deviceState is DeviceManagementLoaded) { return DeviceManagementBody(devices: deviceState.devices); } else if (deviceState is DeviceManagementFiltered) { - return DeviceManagementBody( - devices: deviceState.filteredDevices); + return DeviceManagementBody(devices: deviceState.filteredDevices); } else { return const DeviceManagementBody(devices: []); } diff --git a/lib/pages/device_managment/all_devices/widgets/device_managment_body.dart b/lib/pages/device_managment/all_devices/widgets/device_managment_body.dart index 5b709540..c6046549 100644 --- a/lib/pages/device_managment/all_devices/widgets/device_managment_body.dart +++ b/lib/pages/device_managment/all_devices/widgets/device_managment_body.dart @@ -120,8 +120,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { content: Text( 'This Device is Offline', ), - duration: - Duration(seconds: 2), + duration: Duration(seconds: 2), ), ); return; @@ -135,13 +134,11 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { device: selectedDevices.first, ), ); - } else if (selectedDevices.length > - 1) { - final productTypes = - selectedDevices - .map((device) => - device.productType) - .toSet(); + } else if (selectedDevices.length > 1) { + final productTypes = selectedDevices + .map( + (device) => device.productType) + .toSet(); if (productTypes.length == 1) { showDialog( context: context, @@ -224,13 +221,11 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { device.batteryLevel != null ? '${device.batteryLevel}%' : '-', - formatDateTime( - DateTime.fromMillisecondsSinceEpoch( - (device.createTime ?? 0) * 1000)), + formatDateTime(DateTime.fromMillisecondsSinceEpoch( + (device.createTime ?? 0) * 1000)), device.online == true ? 'Online' : 'Offline', - formatDateTime( - DateTime.fromMillisecondsSinceEpoch( - (device.updateTime ?? 0) * 1000)), + formatDateTime(DateTime.fromMillisecondsSinceEpoch( + (device.updateTime ?? 0) * 1000)), 'Settings', ]; }).toList(), @@ -273,7 +268,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { child: Material( child: Container( width: MediaQuery.of(context).size.width * 0.3, - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: DeviceSettingsPanel( device: device, onClose: () => Navigator.of(context).pop(), diff --git a/lib/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart index 0d3a1a92..443669b4 100644 --- a/lib/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/accurate_calibrating_dialog.dart @@ -18,7 +18,7 @@ class AccurteCalibratingDialog extends StatelessWidget { @override Widget build(_) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, contentPadding: EdgeInsets.zero, content: AccurateDialogWidget( title: 'Calibrating', diff --git a/lib/pages/device_managment/curtain_module/widgets/accurate_calibration_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/accurate_calibration_dialog.dart index 7124639d..968e8caf 100644 --- a/lib/pages/device_managment/curtain_module/widgets/accurate_calibration_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/accurate_calibration_dialog.dart @@ -16,7 +16,7 @@ class AccurateCalibrationDialog extends StatelessWidget { @override Widget build(_) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, contentPadding: EdgeInsets.zero, content: AccurateDialogWidget( title: 'Accurate Calibration', diff --git a/lib/pages/device_managment/curtain_module/widgets/calibrate_completed_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/calibrate_completed_dialog.dart index 77957d76..445703f5 100644 --- a/lib/pages/device_managment/curtain_module/widgets/calibrate_completed_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/calibrate_completed_dialog.dart @@ -17,7 +17,7 @@ class CalibrateCompletedDialog extends StatelessWidget { @override Widget build(_) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, contentPadding: EdgeInsets.zero, content: SizedBox( height: 250, diff --git a/lib/pages/device_managment/curtain_module/widgets/curtain_action_widget.dart b/lib/pages/device_managment/curtain_module/widgets/curtain_action_widget.dart index 8c2ff81c..510c32bf 100644 --- a/lib/pages/device_managment/curtain_module/widgets/curtain_action_widget.dart +++ b/lib/pages/device_managment/curtain_module/widgets/curtain_action_widget.dart @@ -20,7 +20,7 @@ class CurtainActionWidget extends StatelessWidget { height: 60, width: 60, padding: const EdgeInsets.all(8), - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: ClipOval( child: Container( height: 60, diff --git a/lib/pages/device_managment/curtain_module/widgets/curtain_movment_widget.dart b/lib/pages/device_managment/curtain_module/widgets/curtain_movment_widget.dart index e98ff11d..a6443e24 100644 --- a/lib/pages/device_managment/curtain_module/widgets/curtain_movment_widget.dart +++ b/lib/pages/device_managment/curtain_module/widgets/curtain_movment_widget.dart @@ -164,7 +164,7 @@ class _CurtainSliderWidgetState extends State { divisions: 10, // 10% step activeColor: ColorsManager.minBlueDot, thumbColor: ColorsManager.primaryColor, - inactiveColor: ColorsManager.whiteColors, + inactiveColor: ColorsManager.white, // Start dragging — use local control onChangeStart: (_) { diff --git a/lib/pages/device_managment/curtain_module/widgets/pref_revers_card_widget.dart b/lib/pages/device_managment/curtain_module/widgets/pref_revers_card_widget.dart index 85c45d27..70299674 100644 --- a/lib/pages/device_managment/curtain_module/widgets/pref_revers_card_widget.dart +++ b/lib/pages/device_managment/curtain_module/widgets/pref_revers_card_widget.dart @@ -47,10 +47,9 @@ class PrefReversCardWidget extends StatelessWidget { child: Container( padding: const EdgeInsets.all(3), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: const BorderRadius.horizontal( - left: Radius.circular(10), - right: Radius.circular(10)), + left: Radius.circular(10), right: Radius.circular(10)), border: Border.all(color: ColorsManager.grayBorder)), child: SvgPicture.asset( Assets.reverseArrows, diff --git a/lib/pages/device_managment/curtain_module/widgets/prefrences_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/prefrences_dialog.dart index 35844c05..0bbbb203 100644 --- a/lib/pages/device_managment/curtain_module/widgets/prefrences_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/prefrences_dialog.dart @@ -22,7 +22,7 @@ class CurtainModulePrefrencesDialog extends StatelessWidget { @override Widget build(_) { return AlertDialog( - backgroundColor: ColorsManager.CircleImageBackground, + backgroundColor: ColorsManager.circleImageBackground, contentPadding: const EdgeInsets.all(20), title: Center( child: Text( diff --git a/lib/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart index 6fc9adf2..59e992bf 100644 --- a/lib/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/quick_calibrating_dialog.dart @@ -63,7 +63,7 @@ class _QuickCalibratingDialogState extends State { @override Widget build(_) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, contentPadding: EdgeInsets.zero, content: AccurateDialogWidget( title: 'Calibrating', diff --git a/lib/pages/device_managment/curtain_module/widgets/quick_calibration_dialog.dart b/lib/pages/device_managment/curtain_module/widgets/quick_calibration_dialog.dart index 06b386c8..66660e94 100644 --- a/lib/pages/device_managment/curtain_module/widgets/quick_calibration_dialog.dart +++ b/lib/pages/device_managment/curtain_module/widgets/quick_calibration_dialog.dart @@ -18,7 +18,7 @@ class QuickCalibrationDialog extends StatelessWidget { @override Widget build(_) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, contentPadding: EdgeInsets.zero, content: AccurateDialogWidget( title: 'Quick Calibration', diff --git a/lib/pages/device_managment/device_setting/device_settings_panel.dart b/lib/pages/device_managment/device_setting/device_settings_panel.dart index 0856b5d0..a5c887f0 100644 --- a/lib/pages/device_managment/device_setting/device_settings_panel.dart +++ b/lib/pages/device_managment/device_setting/device_settings_panel.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_mgmt_bloc/device_managment_bloc.dart'; @@ -47,8 +46,8 @@ class DeviceSettingsPanel extends StatelessWidget { return BlocBuilder( builder: (context, state) { final _bloc = context.read(); - final iconPath = DeviceIconTypeHelper.getDeviceIconByTypeCode( - device.productType); + final iconPath = + DeviceIconTypeHelper.getDeviceIconByTypeCode(device.productType); final deviceInfo = state is DeviceSettingsUpdate ? state.deviceInfo ?? DeviceInfoModel.empty() : DeviceInfoModel.empty(); @@ -77,11 +76,9 @@ class DeviceSettingsPanel extends StatelessWidget { children: [ Text( 'Device Settings', - style: context.theme.textTheme.titleLarge! - .copyWith( + style: context.theme.textTheme.titleLarge!.copyWith( fontWeight: FontWeight.w700, - color: ColorsManager.vividBlue - .withOpacity(0.7), + color: ColorsManager.vividBlue.withOpacity(0.7), fontSize: 24), ), ], @@ -98,7 +95,7 @@ class DeviceSettingsPanel extends StatelessWidget { backgroundColor: ColorsManager.grayBorder.withOpacity(0.5), child: CircleAvatar( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, radius: 36, child: SvgPicture.asset( iconPath, @@ -116,8 +113,7 @@ class DeviceSettingsPanel extends StatelessWidget { const SizedBox(height: 15), Text( 'Device Name:', - style: context.textTheme.bodyMedium! - .copyWith( + style: context.textTheme.bodyMedium!.copyWith( color: ColorsManager.grayColor, ), ), @@ -143,13 +139,13 @@ class DeviceSettingsPanel extends StatelessWidget { _bloc.add(const ChangeNameEvent( value: false)); deviceManagementBloc - ..add(UpdateDeviceName( - deviceId: device.uuid!, - newName: _bloc - .nameController - .text))..add(ResetSelectedDevices()); + ..add(UpdateDeviceName( + deviceId: device.uuid!, + newName: + _bloc.nameController.text)) + ..add(ResetSelectedDevices()); }, - decoration:const InputDecoration( + decoration: const InputDecoration( isDense: true, contentPadding: EdgeInsets.zero, border: InputBorder.none, @@ -164,18 +160,16 @@ class DeviceSettingsPanel extends StatelessWidget { width: 15, height: 25, child: Visibility( - visible: - _bloc.editName != true, + visible: _bloc.editName != true, replacement: const SizedBox(), child: InkWell( onTap: () { _bloc.add( const ChangeNameEvent( - value: true)); + value: true)); }, child: SvgPicture.asset( - Assets - .editNameIconSettings, + Assets.editNameIconSettings, color: ColorsManager .lightGrayBorderColor, height: 15, diff --git a/lib/pages/device_managment/device_setting/sub_space_dialog.dart b/lib/pages/device_managment/device_setting/sub_space_dialog.dart index 8b5f6850..4ddfe1b6 100644 --- a/lib/pages/device_managment/device_setting/sub_space_dialog.dart +++ b/lib/pages/device_managment/device_setting/sub_space_dialog.dart @@ -32,7 +32,7 @@ class _SubSpaceDialogState extends State { @override Widget build(BuildContext context) { return Dialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 60), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(28), diff --git a/lib/pages/device_managment/gateway/view/gateway_view.dart b/lib/pages/device_managment/gateway/view/gateway_view.dart index 372f190a..5080d5d5 100644 --- a/lib/pages/device_managment/gateway/view/gateway_view.dart +++ b/lib/pages/device_managment/gateway/view/gateway_view.dart @@ -100,7 +100,6 @@ class _DeviceItem extends StatelessWidget { @override Widget build(BuildContext context) { - return DeviceControlsContainer( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -110,7 +109,7 @@ class _DeviceItem extends StatelessWidget { height: 60, width: 60, padding: const EdgeInsets.all(8), - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: SvgPicture.asset( device.icon ?? 'assets/icons/gateway.svg', width: 35, diff --git a/lib/pages/device_managment/power_clamp/view/power_chart.dart b/lib/pages/device_managment/power_clamp/view/power_chart.dart index 7d6371f4..040567c6 100644 --- a/lib/pages/device_managment/power_clamp/view/power_chart.dart +++ b/lib/pages/device_managment/power_clamp/view/power_chart.dart @@ -36,7 +36,7 @@ class _EnergyConsumptionPageState extends State { @override Widget build(BuildContext context) { return Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: Column( children: [ const Row( diff --git a/lib/pages/device_managment/power_clamp/view/power_info_card.dart b/lib/pages/device_managment/power_clamp/view/power_info_card.dart index 601b6346..89bddbce 100644 --- a/lib/pages/device_managment/power_clamp/view/power_info_card.dart +++ b/lib/pages/device_managment/power_clamp/view/power_info_card.dart @@ -22,7 +22,7 @@ class PowerClampInfoCard extends StatelessWidget { child: Container( margin: const EdgeInsets.symmetric(horizontal: 6), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(20), ), height: 55, diff --git a/lib/pages/device_managment/power_clamp/view/smart_power_device_control.dart b/lib/pages/device_managment/power_clamp/view/smart_power_device_control.dart index 03202ba0..8a3d8501 100644 --- a/lib/pages/device_managment/power_clamp/view/smart_power_device_control.dart +++ b/lib/pages/device_managment/power_clamp/view/smart_power_device_control.dart @@ -12,8 +12,7 @@ import 'package:syncrow_web/utils/constants/assets.dart'; import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart'; //Smart Power Clamp -class SmartPowerDeviceControl extends StatelessWidget - with HelperResponsiveLayout { +class SmartPowerDeviceControl extends StatelessWidget with HelperResponsiveLayout { final String deviceId; const SmartPowerDeviceControl({super.key, required this.deviceId}); @@ -129,7 +128,7 @@ class SmartPowerDeviceControl extends StatelessWidget bottom: 10, ), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(20), ), height: 300, @@ -149,8 +148,7 @@ class SmartPowerDeviceControl extends StatelessWidget onPressed: blocProvider.currentPage <= 0 ? null : () { - blocProvider - .add(SmartPowerArrowPressedEvent(-1)); + blocProvider.add(SmartPowerArrowPressedEvent(-1)); pageController.previousPage( duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, @@ -172,8 +170,7 @@ class SmartPowerDeviceControl extends StatelessWidget onPressed: blocProvider.currentPage >= 3 ? null : () { - blocProvider - .add(SmartPowerArrowPressedEvent(1)); + blocProvider.add(SmartPowerArrowPressedEvent(1)); pageController.nextPage( duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, @@ -202,8 +199,8 @@ class SmartPowerDeviceControl extends StatelessWidget blocProvider.add(SelectDateEvent(context: context)); blocProvider.add(FilterRecordsByDateEvent( selectedDate: blocProvider.dateTime!, - viewType: blocProvider - .views[blocProvider.currentIndex])); + viewType: + blocProvider.views[blocProvider.currentIndex])); }, widget: blocProvider.dateSwitcher(), chartData: blocProvider.energyDataList.isNotEmpty diff --git a/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_control_button.dart b/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_control_button.dart index 86fc5ba5..b9a98975 100644 --- a/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_control_button.dart +++ b/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_control_button.dart @@ -30,7 +30,7 @@ class ScheduleControlButton extends StatelessWidget { height: 60, decoration: const BoxDecoration( shape: BoxShape.circle, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), margin: const EdgeInsets.symmetric(horizontal: 4), padding: const EdgeInsets.all(12), diff --git a/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_header.dart b/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_header.dart index 06f785eb..d351ec36 100644 --- a/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_header.dart +++ b/lib/pages/device_managment/schedule_device/schedule_widgets/schedule_header.dart @@ -13,7 +13,7 @@ class ScheduleHeader extends StatelessWidget { Text( 'Scheduling', style: TextStyle( - color: ColorsManager.primaryColorWithOpacity, + color: ColorsManager.opaquePrimary, fontWeight: FontWeight.w700, fontSize: 30, ), diff --git a/lib/pages/device_managment/shared/batch_control/factory_reset.dart b/lib/pages/device_managment/shared/batch_control/factory_reset.dart index 8d1ba3d6..6c2a6d62 100644 --- a/lib/pages/device_managment/shared/batch_control/factory_reset.dart +++ b/lib/pages/device_managment/shared/batch_control/factory_reset.dart @@ -76,7 +76,7 @@ class _FactoryResetWidgetState extends State { child: Text( 'Reset', style: context.textTheme.bodyMedium!.copyWith( - color: ColorsManager.whiteColors, + color: ColorsManager.white, fontWeight: FontWeight.w400, fontSize: 12, ), @@ -95,7 +95,7 @@ class _FactoryResetWidgetState extends State { children: [ ClipOval( child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, height: 60, width: 60, child: Padding( diff --git a/lib/pages/device_managment/shared/icon_name_status_container.dart b/lib/pages/device_managment/shared/icon_name_status_container.dart index 13b6b594..cd856c7c 100644 --- a/lib/pages/device_managment/shared/icon_name_status_container.dart +++ b/lib/pages/device_managment/shared/icon_name_status_container.dart @@ -45,7 +45,7 @@ class IconNameStatusContainer extends StatelessWidget { height: 60, width: 60, padding: EdgeInsets.all(paddingAmount ?? 8), - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: SvgPicture.asset( icon, width: 35, diff --git a/lib/pages/device_managment/shared/sensors_widgets/presence_space_type.dart b/lib/pages/device_managment/shared/sensors_widgets/presence_space_type.dart index e1ca0586..04850e08 100644 --- a/lib/pages/device_managment/shared/sensors_widgets/presence_space_type.dart +++ b/lib/pages/device_managment/shared/sensors_widgets/presence_space_type.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:syncrow_web/utils/constants/assets.dart'; -import 'package:syncrow_web/utils/extension/build_context_x.dart'; +import 'package:syncrow_web/pages/device_managment/ceiling_sensor/model/ceiling_sensor_model.dart'; import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart'; import 'package:syncrow_web/utils/color_manager.dart'; -import 'package:syncrow_web/pages/device_managment/ceiling_sensor/model/ceiling_sensor_model.dart'; +import 'package:syncrow_web/utils/constants/assets.dart'; +import 'package:syncrow_web/utils/extension/build_context_x.dart'; class PresenceSpaceType extends StatelessWidget { const PresenceSpaceType({ @@ -59,7 +59,7 @@ class PresenceSpaceType extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), color: value == spaceType - ? ColorsManager.primaryColorWithOpacity + ? ColorsManager.opaquePrimary : ColorsManager.textGray, ), child: SvgPicture.asset( diff --git a/lib/pages/device_managment/shared/toggle_widget.dart b/lib/pages/device_managment/shared/toggle_widget.dart index 4888572f..e011eec6 100644 --- a/lib/pages/device_managment/shared/toggle_widget.dart +++ b/lib/pages/device_managment/shared/toggle_widget.dart @@ -52,7 +52,7 @@ class ToggleWidget extends StatelessWidget { height: 60, width: 60, padding: const EdgeInsets.all(8), - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: SvgPicture.asset( icon ?? Assets.lightPulp, width: 35, diff --git a/lib/pages/device_managment/three_gang_switch/widgets/cieling_light.dart b/lib/pages/device_managment/three_gang_switch/widgets/cieling_light.dart index 629c131b..28d344ee 100644 --- a/lib/pages/device_managment/three_gang_switch/widgets/cieling_light.dart +++ b/lib/pages/device_managment/three_gang_switch/widgets/cieling_light.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; import 'package:syncrow_web/pages/device_managment/three_gang_switch/bloc/living_room_bloc.dart'; @@ -7,7 +6,8 @@ import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/constants/assets.dart'; class CeilingLight extends StatelessWidget { - const CeilingLight({super.key, required this.value, required this.code, required this.deviceId}); + const CeilingLight( + {super.key, required this.value, required this.code, required this.deviceId}); final bool value; final String code; @@ -24,7 +24,7 @@ class CeilingLight extends StatelessWidget { children: [ ClipOval( child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: SvgPicture.asset( Assets.lightPulp, width: 60, diff --git a/lib/pages/device_managment/three_gang_switch/widgets/spot_light.dart b/lib/pages/device_managment/three_gang_switch/widgets/spot_light.dart index 6ac71a38..2f27e623 100644 --- a/lib/pages/device_managment/three_gang_switch/widgets/spot_light.dart +++ b/lib/pages/device_managment/three_gang_switch/widgets/spot_light.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; import 'package:syncrow_web/pages/device_managment/three_gang_switch/bloc/living_room_bloc.dart'; @@ -7,7 +6,8 @@ import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/constants/assets.dart'; class SpotLight extends StatelessWidget { - const SpotLight({super.key, required this.value, required this.code, required this.deviceId}); + const SpotLight( + {super.key, required this.value, required this.code, required this.deviceId}); final bool value; final String code; @@ -24,7 +24,7 @@ class SpotLight extends StatelessWidget { children: [ ClipOval( child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: SvgPicture.asset( Assets.lightPulp, width: 60, diff --git a/lib/pages/device_managment/three_gang_switch/widgets/wall_light.dart b/lib/pages/device_managment/three_gang_switch/widgets/wall_light.dart index 12c814ac..88b37aff 100644 --- a/lib/pages/device_managment/three_gang_switch/widgets/wall_light.dart +++ b/lib/pages/device_managment/three_gang_switch/widgets/wall_light.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; import 'package:syncrow_web/pages/device_managment/three_gang_switch/bloc/living_room_bloc.dart'; @@ -7,7 +6,8 @@ import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/constants/assets.dart'; class WallLight extends StatelessWidget { - const WallLight({super.key, required this.value, required this.code, required this.deviceId}); + const WallLight( + {super.key, required this.value, required this.code, required this.deviceId}); final bool value; final String code; @@ -24,7 +24,7 @@ class WallLight extends StatelessWidget { children: [ ClipOval( child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: SvgPicture.asset( Assets.lightPulp, width: 60, diff --git a/lib/pages/device_managment/water_heater/helper/add_schedule_dialog_helper.dart b/lib/pages/device_managment/water_heater/helper/add_schedule_dialog_helper.dart index 6b5ff033..e94136d0 100644 --- a/lib/pages/device_managment/water_heater/helper/add_schedule_dialog_helper.dart +++ b/lib/pages/device_managment/water_heater/helper/add_schedule_dialog_helper.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart'; import 'package:syncrow_web/pages/device_managment/schedule_device/schedule_widgets/schedule_mode_buttons.dart'; import 'package:syncrow_web/pages/device_managment/water_heater/models/schedule_entry.dart'; -import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart'; import 'package:syncrow_web/utils/color_manager.dart'; class ScheduleDialogHelper { @@ -58,7 +58,7 @@ class ScheduleDialogHelper { Text( isEdit ? 'Edit Schedule' : 'Add Schedule', style: Theme.of(context).textTheme.titleLarge!.copyWith( - color: ColorsManager.primaryColorWithOpacity, + color: ColorsManager.opaquePrimary, fontWeight: FontWeight.w700, fontSize: 30, ), @@ -171,8 +171,8 @@ class ScheduleDialogHelper { return result; } - static Widget _buildDayCheckboxes(BuildContext ctx, List selectedDays, - Function(int, bool) onChanged) { + static Widget _buildDayCheckboxes( + BuildContext ctx, List selectedDays, Function(int, bool) onChanged) { final dayLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; return Row( mainAxisAlignment: MainAxisAlignment.start, @@ -197,8 +197,7 @@ class ScheduleDialogHelper { children: [ Text( 'Function:', - style: - Theme.of(ctx).textTheme.bodySmall!.copyWith(color: Colors.grey), + style: Theme.of(ctx).textTheme.bodySmall!.copyWith(color: Colors.grey), ), const SizedBox(width: 10), Radio( @@ -213,7 +212,6 @@ class ScheduleDialogHelper { Radio( activeColor: ColorsManager.secondaryColor, focusColor: ColorsManager.secondaryColor, - value: false, groupValue: isOn, onChanged: (val) => onChanged(false), diff --git a/lib/pages/roles_and_permission/users_page/add_user_dialog/view/popup_menu_filter.dart b/lib/pages/roles_and_permission/users_page/add_user_dialog/view/popup_menu_filter.dart index a7f6c2b5..bb2f1a63 100644 --- a/lib/pages/roles_and_permission/users_page/add_user_dialog/view/popup_menu_filter.dart +++ b/lib/pages/roles_and_permission/users_page/add_user_dialog/view/popup_menu_filter.dart @@ -17,7 +17,7 @@ Future showPopUpFilterMenu({ await showMenu( context: context, position: position, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(10)), ), diff --git a/lib/pages/roles_and_permission/users_page/add_user_dialog/view/role_dropdown.dart b/lib/pages/roles_and_permission/users_page/add_user_dialog/view/role_dropdown.dart index 3a5ac65c..4f72fae0 100644 --- a/lib/pages/roles_and_permission/users_page/add_user_dialog/view/role_dropdown.dart +++ b/lib/pages/roles_and_permission/users_page/add_user_dialog/view/role_dropdown.dart @@ -51,7 +51,7 @@ class _RoleDropdownState extends State { const SizedBox(height: 8), SizedBox( child: DropdownButtonFormField( - dropdownColor: ColorsManager.whiteColors, + dropdownColor: ColorsManager.white, // alignment: Alignment., focusColor: Colors.white, autofocus: true, diff --git a/lib/pages/roles_and_permission/users_page/add_user_dialog/view/roles_and_permission.dart b/lib/pages/roles_and_permission/users_page/add_user_dialog/view/roles_and_permission.dart index f4b91747..7f6f1664 100644 --- a/lib/pages/roles_and_permission/users_page/add_user_dialog/view/roles_and_permission.dart +++ b/lib/pages/roles_and_permission/users_page/add_user_dialog/view/roles_and_permission.dart @@ -28,9 +28,7 @@ class RolesAndPermission extends StatelessWidget { Text( 'Role & Permissions', style: context.textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.w700, - fontSize: 20, - color: Colors.black), + fontWeight: FontWeight.w700, fontSize: 20, color: Colors.black), ), const SizedBox( height: 15, @@ -67,21 +65,18 @@ class RolesAndPermission extends StatelessWidget { border: Border.all( color: ColorsManager.grayBorder)), child: TextFormField( - style: - const TextStyle(color: Colors.black), - controller: - _blocRole.roleSearchController, + style: const TextStyle(color: Colors.black), + controller: _blocRole.roleSearchController, onChanged: (value) { _blocRole.add(SearchPermission( nodes: _blocRole.permissions, searchTerm: value)); }, - decoration: textBoxDecoration(radios: 20)! - .copyWith( + decoration: + textBoxDecoration(radios: 20)!.copyWith( fillColor: Colors.white, suffixIcon: Padding( - padding: - const EdgeInsets.only(right: 16), + padding: const EdgeInsets.only(right: 16), child: SvgPicture.asset( Assets.textFieldSearch, width: 24, @@ -108,7 +103,7 @@ class RolesAndPermission extends StatelessWidget { color: ColorsManager.circleRolesBackground, padding: const EdgeInsets.all(8.0), child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: PermissionManagement( bloc: _blocRole, )))) diff --git a/lib/pages/roles_and_permission/users_page/users_table/view/creation_date_filter.dart b/lib/pages/roles_and_permission/users_page/users_table/view/creation_date_filter.dart index 7b7da0bd..a4d8573f 100644 --- a/lib/pages/roles_and_permission/users_page/users_table/view/creation_date_filter.dart +++ b/lib/pages/roles_and_permission/users_page/users_table/view/creation_date_filter.dart @@ -23,7 +23,7 @@ Future showDateFilterMenu({ await showMenu( context: context, position: position, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( bottomRight: Radius.circular(10), @@ -41,9 +41,8 @@ Future showDateFilterMenu({ title: Text( "Sort from newest to oldest", style: TextStyle( - color: isSelected == "NewestToOldest" - ? Colors.black - : Colors.blueGrey), + color: + isSelected == "NewestToOldest" ? Colors.black : Colors.blueGrey), ), ), ), @@ -57,9 +56,8 @@ Future showDateFilterMenu({ title: Text( "Sort from oldest to newest", style: TextStyle( - color: isSelected == "OldestToNewest" - ? Colors.black - : Colors.blueGrey), + color: + isSelected == "OldestToNewest" ? Colors.black : Colors.blueGrey), ), ), ), diff --git a/lib/pages/roles_and_permission/users_page/users_table/view/de_activate_filter.dart b/lib/pages/roles_and_permission/users_page/users_table/view/de_activate_filter.dart index c8742ea5..b04e02c8 100644 --- a/lib/pages/roles_and_permission/users_page/users_table/view/de_activate_filter.dart +++ b/lib/pages/roles_and_permission/users_page/users_table/view/de_activate_filter.dart @@ -23,7 +23,7 @@ Future showDeActivateFilterMenu({ await showMenu( context: context, position: position, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( bottomRight: Radius.circular(10), @@ -41,9 +41,8 @@ Future showDeActivateFilterMenu({ title: Text( "Sort A to Z", style: TextStyle( - color: isSelected == "NewestToOldest" - ? Colors.black - : Colors.blueGrey), + color: + isSelected == "NewestToOldest" ? Colors.black : Colors.blueGrey), ), ), ), @@ -57,9 +56,8 @@ Future showDeActivateFilterMenu({ title: Text( "Sort Z to A", style: TextStyle( - color: isSelected == "OldestToNewest" - ? Colors.black - : Colors.blueGrey), + color: + isSelected == "OldestToNewest" ? Colors.black : Colors.blueGrey), ), ), ), diff --git a/lib/pages/roles_and_permission/users_page/users_table/view/name_filter.dart b/lib/pages/roles_and_permission/users_page/users_table/view/name_filter.dart index f551cf3c..3dffd87f 100644 --- a/lib/pages/roles_and_permission/users_page/users_table/view/name_filter.dart +++ b/lib/pages/roles_and_permission/users_page/users_table/view/name_filter.dart @@ -23,7 +23,7 @@ Future showNameMenu({ await showMenu( context: context, position: position, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( bottomRight: Radius.circular(10), diff --git a/lib/pages/roles_and_permission/users_page/users_table/view/user_table.dart b/lib/pages/roles_and_permission/users_page/users_table/view/user_table.dart index 9b10b5d4..26ef5373 100644 --- a/lib/pages/roles_and_permission/users_page/users_table/view/user_table.dart +++ b/lib/pages/roles_and_permission/users_page/users_table/view/user_table.dart @@ -83,8 +83,7 @@ class _TableRow extends StatelessWidget { for (int i = 0; i < cells.length; i++) Container( width: columnWidths[i], - padding: - const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), // decoration: BoxDecoration( // border: Border( // right: BorderSide(color: ColorsManager.boxDivider), @@ -201,7 +200,7 @@ class _DynamicTableScreenState extends State { return Container( decoration: containerDecoration.copyWith( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(15), bottomRight: Radius.circular(15), @@ -231,8 +230,7 @@ class _DynamicTableScreenState extends State { if (_lastAvailableWidth != availableWidth) { final equalWidth = (availableWidth - totalDividersWidth) / widget.titles.length; - final clampedWidth = - equalWidth.clamp(_minColumnWidth, _maxColumnWidth); + final clampedWidth = equalWidth.clamp(_minColumnWidth, _maxColumnWidth); WidgetsBinding.instance.addPostFrameCallback((_) { setState(() { @@ -249,7 +247,7 @@ class _DynamicTableScreenState extends State { child: Container( width: totalTableWidth, decoration: containerDecoration.copyWith( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: const BorderRadius.all(Radius.circular(20)), ), child: Column( diff --git a/lib/pages/roles_and_permission/users_page/users_table/view/users_page.dart b/lib/pages/roles_and_permission/users_page/users_table/view/users_page.dart index 0a7e3714..cfcd260f 100644 --- a/lib/pages/roles_and_permission/users_page/users_table/view/users_page.dart +++ b/lib/pages/roles_and_permission/users_page/users_table/view/users_page.dart @@ -61,8 +61,7 @@ class UsersPage extends StatelessWidget { : ColorsManager.disabledPink.withOpacity(0.5), ), child: Padding( - padding: - const EdgeInsets.only(left: 10, right: 10, bottom: 5, top: 5), + padding: const EdgeInsets.only(left: 10, right: 10, bottom: 5, top: 5), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, @@ -93,8 +92,7 @@ class UsersPage extends StatelessWidget { child: InkWell( onTap: onTap, child: Padding( - padding: - const EdgeInsets.only(left: 5, right: 5, bottom: 5, top: 5), + padding: const EdgeInsets.only(left: 5, right: 5, bottom: 5, top: 5), child: SvgPicture.asset( status == "invited" ? Assets.invitedIcon @@ -142,7 +140,7 @@ class UsersPage extends StatelessWidget { }, style: const TextStyle(color: Colors.black), decoration: textBoxDecoration(radios: 15)!.copyWith( - fillColor: ColorsManager.whiteColors, + fillColor: ColorsManager.white, errorStyle: const TextStyle(height: 0), hintStyle: context.textTheme.titleSmall?.copyWith( color: Colors.grey, @@ -430,14 +428,12 @@ class UsersPage extends StatelessWidget { Text(user.createdTime ?? ''), Text(user.invitedBy), status( - status: user.isEnabled == false - ? 'disabled' - : user.status, + status: + user.isEnabled == false ? 'disabled' : user.status, ), changeIconStatus( - status: user.isEnabled == false - ? 'disabled' - : user.status, + status: + user.isEnabled == false ? 'disabled' : user.status, userId: user.uuid, onTap: user.status != "invited" ? () { @@ -484,11 +480,10 @@ class UsersPage extends StatelessWidget { context: context, barrierDismissible: false, builder: (BuildContext context) { - return DeleteUserDialog( - onTapDelete: () async { + return DeleteUserDialog(onTapDelete: () async { try { - _blocRole.add(DeleteUserEvent( - user.uuid, context)); + _blocRole.add( + DeleteUserEvent(user.uuid, context)); await Future.delayed( const Duration(seconds: 2)); return true; @@ -521,8 +516,7 @@ class UsersPage extends StatelessWidget { visiblePagesCount: 4, buttonRadius: 10, selectedButtonColor: ColorsManager.secondaryColor, - buttonUnSelectedBorderColor: - ColorsManager.grayBorder, + buttonUnSelectedBorderColor: ColorsManager.grayBorder, lastPageIcon: const Icon(Icons.keyboard_double_arrow_right), firstPageIcon: diff --git a/lib/pages/roles_and_permission/view/role_card.dart b/lib/pages/roles_and_permission/view/role_card.dart index b08b14ea..57af1830 100644 --- a/lib/pages/roles_and_permission/view/role_card.dart +++ b/lib/pages/roles_and_permission/view/role_card.dart @@ -9,7 +9,7 @@ class RoleCard extends StatelessWidget { Widget build(BuildContext context) { return Container( decoration: BoxDecoration( - color: ColorsManager.whiteColors, // Card background color + color: ColorsManager.white, // Card background color borderRadius: BorderRadius.circular(20), // Rounded corners boxShadow: [ BoxShadow( @@ -22,8 +22,8 @@ class RoleCard extends StatelessWidget { ), child: Container( decoration: BoxDecoration( - color: ColorsManager.whiteColors, - borderRadius: BorderRadius.circular(20), + color: ColorsManager.white, + borderRadius: BorderRadius.circular(20), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, diff --git a/lib/pages/roles_and_permission/view/roles_and_permission_page.dart b/lib/pages/roles_and_permission/view/roles_and_permission_page.dart index 4ba83cc1..58a0368f 100644 --- a/lib/pages/roles_and_permission/view/roles_and_permission_page.dart +++ b/lib/pages/roles_and_permission/view/roles_and_permission_page.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:syncrow_web/pages/common/bloc/project_manager.dart'; import 'package:syncrow_web/pages/device_managment/shared/navigate_home_grid_view.dart'; import 'package:syncrow_web/pages/roles_and_permission/bloc/roles_permission_bloc.dart'; import 'package:syncrow_web/pages/roles_and_permission/bloc/roles_permission_state.dart'; @@ -30,8 +29,7 @@ class RolesAndPermissionPage extends StatelessWidget { enableMenuSidebar: false, appBarTitle: Text( 'Roles & Permissions', - style: - ResponsiveTextTheme.of(context).deviceManagementTitle, + style: ResponsiveTextTheme.of(context).deviceManagementTitle, ), rightBody: const NavigateHomeGridView(), centerBody: Row( @@ -66,7 +64,7 @@ class RolesAndPermissionPage extends StatelessWidget { 'Users', style: context.textTheme.titleMedium?.copyWith( color: (_blocRole.tapSelect == true) - ? ColorsManager.whiteColors + ? ColorsManager.white : ColorsManager.grayColor, fontWeight: (_blocRole.tapSelect == true) ? FontWeight.w700 diff --git a/lib/pages/roles_and_permission/view/roles_page.dart b/lib/pages/roles_and_permission/view/roles_page.dart index 9c8ef0cd..58c922cf 100644 --- a/lib/pages/roles_and_permission/view/roles_page.dart +++ b/lib/pages/roles_and_permission/view/roles_page.dart @@ -32,7 +32,7 @@ class RolesPage extends StatelessWidget { controller: searchController, style: const TextStyle(color: Colors.black), decoration: textBoxDecoration(radios: 15)!.copyWith( - fillColor: ColorsManager.whiteColors, + fillColor: ColorsManager.white, errorStyle: const TextStyle(height: 0), hintStyle: context.textTheme.titleSmall?.copyWith( color: Colors.grey, diff --git a/lib/pages/routines/create_new_routines/commu_dropdown.dart b/lib/pages/routines/create_new_routines/commu_dropdown.dart index bab0658c..298829bd 100644 --- a/lib/pages/routines/create_new_routines/commu_dropdown.dart +++ b/lib/pages/routines/create_new_routines/commu_dropdown.dart @@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/routines/create_new_routines/dropdown_menu_content.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart'; import 'package:syncrow_web/utils/color_manager.dart'; + import 'space_tree_dropdown_bloc.dart'; class SpaceTreeDropdown extends StatelessWidget { @@ -176,7 +177,7 @@ class _DropdownContentState extends State<_DropdownContent> { showWhenUnlinked: false, offset: const Offset(0, 48), child: Material( - color: ColorsManager.whiteColors, + color: ColorsManager.white, elevation: 8, borderRadius: BorderRadius.circular(12), child: BlocProvider.value( @@ -201,8 +202,7 @@ class _DropdownContentState extends State<_DropdownContent> { Overlay.of(context).insert(_overlayEntry!); } - CommunityModel? _findCommunity( - SpaceTreeDropdownState state, String? communityId) { + CommunityModel? _findCommunity(SpaceTreeDropdownState state, String? communityId) { if (communityId == null) return null; try { return state.filteredCommunities.firstWhere((c) => c.uuid == communityId); diff --git a/lib/pages/routines/create_new_routines/space_dropdown.dart b/lib/pages/routines/create_new_routines/space_dropdown.dart index 012b2ae7..e97603d0 100644 --- a/lib/pages/routines/create_new_routines/space_dropdown.dart +++ b/lib/pages/routines/create_new_routines/space_dropdown.dart @@ -35,8 +35,7 @@ class SpaceDropdown extends StatelessWidget { DropdownButton2( underline: const SizedBox(), buttonStyleData: ButtonStyleData( - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(12)), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12)), ), value: selectedValue, items: spaces.map((space) { @@ -98,9 +97,7 @@ class SpaceDropdown extends StatelessWidget { padding: const EdgeInsets.only(left: 10), child: Text( selectedValue != null - ? spaces - .firstWhere((e) => e.uuid == selectedValue) - .name + ? spaces.firstWhere((e) => e.uuid == selectedValue).name : hintMessage, style: Theme.of(context).textTheme.bodySmall!.copyWith( fontSize: 13, @@ -134,7 +131,7 @@ class SpaceDropdown extends StatelessWidget { dropdownStyleData: DropdownStyleData( maxHeight: MediaQuery.of(context).size.height * 0.4, decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(10), ), ), diff --git a/lib/pages/routines/helper/save_routine_helper.dart b/lib/pages/routines/helper/save_routine_helper.dart index 2b506620..99e61340 100644 --- a/lib/pages/routines/helper/save_routine_helper.dart +++ b/lib/pages/routines/helper/save_routine_helper.dart @@ -17,10 +17,9 @@ class SaveRoutineHelper { builder: (context) { return BlocBuilder( builder: (context, state) { - final selectedConditionLabel = - state.selectedAutomationOperator == 'and' - ? 'All Conditions are met' - : 'Any Condition is met'; + final selectedConditionLabel = state.selectedAutomationOperator == 'and' + ? 'All Conditions are met' + : 'Any Condition is met'; return AlertDialog( contentPadding: EdgeInsets.zero, @@ -38,11 +37,10 @@ class SaveRoutineHelper { Text( 'Create a scene: ${state.routineName ?? ""}', textAlign: TextAlign.center, - style: - Theme.of(context).textTheme.headlineMedium!.copyWith( - color: ColorsManager.primaryColorWithOpacity, - fontWeight: FontWeight.bold, - ), + style: Theme.of(context).textTheme.headlineMedium!.copyWith( + color: ColorsManager.opaquePrimary, + fontWeight: FontWeight.bold, + ), ), const SizedBox(height: 18), _buildDivider(), @@ -60,8 +58,7 @@ class SaveRoutineHelper { _buildIfConditions(state, context), Container( width: 1, - color: ColorsManager.greyColor - .withValues(alpha: 0.8), + color: ColorsManager.greyColor.withValues(alpha: 0.8), ), _buildThenActions(state, context), ], @@ -100,8 +97,7 @@ class SaveRoutineHelper { child: Row( spacing: 16, children: [ - Expanded( - child: Text('IF: $selectedConditionLabel', style: textStyle)), + Expanded(child: Text('IF: $selectedConditionLabel', style: textStyle)), const Expanded(child: Text('THEN:', style: textStyle)), ], ), @@ -136,7 +132,7 @@ class SaveRoutineHelper { Navigator.pop(context); }, - textColor: ColorsManager.primaryColorWithOpacity, + textColor: ColorsManager.opaquePrimary, ), ], ); @@ -147,8 +143,7 @@ class SaveRoutineHelper { child: ListView( // shrinkWrap: true, children: state.thenItems.map((item) { - final functions = - state.selectedFunctions[item['uniqueCustomId']] ?? []; + final functions = state.selectedFunctions[item['uniqueCustomId']] ?? []; return functionRow(item, context, functions); }).toList(), ), @@ -208,20 +203,19 @@ class SaveRoutineHelper { ), ), child: Center( - child: - item['type'] == 'tap_to_run' || item['type'] == 'scene' - ? Image.memory( - base64Decode(item['icon']), - width: 12, - height: 22, - fit: BoxFit.scaleDown, - ) - : SvgPicture.asset( - item['imagePath'], - width: 12, - height: 12, - fit: BoxFit.scaleDown, - ), + child: item['type'] == 'tap_to_run' || item['type'] == 'scene' + ? Image.memory( + base64Decode(item['icon']), + width: 12, + height: 22, + fit: BoxFit.scaleDown, + ) + : SvgPicture.asset( + item['imagePath'], + width: 12, + height: 12, + fit: BoxFit.scaleDown, + ), ), ), Flexible( diff --git a/lib/pages/routines/view/create_new_routine_view.dart b/lib/pages/routines/view/create_new_routine_view.dart index a2d5d892..ca46815b 100644 --- a/lib/pages/routines/view/create_new_routine_view.dart +++ b/lib/pages/routines/view/create_new_routine_view.dart @@ -35,7 +35,7 @@ class CreateNewRoutineView extends StatelessWidget { child: Card( child: Container( decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(15), ), child: const ConditionsRoutinesDevicesView()), @@ -53,7 +53,7 @@ class CreateNewRoutineView extends StatelessWidget { margin: EdgeInsets.zero, child: Container( decoration: const BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(15), topRight: Radius.circular(15), diff --git a/lib/pages/routines/widgets/condition_toggle.dart b/lib/pages/routines/widgets/condition_toggle.dart index 541ad431..e8123204 100644 --- a/lib/pages/routines/widgets/condition_toggle.dart +++ b/lib/pages/routines/widgets/condition_toggle.dart @@ -12,11 +12,7 @@ class ConditionToggle extends StatelessWidget { }); static const _conditions = ["<", "==", ">"]; - static const _icons = [ - Icons.chevron_left, - Icons.drag_handle, - Icons.chevron_right - ]; + static const _icons = [Icons.chevron_left, Icons.drag_handle, Icons.chevron_right]; @override Widget build(BuildContext context) { @@ -41,16 +37,14 @@ class ConditionToggle extends StatelessWidget { duration: const Duration(milliseconds: 180), curve: Curves.ease, decoration: BoxDecoration( - color: - isSelected ? ColorsManager.vividBlue : Colors.transparent, + color: isSelected ? ColorsManager.vividBlue : Colors.transparent, ), child: Center( child: Icon( _icons[index], size: 20, - color: isSelected - ? ColorsManager.whiteColors - : ColorsManager.blackColor, + color: + isSelected ? ColorsManager.white : ColorsManager.blackColor, weight: isSelected ? 700 : 500, ), ), diff --git a/lib/pages/routines/widgets/delete_scene.dart b/lib/pages/routines/widgets/delete_scene.dart index 10eeb493..058a9aca 100644 --- a/lib/pages/routines/widgets/delete_scene.dart +++ b/lib/pages/routines/widgets/delete_scene.dart @@ -39,7 +39,8 @@ class DeleteSceneWidget extends StatelessWidget { ), ), ), - Container(width: 1, height: 50, color: ColorsManager.greyColor), + Container( + width: 1, height: 50, color: ColorsManager.greyColor), InkWell( onTap: () { context.read().add(const DeleteScene()); @@ -51,7 +52,7 @@ class DeleteSceneWidget extends StatelessWidget { child: Text( 'Confirm', style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: ColorsManager.primaryColorWithOpacity, + color: ColorsManager.opaquePrimary, ), ), ), diff --git a/lib/pages/routines/widgets/dialog_footer.dart b/lib/pages/routines/widgets/dialog_footer.dart index 38178ee6..2b9f6bb5 100644 --- a/lib/pages/routines/widgets/dialog_footer.dart +++ b/lib/pages/routines/widgets/dialog_footer.dart @@ -37,9 +37,7 @@ class DialogFooter extends StatelessWidget { DialogFooterButton( text: 'Confirm', onTap: onConfirm, - textColor: isConfirmEnabled - ? ColorsManager.primaryColorWithOpacity - : Colors.red, + textColor: isConfirmEnabled ? ColorsManager.opaquePrimary : Colors.red, ), ], ], @@ -65,7 +63,7 @@ class DialogFooterButton extends StatelessWidget { return Expanded( child: TextButton( style: TextButton.styleFrom( - foregroundColor: ColorsManager.primaryColorWithOpacity, + foregroundColor: ColorsManager.opaquePrimary, disabledForegroundColor: ColorsManager.primaryColor, ), onPressed: onTap, diff --git a/lib/pages/routines/widgets/dialog_header.dart b/lib/pages/routines/widgets/dialog_header.dart index f1f5686a..19f7ea15 100644 --- a/lib/pages/routines/widgets/dialog_header.dart +++ b/lib/pages/routines/widgets/dialog_header.dart @@ -18,7 +18,7 @@ class DialogHeader extends StatelessWidget { title, textAlign: TextAlign.center, style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: ColorsManager.primaryColorWithOpacity, + color: ColorsManager.opaquePrimary, fontWeight: FontWeight.bold, ), ), diff --git a/lib/pages/routines/widgets/dragable_card.dart b/lib/pages/routines/widgets/dragable_card.dart index 9853df7c..b97d6a65 100644 --- a/lib/pages/routines/widgets/dragable_card.dart +++ b/lib/pages/routines/widgets/dragable_card.dart @@ -33,17 +33,18 @@ class DraggableCard extends StatelessWidget { Widget build(BuildContext context) { return BlocBuilder( builder: (context, state) { - final deviceFunctions = state.selectedFunctions[deviceData['uniqueCustomId']] ?? []; + final deviceFunctions = + state.selectedFunctions[deviceData['uniqueCustomId']] ?? []; - int index = state.thenItems - .indexWhere((item) => item['uniqueCustomId'] == deviceData['uniqueCustomId']); + int index = state.thenItems.indexWhere( + (item) => item['uniqueCustomId'] == deviceData['uniqueCustomId']); if (index != -1) { return _buildCardContent(context, deviceFunctions, padding: padding); } - int ifIndex = state.ifItems - .indexWhere((item) => item['uniqueCustomId'] == deviceData['uniqueCustomId']); + int ifIndex = state.ifItems.indexWhere( + (item) => item['uniqueCustomId'] == deviceData['uniqueCustomId']); if (ifIndex != -1) { return _buildCardContent(context, deviceFunctions, padding: padding); @@ -62,12 +63,13 @@ class DraggableCard extends StatelessWidget { ); } - Widget _buildCardContent(BuildContext context, List deviceFunctions, + Widget _buildCardContent( + BuildContext context, List deviceFunctions, {EdgeInsetsGeometry? padding}) { return Stack( children: [ Card( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: Container( padding: const EdgeInsets.all(16), width: 110, @@ -92,7 +94,8 @@ class DraggableCard extends StatelessWidget { ), ), padding: const EdgeInsets.all(8), - child: deviceData['type'] == 'tap_to_run' || deviceData['type'] == 'scene' + child: deviceData['type'] == 'tap_to_run' || + deviceData['type'] == 'scene' ? Image.memory( base64Decode(deviceData['icon']), ) @@ -123,7 +126,9 @@ class DraggableCard extends StatelessWidget { spacing: 2, children: [ SizedBox( - width: 8, height: 8, child: SvgPicture.asset(Assets.deviceTagIcon)), + width: 8, + height: 8, + child: SvgPicture.asset(Assets.deviceTagIcon)), Flexible( child: Text( deviceData['tag'] ?? '', @@ -141,13 +146,15 @@ class DraggableCard extends StatelessWidget { ), ), Visibility( - visible: deviceData['subSpace'] != null && deviceData['subSpace'] != '', + visible: deviceData['subSpace'] != null && + deviceData['subSpace'] != '', child: const SizedBox( height: 4, ), ), Visibility( - visible: deviceData['subSpace'] != null && deviceData['subSpace'] != '', + visible: deviceData['subSpace'] != null && + deviceData['subSpace'] != '', child: Row( spacing: 2, children: [ @@ -222,7 +229,8 @@ class DraggableCard extends StatelessWidget { } String _formatFunctionValue(DeviceFunctionData function) { - if (function.functionCode == 'temp_set' || function.functionCode == 'temp_current') { + if (function.functionCode == 'temp_set' || + function.functionCode == 'temp_current') { return '${(function.value / 10).toStringAsFixed(0)}°C'; } else if (function.functionCode.contains('countdown')) { final seconds = function.value?.toInt() ?? 0; diff --git a/lib/pages/routines/widgets/if_container.dart b/lib/pages/routines/widgets/if_container.dart index a85e25bc..35ac9dd7 100644 --- a/lib/pages/routines/widgets/if_container.dart +++ b/lib/pages/routines/widgets/if_container.dart @@ -32,8 +32,7 @@ class IfContainer extends StatelessWidget { fontSize: 18, fontWeight: FontWeight.bold)), if (state.isAutomation && state.ifItems.isNotEmpty) AutomationOperatorSelector( - selectedOperator: - state.selectedAutomationOperator), + selectedOperator: state.selectedAutomationOperator), ], ), const SizedBox(height: 16), @@ -57,8 +56,8 @@ class IfContainer extends StatelessWidget { (index) => GestureDetector( onTap: () async { if (!state.isTabToRun) { - final result = await DeviceDialogHelper - .showDeviceDialog( + final result = + await DeviceDialogHelper.showDeviceDialog( context: context, data: state.ifItems[index], removeComparetors: false, @@ -79,8 +78,8 @@ class IfContainer extends StatelessWidget { 'NCPS', 'WH', 'PC', - ].contains(state.ifItems[index] - ['productType'])) { + ].contains( + state.ifItems[index]['productType'])) { context.read().add( AddToIfContainer( state.ifItems[index], false)); @@ -97,12 +96,11 @@ class IfContainer extends StatelessWidget { isFromThen: false, isFromIf: true, onRemove: () { - context.read().add( - RemoveDragCard( - index: index, - isFromThen: false, - key: state.ifItems[index] - ['uniqueCustomId'])); + context.read().add(RemoveDragCard( + index: index, + isFromThen: false, + key: state.ifItems[index] + ['uniqueCustomId'])); }, ), )), @@ -123,9 +121,7 @@ class IfContainer extends StatelessWidget { if (!state.isTabToRun) { if (mutableData['deviceId'] == 'tab_to_run') { - context - .read() - .add(AddToIfContainer(mutableData, true)); + context.read().add(AddToIfContainer(mutableData, true)); } else { final result = await DeviceDialogHelper.showDeviceDialog( dialogType: 'IF', @@ -184,7 +180,7 @@ class AutomationOperatorSelector extends StatelessWidget { style: TextButton.styleFrom( backgroundColor: selectedOperator.toLowerCase() == 'or' ? ColorsManager.dialogBlueTitle - : ColorsManager.whiteColors, + : ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0), ), @@ -193,7 +189,7 @@ class AutomationOperatorSelector extends StatelessWidget { 'Any condition is met', style: context.textTheme.bodyMedium?.copyWith( color: selectedOperator.toLowerCase() == 'or' - ? ColorsManager.whiteColors + ? ColorsManager.white : ColorsManager.blackColor, ), ), @@ -212,7 +208,7 @@ class AutomationOperatorSelector extends StatelessWidget { style: TextButton.styleFrom( backgroundColor: selectedOperator.toLowerCase() == 'and' ? ColorsManager.dialogBlueTitle - : ColorsManager.whiteColors, + : ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0), ), @@ -221,7 +217,7 @@ class AutomationOperatorSelector extends StatelessWidget { 'All condition is met', style: context.textTheme.bodyMedium?.copyWith( color: selectedOperator.toLowerCase() == 'and' - ? ColorsManager.whiteColors + ? ColorsManager.white : ColorsManager.blackColor, ), ), diff --git a/lib/pages/routines/widgets/main_routine_view/routine_view_card.dart b/lib/pages/routines/widgets/main_routine_view/routine_view_card.dart index df21c93e..b1162323 100644 --- a/lib/pages/routines/widgets/main_routine_view/routine_view_card.dart +++ b/lib/pages/routines/widgets/main_routine_view/routine_view_card.dart @@ -91,7 +91,7 @@ class _RoutineViewCardState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: InkWell( borderRadius: BorderRadius.circular(10), child: Padding( @@ -121,8 +121,7 @@ class _RoutineViewCardState extends State { child: SizedBox( width: 16, height: 16, - child: - CircularProgressIndicator(strokeWidth: 2), + child: CircularProgressIndicator(strokeWidth: 2), ), ), ) @@ -160,9 +159,8 @@ class _RoutineViewCardState extends State { height: iconSize, width: iconSize, fit: BoxFit.contain, - errorBuilder: - (context, error, stackTrace) => - Image.asset( + errorBuilder: (context, error, stackTrace) => + Image.asset( Assets.logo, height: iconSize, width: iconSize, @@ -205,8 +203,7 @@ class _RoutineViewCardState extends State { maxLines: 1, style: context.textTheme.bodySmall?.copyWith( color: ColorsManager.blackColor, - fontSize: - widget.isSmallScreenSize(context) ? 10 : 12, + fontSize: widget.isSmallScreenSize(context) ? 10 : 12, ), ), if (widget.spaceName != '') @@ -225,9 +222,8 @@ class _RoutineViewCardState extends State { maxLines: 1, style: context.textTheme.bodySmall?.copyWith( color: ColorsManager.blackColor, - fontSize: widget.isSmallScreenSize(context) - ? 10 - : 12, + fontSize: + widget.isSmallScreenSize(context) ? 10 : 12, ), ), ], diff --git a/lib/pages/routines/widgets/routine_dialog_selection_list_tile.dart b/lib/pages/routines/widgets/routine_dialog_selection_list_tile.dart index b661e591..f75e22ca 100644 --- a/lib/pages/routines/widgets/routine_dialog_selection_list_tile.dart +++ b/lib/pages/routines/widgets/routine_dialog_selection_list_tile.dart @@ -37,9 +37,7 @@ class RoutineDialogSelectionListTile extends StatelessWidget { trailing: Icon( isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked, size: 24, - color: isSelected - ? ColorsManager.primaryColorWithOpacity - : ColorsManager.textGray, + color: isSelected ? ColorsManager.opaquePrimary : ColorsManager.textGray, ), onTap: onTap, ); diff --git a/lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart index 0ca6c125..850287cf 100644 --- a/lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart @@ -65,9 +65,8 @@ class ACHelper { child: Column( mainAxisSize: MainAxisSize.min, children: [ - DialogHeader(dialogType == 'THEN' - ? 'AC Functions' - : 'AC Conditions'), + DialogHeader( + dialogType == 'THEN' ? 'AC Functions' : 'AC Conditions'), Expanded( child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, @@ -78,15 +77,12 @@ class ACHelper { child: _buildFunctionsList( context: context, acFunctions: acFunctions, - onFunctionSelected: - (functionCode, operationName) { - RoutineTapFunctionHelper.onTapFunction( - context, + onFunctionSelected: (functionCode, operationName) { + RoutineTapFunctionHelper.onTapFunction(context, functionCode: functionCode, functionOperationName: operationName, functionValueDescription: - selectedFunctionData - .valueDescription, + selectedFunctionData.valueDescription, deviceUuid: device?.uuid, codesToAddIntoFunctionsWithDefaultValue: [ 'temp_set', @@ -119,8 +115,7 @@ class ACHelper { ? () { final selectedFunctionData = state.addedFunctions.firstWhere( - (f) => - f.functionCode == state.selectedFunction, + (f) => f.functionCode == state.selectedFunction, orElse: () => DeviceFunctionData( entityId: '', functionCode: state.selectedFunction ?? '', @@ -214,12 +209,10 @@ class ACHelper { required String operationName, bool? removeComparators, }) { - final selectedFn = - acFunctions.firstWhere((f) => f.code == selectedFunction); + final selectedFn = acFunctions.firstWhere((f) => f.code == selectedFunction); if (selectedFunction == 'temp_set' || selectedFunction == 'temp_current') { - final displayValue = - (selectedFunctionData?.value ?? selectedFn.min!) / 10; + final displayValue = (selectedFunctionData?.value ?? selectedFn.min!) / 10; final minValue = selectedFn.min! / 10; final maxValue = selectedFn.max! / 10; @@ -462,13 +455,9 @@ class ACHelper { style: context.textTheme.bodyMedium, ), trailing: Icon( - isSelected - ? Icons.radio_button_checked - : Icons.radio_button_unchecked, + isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked, size: 24, - color: isSelected - ? ColorsManager.primaryColorWithOpacity - : ColorsManager.textGray, + color: isSelected ? ColorsManager.opaquePrimary : ColorsManager.textGray, ), onTap: () { if (!isSelected) { @@ -480,8 +469,7 @@ class ACHelper { operationName: operationName, value: value.value, condition: selectedFunctionData?.condition, - valueDescription: - selectedFunctionData?.valueDescription, + valueDescription: selectedFunctionData?.valueDescription, ), ), ); diff --git a/lib/pages/routines/widgets/routine_dialogs/curtain_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/curtain_dialog.dart index 64295e2a..e8189b15 100644 --- a/lib/pages/routines/widgets/routine_dialogs/curtain_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/curtain_dialog.dart @@ -71,10 +71,8 @@ class CurtainHelper { child: _buildFunctionsList( context: context, curtainFunctions: curtainFunctions, - onFunctionSelected: - (functionCode, operationName) { - RoutineTapFunctionHelper.onTapFunction( - context, + onFunctionSelected: (functionCode, operationName) { + RoutineTapFunctionHelper.onTapFunction(context, functionCode: functionCode, functionOperationName: operationName, functionValueDescription: @@ -240,13 +238,9 @@ class CurtainHelper { style: context.textTheme.bodyMedium, ), trailing: Icon( - isSelected - ? Icons.radio_button_checked - : Icons.radio_button_unchecked, + isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked, size: 24, - color: isSelected - ? ColorsManager.primaryColorWithOpacity - : ColorsManager.textGray, + color: isSelected ? ColorsManager.opaquePrimary : ColorsManager.textGray, ), onTap: () { if (!isSelected) { @@ -258,8 +252,7 @@ class CurtainHelper { operationName: operationName, value: value.value, condition: selectedFunctionData?.condition, - valueDescription: - selectedFunctionData?.valueDescription, + valueDescription: selectedFunctionData?.valueDescription, ), ), ); diff --git a/lib/pages/routines/widgets/routine_dialogs/one_gang_switch_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/one_gang_switch_dialog.dart index 6e882c71..8371f8e5 100644 --- a/lib/pages/routines/widgets/routine_dialogs/one_gang_switch_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/one_gang_switch_dialog.dart @@ -89,15 +89,14 @@ class OneGangSwitchHelper { size: 16, color: ColorsManager.textGray, ), - onTap: () => RoutineTapFunctionHelper - .onTapFunction( + onTap: () => + RoutineTapFunctionHelper.onTapFunction( context, functionCode: function.code, functionOperationName: function.operationName, functionValueDescription: - selectedFunctionData - .valueDescription, + selectedFunctionData.valueDescription, deviceUuid: device?.uuid, codesToAddIntoFunctionsWithDefaultValue: [ 'countdown_1', @@ -113,12 +112,10 @@ class OneGangSwitchHelper { child: _buildValueSelector( context: context, selectedFunction: selectedFunction, - selectedFunctionData: - selectedFunctionData, + selectedFunctionData: selectedFunctionData, acFunctions: oneGangFunctions, device: device, - operationName: - selectedOperationName ?? '', + operationName: selectedOperationName ?? '', removeComparetors: removeComparetors, dialogType: dialogType), ), @@ -318,13 +315,9 @@ class OneGangSwitchHelper { style: context.textTheme.bodyMedium, ), trailing: Icon( - isSelected - ? Icons.radio_button_checked - : Icons.radio_button_unchecked, + isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked, size: 24, - color: isSelected - ? ColorsManager.primaryColorWithOpacity - : ColorsManager.textGray, + color: isSelected ? ColorsManager.opaquePrimary : ColorsManager.textGray, ), onTap: () { if (!isSelected) { @@ -336,8 +329,7 @@ class OneGangSwitchHelper { operationName: operationName, value: value.value, condition: selectedFunctionData?.condition, - valueDescription: - selectedFunctionData?.valueDescription, + valueDescription: selectedFunctionData?.valueDescription, ), ), ); diff --git a/lib/pages/routines/widgets/routine_dialogs/setting_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/setting_dialog.dart index b8449838..afef1695 100644 --- a/lib/pages/routines/widgets/routine_dialogs/setting_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/setting_dialog.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/routines/bloc/effective_period/effect_period_bloc.dart'; @@ -13,7 +14,6 @@ import 'package:syncrow_web/pages/routines/view/effective_period_view.dart'; import 'package:syncrow_web/pages/routines/widgets/delete_scene.dart'; import 'package:syncrow_web/pages/routines/widgets/dialog_header.dart'; import 'package:syncrow_web/utils/color_manager.dart'; -import 'package:flutter/cupertino.dart'; class SettingHelper { static Future showSettingDialog({ @@ -30,14 +30,16 @@ class SettingHelper { providers: [ if (effectiveTime != null) BlocProvider( - create: (_) => EffectPeriodBloc()..add(InitialEffectPeriodEvent(effectiveTime)), + create: (_) => + EffectPeriodBloc()..add(InitialEffectPeriodEvent(effectiveTime)), ), if (effectiveTime == null) BlocProvider( create: (_) => EffectPeriodBloc(), ), BlocProvider( - create: (_) => SettingBloc()..add(InitialEvent(selectedIcon: iconId ?? ''))), + create: (_) => + SettingBloc()..add(InitialEvent(selectedIcon: iconId ?? ''))), ], child: AlertDialog( contentPadding: EdgeInsets.zero, @@ -53,7 +55,9 @@ class SettingHelper { } return Container( width: context.read().isExpanded ? 800 : 400, - height: context.read().isExpanded && isAutomation ? 500 : 350, + height: context.read().isExpanded && isAutomation + ? 500 + : 350, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), @@ -76,14 +80,18 @@ class SettingHelper { children: [ Container( padding: const EdgeInsets.only( - top: 10, left: 10, right: 10, bottom: 10), + top: 10, + left: 10, + right: 10, + bottom: 10), child: Column( children: [ InkWell( onTap: () {}, child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment + .spaceBetween, children: [ Text( 'Validity', @@ -91,14 +99,17 @@ class SettingHelper { .textTheme .bodyMedium! .copyWith( - color: - ColorsManager.textPrimaryColor, - fontWeight: FontWeight.w400, + color: ColorsManager + .textPrimaryColor, + fontWeight: + FontWeight.w400, fontSize: 14), ), const Icon( - Icons.arrow_forward_ios_outlined, - color: ColorsManager.textGray, + Icons + .arrow_forward_ios_outlined, + color: + ColorsManager.textGray, size: 15, ) ], @@ -115,15 +126,17 @@ class SettingHelper { ), InkWell( onTap: () { - BlocProvider.of(context).add( - FetchIcons( + BlocProvider.of( + context) + .add(FetchIcons( expanded: !context .read() .isExpanded)); }, child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment + .spaceBetween, children: [ Text( 'Effective Period', @@ -131,14 +144,17 @@ class SettingHelper { .textTheme .bodyMedium! .copyWith( - color: - ColorsManager.textPrimaryColor, - fontWeight: FontWeight.w400, + color: ColorsManager + .textPrimaryColor, + fontWeight: + FontWeight.w400, fontSize: 14), ), const Icon( - Icons.arrow_forward_ios_outlined, - color: ColorsManager.textGray, + Icons + .arrow_forward_ios_outlined, + color: + ColorsManager.textGray, size: 15, ) ], @@ -154,7 +170,8 @@ class SettingHelper { height: 5, ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Text( 'Executed by', @@ -162,8 +179,10 @@ class SettingHelper { .textTheme .bodyMedium! .copyWith( - color: ColorsManager.textPrimaryColor, - fontWeight: FontWeight.w400, + color: ColorsManager + .textPrimaryColor, + fontWeight: + FontWeight.w400, fontSize: 14), ), Text('Cloud', @@ -171,12 +190,17 @@ class SettingHelper { .textTheme .bodyMedium! .copyWith( - color: ColorsManager.textGray, - fontWeight: FontWeight.w400, + color: ColorsManager + .textGray, + fontWeight: + FontWeight.w400, fontSize: 14)), ], ), - if (context.read().state.isUpdate ?? + if (context + .read() + .state + .isUpdate ?? false) const DeleteSceneWidget() ], @@ -188,20 +212,25 @@ class SettingHelper { children: [ Container( padding: const EdgeInsets.only( - top: 10, left: 10, right: 10, bottom: 10), + top: 10, + left: 10, + right: 10, + bottom: 10), child: Column( children: [ InkWell( onTap: () { - BlocProvider.of(context).add( - FetchIcons( + BlocProvider.of( + context) + .add(FetchIcons( expanded: !context .read() .isExpanded)); }, child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment + .spaceBetween, children: [ Text( 'Icons', @@ -209,14 +238,17 @@ class SettingHelper { .textTheme .bodyMedium! .copyWith( - color: - ColorsManager.textPrimaryColor, - fontWeight: FontWeight.w400, + color: ColorsManager + .textPrimaryColor, + fontWeight: + FontWeight.w400, fontSize: 14), ), const Icon( - Icons.arrow_forward_ios_outlined, - color: ColorsManager.textGray, + Icons + .arrow_forward_ios_outlined, + color: + ColorsManager.textGray, size: 15, ) ], @@ -232,7 +264,8 @@ class SettingHelper { height: 5, ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Text( 'Show on devices page', @@ -240,17 +273,21 @@ class SettingHelper { .textTheme .bodyMedium! .copyWith( - color: ColorsManager.textPrimaryColor, - fontWeight: FontWeight.w400, + color: ColorsManager + .textPrimaryColor, + fontWeight: + FontWeight.w400, fontSize: 14), ), Row( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: + MainAxisAlignment.end, children: [ Container( height: 30, width: 1, - color: ColorsManager.graysColor, + color: ColorsManager + .graysColor, ), Transform.scale( scale: .8, @@ -274,7 +311,8 @@ class SettingHelper { height: 5, ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Text( 'Executed by', @@ -282,8 +320,10 @@ class SettingHelper { .textTheme .bodyMedium! .copyWith( - color: ColorsManager.textPrimaryColor, - fontWeight: FontWeight.w400, + color: ColorsManager + .textPrimaryColor, + fontWeight: + FontWeight.w400, fontSize: 14), ), Text('Cloud', @@ -291,12 +331,17 @@ class SettingHelper { .textTheme .bodyMedium! .copyWith( - color: ColorsManager.textGray, - fontWeight: FontWeight.w400, + color: ColorsManager + .textGray, + fontWeight: + FontWeight.w400, fontSize: 14)), ], ), - if (context.read().state.isUpdate ?? + if (context + .read() + .state + .isUpdate ?? false) const DeleteSceneWidget() ], @@ -304,12 +349,14 @@ class SettingHelper { ], ), ), - if (context.read().isExpanded && !isAutomation) + if (context.read().isExpanded && + !isAutomation) SizedBox( width: 400, height: 150, child: settingState is LoadingState - ? const Center(child: CircularProgressIndicator()) + ? const Center( + child: CircularProgressIndicator()) : GridView.builder( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( @@ -326,7 +373,8 @@ class SettingHelper { height: 35, child: InkWell( onTap: () { - BlocProvider.of(context) + BlocProvider.of( + context) .add(SelectIcon( iconId: iconModel.uuid, )); @@ -335,12 +383,14 @@ class SettingHelper { child: SizedBox( child: ClipOval( child: Container( - padding: const EdgeInsets.all(1), + padding: + const EdgeInsets.all(1), decoration: BoxDecoration( border: Border.all( - color: selectedIcon == iconModel.uuid + color: selectedIcon == + iconModel.uuid ? ColorsManager - .primaryColorWithOpacity + .opaquePrimary : Colors.transparent, width: 2, ), @@ -356,8 +406,12 @@ class SettingHelper { ); }, )), - if (context.read().isExpanded && isAutomation) - const SizedBox(height: 350, width: 400, child: EffectivePeriodView()) + if (context.read().isExpanded && + isAutomation) + const SizedBox( + height: 350, + width: 400, + child: EffectivePeriodView()) ], ), Container( @@ -381,23 +435,31 @@ class SettingHelper { alignment: AlignmentDirectional.center, child: Text( 'Cancel', - style: Theme.of(context).textTheme.bodyMedium!.copyWith( + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith( color: ColorsManager.textGray, ), ), ), ), ), - Container(width: 1, height: 50, color: ColorsManager.greyColor), + Container( + width: 1, + height: 50, + color: ColorsManager.greyColor), Expanded( child: InkWell( onTap: () { if (isAutomation) { BlocProvider.of(context).add( EffectiveTimePeriodEvent(EffectiveTime( - start: effectPeriodState.customStartTime!, + start: + effectPeriodState.customStartTime!, end: effectPeriodState.customEndTime!, - loops: effectPeriodState.selectedDaysBinary))); + loops: effectPeriodState + .selectedDaysBinary))); Navigator.of(context).pop(); } else { Navigator.of(context).pop(selectedIcon); @@ -407,8 +469,11 @@ class SettingHelper { alignment: AlignmentDirectional.center, child: Text( 'Confirm', - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - color: ColorsManager.primaryColorWithOpacity, + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith( + color: ColorsManager.opaquePrimary, ), ), ), diff --git a/lib/pages/routines/widgets/routine_dialogs/three_gang_switch_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/three_gang_switch_dialog.dart index 00c3165a..fde9d3c8 100644 --- a/lib/pages/routines/widgets/routine_dialogs/three_gang_switch_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/three_gang_switch_dialog.dart @@ -88,19 +88,17 @@ class ThreeGangSwitchHelper { size: 16, color: ColorsManager.textGray, ), - onTap: () => RoutineTapFunctionHelper - .onTapFunction( + onTap: () => + RoutineTapFunctionHelper.onTapFunction( context, functionCode: function.code, functionOperationName: function.operationName, functionValueDescription: - selectedFunctionData - .valueDescription, + selectedFunctionData.valueDescription, deviceUuid: device?.uuid, codesToAddIntoFunctionsWithDefaultValue: - function.code - .startsWith('countdown') + function.code.startsWith('countdown') ? [function.code] : [], ), @@ -114,12 +112,10 @@ class ThreeGangSwitchHelper { child: _buildValueSelector( context: context, selectedFunction: selectedFunction, - selectedFunctionData: - selectedFunctionData, + selectedFunctionData: selectedFunctionData, switchFunctions: switchFunctions, device: device, - operationName: - selectedOperationName ?? '', + operationName: selectedOperationName ?? '', removeComparetors: removeComparetors, dialogType: dialogType), ), @@ -188,8 +184,7 @@ class ThreeGangSwitchHelper { dialogType: dialogType); } - final selectedFn = - switchFunctions.firstWhere((f) => f.code == selectedFunction); + final selectedFn = switchFunctions.firstWhere((f) => f.code == selectedFunction); final values = selectedFn.getOperationalValues(); return _buildOperationalValuesList( @@ -307,13 +302,9 @@ class ThreeGangSwitchHelper { style: context.textTheme.bodyMedium, ), trailing: Icon( - isSelected - ? Icons.radio_button_checked - : Icons.radio_button_unchecked, + isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked, size: 24, - color: isSelected - ? ColorsManager.primaryColorWithOpacity - : ColorsManager.textGray, + color: isSelected ? ColorsManager.opaquePrimary : ColorsManager.textGray, ), onTap: () { if (!isSelected) { @@ -325,8 +316,7 @@ class ThreeGangSwitchHelper { operationName: operationName, value: value.value, condition: selectedFunctionData?.condition, - valueDescription: - selectedFunctionData?.valueDescription, + valueDescription: selectedFunctionData?.valueDescription, ), ), ); diff --git a/lib/pages/routines/widgets/routine_dialogs/two_gang_switch_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/two_gang_switch_dialog.dart index 8a516eed..68aba181 100644 --- a/lib/pages/routines/widgets/routine_dialogs/two_gang_switch_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/two_gang_switch_dialog.dart @@ -89,15 +89,14 @@ class TwoGangSwitchHelper { size: 16, color: ColorsManager.textGray, ), - onTap: () => RoutineTapFunctionHelper - .onTapFunction( + onTap: () => + RoutineTapFunctionHelper.onTapFunction( context, functionCode: function.code, functionOperationName: function.operationName, functionValueDescription: - selectedFunctionData - .valueDescription, + selectedFunctionData.valueDescription, deviceUuid: device?.uuid, codesToAddIntoFunctionsWithDefaultValue: [ 'countdown_1', @@ -147,13 +146,10 @@ class TwoGangSwitchHelper { // } final selectedFunctionData = state.addedFunctions.firstWhere( - (f) => - f.functionCode == - state.selectedFunction, + (f) => f.functionCode == state.selectedFunction, orElse: () => DeviceFunctionData( entityId: '', - functionCode: - state.selectedFunction ?? '', + functionCode: state.selectedFunction ?? '', operationName: '', value: null, ), @@ -192,8 +188,7 @@ class TwoGangSwitchHelper { required bool removeComparetors, required String dialogType, }) { - if (selectedFunction == 'countdown_1' || - selectedFunction == 'countdown_2') { + if (selectedFunction == 'countdown_1' || selectedFunction == 'countdown_2') { final initialValue = selectedFunctionData?.value ?? 0; return _buildTemperatureSelector( context: context, @@ -207,8 +202,7 @@ class TwoGangSwitchHelper { dialogType: dialogType); } - final selectedFn = - switchFunctions.firstWhere((f) => f.code == selectedFunction); + final selectedFn = switchFunctions.firstWhere((f) => f.code == selectedFunction); final values = selectedFn.getOperationalValues(); return _buildOperationalValuesList( @@ -270,16 +264,15 @@ class TwoGangSwitchHelper { ); }, borderRadius: const BorderRadius.all(Radius.circular(8)), - selectedBorderColor: ColorsManager.primaryColorWithOpacity, + selectedBorderColor: ColorsManager.opaquePrimary, selectedColor: Colors.white, - fillColor: ColorsManager.primaryColorWithOpacity, - color: ColorsManager.primaryColorWithOpacity, + fillColor: ColorsManager.opaquePrimary, + color: ColorsManager.opaquePrimary, constraints: const BoxConstraints( minHeight: 40.0, minWidth: 40.0, ), - isSelected: - conditions.map((c) => c == (currentCondition ?? "==")).toList(), + isSelected: conditions.map((c) => c == (currentCondition ?? "==")).toList(), children: conditions.map((c) => Text(c)).toList(), ); } @@ -295,13 +288,13 @@ class TwoGangSwitchHelper { return Container( padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), decoration: BoxDecoration( - color: ColorsManager.primaryColorWithOpacity.withOpacity(0.1), + color: ColorsManager.opaquePrimary.withOpacity(0.1), borderRadius: BorderRadius.circular(10), ), child: Text( DurationFormatMixin.formatDuration(initialValue?.toInt() ?? 0), style: context.textTheme.headlineMedium!.copyWith( - color: ColorsManager.primaryColorWithOpacity, + color: ColorsManager.opaquePrimary, ), ), ); @@ -338,8 +331,7 @@ class TwoGangSwitchHelper { ); }, onTextChanged: (value) { - final roundedValue = - value.round(); // Round to nearest integer (stepSize 1) + final roundedValue = value.round(); // Round to nearest integer (stepSize 1) context.read().add( AddFunction( functionData: DeviceFunctionData( @@ -391,13 +383,9 @@ class TwoGangSwitchHelper { style: context.textTheme.bodyMedium, ), trailing: Icon( - isSelected - ? Icons.radio_button_checked - : Icons.radio_button_unchecked, + isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked, size: 24, - color: isSelected - ? ColorsManager.primaryColorWithOpacity - : ColorsManager.textGray, + color: isSelected ? ColorsManager.opaquePrimary : ColorsManager.textGray, ), onTap: () { if (!isSelected) { @@ -409,8 +397,7 @@ class TwoGangSwitchHelper { operationName: operationName, value: value.value, condition: selectedFunctionData?.condition, - valueDescription: - selectedFunctionData?.valueDescription, + valueDescription: selectedFunctionData?.valueDescription, ), ), ); diff --git a/lib/pages/routines/widgets/routine_search_and_buttons.dart b/lib/pages/routines/widgets/routine_search_and_buttons.dart index efeedf9d..cc507588 100644 --- a/lib/pages/routines/widgets/routine_search_and_buttons.dart +++ b/lib/pages/routines/widgets/routine_search_and_buttons.dart @@ -61,8 +61,9 @@ class _RoutineSearchAndButtonsState extends State { children: [ ConstrainedBox( constraints: BoxConstraints( - maxWidth: - constraints.maxWidth > 700 ? 450 : constraints.maxWidth - 32), + maxWidth: constraints.maxWidth > 700 + ? 450 + : constraints.maxWidth - 32), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -71,7 +72,9 @@ class _RoutineSearchAndButtonsState extends State { children: [ Text('* ', style: context.textTheme.bodyMedium! - .copyWith(color: ColorsManager.red, fontSize: 13)), + .copyWith( + color: ColorsManager.red, + fontSize: 13)), Text( 'Routine Name', style: context.textTheme.bodyMedium!.copyWith( @@ -93,9 +96,11 @@ class _RoutineSearchAndButtonsState extends State { decoration: InputDecoration( hintText: 'Please enter the name', hintStyle: context.textTheme.bodyMedium! - .copyWith(fontSize: 12, color: ColorsManager.grayColor), - contentPadding: - const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + .copyWith( + fontSize: 12, + color: ColorsManager.grayColor), + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, vertical: 10), border: InputBorder.none, ), onTapOutside: (_) { @@ -121,9 +126,11 @@ class _RoutineSearchAndButtonsState extends State { width: 200, child: Center( child: DefaultButton( - onPressed: state.isAutomation || state.isTabToRun + onPressed: state.isAutomation || + state.isTabToRun ? () async { - final result = await SettingHelper.showSettingDialog( + final result = await SettingHelper + .showSettingDialog( context: context, iconId: state.selectedIcon ?? '', ); @@ -186,10 +193,12 @@ class _RoutineSearchAndButtonsState extends State { child: Center( child: DefaultButton( onPressed: () async { - if (state.routineName == null || state.routineName!.isEmpty) { + if (state.routineName == null || + state.routineName!.isEmpty) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: const Text('Please enter the routine name'), + content: const Text( + 'Please enter the routine name'), duration: const Duration(seconds: 2), backgroundColor: ColorsManager.red, action: SnackBarAction( @@ -203,10 +212,12 @@ class _RoutineSearchAndButtonsState extends State { return; } - if (state.ifItems.isEmpty || state.thenItems.isEmpty) { + if (state.ifItems.isEmpty || + state.thenItems.isEmpty) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: const Text('Please add if and then condition'), + content: const Text( + 'Please add if and then condition'), duration: const Duration(seconds: 2), backgroundColor: ColorsManager.red, action: SnackBarAction( @@ -221,7 +232,8 @@ class _RoutineSearchAndButtonsState extends State { } // final result = // await - BlocProvider.of(context).add(ResetErrorMessage()); + BlocProvider.of(context) + .add(ResetErrorMessage()); SaveRoutineHelper.showSaveRoutineDialog(context); // if (result != null && result) { // BlocProvider.of(context).add( @@ -240,7 +252,7 @@ class _RoutineSearchAndButtonsState extends State { textAlign: TextAlign.center, style: TextStyle( fontSize: 12, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), ), @@ -261,10 +273,14 @@ class _RoutineSearchAndButtonsState extends State { child: DefaultButton( onPressed: state.isAutomation || state.isTabToRun ? () async { - final result = await SettingHelper.showSettingDialog( - context: context, iconId: state.selectedIcon ?? ''); + final result = + await SettingHelper.showSettingDialog( + context: context, + iconId: state.selectedIcon ?? ''); if (result != null) { - context.read().add(AddSelectedIcon(result)); + context + .read() + .add(AddSelectedIcon(result)); } } : null, @@ -314,10 +330,12 @@ class _RoutineSearchAndButtonsState extends State { child: Center( child: DefaultButton( onPressed: () async { - if (state.routineName == null || state.routineName!.isEmpty) { + if (state.routineName == null || + state.routineName!.isEmpty) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: const Text('Please enter the routine name'), + content: + const Text('Please enter the routine name'), duration: const Duration(seconds: 2), backgroundColor: ColorsManager.red, action: SnackBarAction( @@ -334,7 +352,8 @@ class _RoutineSearchAndButtonsState extends State { if (state.ifItems.isEmpty || state.thenItems.isEmpty) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: const Text('Please add if and then condition'), + content: const Text( + 'Please add if and then condition'), duration: const Duration(seconds: 2), backgroundColor: ColorsManager.red, action: SnackBarAction( @@ -349,7 +368,8 @@ class _RoutineSearchAndButtonsState extends State { } // final result = // await - BlocProvider.of(context).add(ResetErrorMessage()); + BlocProvider.of(context) + .add(ResetErrorMessage()); SaveRoutineHelper.showSaveRoutineDialog(context); // if (result != null && result) { // BlocProvider.of(context).add( @@ -368,7 +388,7 @@ class _RoutineSearchAndButtonsState extends State { textAlign: TextAlign.center, style: TextStyle( fontSize: 12, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), ), diff --git a/lib/pages/routines/widgets/value_display.dart b/lib/pages/routines/widgets/value_display.dart index 6a8bd949..ef81ccea 100644 --- a/lib/pages/routines/widgets/value_display.dart +++ b/lib/pages/routines/widgets/value_display.dart @@ -19,13 +19,13 @@ class ValueDisplay extends StatelessWidget { return Container( padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), decoration: BoxDecoration( - color: ColorsManager.primaryColorWithOpacity.withOpacity(0.1), + color: ColorsManager.opaquePrimary.withOpacity(0.1), borderRadius: BorderRadius.circular(10), ), child: Text( '$label $unit ', style: context.textTheme.headlineMedium!.copyWith( - color: ColorsManager.primaryColorWithOpacity, + color: ColorsManager.opaquePrimary, ), ), ); diff --git a/lib/pages/space_management_v2/main_module/shared/widgets/community_dialog.dart b/lib/pages/space_management_v2/main_module/shared/widgets/community_dialog.dart index 32f6f39c..7ff9bd8c 100644 --- a/lib/pages/space_management_v2/main_module/shared/widgets/community_dialog.dart +++ b/lib/pages/space_management_v2/main_module/shared/widgets/community_dialog.dart @@ -50,7 +50,7 @@ class _CommunityDialogState extends State { width: MediaQuery.of(context).size.width * 0.3, padding: const EdgeInsets.all(20), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( @@ -110,7 +110,7 @@ class _CommunityDialogState extends State { } }, borderRadius: 10, - foregroundColor: ColorsManager.whiteColors, + foregroundColor: ColorsManager.white, child: const Text('OK'), ), ); diff --git a/lib/pages/space_management_v2/main_module/widgets/community_structure_header.dart b/lib/pages/space_management_v2/main_module/widgets/community_structure_header.dart index 2e1a350e..60659925 100644 --- a/lib/pages/space_management_v2/main_module/widgets/community_structure_header.dart +++ b/lib/pages/space_management_v2/main_module/widgets/community_structure_header.dart @@ -17,7 +17,7 @@ class CommunityStructureHeader extends StatelessWidget { return Container( padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, boxShadow: [ BoxShadow( color: ColorsManager.shadowBlackColor.withValues(alpha: 0.1), diff --git a/lib/pages/space_management_v2/main_module/widgets/plus_button_widget.dart b/lib/pages/space_management_v2/main_module/widgets/plus_button_widget.dart index 236b73c9..bbc0e2ed 100644 --- a/lib/pages/space_management_v2/main_module/widgets/plus_button_widget.dart +++ b/lib/pages/space_management_v2/main_module/widgets/plus_button_widget.dart @@ -16,7 +16,7 @@ class PlusButtonWidget extends StatelessWidget { style: IconButton.styleFrom(backgroundColor: ColorsManager.spaceColor), icon: const Icon( Icons.add, - color: ColorsManager.whiteColors, + color: ColorsManager.white, size: 20, ), ); diff --git a/lib/pages/space_management_v2/main_module/widgets/space_cell.dart b/lib/pages/space_management_v2/main_module/widgets/space_cell.dart index 3eb6d5df..d9e894be 100644 --- a/lib/pages/space_management_v2/main_module/widgets/space_cell.dart +++ b/lib/pages/space_management_v2/main_module/widgets/space_cell.dart @@ -56,7 +56,7 @@ class SpaceCell extends StatelessWidget { child: SvgPicture.asset( icon, colorFilter: const ColorFilter.mode( - ColorsManager.whiteColors, + ColorsManager.white, BlendMode.srcIn, ), width: 24, @@ -68,7 +68,7 @@ class SpaceCell extends StatelessWidget { BoxDecoration _containerDecoration() { return BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(15), boxShadow: [ BoxShadow( diff --git a/lib/pages/space_management_v2/main_module/widgets/space_management_templates_view.dart b/lib/pages/space_management_v2/main_module/widgets/space_management_templates_view.dart index 138dbbc4..cdd6b386 100644 --- a/lib/pages/space_management_v2/main_module/widgets/space_management_templates_view.dart +++ b/lib/pages/space_management_v2/main_module/widgets/space_management_templates_view.dart @@ -8,7 +8,7 @@ class SpaceManagementTemplatesView extends StatelessWidget { @override Widget build(BuildContext context) { return ColoredBox( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: GridView.builder( padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 20), gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( diff --git a/lib/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog.dart b/lib/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog.dart index f2ddf24a..ceb493ec 100644 --- a/lib/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog.dart +++ b/lib/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog.dart @@ -6,9 +6,8 @@ import 'package:syncrow_web/pages/space_management_v2/modules/delete_space/data/ import 'package:syncrow_web/pages/space_management_v2/modules/delete_space/presentation/bloc/delete_space_bloc.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog_form.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_loading_widget.dart'; -import 'package:syncrow_web/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_status_widget.dart'; import 'package:syncrow_web/services/api/http_service.dart'; -import 'package:syncrow_web/utils/color_manager.dart'; +import 'package:syncrow_web/utils/extension/app_snack_bar.dart'; import 'package:syncrow_web/utils/extension/build_context_x.dart'; class DeleteSpaceDialog extends StatelessWidget { @@ -39,7 +38,19 @@ class DeleteSpaceDialog extends StatelessWidget { ), child: BlocConsumer( listener: (context, state) { - if (state case DeleteSpaceSuccess()) onSuccess(); + switch (state) { + case DeleteSpaceSuccess(:final successMessage): + onSuccess(); + Navigator.pop(context); + context.showSuccessSnackbar(successMessage); + break; + case DeleteSpaceFailure(:final errorMessage): + Navigator.pop(context); + context.showFailureSnackbar(errorMessage); + break; + default: + break; + } }, builder: (context, state) => switch (state) { DeleteSpaceInitial() => DeleteSpaceDialogForm( @@ -47,22 +58,7 @@ class DeleteSpaceDialog extends StatelessWidget { communityUuid: community.uuid, ), DeleteSpaceLoading() => const DeleteSpaceLoadingWidget(), - DeleteSpaceSuccess() => DeleteSpaceStatusWidget( - message: state.successMessage, - icon: const Icon( - Icons.check_circle, - size: 92, - color: ColorsManager.goodGreen, - ), - ), - DeleteSpaceFailure() => DeleteSpaceStatusWidget( - message: state.errorMessage, - icon: const Icon( - Icons.error, - size: 92, - color: ColorsManager.red, - ), - ), + _ => const SizedBox.shrink(), }, ), ), diff --git a/lib/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog_form.dart b/lib/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog_form.dart index 055b67b8..f256523d 100644 --- a/lib/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog_form.dart +++ b/lib/pages/space_management_v2/modules/delete_space/presentation/widgets/delete_space_dialog_form.dart @@ -46,25 +46,14 @@ class DeleteSpaceDialogForm extends StatelessWidget { ), const SizedBox(height: 24), Row( + spacing: 16, children: [ - Expanded( - child: FilledButton( - style: _buildButtonStyle( - context, - color: ColorsManager.grey25, - textColor: ColorsManager.blackColor, - ), - onPressed: Navigator.of(context).pop, - child: const Text('Cancel'), - ), - ), - const SizedBox(width: 16), Expanded( child: FilledButton( style: _buildButtonStyle( context, color: ColorsManager.semiTransparentRed, - textColor: ColorsManager.whiteColors, + textColor: ColorsManager.white, ), onPressed: () { context.read().add( @@ -79,6 +68,17 @@ class DeleteSpaceDialogForm extends StatelessWidget { child: const Text('Delete'), ), ), + Expanded( + child: FilledButton( + style: _buildButtonStyle( + context, + color: ColorsManager.grey25, + textColor: ColorsManager.blackColor, + ), + onPressed: Navigator.of(context).pop, + child: const Text('Cancel'), + ), + ), ], ), ], @@ -101,6 +101,7 @@ class DeleteSpaceDialogForm extends StatelessWidget { fontWeight: FontWeight.w400, fontSize: 14, ), + elevation: 4, ); } } diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart index 8d7d2e29..67820736 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart @@ -39,7 +39,7 @@ class SpaceDetailsActionButtons extends StatelessWidget { onPressed: onSave, borderRadius: 10, backgroundColor: ColorsManager.secondaryColor, - foregroundColor: ColorsManager.whiteColors, + foregroundColor: ColorsManager.white, child: Text(saveButtonLabel), ); } diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_devices_box.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_devices_box.dart index 4c8fec4f..65a53181 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_devices_box.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_devices_box.dart @@ -66,7 +66,7 @@ class SpaceDetailsDevicesBox extends StatelessWidget { color: ColorsManager.spaceColor, ), ), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), side: const BorderSide( @@ -103,9 +103,7 @@ class SpaceDetailsDevicesBox extends StatelessWidget { ).then((resultSpace) { if (resultSpace != null) { if (context.mounted) { - context - .read() - .add(UpdateSpaceDetails(resultSpace)); + context.read().add(UpdateSpaceDetails(resultSpace)); } } }); diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_dialog.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_dialog.dart index d97442ec..370fd59b 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_dialog.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_dialog.dart @@ -74,7 +74,7 @@ class _SpaceDetailsDialogState extends State { Widget _buildLoadingDialog() { return AlertDialog( title: widget.title, - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: SizedBox( height: context.screenHeight * 0.3, width: context.screenWidth * 0.5, @@ -86,7 +86,7 @@ class _SpaceDetailsDialogState extends State { Widget _buildErrorDialog(String errorMessage) { return AlertDialog( title: widget.title, - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: Center( child: SelectableText( errorMessage, diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_form.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_form.dart index e4007511..a19d92d2 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_form.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_form.dart @@ -31,7 +31,7 @@ class SpaceDetailsForm extends StatelessWidget { builder: (context, space) { return AlertDialog( title: title, - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: SizedBox( height: context.screenHeight * 0.3, width: context.screenWidth * 0.5, diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_icon_selection_dialog.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_icon_selection_dialog.dart index 5fe5b463..a1c4adfa 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_icon_selection_dialog.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_icon_selection_dialog.dart @@ -32,7 +32,7 @@ class SpaceIconSelectionDialog extends StatelessWidget { 'Space Icon', style: context.textTheme.headlineMedium, ), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: Container( width: context.screenWidth * 0.45, height: context.screenHeight * 0.275, diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_chip.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_chip.dart index 6bc9f6d1..16d2ba10 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_chip.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_chip.dart @@ -24,7 +24,7 @@ class SubspaceChip extends StatelessWidget { color: isDuplicate ? ColorsManager.red : ColorsManager.spaceColor, ), ), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), side: BorderSide( diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_name_display_widget.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_name_display_widget.dart index e72bffde..9096db27 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_name_display_widget.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_name_display_widget.dart @@ -81,7 +81,7 @@ class _SubspaceNameDisplayWidgetState extends State { _focusNode.requestFocus(); }, child: Chip( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), side: const BorderSide(color: ColorsManager.transparentColor), diff --git a/lib/pages/space_management_v2/modules/tags/presentation/widgets/add_device_type_widget.dart b/lib/pages/space_management_v2/modules/tags/presentation/widgets/add_device_type_widget.dart index 2c100b15..6f3bab85 100644 --- a/lib/pages/space_management_v2/modules/tags/presentation/widgets/add_device_type_widget.dart +++ b/lib/pages/space_management_v2/modules/tags/presentation/widgets/add_device_type_widget.dart @@ -63,7 +63,7 @@ class _AddDeviceTypeWidgetState extends State { child: Builder( builder: (context) => AlertDialog( title: const SelectableText('Add Devices'), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: BlocBuilder( builder: (context, state) => switch (state) { ProductsInitial() || ProductsLoading() => _buildLoading(context), diff --git a/lib/pages/space_management_v2/modules/tags/presentation/widgets/product_tag_field.dart b/lib/pages/space_management_v2/modules/tags/presentation/widgets/product_tag_field.dart index 30282123..1a4af094 100644 --- a/lib/pages/space_management_v2/modules/tags/presentation/widgets/product_tag_field.dart +++ b/lib/pages/space_management_v2/modules/tags/presentation/widgets/product_tag_field.dart @@ -138,7 +138,7 @@ class _ProductTagFieldState extends State { child: Material( elevation: 4.0, child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, constraints: const BoxConstraints(maxHeight: 200.0), child: ListView.builder( shrinkWrap: true, diff --git a/lib/pages/space_management_v2/modules/tags/presentation/widgets/product_type_card.dart b/lib/pages/space_management_v2/modules/tags/presentation/widgets/product_type_card.dart index c3910aca..12851201 100644 --- a/lib/pages/space_management_v2/modules/tags/presentation/widgets/product_type_card.dart +++ b/lib/pages/space_management_v2/modules/tags/presentation/widgets/product_type_card.dart @@ -23,7 +23,7 @@ class ProductTypeCard extends StatelessWidget { Widget build(BuildContext context) { return Card( elevation: 2, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), diff --git a/lib/pages/space_tree/view/custom_expansion.dart b/lib/pages/space_tree/view/custom_expansion.dart index dab0a49f..cac07aca 100644 --- a/lib/pages/space_tree/view/custom_expansion.dart +++ b/lib/pages/space_tree/view/custom_expansion.dart @@ -43,7 +43,7 @@ class CustomExpansionTileSpaceTree extends StatelessWidget { return ColorsManager.checkBoxFillColor; }), - checkColor: ColorsManager.whiteColors, + checkColor: ColorsManager.white, ), _buildExpansionIcon(), Expanded( diff --git a/lib/pages/space_tree/view/space_tree_view.dart b/lib/pages/space_tree/view/space_tree_view.dart index c60474f8..c5fad9b0 100644 --- a/lib/pages/space_tree/view/space_tree_view.dart +++ b/lib/pages/space_tree/view/space_tree_view.dart @@ -48,17 +48,15 @@ class _SpaceTreeViewState extends State { @override Widget build(BuildContext context) { - return BlocBuilder( - builder: (context, state) { + return BlocBuilder(builder: (context, state) { final communities = state.searchQuery.isNotEmpty ? state.filteredCommunity : state.communityList; return Container( height: MediaQuery.sizeOf(context).height, decoration: widget.isSide == true - ? subSectionContainerDecoration.copyWith( - color: ColorsManager.whiteColors) - : const BoxDecoration(color: ColorsManager.whiteColors), + ? subSectionContainerDecoration.copyWith(color: ColorsManager.white) + : const BoxDecoration(color: ColorsManager.white), child: state is SpaceTreeLoadingState ? const Center(child: CircularProgressIndicator()) : Column( @@ -133,10 +131,9 @@ class _SpaceTreeViewState extends State { ) else CustomSearchBar( - onSearchChanged: (query) => - context.read().add( - SearchQueryEvent(query), - ), + onSearchChanged: (query) => context.read().add( + SearchQueryEvent(query), + ), ), const SizedBox(height: 16), Expanded( @@ -177,8 +174,7 @@ class _SpaceTreeViewState extends State { communities[index].uuid, ), ), - isExpanded: - state.expandedCommunities.contains( + isExpanded: state.expandedCommunities.contains( communities[index].uuid, ), onItemSelected: () { @@ -226,10 +222,9 @@ class _SpaceTreeViewState extends State { ), isSelected: state.selectedSpaces .contains(space.uuid) || - state.soldCheck - .contains(space.uuid), - isSoldCheck: state.soldCheck - .contains(space.uuid), + state.soldCheck.contains(space.uuid), + isSoldCheck: + state.soldCheck.contains(space.uuid), children: _buildNestedSpaces( context, state, @@ -243,8 +238,7 @@ class _SpaceTreeViewState extends State { }, ), ), - if (state.paginationIsLoading) - const CircularProgressIndicator(), + if (state.paginationIsLoading) const CircularProgressIndicator(), ], ), ); diff --git a/lib/pages/spaces_management/add_device_type/views/add_device_type_widget.dart b/lib/pages/spaces_management/add_device_type/views/add_device_type_widget.dart index ede6afb9..bdafb150 100644 --- a/lib/pages/spaces_management/add_device_type/views/add_device_type_widget.dart +++ b/lib/pages/spaces_management/add_device_type/views/add_device_type_widget.dart @@ -6,10 +6,10 @@ import 'package:syncrow_web/pages/spaces_management/add_device_type/bloc/add_dev import 'package:syncrow_web/pages/spaces_management/add_device_type/bloc/add_device_state.dart'; import 'package:syncrow_web/pages/spaces_management/add_device_type/bloc/add_device_type_model_event.dart'; import 'package:syncrow_web/pages/spaces_management/add_device_type/widgets/scrollable_grid_view_widget.dart'; -import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_model.dart'; -import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart'; +import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_model.dart'; +import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart'; import 'package:syncrow_web/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart'; import 'package:syncrow_web/pages/spaces_management/helper/tag_helper.dart'; import 'package:syncrow_web/utils/color_manager.dart'; @@ -24,8 +24,7 @@ class AddDeviceTypeWidget extends StatelessWidget { final String spaceName; final bool isCreate; final Function(List, List?)? onSave; - final List projectTags; - + final List projectTags; const AddDeviceTypeWidget( {super.key, @@ -58,7 +57,7 @@ class AddDeviceTypeWidget extends StatelessWidget { child: Builder( builder: (context) => AlertDialog( title: const Text('Add Devices'), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: BlocBuilder( builder: (context, state) { if (state is AddDeviceLoading) { @@ -75,8 +74,7 @@ class AddDeviceTypeWidget extends StatelessWidget { const SizedBox(height: 16), Expanded( child: Padding( - padding: - const EdgeInsets.symmetric(horizontal: 20.0), + padding: const EdgeInsets.symmetric(horizontal: 20.0), child: ScrollableGridViewWidget( initialProductCounts: state.selectedProducts, products: products, @@ -112,12 +110,11 @@ class AddDeviceTypeWidget extends StatelessWidget { backgroundColor: ColorsManager.secondaryColor, foregroundColor: isDisabled ? ColorsManager.whiteColorsWithOpacity - : ColorsManager.whiteColors, + : ColorsManager.white, onPressed: () async { if (state is AddDeviceLoaded && state.selectedProducts.isNotEmpty) { - final initialTags = - TagHelper.generateInitialForTags( + final initialTags = TagHelper.generateInitialForTags( spaceTags: spaceTags, subspaces: subspaces, ); diff --git a/lib/pages/spaces_management/add_device_type/widgets/device_type_tile_widget.dart b/lib/pages/spaces_management/add_device_type/widgets/device_type_tile_widget.dart index db2d6014..85a8a031 100644 --- a/lib/pages/spaces_management/add_device_type/widgets/device_type_tile_widget.dart +++ b/lib/pages/spaces_management/add_device_type/widgets/device_type_tile_widget.dart @@ -34,7 +34,7 @@ class DeviceTypeTileWidget extends StatelessWidget { return Card( elevation: 2, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), diff --git a/lib/pages/spaces_management/all_spaces/widgets/add_device_type_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/add_device_type_widget.dart index 0e9f4bd1..40708df7 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/add_device_type_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/add_device_type_widget.dart @@ -32,8 +32,9 @@ class _AddDeviceWidgetState extends State { void initState() { super.initState(); _scrollController = ScrollController(); - productCounts = - widget.initialSelectedProducts != null ? List.from(widget.initialSelectedProducts!) : []; + productCounts = widget.initialSelectedProducts != null + ? List.from(widget.initialSelectedProducts!) + : []; } @override @@ -55,7 +56,7 @@ class _AddDeviceWidgetState extends State { return AlertDialog( title: const Text('Add Devices'), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: SingleChildScrollView( child: Container( width: size.width * 0.9, @@ -96,10 +97,12 @@ class _AddDeviceWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - _buildActionButton('Cancel', ColorsManager.boxColor, ColorsManager.blackColor, () { + _buildActionButton( + 'Cancel', ColorsManager.boxColor, ColorsManager.blackColor, () { Navigator.of(context).pop(); }), - _buildActionButton('Continue', ColorsManager.secondaryColor, ColorsManager.whiteColors, () { + _buildActionButton( + 'Continue', ColorsManager.secondaryColor, ColorsManager.white, () { Navigator.of(context).pop(); if (widget.onProductsSelected != null) { widget.onProductsSelected!(productCounts); @@ -114,7 +117,11 @@ class _AddDeviceWidgetState extends State { Widget _buildDeviceTypeTile(ProductModel product, Size size) { final selectedProduct = productCounts.firstWhere( (p) => p.productId == product.uuid, - orElse: () => SelectedProduct(productId: product.uuid, count: 0, productName: product.catName, product: product), + orElse: () => SelectedProduct( + productId: product.uuid, + count: 0, + productName: product.catName, + product: product), ); return SizedBox( @@ -122,7 +129,7 @@ class _AddDeviceWidgetState extends State { height: size.height * 0.15, child: Card( elevation: 2, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), @@ -143,8 +150,11 @@ class _AddDeviceWidgetState extends State { setState(() { if (newCount > 0) { if (!productCounts.contains(selectedProduct)) { - productCounts - .add(SelectedProduct(productId: product.uuid, count: newCount, productName: product.catName, product: product)); + productCounts.add(SelectedProduct( + productId: product.uuid, + count: newCount, + productName: product.catName, + product: product)); } else { selectedProduct.count = newCount; } @@ -192,7 +202,8 @@ class _AddDeviceWidgetState extends State { height: size.width > 800 ? 35 : 25, child: Text( product.name ?? '', - style: context.textTheme.bodySmall?.copyWith(color: ColorsManager.blackColor), + style: + context.textTheme.bodySmall?.copyWith(color: ColorsManager.blackColor), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, diff --git a/lib/pages/spaces_management/all_spaces/widgets/blank_community_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/blank_community_widget.dart index 66f1a026..e2c4b0f8 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/blank_community_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/blank_community_widget.dart @@ -20,8 +20,7 @@ class _BlankCommunityWidgetState extends State { Widget build(BuildContext context) { return Expanded( child: Container( - color: - ColorsManager.whiteColors, // Parent container with white background + color: ColorsManager.white, // Parent container with white background child: GridView.builder( padding: const EdgeInsets.only(left: 40.0, top: 20.0), gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( diff --git a/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart index 6bc35cca..d0b3c5d0 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart @@ -14,7 +14,7 @@ class CommunityStructureHeader extends StatefulWidget { final TextEditingController nameController; final VoidCallback onSave; final VoidCallback onDelete; - final VoidCallback onEdit; + final VoidCallback onEdit; final VoidCallback onDuplicate; final VoidCallback onEditName; @@ -40,8 +40,7 @@ class CommunityStructureHeader extends StatefulWidget { required this.onEdit}); @override - State createState() => - _CommunityStructureHeaderState(); + State createState() => _CommunityStructureHeaderState(); } class _CommunityStructureHeaderState extends State { @@ -53,7 +52,7 @@ class _CommunityStructureHeaderState extends State { return Container( padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, boxShadow: [ BoxShadow( color: ColorsManager.shadowBlackColor, diff --git a/lib/pages/spaces_management/all_spaces/widgets/community_structure_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/community_structure_widget.dart index 4f68fb7e..01cb11a2 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/community_structure_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/community_structure_widget.dart @@ -3,24 +3,23 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; - // Syncrow project imports import 'package:syncrow_web/pages/common/buttons/add_space_button.dart'; import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; import 'package:syncrow_web/pages/common/buttons/default_button.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart'; +import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart'; +import 'package:syncrow_web/pages/spaces_management/all_spaces/model/connection_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart'; -import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart'; -import 'package:syncrow_web/pages/spaces_management/all_spaces/model/connection_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/blank_community_widget.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/community_structure_header_widget.dart'; -import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/curved_line_painter.dart'; +import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/dialogs/duplicate_process_dialog.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/space_card_widget.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/space_container_widget.dart'; @@ -67,8 +66,7 @@ class _CommunityStructureAreaState extends State { void initState() { super.initState(); spaces = widget.spaces.isNotEmpty ? flattenSpaces(widget.spaces) : []; - connections = - widget.spaces.isNotEmpty ? createConnections(widget.spaces) : []; + connections = widget.spaces.isNotEmpty ? createConnections(widget.spaces) : []; _adjustCanvasSizeForSpaces(); _nameController = TextEditingController( text: widget.selectedCommunity?.name ?? '', @@ -129,7 +127,7 @@ class _CommunityStructureAreaState extends State { child: Container( decoration: const BoxDecoration( border: Border( - left: BorderSide(color: ColorsManager.whiteColors, width: 1.0), + left: BorderSide(color: ColorsManager.white, width: 1.0), ), ), child: Column( @@ -201,8 +199,7 @@ class _CommunityStructureAreaState extends State { index: entry.key, onButtonTap: (int index, Offset newPosition) { _showCreateSpaceDialog(screenSize, - position: - spaces[index].position + newPosition, + position: spaces[index].position + newPosition, parentIndex: index, projectTags: widget.projectTags); }, @@ -303,8 +300,7 @@ class _CommunityStructureAreaState extends State { return CreateSpaceDialog( products: widget.products, spaceModels: widget.spaceModels, - allTags: - TagHelper.getAllTagValues(widget.communities, widget.spaceModels), + allTags: TagHelper.getAllTagValues(widget.communities, widget.spaceModels), parentSpace: parentIndex != null ? spaces[parentIndex] : null, projectTags: projectTags, onCreateSpace: (String name, @@ -376,8 +372,8 @@ class _CommunityStructureAreaState extends State { tags: widget.selectedSpace?.tags, subspaces: widget.selectedSpace?.subspaces, isEdit: true, - allTags: TagHelper.getAllTagValues( - widget.communities, widget.spaceModels), + allTags: + TagHelper.getAllTagValues(widget.communities, widget.spaceModels), onCreateSpace: (String name, String icon, List selectedProducts, @@ -557,8 +553,7 @@ class _CommunityStructureAreaState extends State { void _selectSpace(BuildContext context, SpaceModel space) { context.read().add( SelectSpaceEvent( - selectedCommunity: widget.selectedCommunity, - selectedSpace: space), + selectedCommunity: widget.selectedCommunity, selectedSpace: space), ); } @@ -657,7 +652,7 @@ class _CommunityStructureAreaState extends State { context: context, builder: (BuildContext context) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, title: Text( "Duplicate Space", textAlign: TextAlign.center, @@ -717,7 +712,7 @@ class _CommunityStructureAreaState extends State { }, backgroundColor: ColorsManager.secondaryColor, borderRadius: 10, - foregroundColor: ColorsManager.whiteColors, + foregroundColor: ColorsManager.white, child: const Text('OK'), ), ), @@ -735,8 +730,7 @@ class _CommunityStructureAreaState extends State { SpaceModel duplicated = _deepCloneSpaceTree(space, parent: parent); - duplicated.position = - Offset(space.position.dx + 300, space.position.dy + 100); + duplicated.position = Offset(space.position.dx + 300, space.position.dy + 100); List duplicatedSubtree = []; void collectSubtree(SpaceModel node) { duplicatedSubtree.add(node); diff --git a/lib/pages/spaces_management/all_spaces/widgets/create_space_widgets/devices_part_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/create_space_widgets/devices_part_widget.dart index 94896554..531970c4 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/create_space_widgets/devices_part_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/create_space_widgets/devices_part_widget.dart @@ -29,8 +29,7 @@ class DevicesPartWidget extends StatelessWidget { return Column( children: [ (tags?.isNotEmpty == true || - subspaces?.any( - (subspace) => subspace.tags?.isNotEmpty == true) == + subspaces?.any((subspace) => subspace.tags?.isNotEmpty == true) == true) ? SizedBox( width: screenWidth * 0.25, @@ -69,7 +68,7 @@ class DevicesPartWidget extends StatelessWidget { .bodySmall ?.copyWith(color: ColorsManager.spaceColor), ), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), side: const BorderSide( diff --git a/lib/pages/spaces_management/all_spaces/widgets/create_space_widgets/space_model_linking_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/create_space_widgets/space_model_linking_widget.dart index cd9ae470..9660b42e 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/create_space_widgets/space_model_linking_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/create_space_widgets/space_model_linking_widget.dart @@ -37,8 +37,8 @@ class SpaceModelLinkingWidget extends StatelessWidget { ) : Container( width: screenWidth * 0.25, - padding: const EdgeInsets.symmetric( - vertical: 10.0, horizontal: 16.0), + padding: + const EdgeInsets.symmetric(vertical: 10.0, horizontal: 16.0), decoration: BoxDecoration( color: ColorsManager.boxColor, borderRadius: BorderRadius.circular(10), @@ -55,7 +55,7 @@ class SpaceModelLinkingWidget extends StatelessWidget { .bodyMedium! .copyWith(color: ColorsManager.spaceColor), ), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), side: const BorderSide( diff --git a/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart b/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart index 8cf30f7c..c48e062e 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart @@ -9,7 +9,6 @@ import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_mo import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/devices_part_widget.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/icon_choose_part_widget.dart'; -import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/space_model_linking_widget.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/space_name_textfield_widget.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/sub_space_part_widget.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/dialogs/icon_selection_dialog.dart'; @@ -85,8 +84,7 @@ class CreateSpaceDialogState extends State { nameController = TextEditingController(text: widget.name ?? ''); selectedProducts = widget.selectedProducts.isNotEmpty ? widget.selectedProducts : []; - isOkButtonEnabled = - enteredName.isNotEmpty || nameController.text.isNotEmpty; + isOkButtonEnabled = enteredName.isNotEmpty || nameController.text.isNotEmpty; if (widget.currentSpaceModel != null) { subspaces = []; tags = []; @@ -105,10 +103,9 @@ class CreateSpaceDialogState extends State { final screenWidth = MediaQuery.of(context).size.width; return AlertDialog( - title: widget.isEdit - ? const Text('Edit Space') - : const Text('Create New Space'), - backgroundColor: ColorsManager.whiteColors, + title: + widget.isEdit ? const Text('Edit Space') : const Text('Create New Space'), + backgroundColor: ColorsManager.white, content: SizedBox( width: screenWidth * 0.5, child: SingleChildScrollView( @@ -213,8 +210,7 @@ class CreateSpaceDialogState extends State { subspaces, ); }, - isTagsAndSubspaceModelDisabled: - isTagsAndSubspaceModelDisabled, + isTagsAndSubspaceModelDisabled: isTagsAndSubspaceModelDisabled, screenWidth: screenWidth, editChipOnTap: () async { _showSubSpaceDialog( @@ -232,8 +228,7 @@ class CreateSpaceDialogState extends State { tags: tags, subspaces: subspaces, screenWidth: screenWidth, - isTagsAndSubspaceModelDisabled: - isTagsAndSubspaceModelDisabled, + isTagsAndSubspaceModelDisabled: isTagsAndSubspaceModelDisabled, onEditChip: () async { await showDialog( context: context, @@ -298,17 +293,11 @@ class CreateSpaceDialogState extends State { } else if (isNameFieldExist) { return; } else { - String newName = enteredName.isNotEmpty - ? enteredName - : (widget.name ?? ''); + String newName = + enteredName.isNotEmpty ? enteredName : (widget.name ?? ''); if (newName.isNotEmpty) { - widget.onCreateSpace( - newName, - selectedIcon, - selectedProducts, - selectedSpaceModel, - subspaces, - tags); + widget.onCreateSpace(newName, selectedIcon, selectedProducts, + selectedSpaceModel, subspaces, tags); Navigator.of(context).pop(); } } @@ -317,7 +306,7 @@ class CreateSpaceDialogState extends State { backgroundColor: isOkButtonEnabled ? ColorsManager.secondaryColor : ColorsManager.grayColor, - foregroundColor: ColorsManager.whiteColors, + foregroundColor: ColorsManager.white, child: const Text('OK'), ), ), @@ -384,8 +373,7 @@ class CreateSpaceDialogState extends State { final List tagsToAppendToSpace = []; if (slectedSubspaces != null && slectedSubspaces.isNotEmpty) { - final updatedIds = - slectedSubspaces.map((s) => s.internalId).toSet(); + final updatedIds = slectedSubspaces.map((s) => s.internalId).toSet(); if (existingSubSpaces != null) { final deletedSubspaces = existingSubSpaces .where((s) => !updatedIds.contains(s.internalId)) @@ -425,16 +413,16 @@ class CreateSpaceDialogState extends State { ); } - void _showTagCreateDialog(BuildContext context, String name, bool isEdit, - List? products) { + void _showTagCreateDialog( + BuildContext context, String name, bool isEdit, List? products) { isEdit ? showDialog( context: context, builder: (BuildContext context) { return AssignTagDialog( title: 'Edit Device', - addedProducts: TagHelper.createInitialSelectedProductsForTags( - tags, subspaces), + addedProducts: + TagHelper.createInitialSelectedProductsForTags(tags, subspaces), spaceName: name, products: products, subspaces: subspaces, @@ -474,8 +462,7 @@ class CreateSpaceDialogState extends State { allTags: widget.allTags, projectTags: widget.projectTags, initialSelectedProducts: - TagHelper.createInitialSelectedProductsForTags( - tags, subspaces), + TagHelper.createInitialSelectedProductsForTags(tags, subspaces), onSave: (selectedSpaceTags, selectedSubspaces) { setState(() { tags = selectedSpaceTags; diff --git a/lib/pages/spaces_management/all_spaces/widgets/dialogs/delete_dialogue.dart b/lib/pages/spaces_management/all_spaces/widgets/dialogs/delete_dialogue.dart index 27275be1..ec6684f6 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/dialogs/delete_dialogue.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/dialogs/delete_dialogue.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; import 'package:syncrow_web/utils/color_manager.dart'; -void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm, bool isSpace) { +void showDeleteConfirmationDialog( + BuildContext context, VoidCallback onConfirm, bool isSpace) { final String title = isSpace ? 'Delete Space' : 'Delete Community'; final String subtitle = isSpace ? 'All the data in the space will be lost' @@ -17,7 +18,7 @@ void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm, child: SizedBox( width: 500, child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, padding: const EdgeInsets.all(20.0), child: Column( mainAxisSize: MainAxisSize.min, @@ -41,7 +42,8 @@ void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm, showProcessingPopup(context, isSpace, onConfirm); }, style: _dialogButtonStyle(ColorsManager.spaceColor), - child: const Text('Continue', style: TextStyle(color: ColorsManager.whiteColors)), + child: const Text('Continue', + style: TextStyle(color: ColorsManager.white)), ), ], ), @@ -66,7 +68,7 @@ void showProcessingPopup(BuildContext context, bool isSpace, VoidCallback onDele child: SizedBox( width: 500, child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, padding: const EdgeInsets.all(20.0), child: Column( mainAxisSize: MainAxisSize.min, @@ -83,7 +85,8 @@ void showProcessingPopup(BuildContext context, bool isSpace, VoidCallback onDele ElevatedButton( onPressed: onDelete, style: _dialogButtonStyle(ColorsManager.warningRed), - child: const Text('Delete', style: TextStyle(color: ColorsManager.whiteColors)), + child: const Text('Delete', + style: TextStyle(color: ColorsManager.white)), ), CancelButton( label: 'Cancel', @@ -108,7 +111,7 @@ Widget _buildWarningIcon() { color: ColorsManager.warningRed, shape: BoxShape.circle, ), - child: const Icon(Icons.close, color: ColorsManager.whiteColors, size: 40), + child: const Icon(Icons.close, color: ColorsManager.white, size: 40), ); } @@ -123,7 +126,10 @@ Widget _buildDialogSubtitle(BuildContext context, String subtitle) { return Text( subtitle, textAlign: TextAlign.center, - style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: ColorsManager.grayColor), + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith(color: ColorsManager.grayColor), ); } diff --git a/lib/pages/spaces_management/all_spaces/widgets/dialogs/icon_selection_dialog.dart b/lib/pages/spaces_management/all_spaces/widgets/dialogs/icon_selection_dialog.dart index b2a01988..02c9cdc8 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/dialogs/icon_selection_dialog.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/dialogs/icon_selection_dialog.dart @@ -21,10 +21,10 @@ class IconSelectionDialog extends StatelessWidget { elevation: 0, backgroundColor: ColorsManager.transparentColor, child: Container( - width: screenWidth * 0.44, + width: screenWidth * 0.44, height: screenHeight * 0.45, decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( @@ -35,8 +35,9 @@ class IconSelectionDialog extends StatelessWidget { ], ), child: AlertDialog( - title: Text('Space Icon',style: Theme.of(context).textTheme.headlineMedium), - backgroundColor: ColorsManager.whiteColors, + title: + Text('Space Icon', style: Theme.of(context).textTheme.headlineMedium), + backgroundColor: ColorsManager.white, content: Container( width: screenWidth * 0.4, height: screenHeight * 0.45, diff --git a/lib/pages/spaces_management/all_spaces/widgets/hoverable_button.dart b/lib/pages/spaces_management/all_spaces/widgets/hoverable_button.dart index 49a863b6..256f0019 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/hoverable_button.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/hoverable_button.dart @@ -36,7 +36,7 @@ class _HoverableButtonState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 8), decoration: BoxDecoration( - color: isHovered ? ColorsManager.warningRed : ColorsManager.whiteColors, + color: isHovered ? ColorsManager.warningRed : ColorsManager.white, borderRadius: BorderRadius.circular(16), boxShadow: [ if (isHovered) @@ -65,7 +65,7 @@ class _HoverableButtonState extends State { return isHovered ? const Icon( Icons.close, - color: ColorsManager.whiteColors, + color: ColorsManager.white, size: 24, ) : SvgPicture.asset( diff --git a/lib/pages/spaces_management/all_spaces/widgets/plus_button_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/plus_button_widget.dart index 6c5babaf..b2947d7c 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/plus_button_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/plus_button_widget.dart @@ -30,7 +30,7 @@ class PlusButtonWidget extends StatelessWidget { ), child: const Icon( Icons.add, - color: ColorsManager.whiteColors, + color: ColorsManager.white, size: 20, ), ), diff --git a/lib/pages/spaces_management/all_spaces/widgets/selected_products_button_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/selected_products_button_widget.dart index 7076a580..a5c2a25d 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/selected_products_button_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/selected_products_button_widget.dart @@ -68,7 +68,7 @@ class SelectedProductsButtons extends StatelessWidget { child: Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(16), ), child: const Icon( diff --git a/lib/pages/spaces_management/all_spaces/widgets/space_container_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/space_container_widget.dart index 6f52eb50..24ba0474 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/space_container_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/space_container_widget.dart @@ -64,7 +64,7 @@ class SpaceContainerWidget extends StatelessWidget { child: Center( child: SvgPicture.asset( icon, - color: ColorsManager.whiteColors, + color: ColorsManager.white, width: 24, height: 24, ), @@ -74,7 +74,7 @@ class SpaceContainerWidget extends StatelessWidget { BoxDecoration _containerDecoration() { return BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(15), boxShadow: [ BoxShadow( diff --git a/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart index 62d8197c..51087c51 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart @@ -23,7 +23,7 @@ class SpaceWidget extends StatelessWidget { child: Container( padding: const EdgeInsets.all(8.0), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(8), boxShadow: [ BoxShadow( diff --git a/lib/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart b/lib/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart index 21ba141c..e0304eba 100644 --- a/lib/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart +++ b/lib/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart @@ -60,7 +60,7 @@ class AssignTagDialog extends StatelessWidget { return AlertDialog( title: Text(title), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: SingleChildScrollView( child: Column( children: [ diff --git a/lib/pages/spaces_management/assign_tag/views/widgets/save_add_device_row_widget.dart b/lib/pages/spaces_management/assign_tag/views/widgets/save_add_device_row_widget.dart index a81b7ad0..8b96f0b9 100644 --- a/lib/pages/spaces_management/assign_tag/views/widgets/save_add_device_row_widget.dart +++ b/lib/pages/spaces_management/assign_tag/views/widgets/save_add_device_row_widget.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; +import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; +import 'package:syncrow_web/pages/common/buttons/default_button.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart'; -import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; -import 'package:syncrow_web/pages/common/buttons/default_button.dart'; import 'package:syncrow_web/utils/color_manager.dart'; import '../../../add_device_type/views/add_device_type_widget.dart'; @@ -44,8 +44,8 @@ class SaveAddDeviceRowWidget extends StatelessWidget { final result = TagHelper.processTags(updatedTags, subspaces); final processedTags = result['updatedTags'] as List; - final processedSubspaces = List.from( - result['subspaces'] as List); + final processedSubspaces = + List.from(result['subspaces'] as List); Navigator.of(context).pop(); @@ -75,13 +75,12 @@ class SaveAddDeviceRowWidget extends StatelessWidget { borderRadius: 10, backgroundColor: ColorsManager.secondaryColor, foregroundColor: isSaveEnabled - ? ColorsManager.whiteColors + ? ColorsManager.white : ColorsManager.whiteColorsWithOpacity, onPressed: isSaveEnabled ? () async { final updatedTags = List.from(tags); - final result = - TagHelper.processTags(updatedTags, subspaces); + final result = TagHelper.processTags(updatedTags, subspaces); final processedTags = result['updatedTags'] as List; final processedSubspaces = List.from( diff --git a/lib/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart b/lib/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart index 57ed93df..052eb1d5 100644 --- a/lib/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart +++ b/lib/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart @@ -71,7 +71,7 @@ class AssignTagModelsDialog extends StatelessWidget { return AlertDialog( title: Text(title), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: SingleChildScrollView( child: Column( children: [ @@ -81,16 +81,13 @@ class AssignTagModelsDialog extends StatelessWidget { tags: state.tags, updatedTags: state.updatedTags, onDeleteDevice: ({required index, required tag}) { - context - .read() - .add(DeleteTagModel( + context.read().add(DeleteTagModel( tagToDelete: tag, tags: state.tags, )); controllers.removeAt(index); }, - onTagDropDownSelected: ( - {required index, required tag}) { + onTagDropDownSelected: ({required index, required tag}) { context.read().add( UpdateTag( index: index, diff --git a/lib/pages/spaces_management/assign_tag_models/views/widgets/RowOfCancelSaveWidget.dart b/lib/pages/spaces_management/assign_tag_models/views/widgets/RowOfCancelSaveWidget.dart index 9b2a1367..989e955c 100644 --- a/lib/pages/spaces_management/assign_tag_models/views/widgets/RowOfCancelSaveWidget.dart +++ b/lib/pages/spaces_management/assign_tag_models/views/widgets/RowOfCancelSaveWidget.dart @@ -53,13 +53,12 @@ class RowOfSaveCancelWidget extends StatelessWidget { label: 'Add New Device', onPressed: () async { final updatedTags = List.from(state.tags); - final result = TagHelper.updateSubspaceTagModels( - updatedTags, subspaces); + final result = + TagHelper.updateSubspaceTagModels(updatedTags, subspaces); final processedTags = result['updatedTags'] as List; - final processedSubspaces = - List.from( - result['subspaces'] as List); + final processedSubspaces = List.from( + result['subspaces'] as List); if (context.mounted) { Navigator.of(context).pop(); @@ -98,7 +97,7 @@ class RowOfSaveCancelWidget extends StatelessWidget { borderRadius: 10, backgroundColor: ColorsManager.secondaryColor, foregroundColor: state.isSaveEnabled - ? ColorsManager.whiteColors + ? ColorsManager.white : ColorsManager.whiteColorsWithOpacity, onPressed: state.isSaveEnabled ? () async { @@ -107,14 +106,12 @@ class RowOfSaveCancelWidget extends StatelessWidget { final result = TagHelper.updateSubspaceTagModels( updatedTags, subspaces); - final processedTags = - result['updatedTags'] as List; + final processedTags = result['updatedTags'] as List; final processedSubspaces = List.from( result['subspaces'] as List); - Navigator.of(context) - .popUntil((route) => route.isFirst); + Navigator.of(context).popUntil((route) => route.isFirst); await showDialog( context: context, diff --git a/lib/pages/spaces_management/create_community/view/create_community_dialog.dart b/lib/pages/spaces_management/create_community/view/create_community_dialog.dart index 13e676b5..9b061243 100644 --- a/lib/pages/spaces_management/create_community/view/create_community_dialog.dart +++ b/lib/pages/spaces_management/create_community/view/create_community_dialog.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; +import 'package:syncrow_web/pages/common/buttons/default_button.dart'; import 'package:syncrow_web/pages/spaces_management/create_community/bloc/community_dialog_bloc.dart'; import 'package:syncrow_web/pages/spaces_management/create_community/bloc/community_dialog_event.dart'; import 'package:syncrow_web/pages/spaces_management/create_community/bloc/community_dialog_state.dart'; import 'package:syncrow_web/utils/color_manager.dart'; -import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; -import 'package:syncrow_web/pages/common/buttons/default_button.dart'; class CreateCommunityDialog extends StatelessWidget { final Function(String name, String description) onCreateCommunity; @@ -39,7 +39,7 @@ class CreateCommunityDialog extends StatelessWidget { width: MediaQuery.of(context).size.width * 0.3, padding: const EdgeInsets.all(20), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( @@ -148,7 +148,7 @@ class CreateCommunityDialog extends StatelessWidget { ? ColorsManager.secondaryColor : ColorsManager.lightGrayColor, borderRadius: 10, - foregroundColor: ColorsManager.whiteColors, + foregroundColor: ColorsManager.white, child: const Text('OK'), ), ), diff --git a/lib/pages/spaces_management/create_subspace/views/create_subspace_model_dialog.dart b/lib/pages/spaces_management/create_subspace/views/create_subspace_model_dialog.dart index 82df866a..18ff34ed 100644 --- a/lib/pages/spaces_management/create_subspace/views/create_subspace_model_dialog.dart +++ b/lib/pages/spaces_management/create_subspace/views/create_subspace_model_dialog.dart @@ -60,7 +60,7 @@ class _CreateSubSpaceDialogState extends State { builder: (context, state) { return Container( width: context.screenWidth * 0.35, - color: ColorsManager.whiteColors, + color: ColorsManager.white, padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/spaces_management/create_subspace/views/widgets/ok_cancel_sub_space_widget.dart b/lib/pages/spaces_management/create_subspace/views/widgets/ok_cancel_sub_space_widget.dart index 3952e105..9813d22e 100644 --- a/lib/pages/spaces_management/create_subspace/views/widgets/ok_cancel_sub_space_widget.dart +++ b/lib/pages/spaces_management/create_subspace/views/widgets/ok_cancel_sub_space_widget.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_model.dart'; -import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; import 'package:syncrow_web/pages/common/buttons/default_button.dart'; +import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_model.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; import '../../bloc/subspace_bloc.dart'; import '../../bloc/subspace_event.dart'; @@ -65,7 +65,7 @@ class OkCancelSubSpaceWidget extends StatelessWidget { borderRadius: 10, foregroundColor: errorMessage.isNotEmpty ? ColorsManager.whiteColorsWithOpacity - : ColorsManager.whiteColors, + : ColorsManager.white, child: const Text('OK'), ), ), diff --git a/lib/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart b/lib/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart index 66acdf3d..8b8009f3 100644 --- a/lib/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart +++ b/lib/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart @@ -43,7 +43,7 @@ class CreateSubSpaceModelDialog extends StatelessWidget { }, child: BlocBuilder( builder: (context, state) => Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, width: screenWidth * 0.3, padding: const EdgeInsets.all(16), child: Column( diff --git a/lib/pages/spaces_management/create_subspace_model/widgets/create_subspace_model_footer_buttons.dart b/lib/pages/spaces_management/create_subspace_model/widgets/create_subspace_model_footer_buttons.dart index a8dcf89c..c687331f 100644 --- a/lib/pages/spaces_management/create_subspace_model/widgets/create_subspace_model_footer_buttons.dart +++ b/lib/pages/spaces_management/create_subspace_model/widgets/create_subspace_model_footer_buttons.dart @@ -43,7 +43,7 @@ class CreateSubspaceModelFooterButtons extends StatelessWidget { borderRadius: 10, foregroundColor: errorMessage.isNotEmpty ? ColorsManager.whiteColorsWithOpacity - : ColorsManager.whiteColors, + : ColorsManager.white, child: const Text('OK'), ), ), diff --git a/lib/pages/spaces_management/create_subspace_model/widgets/subspace_chip.dart b/lib/pages/spaces_management/create_subspace_model/widgets/subspace_chip.dart index 098b4804..a25866e2 100644 --- a/lib/pages/spaces_management/create_subspace_model/widgets/subspace_chip.dart +++ b/lib/pages/spaces_management/create_subspace_model/widgets/subspace_chip.dart @@ -24,7 +24,7 @@ class SubspaceChip extends StatelessWidget { color: isDuplicate ? ColorsManager.red : ColorsManager.spaceColor, ), ), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), side: BorderSide( diff --git a/lib/pages/spaces_management/link_space_model/view/link_space_model_dialog.dart b/lib/pages/spaces_management/link_space_model/view/link_space_model_dialog.dart index bbd0de36..31fad507 100644 --- a/lib/pages/spaces_management/link_space_model/view/link_space_model_dialog.dart +++ b/lib/pages/spaces_management/link_space_model/view/link_space_model_dialog.dart @@ -32,7 +32,7 @@ class LinkSpaceModelDialog extends StatelessWidget { builder: (context) { final bloc = context.read(); return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, title: const Text('Link a space model'), content: spaceModels.isNotEmpty ? Container( @@ -72,7 +72,9 @@ class LinkSpaceModelDialog extends StatelessWidget { ), borderRadius: BorderRadius.circular(8.0), ), - child: SpaceModelCardWidget(model: model,), + child: SpaceModelCardWidget( + model: model, + ), ), ); }, diff --git a/lib/pages/spaces_management/space_model/view/space_model_page.dart b/lib/pages/spaces_management/space_model/view/space_model_page.dart index eef196be..acd95137 100644 --- a/lib/pages/spaces_management/space_model/view/space_model_page.dart +++ b/lib/pages/spaces_management/space_model/view/space_model_page.dart @@ -18,7 +18,10 @@ class SpaceModelPage extends StatelessWidget { final List projectTags; const SpaceModelPage( - {Key? key, this.products, this.onSpaceModelsUpdated, required this.projectTags}) + {Key? key, + this.products, + this.onSpaceModelsUpdated, + required this.projectTags}) : super(key: key); @override @@ -39,7 +42,7 @@ class SpaceModelPage extends StatelessWidget { } return Scaffold( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, body: Padding( padding: const EdgeInsets.fromLTRB(20.0, 16.0, 16.0, 16.0), child: Column( @@ -115,8 +118,10 @@ class SpaceModelPage extends StatelessWidget { return Center( child: Text( 'Error: ${state.message}', - style: - Theme.of(context).textTheme.bodySmall?.copyWith(color: ColorsManager.warningRed), + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith(color: ColorsManager.warningRed), ), ); } diff --git a/lib/pages/spaces_management/space_model/widgets/add_space_model_widget.dart b/lib/pages/spaces_management/space_model/widgets/add_space_model_widget.dart index 20876a39..e7204f81 100644 --- a/lib/pages/spaces_management/space_model/widgets/add_space_model_widget.dart +++ b/lib/pages/spaces_management/space_model/widgets/add_space_model_widget.dart @@ -9,7 +9,7 @@ class AddSpaceModelWidget extends StatelessWidget { return Container( margin: const EdgeInsets.all(8.0), decoration: BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: BorderRadius.circular(20), boxShadow: const [ BoxShadow( diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/confirm_merge_dialog.dart b/lib/pages/spaces_management/space_model/widgets/dialog/confirm_merge_dialog.dart index 2a39d67b..ca0cbdb5 100644 --- a/lib/pages/spaces_management/space_model/widgets/dialog/confirm_merge_dialog.dart +++ b/lib/pages/spaces_management/space_model/widgets/dialog/confirm_merge_dialog.dart @@ -7,7 +7,7 @@ class ConfirmMergeDialog extends StatelessWidget { @override Widget build(BuildContext context) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, title: Center( child: Text( 'Merge', @@ -70,7 +70,7 @@ class ConfirmMergeDialog extends StatelessWidget { style: Theme.of(context).textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w400, fontSize: 16, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), ), diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/confirm_overwrite_dialog.dart b/lib/pages/spaces_management/space_model/widgets/dialog/confirm_overwrite_dialog.dart index 0497b570..e51fba45 100644 --- a/lib/pages/spaces_management/space_model/widgets/dialog/confirm_overwrite_dialog.dart +++ b/lib/pages/spaces_management/space_model/widgets/dialog/confirm_overwrite_dialog.dart @@ -8,7 +8,7 @@ class ConfirmOverwriteDialog extends StatelessWidget { @override Widget build(BuildContext context) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, title: Center( child: Text( 'Overwrite', @@ -90,7 +90,7 @@ class ConfirmOverwriteDialog extends StatelessWidget { style: Theme.of(context).textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w400, fontSize: 16, - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), ), diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart b/lib/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart index 70dde231..4b72cbe6 100644 --- a/lib/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart +++ b/lib/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart @@ -9,13 +9,12 @@ import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/bloc/create_space_model_bloc.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/bloc/create_space_model_event.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/bloc/create_space_model_state.dart'; -import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_state.dart'; -import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; -import 'package:syncrow_web/pages/spaces_management/space_model/widgets/tag_chips_display_widget.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_bloc.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_event.dart'; - +import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model_state.dart'; +import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/widgets/subspace_model_create_widget.dart'; +import 'package:syncrow_web/pages/spaces_management/space_model/widgets/tag_chips_display_widget.dart'; import 'package:syncrow_web/services/space_model_mang_api.dart'; import 'package:syncrow_web/utils/color_manager.dart'; @@ -50,7 +49,7 @@ class CreateSpaceModelDialog extends StatelessWidget { return AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: SizedBox( width: screenWidth * 0.3, child: BlocProvider( @@ -71,7 +70,8 @@ class CreateSpaceModelDialog extends StatelessWidget { spaceNameController.addListener(() { bloc.add(UpdateSpaceTemplateName( - name: spaceNameController.text, allModels: otherSpaceModels ?? [])); + name: spaceNameController.text, + allModels: otherSpaceModels ?? [])); }); return bloc; @@ -89,7 +89,9 @@ class CreateSpaceModelDialog extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text( - spaceModel?.uuid == null ? 'Create New Space Model' : 'Edit Space Model', + spaceModel?.uuid == null + ? 'Create New Space Model' + : 'Edit Space Model', style: Theme.of(context) .textTheme .headlineLarge @@ -101,8 +103,9 @@ class CreateSpaceModelDialog extends StatelessWidget { child: TextField( controller: spaceNameController, onChanged: (value) { - context.read().add(UpdateSpaceTemplateName( - name: value, allModels: otherSpaceModels ?? [])); + context.read().add( + UpdateSpaceTemplateName( + name: value, allModels: otherSpaceModels ?? [])); }, style: Theme.of(context) .textTheme @@ -176,7 +179,8 @@ class CreateSpaceModelDialog extends StatelessWidget { !isNameValid) ? null : () { - final updatedSpaceTemplate = updatedSpaceModel.copyWith( + final updatedSpaceTemplate = + updatedSpaceModel.copyWith( modelName: spaceNameController.text.trim(), ); if (updatedSpaceModel.uuid == null) { @@ -185,44 +189,62 @@ class CreateSpaceModelDialog extends StatelessWidget { spaceTemplate: updatedSpaceTemplate, onCreate: (newModel) { if (pageContext != null) { - pageContext!.read().add( - CreateSpaceModel(newSpaceModel: newModel)); + pageContext! + .read() + .add(CreateSpaceModel( + newSpaceModel: + newModel)); pageContext! .read() - .add(UpdateSpaceModelCache(newModel)); + .add(UpdateSpaceModelCache( + newModel)); } - Navigator.of(context).pop(); // Close the dialog + Navigator.of(context) + .pop(); // Close the dialog }, ), ); } else { if (pageContext != null) { - final currentState = - pageContext!.read().state; + final currentState = pageContext! + .read() + .state; if (currentState is SpaceModelLoaded) { - final spaceModels = List.from( - currentState.spaceModels); + final spaceModels = + List.from( + currentState.spaceModels); - final SpaceTemplateModel? currentSpaceModel = - spaceModels.cast().firstWhere( - (sm) => sm?.uuid == updatedSpaceModel.uuid, + final SpaceTemplateModel? + currentSpaceModel = spaceModels + .cast() + .firstWhere( + (sm) => + sm?.uuid == + updatedSpaceModel.uuid, orElse: () => null, ); if (currentSpaceModel != null) { context .read() .add(ModifySpaceTemplate( - spaceTemplate: currentSpaceModel, - updatedSpaceTemplate: updatedSpaceTemplate, + spaceTemplate: + currentSpaceModel, + updatedSpaceTemplate: + updatedSpaceTemplate, onUpdate: (newModel) { if (pageContext != null) { - pageContext!.read().add( - UpdateSpaceModel( - spaceModelUuid: - newModel.uuid ?? '')); pageContext! - .read() - .add(UpdateSpaceModelCache(newModel)); + .read() + .add(UpdateSpaceModel( + spaceModelUuid: + newModel.uuid ?? + '')); + pageContext! + .read< + SpaceManagementBloc>() + .add( + UpdateSpaceModelCache( + newModel)); } Navigator.of(context).pop(); })); @@ -233,11 +255,11 @@ class CreateSpaceModelDialog extends StatelessWidget { }, backgroundColor: ColorsManager.secondaryColor, borderRadius: 10, - foregroundColor: - ((state.errorMessage != null && state.errorMessage != '') || - !isNameValid) - ? ColorsManager.whiteColorsWithOpacity - : ColorsManager.whiteColors, + foregroundColor: ((state.errorMessage != null && + state.errorMessage != '') || + !isNameValid) + ? ColorsManager.whiteColorsWithOpacity + : ColorsManager.white, child: const Text('OK'), ), ), diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/delete_space_model_dialog.dart b/lib/pages/spaces_management/space_model/widgets/dialog/delete_space_model_dialog.dart index 8349baa4..4914fced 100644 --- a/lib/pages/spaces_management/space_model/widgets/dialog/delete_space_model_dialog.dart +++ b/lib/pages/spaces_management/space_model/widgets/dialog/delete_space_model_dialog.dart @@ -17,7 +17,7 @@ class DeleteSpaceModelDialog extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(20), ), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, title: Center( child: Text( "Delete Space Model", @@ -73,7 +73,7 @@ class DeleteSpaceModelDialog extends StatelessWidget { }, backgroundColor: ColorsManager.semiTransparentRed, borderRadius: 10, - foregroundColor: ColorsManager.whiteColors, + foregroundColor: ColorsManager.white, child: const Text('Delete'), ), ), diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/link_space_model_spaces_dialog.dart b/lib/pages/spaces_management/space_model/widgets/dialog/link_space_model_spaces_dialog.dart index 4da0c642..afdf3dd8 100644 --- a/lib/pages/spaces_management/space_model/widgets/dialog/link_space_model_spaces_dialog.dart +++ b/lib/pages/spaces_management/space_model/widgets/dialog/link_space_model_spaces_dialog.dart @@ -17,8 +17,7 @@ class LinkSpaceModelSpacesDialog extends StatefulWidget { _LinkSpaceModelSpacesDialogState(); } -class _LinkSpaceModelSpacesDialogState - extends State { +class _LinkSpaceModelSpacesDialogState extends State { @override void initState() { context.read().add(LinkSpaceModelSelectedIdsEvent()); @@ -89,8 +88,7 @@ class _LinkSpaceModelSpacesDialogState const Expanded( child: Text( "Creation date and time:", - style: const TextStyle( - fontWeight: FontWeight.bold), + style: const TextStyle(fontWeight: FontWeight.bold), ), ), const SizedBox(width: 8), @@ -125,14 +123,12 @@ class _LinkSpaceModelSpacesDialogState Expanded( flex: 7, child: Container( - color: ColorsManager.whiteColors, + color: ColorsManager.white, child: SpaceTreeView( isSide: true, onSelect: () { - context - .read() - .add( - LinkSpaceModelSelectedIdsEvent()); + context.read().add( + LinkSpaceModelSelectedIdsEvent()); }))) ], ), @@ -228,8 +224,7 @@ Widget _buildDetailRow(String label, String value) { Expanded( child: Text( value, - style: const TextStyle( - fontWeight: FontWeight.bold, color: Colors.black), + style: const TextStyle(fontWeight: FontWeight.bold, color: Colors.black), ), ), ], @@ -243,8 +238,7 @@ Widget _buildButton(String text, Color color, VoidCallback onPressed) { child: Center( child: Text( text, - style: - TextStyle(color: color, fontWeight: FontWeight.w400, fontSize: 14), + style: TextStyle(color: color, fontWeight: FontWeight.w400, fontSize: 14), ), ), ); diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/linking_attention_dialog.dart b/lib/pages/spaces_management/space_model/widgets/dialog/linking_attention_dialog.dart index 15d92029..770e5c18 100644 --- a/lib/pages/spaces_management/space_model/widgets/dialog/linking_attention_dialog.dart +++ b/lib/pages/spaces_management/space_model/widgets/dialog/linking_attention_dialog.dart @@ -9,7 +9,7 @@ class LinkingAttentionDialog extends StatelessWidget { @override Widget build(BuildContext context) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, title: Center( child: Text( 'Linking Attention', diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/linking_successful.dart b/lib/pages/spaces_management/space_model/widgets/dialog/linking_successful.dart index 6a228fc1..bbf8b5eb 100644 --- a/lib/pages/spaces_management/space_model/widgets/dialog/linking_successful.dart +++ b/lib/pages/spaces_management/space_model/widgets/dialog/linking_successful.dart @@ -9,7 +9,7 @@ class LinkingSuccessful extends StatelessWidget { @override Widget build(BuildContext context) { return AlertDialog( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, title: Center( child: SvgPicture.asset( Assets.successIcon, diff --git a/lib/pages/spaces_management/space_model/widgets/subspace_name_label_widget.dart b/lib/pages/spaces_management/space_model/widgets/subspace_name_label_widget.dart index 6a6aec44..fae6aaca 100644 --- a/lib/pages/spaces_management/space_model/widgets/subspace_name_label_widget.dart +++ b/lib/pages/spaces_management/space_model/widgets/subspace_name_label_widget.dart @@ -15,7 +15,7 @@ class SubspaceNameDisplayWidget extends StatefulWidget { Key? key, required this.text, this.textStyle, - this.backgroundColor = ColorsManager.whiteColors, + this.backgroundColor = ColorsManager.white, this.borderColor = ColorsManager.transparentColor, this.padding = const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0), this.borderRadius = const BorderRadius.all(Radius.circular(10)), @@ -24,8 +24,7 @@ class SubspaceNameDisplayWidget extends StatefulWidget { }) : super(key: key); @override - _SubspaceNameDisplayWidgetState createState() => - _SubspaceNameDisplayWidgetState(); + _SubspaceNameDisplayWidgetState createState() => _SubspaceNameDisplayWidgetState(); } class _SubspaceNameDisplayWidgetState extends State { diff --git a/lib/pages/spaces_management/space_model/widgets/tag_chips_display_widget.dart b/lib/pages/spaces_management/space_model/widgets/tag_chips_display_widget.dart index 86f99e02..63aeac14 100644 --- a/lib/pages/spaces_management/space_model/widgets/tag_chips_display_widget.dart +++ b/lib/pages/spaces_management/space_model/widgets/tag_chips_display_widget.dart @@ -111,7 +111,7 @@ class TagChipDisplay extends StatelessWidget { MapEntry entry, ) { return Chip( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), side: const BorderSide( diff --git a/lib/pages/spaces_management/tag_model/views/add_device_type_model_widget.dart b/lib/pages/spaces_management/tag_model/views/add_device_type_model_widget.dart index c0226ba8..d4f4706f 100644 --- a/lib/pages/spaces_management/tag_model/views/add_device_type_model_widget.dart +++ b/lib/pages/spaces_management/tag_model/views/add_device_type_model_widget.dart @@ -2,10 +2,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; import 'package:syncrow_web/pages/common/buttons/default_button.dart'; -import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart'; -import 'package:syncrow_web/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart'; +import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart'; +import 'package:syncrow_web/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart'; import 'package:syncrow_web/pages/spaces_management/helper/tag_helper.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart'; @@ -63,7 +63,7 @@ class AddDeviceTypeModelWidget extends StatelessWidget { child: Builder( builder: (context) => AlertDialog( title: const Text('Add Devices'), - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, content: BlocBuilder( builder: (context, state) { if (state is AddDeviceModelLoading) { @@ -154,14 +154,14 @@ class AddDeviceTypeModelWidget extends StatelessWidget { width: 140, child: BlocBuilder( builder: (context, state) { - final isDisabled = - state is AddDeviceModelLoaded && state.selectedProducts.isEmpty; + final isDisabled = state is AddDeviceModelLoaded && + state.selectedProducts.isEmpty; return DefaultButton( backgroundColor: ColorsManager.secondaryColor, foregroundColor: isDisabled ? ColorsManager.whiteColorsWithOpacity - : ColorsManager.whiteColors, + : ColorsManager.white, borderRadius: 10, onPressed: isDisabled ? null // Disable the button @@ -173,8 +173,9 @@ class AddDeviceTypeModelWidget extends StatelessWidget { subspaces: subspaces, ); - final dialogTitle = - initialTags.isNotEmpty ? 'Edit Device' : 'Assign Tags'; + final dialogTitle = initialTags.isNotEmpty + ? 'Edit Device' + : 'Assign Tags'; Navigator.of(context).pop(); await showDialog( context: context, diff --git a/lib/pages/spaces_management/tag_model/widgets/device_type_tile_widget.dart b/lib/pages/spaces_management/tag_model/widgets/device_type_tile_widget.dart index 3d645d7c..8a37da53 100644 --- a/lib/pages/spaces_management/tag_model/widgets/device_type_tile_widget.dart +++ b/lib/pages/spaces_management/tag_model/widgets/device_type_tile_widget.dart @@ -34,7 +34,7 @@ class DeviceTypeTileWidget extends StatelessWidget { return Card( elevation: 2, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), diff --git a/lib/pages/visitor_password/view/add_device_dialog.dart b/lib/pages/visitor_password/view/add_device_dialog.dart index d69aa21d..f9380177 100644 --- a/lib/pages/visitor_password/view/add_device_dialog.dart +++ b/lib/pages/visitor_password/view/add_device_dialog.dart @@ -2,15 +2,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:syncrow_web/pages/common/access_device_table.dart'; -import 'package:syncrow_web/pages/common/bloc/project_manager.dart'; -import 'package:syncrow_web/pages/common/text_field/custom_web_textfield.dart'; import 'package:syncrow_web/pages/common/buttons/default_button.dart'; +import 'package:syncrow_web/pages/common/text_field/custom_web_textfield.dart'; import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart'; import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_event.dart'; import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_state.dart'; import 'package:syncrow_web/utils/color_manager.dart'; -import 'package:syncrow_web/utils/constants/assets.dart'; import 'package:syncrow_web/utils/constants/app_enum.dart'; +import 'package:syncrow_web/utils/constants/assets.dart'; import 'package:syncrow_web/utils/style.dart'; class AddDeviceDialog extends StatelessWidget { @@ -20,8 +19,7 @@ class AddDeviceDialog extends StatelessWidget { Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return BlocProvider( - create: (context) => - VisitorPasswordBloc()..add(FetchDevice()), + create: (context) => VisitorPasswordBloc()..add(FetchDevice()), child: BlocBuilder( builder: (BuildContext context, VisitorPasswordState state) { final visitorBloc = BlocProvider.of(context); @@ -38,9 +36,7 @@ class AddDeviceDialog extends StatelessWidget { title: Text( 'Add Accessible Device', style: Theme.of(context).textTheme.headlineLarge!.copyWith( - fontWeight: FontWeight.w400, - fontSize: 24, - color: Colors.black), + fontWeight: FontWeight.w400, fontSize: 24, color: Colors.black), ), content: SizedBox( height: MediaQuery.of(context).size.height / 1.7, @@ -70,13 +66,10 @@ class AddDeviceDialog extends StatelessWidget { ), Text( 'Only online accessible devices can be added', - style: Theme.of(context) - .textTheme - .bodySmall! - .copyWith( - fontWeight: FontWeight.w400, - fontSize: 12, - color: ColorsManager.grayColor), + style: Theme.of(context).textTheme.bodySmall!.copyWith( + fontWeight: FontWeight.w400, + fontSize: 12, + color: ColorsManager.grayColor), ), ], )), @@ -144,7 +137,7 @@ class AddDeviceDialog extends StatelessWidget { child: Container( width: size.width * 0.06, child: DefaultButton( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, borderRadius: 9, child: Text( 'Reset', @@ -157,8 +150,8 @@ class AddDeviceDialog extends StatelessWidget { visitorBloc.deviceNameController.clear(); visitorBloc.deviceIdController.clear(); visitorBloc.unitNameController.clear(); - visitorBloc.add( - FetchDevice()); // Reset to original list + visitorBloc + .add(FetchDevice()); // Reset to original list }, ), ), @@ -178,8 +171,7 @@ class AddDeviceDialog extends StatelessWidget { selectAll: (p0) { visitorBloc.selectedDeviceIds.clear(); for (var item in state.data) { - visitorBloc - .add(SelectDeviceEvent(item.uuid)); + visitorBloc.add(SelectDeviceEvent(item.uuid)); } }, onRowSelected: (index, isSelected, row) { diff --git a/lib/pages/visitor_password/view/visitor_password_dialog.dart b/lib/pages/visitor_password/view/visitor_password_dialog.dart index 5362f448..1f8a9b27 100644 --- a/lib/pages/visitor_password/view/visitor_password_dialog.dart +++ b/lib/pages/visitor_password/view/visitor_password_dialog.dart @@ -438,7 +438,7 @@ class VisitorPasswordDialog extends StatelessWidget { .bodySmall! .copyWith( fontWeight: FontWeight.w400, - color: ColorsManager.whiteColors, + color: ColorsManager.white, fontSize: 12), ), ), @@ -536,7 +536,7 @@ class VisitorPasswordDialog extends StatelessWidget { 'Ok', style: Theme.of(context).textTheme.bodySmall!.copyWith( fontWeight: FontWeight.w400, - color: ColorsManager.whiteColors, + color: ColorsManager.white, fontSize: 16), ), ), @@ -595,14 +595,12 @@ class VisitorPasswordDialog extends StatelessWidget { ), Text( 'Set Password', - style: Theme.of(context) - .textTheme - .headlineLarge! - .copyWith( - fontSize: 24, - fontWeight: FontWeight.w400, - color: Colors.black, - ), + style: + Theme.of(context).textTheme.headlineLarge!.copyWith( + fontSize: 24, + fontWeight: FontWeight.w400, + color: Colors.black, + ), ), ], ), @@ -682,7 +680,7 @@ class VisitorPasswordDialog extends StatelessWidget { 'Confirm', style: Theme.of(context).textTheme.bodySmall!.copyWith( fontWeight: FontWeight.w400, - color: ColorsManager.whiteColors, + color: ColorsManager.white, fontSize: 16, ), ), diff --git a/lib/utils/color_manager.dart b/lib/utils/color_manager.dart index 194a36ba..5d38c1c0 100644 --- a/lib/utils/color_manager.dart +++ b/lib/utils/color_manager.dart @@ -1,23 +1,20 @@ import 'package:flutter/material.dart'; -abstract class ColorsManager { +abstract final class ColorsManager { + const ColorsManager._(); + static const Color textPrimaryColor = Color(0xFF5D5D5D); static const Color switchOffColor = Color(0x7F8D99AE); - static const Color primaryColor = Color(0xFF0030CB); //023DFE + static const Color primaryColor = Color(0xFF0030CB); static const Color secondaryTextColor = Color(0xFF848484); - static Color primaryColorWithOpacity = - const Color(0xFF023DFE).withOpacity(0.6); - static const Color whiteColors = Colors.white; - static Color whiteColorsWithOpacity = Colors.white.withOpacity(0.6); - + static final Color opaquePrimary = const Color(0xFF023DFE).withValues(alpha: 0.6); + static const Color white = Color(0xFFFFFFFF); + static Color whiteColorsWithOpacity = Colors.white.withValues(alpha: 0.6); static const Color secondaryColor = Color(0xFF023DFE); static const Color onSecondaryColor = Color(0xFF023DFE); - static Color shadowBlackColor = Colors.black.withOpacity(0.2); - - static Color dialogBlueTitle = const Color(0xFF023DFE).withOpacity(0.6); - + static Color shadowBlackColor = Colors.black.withValues(alpha: 0.2); + static Color dialogBlueTitle = const Color(0xFF023DFE).withValues(alpha: 0.6); static const Color primaryTextColor = Colors.black; - static const Color greyColor = Color(0xFFd5d5d5); static const Color lightGreyColor = Color(0xFF999999); static const Color backgroundColor = Color(0xFFececec); @@ -57,11 +54,10 @@ abstract class ColorsManager { static const Color neutralGray = Color(0xFFE5E5E5); static const Color warningRed = Color(0xFFFF6465); static const Color borderColor = Color(0xFFE5E5E5); - static const Color CircleImageBackground = Color(0xFFF4F4F4); + static const Color circleImageBackground = Color(0xFFF4F4F4); static const Color softGray = Color(0xFFD5D5D5); static const Color semiTransparentBlack = Color(0x19000000); static const Color dataHeaderGrey = Color(0x33999999); - static const Color circleImageBackground = Color(0xFFF4F4F4); static const Color circleRolesBackground = Color(0xFFF8F8F8); static const Color activeGreen = Color(0xFF99FF93); static const Color activeGreenText = Color(0xFF008905); @@ -72,7 +68,7 @@ abstract class ColorsManager { static const Color invitedOrangeText = Color(0xFFFFBF00); static const Color lightGrayBorderColor = Color(0xB2D5D5D5); static const Color vividBlue = Color(0xFF023DFE); - static const Color semiTransparentRed = Color(0x99FF0000); + static const Color semiTransparentRed = Color(0xFFFF6465); static const Color grey700 = Color(0xFF2D3748); static const Color goodGreen = Color(0xFF0CEC16); static const Color moderateYellow = Color(0xFFFAC96C); @@ -95,5 +91,4 @@ abstract class ColorsManager { static const Color shadowOfDetailsContainer = Color(0x40000000); static const Color checkBoxBorderGray = Color(0xffD0D0D0); static const Color timePickerColor = Color(0xff000000); - } diff --git a/lib/utils/extension/app_snack_bar.dart b/lib/utils/extension/app_snack_bar.dart index 14cb9b43..c13faf4c 100644 --- a/lib/utils/extension/app_snack_bar.dart +++ b/lib/utils/extension/app_snack_bar.dart @@ -37,7 +37,7 @@ extension AppSnackBarsBuildContextExtension on BuildContext { Text( message, style: textTheme.bodyMedium?.copyWith( - color: ColorsManager.whiteColors, + color: ColorsManager.white, ), ), ], diff --git a/lib/utils/extension/build_context_x.dart b/lib/utils/extension/build_context_x.dart index 0abd16a1..422ab269 100644 --- a/lib/utils/extension/build_context_x.dart +++ b/lib/utils/extension/build_context_x.dart @@ -49,7 +49,7 @@ extension BuildContextExt on BuildContext { title, style: titleStyle ?? context.textTheme.bodyMedium!.copyWith( - color: ColorsManager.primaryColorWithOpacity, + color: ColorsManager.opaquePrimary, fontWeight: FontWeight.bold, ), ), @@ -87,8 +87,8 @@ extension BuildContextExt on BuildContext { child: Text( onDismissText ?? 'Cancel', style: context.textTheme.bodyMedium!.copyWith( - color: onDismissColor ?? - ColorsManager.greyColor), + color: + onDismissColor ?? ColorsManager.greyColor), ), ), ), @@ -104,7 +104,7 @@ extension BuildContextExt on BuildContext { onConfirmText ?? 'Confirm', style: context.textTheme.bodyMedium!.copyWith( color: onConfirmColor ?? - ColorsManager.primaryColorWithOpacity), + ColorsManager.opaquePrimary), ), ), ), diff --git a/lib/utils/snack_bar.dart b/lib/utils/snack_bar.dart index 0a312e5a..45b65459 100644 --- a/lib/utils/snack_bar.dart +++ b/lib/utils/snack_bar.dart @@ -22,7 +22,7 @@ class CustomSnackBar { content: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon( Icons.check_circle, - color: ColorsManager.whiteColors, + color: ColorsManager.white, size: 32, ), const SizedBox( @@ -30,10 +30,8 @@ class CustomSnackBar { ), Text( message, - style: Theme.of(currentContext) - .textTheme - .bodySmall! - .copyWith(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.green), + style: Theme.of(currentContext).textTheme.bodySmall!.copyWith( + fontSize: 14, fontWeight: FontWeight.w500, color: Colors.green), ) ]), ); @@ -59,10 +57,8 @@ class CustomSnackBar { ), Text( message, - style: Theme.of(currentContext) - .textTheme - .bodySmall! - .copyWith(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.green), + style: Theme.of(currentContext).textTheme.bodySmall!.copyWith( + fontSize: 14, fontWeight: FontWeight.w500, color: Colors.green), ) ]), ); diff --git a/lib/utils/style.dart b/lib/utils/style.dart index 905bb7a8..9424b090 100644 --- a/lib/utils/style.dart +++ b/lib/utils/style.dart @@ -52,11 +52,11 @@ BoxDecoration containerWhiteDecoration = BoxDecoration( offset: const Offset(0, 5), // changes position of shadow ), ], - color: ColorsManager.whiteColors, + color: ColorsManager.white, borderRadius: const BorderRadius.all(Radius.circular(15))); BoxDecoration subSectionContainerDecoration = BoxDecoration( - color: ColorsManager.whiteColors, + color: ColorsManager.white, boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.1), diff --git a/lib/utils/theme/responsive_text_theme.dart b/lib/utils/theme/responsive_text_theme.dart index f5daed7f..3bac7956 100644 --- a/lib/utils/theme/responsive_text_theme.dart +++ b/lib/utils/theme/responsive_text_theme.dart @@ -24,7 +24,7 @@ class ResponsiveTextTheme extends ThemeExtension { deviceManagementTitle: TextStyle( fontSize: isMobile ? 20 : 30, fontWeight: FontWeight.w700, - color: ColorsManager.whiteColors), + color: ColorsManager.white), ); } } diff --git a/lib/utils/theme/theme.dart b/lib/utils/theme/theme.dart index 5c036762..7ee176bc 100644 --- a/lib/utils/theme/theme.dart +++ b/lib/utils/theme/theme.dart @@ -7,7 +7,7 @@ final myTheme = ThemeData( textTheme: const TextTheme( bodySmall: TextStyle( fontSize: 13, - color: ColorsManager.whiteColors, + color: ColorsManager.white, fontWeight: FontWeight.normal, ), bodyMedium: TextStyle(color: Colors.black87, fontSize: 14), @@ -30,13 +30,13 @@ final myTheme = ThemeData( if (states.contains(WidgetState.selected)) { return ColorsManager.blueColor; } - return ColorsManager.whiteColors; + return ColorsManager.white; }), trackColor: WidgetStateProperty.resolveWith((states) { if (states.contains(WidgetState.selected)) { return ColorsManager.blueColor.withOpacity(0.5); } - return ColorsManager.whiteColors; + return ColorsManager.white; }), ), checkboxTheme: CheckboxThemeData( @@ -47,12 +47,12 @@ final myTheme = ThemeData( return Colors.grey.shade200; }), checkColor: WidgetStateProperty.all(Colors.white), - side: const BorderSide(color: ColorsManager.whiteColors), + side: const BorderSide(color: ColorsManager.white), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(4), ), ), dialogTheme: const DialogThemeData( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, ), ); diff --git a/lib/utils/user_drop_down_menu.dart b/lib/utils/user_drop_down_menu.dart index 15da1f3a..2364c58c 100644 --- a/lib/utils/user_drop_down_menu.dart +++ b/lib/utils/user_drop_down_menu.dart @@ -1,10 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/svg.dart'; import 'package:go_router/go_router.dart'; import 'package:syncrow_web/pages/auth/bloc/auth_bloc.dart'; import 'package:syncrow_web/pages/auth/model/user_model.dart'; -import 'package:syncrow_web/pages/common/bloc/project_manager.dart'; import 'package:syncrow_web/pages/common/buttons/default_button.dart'; import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/constants/assets.dart'; @@ -81,7 +79,7 @@ class _UserDropdownMenuState extends State { await showMenu( context: context, position: position, - color: ColorsManager.whiteColors, + color: ColorsManager.white, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.only( bottomRight: Radius.circular(10), @@ -122,8 +120,7 @@ class _UserDropdownMenuState extends State { height: 200, width: 400, child: Padding( - padding: - const EdgeInsets.only(top: 24, left: 24, right: 24), + padding: const EdgeInsets.only(top: 24, left: 24, right: 24), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -136,14 +133,12 @@ class _UserDropdownMenuState extends State { padding: const EdgeInsets.only(top: 16), child: Text( 'Log out of your Syncrow account', - style: Theme.of(context) - .textTheme - .bodyMedium! - .copyWith( - fontSize: 14, - fontWeight: FontWeight.w400, - color: Colors.black, - ), + style: + Theme.of(context).textTheme.bodyMedium!.copyWith( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + ), ), ), const SizedBox( @@ -154,7 +149,7 @@ class _UserDropdownMenuState extends State { SizedBox.square( dimension: 80, child: CircleAvatar( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, child: SizedBox.square( dimension: 78, child: SvgPicture.asset( @@ -170,8 +165,7 @@ class _UserDropdownMenuState extends State { ), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '${widget.user?.firstName ?? ''} ${widget.user?.lastName}', @@ -215,13 +209,11 @@ class _UserDropdownMenuState extends State { elevation: 1, child: Text( 'Cancel', - style: Theme.of(context) - .textTheme - .bodyMedium! - .copyWith( - fontSize: 12, - color: Colors.black, - ), + style: + Theme.of(context).textTheme.bodyMedium!.copyWith( + fontSize: 12, + color: Colors.black, + ), ), ), ), diff --git a/lib/web_layout/web_app_bar.dart b/lib/web_layout/web_app_bar.dart index 3cfe171e..3dd687f9 100644 --- a/lib/web_layout/web_app_bar.dart +++ b/lib/web_layout/web_app_bar.dart @@ -212,7 +212,7 @@ class _UserAvatar extends StatelessWidget { return SizedBox.square( dimension: 40, child: CircleAvatar( - backgroundColor: ColorsManager.whiteColors, + backgroundColor: ColorsManager.white, child: SizedBox.square( dimension: 35, child: SvgPicture.asset( From c4ed30f539e0edace792b5977b0a64d90c6d86ac Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 11:59:21 +0300 Subject: [PATCH 02/10] Enhance ButtonContentWidget to support customizable icon dimensions. --- .../presentation/widgets/button_content_widget.dart | 8 ++++++-- .../presentation/widgets/space_details_devices_box.dart | 2 ++ .../presentation/widgets/space_sub_spaces_box.dart | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/button_content_widget.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/button_content_widget.dart index 4c95634e..ca83742d 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/button_content_widget.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/button_content_widget.dart @@ -6,11 +6,15 @@ class ButtonContentWidget extends StatelessWidget { final String label; final String? svgAssets; final bool disabled; + final double? iconWidth; + final double? iconHeight; const ButtonContentWidget({ required this.label, this.svgAssets, this.disabled = false, + this.iconWidth, + this.iconHeight, super.key, }); @@ -38,8 +42,8 @@ class ButtonContentWidget extends StatelessWidget { padding: const EdgeInsets.only(left: 6.0), child: SvgPicture.asset( svgAssets!, - width: screenWidth * 0.015, - height: screenWidth * 0.015, + width: iconWidth ?? screenWidth * 0.015, + height: iconHeight ?? screenWidth * 0.015, ), ), const SizedBox(width: 10), diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_devices_box.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_devices_box.dart index 65a53181..1e9de130 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_devices_box.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_devices_box.dart @@ -90,6 +90,8 @@ class SpaceDetailsDevicesBox extends StatelessWidget { child: ButtonContentWidget( svgAssets: Assets.addIcon, label: 'Add Devices', + iconWidth: 12, + iconHeight: 12, ), ), ); diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_box.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_box.dart index 719988c6..7312b844 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_box.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_box.dart @@ -28,6 +28,8 @@ class SpaceSubSpacesBox extends StatelessWidget { child: ButtonContentWidget( svgAssets: Assets.addIcon, label: 'Create Sub Spaces', + iconWidth: 12, + iconHeight: 12, ), ), ); From 6dbb6b6a6e12a2bb0d64cc9efd1ef917e3a1d97b Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 11:59:46 +0300 Subject: [PATCH 03/10] Made Create Space dialog title match the figma design. --- .../presentation/helpers/space_details_dialog_helper.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/helpers/space_details_dialog_helper.dart b/lib/pages/space_management_v2/modules/space_details/presentation/helpers/space_details_dialog_helper.dart index 45cb0e89..175bafc8 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/helpers/space_details_dialog_helper.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/helpers/space_details_dialog_helper.dart @@ -49,7 +49,7 @@ abstract final class SpaceDetailsDialogHelper { }, child: SpaceDetailsDialog( context: context, - title: const SelectableText('Create Space'), + title: const SelectableText('Create New Space'), spaceModel: SpaceModel.empty(), onSave: (space) { context.read().add( From 16b79ae12f3d93cef95d431906dfb8c79b5ffd16 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 12:00:53 +0300 Subject: [PATCH 04/10] Enhanced sizing of SpaceDetailsForm and SpaceIconPicker. --- .../widgets/space_details_form.dart | 15 ++++++++++---- .../widgets/space_icon_picker.dart | 20 +++++++------------ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_form.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_form.dart index a19d92d2..886a792d 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_form.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_form.dart @@ -30,18 +30,25 @@ class SpaceDetailsForm extends StatelessWidget { buildWhen: (previous, current) => previous != current, builder: (context, space) { return AlertDialog( - title: title, + title: DefaultTextStyle( + style: context.textTheme.titleLarge!.copyWith( + fontSize: 30, + fontWeight: FontWeight.w400, + color: ColorsManager.blackColor, + ), + child: title, + ), backgroundColor: ColorsManager.white, content: SizedBox( height: context.screenHeight * 0.3, - width: context.screenWidth * 0.5, + width: context.screenWidth * 0.4, child: Row( - spacing: 20, + spacing: 12, crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded(child: SpaceIconPicker(iconPath: space.icon)), Expanded( - flex: 2, + flex: 3, child: ListView( shrinkWrap: true, children: [ diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_icon_picker.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_icon_picker.dart index 68bfdefc..8b8d3277 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_icon_picker.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_icon_picker.dart @@ -17,14 +17,14 @@ class SpaceIconPicker extends StatelessWidget { @override Widget build(BuildContext context) { - return Center( + return Align( + alignment: Alignment.center, child: Stack( - alignment: Alignment.center, children: [ Container( - width: context.screenWidth * 0.175, - height: context.screenHeight * 0.175, + width: context.screenWidth * 0.13, + height: context.screenHeight * 0.13, decoration: const BoxDecoration( color: ColorsManager.boxColor, shape: BoxShape.circle, @@ -38,7 +38,7 @@ class SpaceIconPicker extends StatelessWidget { ), Positioned.directional( top: 12, - start: context.screenHeight * 0.06, + start: context.screenHeight * 0.0375, textDirection: Directionality.of(context), child: InkWell( onTap: () { @@ -58,14 +58,8 @@ class SpaceIconPicker extends StatelessWidget { }); }, child: Container( - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: SvgPicture.asset( - Assets.iconEdit, - width: 16, - height: 16, - ), + decoration: const BoxDecoration(shape: BoxShape.circle), + child: SvgPicture.asset(Assets.iconEdit, width: 16, height: 16), ), ), ), From 1448aa97ce2153470719c30a1769a841b5b18dd3 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 12:05:24 +0300 Subject: [PATCH 05/10] Refactor SpaceDetailsDialog to improve title handling and loading/error dialogs --- .../widgets/space_details_dialog.dart | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_dialog.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_dialog.dart index 370fd59b..53af6b5d 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_dialog.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_dialog.dart @@ -43,12 +43,23 @@ class _SpaceDetailsDialogState extends State { super.initState(); } + Widget _buildTitle(BuildContext context) { + return DefaultTextStyle( + style: context.textTheme.titleLarge!.copyWith( + fontSize: 30, + fontWeight: FontWeight.w400, + color: ColorsManager.blackColor, + ), + child: widget.title, + ); + } + @override Widget build(BuildContext context) { final isCreateMode = widget.spaceModel.uuid.isEmpty; if (isCreateMode) { return SpaceDetailsForm( - title: widget.title, + title: _buildTitle(context), space: SpaceDetailsModel.empty(), onSave: widget.onSave, ); @@ -57,23 +68,23 @@ class _SpaceDetailsDialogState extends State { return BlocBuilder( bloc: widget.context.read(), builder: (context, state) => switch (state) { - SpaceDetailsInitial() => _buildLoadingDialog(), - SpaceDetailsLoading() => _buildLoadingDialog(), + SpaceDetailsInitial() => buildLoadingDialog(), + SpaceDetailsLoading() => buildLoadingDialog(), SpaceDetailsLoaded(:final spaceDetails) => SpaceDetailsForm( - title: widget.title, + title: _buildTitle(context), space: spaceDetails, onSave: widget.onSave, ), - SpaceDetailsFailure(:final errorMessage) => _buildErrorDialog( + SpaceDetailsFailure(:final errorMessage) => buildErrorDialog( errorMessage, ), }, ); } - Widget _buildLoadingDialog() { + Widget buildLoadingDialog() { return AlertDialog( - title: widget.title, + title: _buildTitle(context), backgroundColor: ColorsManager.white, content: SizedBox( height: context.screenHeight * 0.3, @@ -83,18 +94,17 @@ class _SpaceDetailsDialogState extends State { ); } - Widget _buildErrorDialog(String errorMessage) { + Widget buildErrorDialog(String errorMessage) { return AlertDialog( - title: widget.title, + title: _buildTitle(context), backgroundColor: ColorsManager.white, - content: Center( - child: SelectableText( - errorMessage, - style: context.textTheme.bodyLarge?.copyWith( - color: ColorsManager.red, - fontWeight: FontWeight.w500, - fontSize: 18, - ), + content: SelectableText( + errorMessage, + textAlign: TextAlign.center, + style: context.textTheme.bodyLarge?.copyWith( + color: ColorsManager.red, + fontWeight: FontWeight.w500, + fontSize: 18, ), ), ); From 527c04de9ad48a990e3a20d9a9408d08ca495e6f Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 12:06:58 +0300 Subject: [PATCH 06/10] Refactor SpaceDetailsActionButtons to improve button layout and spacing --- .../presentation/widgets/space_details_action_buttons.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart index 67820736..5a0d6d63 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart @@ -24,8 +24,10 @@ class SpaceDetailsActionButtons extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, spacing: 10, children: [ - Expanded(child: _buildCancelButton(context)), - Expanded(child: _buildSaveButton()), + const Spacer(), + Expanded(flex: 2, child: _buildCancelButton(context)), + Expanded(flex: 2, child: _buildSaveButton()), + const Spacer(), ], ); } From 47340c3235b5935b570f1b3024c60a66eae86179 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 12:34:06 +0300 Subject: [PATCH 07/10] Rework fixes. --- ...ce_management_community_dialog_helper.dart | 19 +++- .../widgets/create_space_button.dart | 99 +++++++++---------- .../presentation/create_community_dialog.dart | 23 ++--- .../widgets/space_details_action_buttons.dart | 34 +++++-- .../widgets/space_sub_spaces_dialog.dart | 13 ++- .../widgets/sub_spaces_input.dart | 2 +- .../widgets/subspace_name_display_widget.dart | 6 +- 7 files changed, 113 insertions(+), 83 deletions(-) diff --git a/lib/pages/space_management_v2/main_module/shared/helpers/space_management_community_dialog_helper.dart b/lib/pages/space_management_v2/main_module/shared/helpers/space_management_community_dialog_helper.dart index e1981208..b9d4265c 100644 --- a/lib/pages/space_management_v2/main_module/shared/helpers/space_management_community_dialog_helper.dart +++ b/lib/pages/space_management_v2/main_module/shared/helpers/space_management_community_dialog_helper.dart @@ -1,12 +1,29 @@ import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/communities/domain/models/community_model.dart'; +import 'package:syncrow_web/pages/space_management_v2/modules/communities/presentation/bloc/communities_bloc.dart'; +import 'package:syncrow_web/pages/space_management_v2/modules/communities/presentation/communities_tree_selection_bloc/communities_tree_selection_bloc.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/create_community/presentation/create_community_dialog.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/update_community/presentation/edit_community_dialog.dart'; +import 'package:syncrow_web/utils/extension/app_snack_bar.dart'; abstract final class SpaceManagementCommunityDialogHelper { static void showCreateDialog(BuildContext context) => showDialog( context: context, - builder: (_) => const CreateCommunityDialog(), + builder: (_) => CreateCommunityDialog( + onSuccess: (community) { + context.showSuccessSnackbar( + '${community.name} community created successfully', + ); + context.read().add( + InsertCommunity(community), + ); + + context.read().add( + SelectCommunityEvent(community: community), + ); + }, + ), ); static void showEditDialog( diff --git a/lib/pages/space_management_v2/main_module/widgets/create_space_button.dart b/lib/pages/space_management_v2/main_module/widgets/create_space_button.dart index 4032c2ab..0906f31b 100644 --- a/lib/pages/space_management_v2/main_module/widgets/create_space_button.dart +++ b/lib/pages/space_management_v2/main_module/widgets/create_space_button.dart @@ -23,62 +23,55 @@ class _CreateSpaceButtonState extends State { @override Widget build(BuildContext context) { - return Tooltip( - margin: const EdgeInsets.symmetric(vertical: 24), - message: 'Create a new space', - child: InkWell( - onTap: () => SpaceDetailsDialogHelper.showCreate( - context, - communityUuid: widget.community.uuid, - onSuccess: (updatedSpaceModel) { - final newCommunity = widget.community.copyWith( - spaces: [...widget.community.spaces, updatedSpaceModel], - ); - context.read().add( - CommunitiesUpdateCommunity(newCommunity), - ); - context.read().add( - SelectSpaceEvent( - space: updatedSpaceModel, - community: newCommunity, - ), - ); - }, - ), - child: MouseRegion( - onEnter: (_) => setState(() => _isHovered = true), - onExit: (_) => setState(() => _isHovered = false), - child: AnimatedOpacity( - duration: const Duration(milliseconds: 100), - opacity: _isHovered ? 1.0 : 0.45, + return InkWell( + onTap: () => SpaceDetailsDialogHelper.showCreate( + context, + communityUuid: widget.community.uuid, + onSuccess: (updatedSpaceModel) { + final newCommunity = widget.community.copyWith( + spaces: [...widget.community.spaces, updatedSpaceModel], + ); + context.read().add( + CommunitiesUpdateCommunity(newCommunity), + ); + context.read().add( + SelectSpaceEvent( + space: updatedSpaceModel, + community: newCommunity, + ), + ); + }, + ), + child: MouseRegion( + onEnter: (_) => setState(() => _isHovered = true), + onExit: (_) => setState(() => _isHovered = false), + child: AnimatedOpacity( + duration: const Duration(milliseconds: 100), + opacity: _isHovered ? 1.0 : 0.45, + child: Container( + width: 150, + height: 90, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + boxShadow: [ + BoxShadow( + color: Colors.grey.withValues(alpha: 0.8), + spreadRadius: 3, + blurRadius: 8, + offset: const Offset(0, 4), + ), + ], + ), child: Container( - width: 150, - height: 90, + margin: const EdgeInsets.symmetric(vertical: 20), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(20), - boxShadow: [ - BoxShadow( - color: Colors.grey.withValues(alpha: 0.2), - spreadRadius: 3, - blurRadius: 8, - offset: const Offset(0, 4), - ), - ], + border: Border.all(color: ColorsManager.borderColor, width: 2), + color: ColorsManager.boxColor, + shape: BoxShape.circle, ), - child: Container( - margin: const EdgeInsets.symmetric(vertical: 20), - decoration: BoxDecoration( - border: Border.all(color: ColorsManager.borderColor, width: 2), - color: ColorsManager.boxColor, - shape: BoxShape.circle, - ), - child: const Center( - child: Icon( - Icons.add, - color: Colors.blue, - ), - ), + child: const Center( + child: Icon(Icons.add, color: ColorsManager.vividBlue), ), ), ), diff --git a/lib/pages/space_management_v2/modules/create_community/presentation/create_community_dialog.dart b/lib/pages/space_management_v2/modules/create_community/presentation/create_community_dialog.dart index 299c0078..0bd63616 100644 --- a/lib/pages/space_management_v2/modules/create_community/presentation/create_community_dialog.dart +++ b/lib/pages/space_management_v2/modules/create_community/presentation/create_community_dialog.dart @@ -2,15 +2,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/space_management_v2/main_module/shared/helpers/space_management_community_dialog_helper.dart'; import 'package:syncrow_web/pages/space_management_v2/main_module/shared/widgets/community_dialog.dart'; -import 'package:syncrow_web/pages/space_management_v2/modules/communities/presentation/bloc/communities_bloc.dart'; -import 'package:syncrow_web/pages/space_management_v2/modules/communities/presentation/communities_tree_selection_bloc/communities_tree_selection_bloc.dart'; +import 'package:syncrow_web/pages/space_management_v2/modules/communities/domain/models/community_model.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/create_community/data/services/remote_create_community_service.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/create_community/domain/param/create_community_param.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/create_community/presentation/bloc/create_community_bloc.dart'; import 'package:syncrow_web/services/api/http_service.dart'; class CreateCommunityDialog extends StatelessWidget { - const CreateCommunityDialog({super.key}); + const CreateCommunityDialog({ + required this.onSuccess, + super.key, + }); + + final void Function(CommunityModel community) onSuccess; @override Widget build(BuildContext context) { @@ -27,23 +31,14 @@ class CreateCommunityDialog extends StatelessWidget { case CreateCommunitySuccess(:final community): Navigator.of(context).pop(); Navigator.of(context).pop(); - SpaceManagementCommunityDialogHelper.showSuccessSnackBar( - context, - '${community.name} community created successfully', - ); - context.read().add( - InsertCommunity(community), - ); - context.read().add( - SelectCommunityEvent(community: community), - ); + onSuccess(community); break; case CreateCommunityFailure(): Navigator.of(context).pop(); break; } }, - builder: (BuildContext context, CreateCommunityState state) { + builder: (context, state) { return CommunityDialog( title: const Text('Create Community'), initialName: null, diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart index 5a0d6d63..4d462091 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart @@ -1,6 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:syncrow_web/pages/common/buttons/cancel_button.dart'; -import 'package:syncrow_web/pages/common/buttons/default_button.dart'; import 'package:syncrow_web/utils/color_manager.dart'; class SpaceDetailsActionButtons extends StatelessWidget { @@ -10,12 +8,14 @@ class SpaceDetailsActionButtons extends StatelessWidget { required this.onCancel, this.saveButtonLabel = 'OK', this.cancelButtonLabel = 'Cancel', + this.spacerFlex = 1, }); final VoidCallback onCancel; final VoidCallback? onSave; final String saveButtonLabel; final String cancelButtonLabel; + final int spacerFlex; @override Widget build(BuildContext context) { @@ -24,24 +24,40 @@ class SpaceDetailsActionButtons extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, spacing: 10, children: [ - const Spacer(), + if (spacerFlex > 0) Spacer(flex: spacerFlex), Expanded(flex: 2, child: _buildCancelButton(context)), Expanded(flex: 2, child: _buildSaveButton()), - const Spacer(), + if (spacerFlex > 0) Spacer(flex: spacerFlex), ], ); } Widget _buildCancelButton(BuildContext context) { - return CancelButton(onPressed: onCancel, label: cancelButtonLabel); + return ElevatedButton( + onPressed: onSave, + style: ElevatedButton.styleFrom( + elevation: 4, + backgroundColor: ColorsManager.boxColor, + foregroundColor: ColorsManager.blackColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + ), + child: Text(cancelButtonLabel), + ); } Widget _buildSaveButton() { - return DefaultButton( + return ElevatedButton( onPressed: onSave, - borderRadius: 10, - backgroundColor: ColorsManager.secondaryColor, - foregroundColor: ColorsManager.white, + style: ElevatedButton.styleFrom( + elevation: 4, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + backgroundColor: ColorsManager.secondaryColor, + foregroundColor: ColorsManager.white, + ), child: Text(saveButtonLabel), ); } diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_dialog.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_dialog.dart index 6b05ab8a..34d16465 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_dialog.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_dialog.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/space_details/domain/models/subspace.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/space_details/presentation/widgets/sub_spaces_input.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; +import 'package:syncrow_web/utils/extension/build_context_x.dart'; import 'package:uuid/uuid.dart'; class SpaceSubSpacesDialog extends StatefulWidget { @@ -68,7 +70,14 @@ class _SpaceSubSpacesDialogState extends State { @override Widget build(BuildContext context) { return AlertDialog( - title: const SelectableText('Create Sub Spaces'), + title: DefaultTextStyle( + style: context.textTheme.titleLarge!.copyWith( + fontSize: 30, + fontWeight: FontWeight.w400, + color: ColorsManager.blackColor, + ), + child: const SelectableText('Create Sub-Space'), + ), content: Column( spacing: 12, mainAxisSize: MainAxisSize.min, @@ -96,6 +105,8 @@ class _SpaceSubSpacesDialogState extends State { SpaceDetailsActionButtons( onSave: _hasDuplicateNames ? null : _handleSave, onCancel: Navigator.of(context).pop, + saveButtonLabel: 'Save', + spacerFlex: 0, ) ], ); diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/sub_spaces_input.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/sub_spaces_input.dart index dac52f93..96a1bdac 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/sub_spaces_input.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/sub_spaces_input.dart @@ -39,7 +39,7 @@ class _SubSpacesInputState extends State { @override Widget build(BuildContext context) { return Container( - width: context.screenWidth * 0.35, + width: context.screenWidth * 0.335, padding: const EdgeInsets.symmetric( vertical: 10, horizontal: 16, diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_name_display_widget.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_name_display_widget.dart index 9096db27..88c3b639 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_name_display_widget.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/subspace_name_display_widget.dart @@ -124,16 +124,14 @@ class _SubspaceNameDisplayWidgetState extends State { children: [ SizedBox( width: context.screenWidth * 0.065, - height: context.screenHeight * 0.025, + height: context.screenHeight * 0.0135, child: TextField( focusNode: _focusNode, controller: _controller, style: textStyle?.copyWith( color: _hasDuplicateName ? Colors.red : null, ), - decoration: const InputDecoration.collapsed( - hintText: '', - ), + decoration: const InputDecoration.collapsed(hintText: ''), onChanged: _handleNameChange, onTapOutside: (_) => _tryToFinishEditing(), onSubmitted: _tryToSubmit, From 6943ee07ac02b53ca65ad9e57ea9818770de81ec Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 12:38:24 +0300 Subject: [PATCH 08/10] - Updated the onSave callback in SpaceSubSpacesDialog to accept product allocations, allowing for better management of subspace data. --- .../widgets/space_details_action_buttons.dart | 2 +- .../widgets/space_sub_spaces_box.dart | 8 +++++++- .../widgets/space_sub_spaces_dialog.dart | 19 +++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart index 4d462091..c86ec8f7 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart @@ -34,7 +34,7 @@ class SpaceDetailsActionButtons extends StatelessWidget { Widget _buildCancelButton(BuildContext context) { return ElevatedButton( - onPressed: onSave, + onPressed: onCancel, style: ElevatedButton.styleFrom( elevation: 4, backgroundColor: ColorsManager.boxColor, diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_box.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_box.dart index 7312b844..58e3ce16 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_box.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_box.dart @@ -65,10 +65,16 @@ class SpaceSubSpacesBox extends StatelessWidget { barrierDismissible: false, builder: (_) => SpaceSubSpacesDialog( subspaces: subspaces, - onSave: (subspaces) { + onSave: (subspaces, productAllocationsToBeAssignedToMainSpace) { context.read().add( UpdateSpaceDetailsSubspaces(subspaces), ); + + context.read().add( + UpdateSpaceDetailsProductAllocations( + productAllocationsToBeAssignedToMainSpace, + ), + ); }, ), ); diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_dialog.dart b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_dialog.dart index 34d16465..924a96e6 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_dialog.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/widgets/space_sub_spaces_dialog.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:syncrow_web/pages/space_management_v2/modules/space_details/domain/models/product_allocation.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/space_details/domain/models/subspace.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/space_details/presentation/widgets/space_details_action_buttons.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/space_details/presentation/widgets/sub_spaces_input.dart'; @@ -14,7 +15,10 @@ class SpaceSubSpacesDialog extends StatefulWidget { }); final List subspaces; - final void Function(List subspaces) onSave; + final void Function( + List subspaces, + List productAllocations, + ) onSave; @override State createState() => _SpaceSubSpacesDialogState(); @@ -23,6 +27,7 @@ class SpaceSubSpacesDialog extends StatefulWidget { class _SpaceSubSpacesDialogState extends State { late final TextEditingController _subspaceNameController; late List _subspaces; + final _productAllocationsToBeAssignedToMainSpace = []; bool get _hasDuplicateNames => _subspaces.map((subspace) => subspace.name.toLowerCase()).toSet().length != @@ -54,16 +59,22 @@ class _SpaceSubSpacesDialogState extends State { }); } - void _handleSubspaceDeleted(String uuid) => setState( - () => _subspaces = _subspaces.where((s) => s.uuid != uuid).toList(), + void _handleSubspaceDeleted(String uuid) { + setState(() { + final subspaceToDelete = _subspaces.firstWhere((s) => s.uuid == uuid); + _productAllocationsToBeAssignedToMainSpace.addAll( + subspaceToDelete.productAllocations, ); + _subspaces = _subspaces.where((s) => s.uuid != uuid).toList(); + }); + } void _handleSave() { final name = _subspaceNameController.text.trim(); if (name.isNotEmpty) { _handleSubspaceAdded(name); } - widget.onSave(_subspaces); + widget.onSave(_subspaces, _productAllocationsToBeAssignedToMainSpace); Navigator.of(context).pop(); } From 7d778097501c845333d3876f15d5c3687a5bd272 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 14:51:07 +0300 Subject: [PATCH 09/10] Refactor CustomExpansionTile and SpaceDetailsDialogHelper for improved functionality and UI consistency - Updated CustomExpansionTile to enhance selection state handling and UI responsiveness. - Integrated success and error snackbars in SpaceDetailsDialogHelper for better user feedback during space creation and updates. - Removed redundant comments and improved code readability. --- lib/common/widgets/custom_expansion_tile.dart | 45 ++++++++----------- .../helpers/space_details_dialog_helper.dart | 22 ++++----- 2 files changed, 27 insertions(+), 40 deletions(-) diff --git a/lib/common/widgets/custom_expansion_tile.dart b/lib/common/widgets/custom_expansion_tile.dart index 74151ca2..7bb74a74 100644 --- a/lib/common/widgets/custom_expansion_tile.dart +++ b/lib/common/widgets/custom_expansion_tile.dart @@ -5,19 +5,20 @@ class CustomExpansionTile extends StatefulWidget { final String title; final List? children; final bool initiallyExpanded; - final bool isSelected; // Add this to track selection - final bool? isExpanded; // External control over expansion - final ValueChanged? onExpansionChanged; // Notify when expansion changes - final VoidCallback? onItemSelected; // Callback for selecting the item + final bool isSelected; + final bool? isExpanded; + final ValueChanged? onExpansionChanged; + final VoidCallback? onItemSelected; - CustomExpansionTile({ + const CustomExpansionTile({ + super.key, required this.title, this.children, this.initiallyExpanded = false, - this.isExpanded, // Allow external control over expansion - this.onExpansionChanged, // Notify when expansion changes - this.onItemSelected, // Trigger item selection when name is tapped - required this.isSelected, // Add this to initialize selection state + this.isExpanded, + this.onExpansionChanged, + this.onItemSelected, + required this.isSelected, }); @override @@ -25,7 +26,7 @@ class CustomExpansionTile extends StatefulWidget { } class CustomExpansionTileState extends State { - bool _isExpanded = false; // Local expansion state + bool _isExpanded = false; @override void initState() { @@ -36,7 +37,6 @@ class CustomExpansionTileState extends State { @override void didUpdateWidget(CustomExpansionTile oldWidget) { super.didUpdateWidget(oldWidget); - // Sync local state with external control of expansion state if (widget.isExpanded != null && widget.isExpanded != _isExpanded) { setState(() { _isExpanded = widget.isExpanded!; @@ -44,7 +44,6 @@ class CustomExpansionTileState extends State { } } - // Utility function to capitalize the first letter of the title String _capitalizeFirstLetter(String text) { if (text.isEmpty) return text; return text[0].toUpperCase() + text.substring(1); @@ -56,7 +55,6 @@ class CustomExpansionTileState extends State { children: [ Row( children: [ - // Expand/collapse icon, now wrapped in a GestureDetector for specific onTap if (widget.children != null && widget.children!.isNotEmpty) GestureDetector( onTap: () { @@ -70,38 +68,33 @@ class CustomExpansionTileState extends State { ? Icons.keyboard_arrow_down : Icons.keyboard_arrow_right, color: ColorsManager.lightGrayColor, - size: 16.0, // Adjusted size for better alignment + size: 16, ), ), - // The title text, wrapped in GestureDetector to handle selection Expanded( child: GestureDetector( onTap: () { if (widget.onItemSelected != null) { - widget.onItemSelected!(); + widget.onItemSelected!.call(); } }, child: Text( _capitalizeFirstLetter(widget.title), style: TextStyle( color: widget.isSelected - ? ColorsManager - .blackColor // Change color to black when selected - : ColorsManager - .lightGrayColor, // Gray when not selected - fontWeight: FontWeight.w400, + ? ColorsManager.blackColor + : ColorsManager.lightGrayColor, + fontWeight: + widget.isSelected ? FontWeight.w600 : FontWeight.w400, ), ), ), ), ], ), - // The expanded section (children) that shows when the tile is expanded - if (_isExpanded && - widget.children != null && - widget.children!.isNotEmpty) + if (_isExpanded && widget.children != null && widget.children!.isNotEmpty) Padding( - padding: const EdgeInsets.only(left: 24.0), // Indented children + padding: const EdgeInsets.only(left: 24), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: widget.children!, diff --git a/lib/pages/space_management_v2/modules/space_details/presentation/helpers/space_details_dialog_helper.dart b/lib/pages/space_management_v2/modules/space_details/presentation/helpers/space_details_dialog_helper.dart index 175bafc8..6376972d 100644 --- a/lib/pages/space_management_v2/modules/space_details/presentation/helpers/space_details_dialog_helper.dart +++ b/lib/pages/space_management_v2/modules/space_details/presentation/helpers/space_details_dialog_helper.dart @@ -12,6 +12,7 @@ import 'package:syncrow_web/pages/space_management_v2/modules/update_space/data/ import 'package:syncrow_web/pages/space_management_v2/modules/update_space/domain/params/update_space_param.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/update_space/presentation/bloc/update_space_bloc.dart'; import 'package:syncrow_web/services/api/http_service.dart'; +import 'package:syncrow_web/utils/extension/app_snack_bar.dart'; abstract final class SpaceDetailsDialogHelper { static void showCreate( @@ -140,6 +141,9 @@ abstract final class SpaceDetailsDialogHelper { Navigator.of(context).pop(); Navigator.of(context).pop(); onSuccess?.call(space); + context.showSuccessSnackbar( + '${space.spaceName} space was updated successfully', + ); } static void _onLoading(BuildContext context) { @@ -152,20 +156,7 @@ abstract final class SpaceDetailsDialogHelper { static void _onError(BuildContext context, String errorMessage) { Navigator.of(context).pop(); - showDialog( - context: context, - barrierDismissible: false, - builder: (_) => AlertDialog( - title: const Text('Error'), - content: Text(errorMessage), - actions: [ - TextButton( - onPressed: Navigator.of(context).pop, - child: const Text('OK'), - ), - ], - ), - ); + context.showFailureSnackbar(errorMessage); } static void _onCreateSuccess( @@ -176,5 +167,8 @@ abstract final class SpaceDetailsDialogHelper { Navigator.of(context).pop(); Navigator.of(context).pop(); onSuccess?.call(space); + context.showSuccessSnackbar( + '${space.spaceName} space created successfully', + ); } } From 9d0a1f4883d33a8fa038d32b49564a502cbec3ff Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 24 Jul 2025 15:04:10 +0300 Subject: [PATCH 10/10] Refactor SpaceManagementSidebarHeader to integrate CustomSearchBar and improve layout --- lib/common/widgets/search_bar.dart | 6 +- .../space_management_communities_tree.dart | 8 +-- .../space_management_sidebar_header.dart | 59 +++++++++++++------ 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/lib/common/widgets/search_bar.dart b/lib/common/widgets/search_bar.dart index da185369..ba4a25c9 100644 --- a/lib/common/widgets/search_bar.dart +++ b/lib/common/widgets/search_bar.dart @@ -7,7 +7,7 @@ class CustomSearchBar extends StatefulWidget { final TextEditingController? controller; final String hintText; final String? searchQuery; - final Function(String)? onSearchChanged; // Callback for search input changes + final void Function(String)? onSearchChanged; const CustomSearchBar({ super.key, @@ -37,7 +37,7 @@ class _CustomSearchBarState extends State { color: ColorsManager.white, boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.2), + color: ColorsManager.shadowBlackColor.withValues(alpha: 0.1), spreadRadius: 0, blurRadius: 8, offset: const Offset(0, 4), @@ -57,7 +57,7 @@ class _CustomSearchBarState extends State { style: const TextStyle( color: Colors.black, ), - onChanged: widget.onSearchChanged, // Call the callback on text change + onChanged: widget.onSearchChanged, decoration: InputDecoration( filled: true, fillColor: ColorsManager.textFieldGreyColor, diff --git a/lib/pages/space_management_v2/modules/communities/presentation/widgets/space_management_communities_tree.dart b/lib/pages/space_management_v2/modules/communities/presentation/widgets/space_management_communities_tree.dart index d986ef01..c5535b21 100644 --- a/lib/pages/space_management_v2/modules/communities/presentation/widgets/space_management_communities_tree.dart +++ b/lib/pages/space_management_v2/modules/communities/presentation/widgets/space_management_communities_tree.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/common/widgets/app_loading_indicator.dart'; -import 'package:syncrow_web/common/widgets/search_bar.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/communities/domain/params/load_communities_param.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/communities/presentation/bloc/communities_bloc.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/communities/presentation/widgets/communities_tree_failure_widget.dart'; @@ -55,12 +54,9 @@ class _SpaceManagementCommunitiesTreeState ], ), child: Column( + spacing: 16, children: [ - const SpaceManagementSidebarHeader(), - CustomSearchBar( - onSearchChanged: _onSearchChanged, - ), - const SizedBox(height: 16), + SpaceManagementSidebarHeader(onSearchChanged: _onSearchChanged), switch (state.status) { CommunitiesStatus.initial => const AppLoadingIndicator(), CommunitiesStatus.loading => state.communities.isEmpty diff --git a/lib/pages/space_management_v2/modules/communities/presentation/widgets/space_management_sidebar_header.dart b/lib/pages/space_management_v2/modules/communities/presentation/widgets/space_management_sidebar_header.dart index b5f2a1b7..e31f49b5 100644 --- a/lib/pages/space_management_v2/modules/communities/presentation/widgets/space_management_sidebar_header.dart +++ b/lib/pages/space_management_v2/modules/communities/presentation/widgets/space_management_sidebar_header.dart @@ -1,34 +1,59 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:syncrow_web/common/widgets/search_bar.dart'; import 'package:syncrow_web/pages/space_management_v2/main_module/shared/helpers/space_management_community_dialog_helper.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/communities/presentation/communities_tree_selection_bloc/communities_tree_selection_bloc.dart'; import 'package:syncrow_web/pages/space_management_v2/modules/communities/presentation/widgets/space_management_sidebar_add_community_button.dart'; import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/extension/build_context_x.dart'; -import 'package:syncrow_web/utils/style.dart'; class SpaceManagementSidebarHeader extends StatelessWidget { - const SpaceManagementSidebarHeader({super.key}); + const SpaceManagementSidebarHeader({ + required this.onSearchChanged, + super.key, + }); + + final void Function(String) onSearchChanged; @override Widget build(BuildContext context) { - return Container( - decoration: subSectionContainerDecoration, - padding: const EdgeInsets.all(16), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Communities', - style: context.textTheme.titleMedium?.copyWith( - color: ColorsManager.blackColor, - ), + return Stack( + clipBehavior: Clip.none, + children: [ + Padding( + padding: const EdgeInsets.only(top: 56), + child: CustomSearchBar( + onSearchChanged: onSearchChanged, ), - SpaceManagementSidebarAddCommunityButton( - onTap: () => _onAddCommunity(context), + ), + Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: ColorsManager.white, + boxShadow: [ + BoxShadow( + color: ColorsManager.shadowBlackColor.withValues(alpha: 0.1), + blurRadius: 10, + offset: const Offset(0, 4), + ), + ], ), - ], - ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Communities', + style: context.textTheme.titleMedium?.copyWith( + color: ColorsManager.blackColor, + ), + ), + SpaceManagementSidebarAddCommunityButton( + onTap: () => _onAddCommunity(context), + ), + ], + ), + ), + ], ); }