From 097e70b906d4b431f0f76d2ae804269b8210855a Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Thu, 9 Jan 2025 13:32:09 +0400 Subject: [PATCH] color manager --- .../widgets/add_device_type_widget.dart | 2 +- .../community_structure_header_widget.dart | 2 +- .../widgets/dialogs/create_space_dialog.dart | 6 +-- .../widgets/dialogs/delete_dialogue.dart | 8 +-- .../dialogs/icon_selection_dialog.dart | 2 +- .../widgets/plus_button_widget.dart | 2 +- .../all_spaces/widgets/sidebar_widget.dart | 2 +- .../widgets/space_container_widget.dart | 2 +- .../all_spaces/widgets/space_widget.dart | 7 +-- .../views/assign_tag_models_dialog.dart | 8 +-- .../space_model/view/space_model_page.dart | 48 ++---------------- .../widgets/add_space_model_widget.dart | 50 +++++++++++++++++++ .../dialog/create_space_model_dialog.dart | 2 +- .../widgets/space_model_card_widget.dart | 4 +- .../widgets/subspace_chip_widget.dart | 2 +- .../widgets/subspace_model_create_widget.dart | 10 ++-- .../widgets/tag_chips_display_widget.dart | 10 ++-- 17 files changed, 88 insertions(+), 79 deletions(-) create mode 100644 lib/pages/spaces_management/space_model/widgets/add_space_model_widget.dart 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 93a38716..351eacce 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 @@ -99,7 +99,7 @@ class _AddDeviceWidgetState extends State { _buildActionButton('Cancel', ColorsManager.boxColor, ColorsManager.blackColor, () { Navigator.of(context).pop(); }), - _buildActionButton('Continue', ColorsManager.secondaryColor, Colors.white, () { + _buildActionButton('Continue', ColorsManager.secondaryColor, ColorsManager.whiteColors, () { Navigator.of(context).pop(); if (widget.onProductsSelected != null) { widget.onProductsSelected!(productCounts); 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 63306581..612f9101 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 @@ -178,7 +178,7 @@ class _CommunityStructureHeaderState extends State { padding: 2.0, height: buttonHeight, elevation: 0, - borderColor: Colors.grey.shade300, + borderColor: ColorsManager.lightGrayColor, child: Row( mainAxisSize: MainAxisSize.min, children: [ 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 f6a02833..222881a8 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 @@ -104,7 +104,7 @@ class CreateSpaceDialogState extends State { width: screenWidth * 0.020, height: screenWidth * 0.020, decoration: const BoxDecoration( - color: Colors.white, + color: ColorsManager.whiteColors, shape: BoxShape.circle, ), child: SvgPicture.asset( @@ -143,7 +143,7 @@ class CreateSpaceDialogState extends State { } }); }, - style: const TextStyle(color: Colors.black), + style: const TextStyle(color: ColorsManager.blackColor), decoration: InputDecoration( hintText: 'Please enter the name', hintStyle: const TextStyle( @@ -212,7 +212,7 @@ class CreateSpaceDialogState extends State { ); }, backgroundColor: ColorsManager.textFieldGreyColor, - foregroundColor: Colors.black, + foregroundColor: ColorsManager.blackColor, borderColor: ColorsManager.neutralGray, borderRadius: 16.0, padding: 10.0, // Reduced padding for smaller size 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 8607f9e0..27275be1 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 @@ -40,8 +40,8 @@ void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm, Navigator.of(context).pop(); // Close the first dialog showProcessingPopup(context, isSpace, onConfirm); }, - style: _dialogButtonStyle(Colors.blue), - child: const Text('Continue', style: TextStyle(color: Colors.white)), + style: _dialogButtonStyle(ColorsManager.spaceColor), + child: const Text('Continue', style: TextStyle(color: ColorsManager.whiteColors)), ), ], ), @@ -83,7 +83,7 @@ void showProcessingPopup(BuildContext context, bool isSpace, VoidCallback onDele ElevatedButton( onPressed: onDelete, style: _dialogButtonStyle(ColorsManager.warningRed), - child: const Text('Delete', style: TextStyle(color: Colors.white)), + child: const Text('Delete', style: TextStyle(color: ColorsManager.whiteColors)), ), CancelButton( label: 'Cancel', @@ -108,7 +108,7 @@ Widget _buildWarningIcon() { color: ColorsManager.warningRed, shape: BoxShape.circle, ), - child: const Icon(Icons.close, color: Colors.white, size: 40), + child: const Icon(Icons.close, color: ColorsManager.whiteColors, size: 40), ); } 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 5251ba32..b2a01988 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 @@ -28,7 +28,7 @@ class IconSelectionDialog extends StatelessWidget { borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.2), // Shadow color + color: ColorsManager.blackColor.withOpacity(0.2), // Shadow color blurRadius: 20, // Spread of the blur offset: const Offset(0, 8), // Offset of the shadow ), 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 b077ac9d..40be7284 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 @@ -45,7 +45,7 @@ class PlusButtonWidget extends StatelessWidget { color: ColorsManager.spaceColor, shape: BoxShape.circle, ), - child: const Icon(Icons.add, color: Colors.white, size: 20), + child: const Icon(Icons.add, color: ColorsManager.whiteColors, size: 20), ), ), ); diff --git a/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart index 2d557e25..da67e6ed 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/sidebar_widget.dart @@ -120,7 +120,7 @@ class _SidebarWidgetState extends State { children: [ Text('Communities', style: Theme.of(context).textTheme.titleMedium?.copyWith( - color: Colors.black, + color: ColorsManager.blackColor, )), GestureDetector( onTap: () => _navigateToBlank(context), 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 78af5f10..6f52eb50 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 @@ -78,7 +78,7 @@ class SpaceContainerWidget extends StatelessWidget { borderRadius: BorderRadius.circular(15), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.5), + color: ColorsManager.lightGrayColor.withOpacity(0.5), spreadRadius: 2, blurRadius: 5, offset: const Offset(0, 3), // Shadow position 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 e4ce27cc..6e1f50c1 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; class SpaceWidget extends StatelessWidget { final String name; @@ -23,11 +24,11 @@ class SpaceWidget extends StatelessWidget { Container( padding: const EdgeInsets.all(8.0), decoration: BoxDecoration( - color: Colors.white, + color: ColorsManager.whiteColors, borderRadius: BorderRadius.circular(8), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.5), + color: ColorsManager.lightGrayColor.withOpacity(0.5), spreadRadius: 5, blurRadius: 7, offset: const Offset(0, 3), @@ -36,7 +37,7 @@ class SpaceWidget extends StatelessWidget { ), child: Row( children: [ - const Icon(Icons.location_on, color: Colors.blue), + const Icon(Icons.location_on, color: ColorsManager.spaceColor), const SizedBox(width: 8), Text(name, style: const TextStyle(fontSize: 16)), ], 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 2b2891cb..f4f2276f 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 @@ -96,7 +96,7 @@ class AssignTagModelsDialog extends StatelessWidget { 'No Data Available', style: TextStyle( fontSize: 14, - color: Colors.grey, + color: ColorsManager.lightGrayColor, ), ), ), @@ -159,7 +159,7 @@ class AssignTagModelsDialog extends StatelessWidget { ), style: const TextStyle( fontSize: 14, - color: Colors.black, + color: ColorsManager.blackColor, ), ), ), @@ -172,7 +172,7 @@ class AssignTagModelsDialog extends StatelessWidget { color: ColorsManager.whiteColors, icon: const Icon( Icons.arrow_drop_down, - color: Colors.black), + color: ColorsManager.blackColor), onSelected: (value) { controller.text = value; context @@ -273,7 +273,7 @@ class AssignTagModelsDialog extends StatelessWidget { if (state.errorMessage != null) Text( state.errorMessage!, - style: const TextStyle(color: Colors.red), + style: const TextStyle(color: ColorsManager.warningRed), ), ], ), 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 ea9a9cee..6b9818c9 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 @@ -5,6 +5,7 @@ import 'package:syncrow_web/pages/spaces_management/space_model/bloc/space_model 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/add_space_model_widget.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/widgets/space_model_card_widget.dart'; import 'package:syncrow_web/utils/color_manager.dart'; @@ -61,7 +62,7 @@ class SpaceModelPage extends StatelessWidget { }, ); }, - child: _buildAddContainer(), + child: const AddSpaceModelWidget(), ); } // Render existing space model @@ -81,7 +82,7 @@ class SpaceModelPage extends StatelessWidget { return Center( child: Text( 'Error: ${state.message}', - style: const TextStyle(color: Colors.red), + style: const TextStyle(color: ColorsManager.warningRed), ), ); } @@ -90,49 +91,6 @@ class SpaceModelPage extends StatelessWidget { ); } - Widget _buildAddContainer() { - return Container( - margin: const EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: ColorsManager.whiteColors, - borderRadius: BorderRadius.circular(20), - boxShadow: const [ - BoxShadow( - color: ColorsManager.semiTransparentBlackColor, - blurRadius: 15, - offset: Offset(0, 4), - spreadRadius: 0, - ), - BoxShadow( - color: ColorsManager.semiTransparentBlackColor, - blurRadius: 25, - offset: Offset(0, 15), - spreadRadius: -5, - ), - ], - ), - child: Center( - child: Container( - width: 60, - height: 0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: ColorsManager.neutralGray, - border: Border.all( - color: ColorsManager.textFieldGreyColor, - width: 2.0, - ), - ), - child: const Icon( - Icons.add, - size: 40, - color: ColorsManager.spaceColor, - ), - ), - ), - ); - } - double _calculateChildAspectRatio(BuildContext context) { double screenWidth = MediaQuery.of(context).size.width; if (screenWidth > 1600) { 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 new file mode 100644 index 00000000..20876a39 --- /dev/null +++ b/lib/pages/spaces_management/space_model/widgets/add_space_model_widget.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; + +class AddSpaceModelWidget extends StatelessWidget { + const AddSpaceModelWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: ColorsManager.whiteColors, + borderRadius: BorderRadius.circular(20), + boxShadow: const [ + BoxShadow( + color: ColorsManager.semiTransparentBlackColor, + blurRadius: 15, + offset: Offset(0, 4), + spreadRadius: 0, + ), + BoxShadow( + color: ColorsManager.semiTransparentBlackColor, + blurRadius: 25, + offset: Offset(0, 15), + spreadRadius: -5, + ), + ], + ), + child: Center( + child: Container( + width: 60, + height: 60, // Set a proper height here + decoration: BoxDecoration( + shape: BoxShape.circle, + color: ColorsManager.neutralGray, + border: Border.all( + color: ColorsManager.textFieldGreyColor, + width: 2.0, + ), + ), + child: const Icon( + Icons.add, + size: 40, + color: ColorsManager.spaceColor, + ), + ), + ), + ); + } +} 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 88a23bcf..51222ad8 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 @@ -174,7 +174,7 @@ class CreateSpaceModelDialog extends StatelessWidget { } else if (state is CreateSpaceModelError) { return Text( 'Error: ${state.message}', - style: const TextStyle(color: Colors.red), + style: const TextStyle(color: ColorsManager.warningRed), ); } diff --git a/lib/pages/spaces_management/space_model/widgets/space_model_card_widget.dart b/lib/pages/spaces_management/space_model/widgets/space_model_card_widget.dart index 208b0893..4471743b 100644 --- a/lib/pages/spaces_management/space_model/widgets/space_model_card_widget.dart +++ b/lib/pages/spaces_management/space_model/widgets/space_model_card_widget.dart @@ -33,11 +33,11 @@ class SpaceModelCardWidget extends StatelessWidget { return Container( decoration: BoxDecoration( - color: Colors.white, + color: ColorsManager.whiteColors, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.5), + color: ColorsManager.lightGrayColor.withOpacity(0.5), spreadRadius: 2, blurRadius: 5, offset: const Offset(0, 3), diff --git a/lib/pages/spaces_management/space_model/widgets/subspace_chip_widget.dart b/lib/pages/spaces_management/space_model/widgets/subspace_chip_widget.dart index debe3801..517448c8 100644 --- a/lib/pages/spaces_management/space_model/widgets/subspace_chip_widget.dart +++ b/lib/pages/spaces_management/space_model/widgets/subspace_chip_widget.dart @@ -25,7 +25,7 @@ class SubspaceChipWidget extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), side: const BorderSide( - color: Colors.transparent, + color: ColorsManager.transparentColor, width: 0, ), ), diff --git a/lib/pages/spaces_management/space_model/widgets/subspace_model_create_widget.dart b/lib/pages/spaces_management/space_model/widgets/subspace_model_create_widget.dart index 31ed8659..22444c3d 100644 --- a/lib/pages/spaces_management/space_model/widgets/subspace_model_create_widget.dart +++ b/lib/pages/spaces_management/space_model/widgets/subspace_model_create_widget.dart @@ -85,7 +85,7 @@ class SubspaceModelCreate extends StatelessWidget { style: const TextStyle( color: ColorsManager.spaceColor), // Text color ), - backgroundColor: Colors.white, // Chip background color + backgroundColor: ColorsManager.whiteColors, // Chip background color shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), // Rounded chip @@ -118,15 +118,15 @@ class SubspaceModelCreate extends StatelessWidget { label: const Text( 'Edit', style: TextStyle( - color: ColorsManager.spaceColor), // Text color + color: ColorsManager.spaceColor), ), backgroundColor: - Colors.white, // Background color for "Edit" + ColorsManager.whiteColors, shape: RoundedRectangleBorder( borderRadius: - BorderRadius.circular(16), // Rounded chip + BorderRadius.circular(16), side: const BorderSide( - color: ColorsManager.spaceColor), // Border color + color: ColorsManager.spaceColor), ), ), ), 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 f367012d..9cb356ef 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 @@ -71,7 +71,7 @@ class TagChipDisplay extends StatelessWidget { color: ColorsManager.spaceColor, ), ), - backgroundColor: Colors.white, + backgroundColor: ColorsManager.whiteColors, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), side: const BorderSide( @@ -104,14 +104,14 @@ class TagChipDisplay extends StatelessWidget { label: const Text( 'Edit', style: TextStyle( - color: ColorsManager.spaceColor), // Text color + color: ColorsManager.spaceColor), ), backgroundColor: - Colors.white, // Background color for "Edit" + ColorsManager.whiteColors, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16), // Rounded chip + borderRadius: BorderRadius.circular(16), side: const BorderSide( - color: ColorsManager.spaceColor), // Border color + color: ColorsManager.spaceColor), ), ), ),