mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 22:09:40 +00:00
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.
This commit is contained in:
@ -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<DeleteSpaceBloc, DeleteSpaceState>(
|
||||
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(),
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -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<DeleteSpaceBloc>().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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class SpaceDetailsActionButtons extends StatelessWidget {
|
||||
onPressed: onSave,
|
||||
borderRadius: 10,
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
foregroundColor: ColorsManager.whiteColors,
|
||||
foregroundColor: ColorsManager.white,
|
||||
child: Text(saveButtonLabel),
|
||||
);
|
||||
}
|
||||
|
@ -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<SpaceDetailsModelBloc>()
|
||||
.add(UpdateSpaceDetails(resultSpace));
|
||||
context.read<SpaceDetailsModelBloc>().add(UpdateSpaceDetails(resultSpace));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -74,7 +74,7 @@ class _SpaceDetailsDialogState extends State<SpaceDetailsDialog> {
|
||||
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<SpaceDetailsDialog> {
|
||||
Widget _buildErrorDialog(String errorMessage) {
|
||||
return AlertDialog(
|
||||
title: widget.title,
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.white,
|
||||
content: Center(
|
||||
child: SelectableText(
|
||||
errorMessage,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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(
|
||||
|
@ -81,7 +81,7 @@ class _SubspaceNameDisplayWidgetState extends State<SubspaceNameDisplayWidget> {
|
||||
_focusNode.requestFocus();
|
||||
},
|
||||
child: Chip(
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: const BorderSide(color: ColorsManager.transparentColor),
|
||||
|
@ -63,7 +63,7 @@ class _AddDeviceTypeWidgetState extends State<AddDeviceTypeWidget> {
|
||||
child: Builder(
|
||||
builder: (context) => AlertDialog(
|
||||
title: const SelectableText('Add Devices'),
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.white,
|
||||
content: BlocBuilder<ProductsBloc, ProductsState>(
|
||||
builder: (context, state) => switch (state) {
|
||||
ProductsInitial() || ProductsLoading() => _buildLoading(context),
|
||||
|
@ -138,7 +138,7 @@ class _ProductTagFieldState extends State<ProductTagField> {
|
||||
child: Material(
|
||||
elevation: 4.0,
|
||||
child: Container(
|
||||
color: ColorsManager.whiteColors,
|
||||
color: ColorsManager.white,
|
||||
constraints: const BoxConstraints(maxHeight: 200.0),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
|
@ -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),
|
||||
),
|
||||
|
Reference in New Issue
Block a user