mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 14:39:41 +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,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<Tag>, List<SubspaceModel>?)? onSave;
|
||||
final List<Tag> projectTags;
|
||||
|
||||
final List<Tag> 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<AddDeviceTypeBloc, AddDeviceState>(
|
||||
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,
|
||||
);
|
||||
|
@ -34,7 +34,7 @@ class DeviceTypeTileWidget extends StatelessWidget {
|
||||
|
||||
return Card(
|
||||
elevation: 2,
|
||||
color: ColorsManager.whiteColors,
|
||||
color: ColorsManager.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
|
@ -32,8 +32,9 @@ class _AddDeviceWidgetState extends State<AddDeviceWidget> {
|
||||
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<AddDeviceWidget> {
|
||||
|
||||
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<AddDeviceWidget> {
|
||||
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<AddDeviceWidget> {
|
||||
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<AddDeviceWidget> {
|
||||
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<AddDeviceWidget> {
|
||||
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<AddDeviceWidget> {
|
||||
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,
|
||||
|
@ -20,8 +20,7 @@ class _BlankCommunityWidgetState extends State<BlankCommunityWidget> {
|
||||
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(
|
||||
|
@ -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<CommunityStructureHeader> createState() =>
|
||||
_CommunityStructureHeaderState();
|
||||
State<CommunityStructureHeader> createState() => _CommunityStructureHeaderState();
|
||||
}
|
||||
|
||||
class _CommunityStructureHeaderState extends State<CommunityStructureHeader> {
|
||||
@ -53,7 +52,7 @@ class _CommunityStructureHeaderState extends State<CommunityStructureHeader> {
|
||||
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,
|
||||
|
@ -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<CommunityStructureArea> {
|
||||
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<CommunityStructureArea> {
|
||||
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<CommunityStructureArea> {
|
||||
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<CommunityStructureArea> {
|
||||
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<CommunityStructureArea> {
|
||||
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<SelectedProduct> selectedProducts,
|
||||
@ -557,8 +553,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
||||
void _selectSpace(BuildContext context, SpaceModel space) {
|
||||
context.read<SpaceManagementBloc>().add(
|
||||
SelectSpaceEvent(
|
||||
selectedCommunity: widget.selectedCommunity,
|
||||
selectedSpace: space),
|
||||
selectedCommunity: widget.selectedCommunity, selectedSpace: space),
|
||||
);
|
||||
}
|
||||
|
||||
@ -657,7 +652,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
||||
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<CommunityStructureArea> {
|
||||
},
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
borderRadius: 10,
|
||||
foregroundColor: ColorsManager.whiteColors,
|
||||
foregroundColor: ColorsManager.white,
|
||||
child: const Text('OK'),
|
||||
),
|
||||
),
|
||||
@ -735,8 +730,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
||||
|
||||
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<SpaceModel> duplicatedSubtree = [];
|
||||
void collectSubtree(SpaceModel node) {
|
||||
duplicatedSubtree.add(node);
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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<CreateSpaceDialog> {
|
||||
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<CreateSpaceDialog> {
|
||||
|
||||
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<CreateSpaceDialog> {
|
||||
subspaces,
|
||||
);
|
||||
},
|
||||
isTagsAndSubspaceModelDisabled:
|
||||
isTagsAndSubspaceModelDisabled,
|
||||
isTagsAndSubspaceModelDisabled: isTagsAndSubspaceModelDisabled,
|
||||
screenWidth: screenWidth,
|
||||
editChipOnTap: () async {
|
||||
_showSubSpaceDialog(
|
||||
@ -232,8 +228,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
tags: tags,
|
||||
subspaces: subspaces,
|
||||
screenWidth: screenWidth,
|
||||
isTagsAndSubspaceModelDisabled:
|
||||
isTagsAndSubspaceModelDisabled,
|
||||
isTagsAndSubspaceModelDisabled: isTagsAndSubspaceModelDisabled,
|
||||
onEditChip: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
@ -298,17 +293,11 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
} 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<CreateSpaceDialog> {
|
||||
backgroundColor: isOkButtonEnabled
|
||||
? ColorsManager.secondaryColor
|
||||
: ColorsManager.grayColor,
|
||||
foregroundColor: ColorsManager.whiteColors,
|
||||
foregroundColor: ColorsManager.white,
|
||||
child: const Text('OK'),
|
||||
),
|
||||
),
|
||||
@ -384,8 +373,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
final List<Tag> 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<CreateSpaceDialog> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showTagCreateDialog(BuildContext context, String name, bool isEdit,
|
||||
List<ProductModel>? products) {
|
||||
void _showTagCreateDialog(
|
||||
BuildContext context, String name, bool isEdit, List<ProductModel>? 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<CreateSpaceDialog> {
|
||||
allTags: widget.allTags,
|
||||
projectTags: widget.projectTags,
|
||||
initialSelectedProducts:
|
||||
TagHelper.createInitialSelectedProductsForTags(
|
||||
tags, subspaces),
|
||||
TagHelper.createInitialSelectedProductsForTags(tags, subspaces),
|
||||
onSave: (selectedSpaceTags, selectedSubspaces) {
|
||||
setState(() {
|
||||
tags = selectedSpaceTags;
|
||||
|
@ -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),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -36,7 +36,7 @@ class _HoverableButtonState extends State<HoverableButton> {
|
||||
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<HoverableButton> {
|
||||
return isHovered
|
||||
? const Icon(
|
||||
Icons.close,
|
||||
color: ColorsManager.whiteColors,
|
||||
color: ColorsManager.white,
|
||||
size: 24,
|
||||
)
|
||||
: SvgPicture.asset(
|
||||
|
@ -30,7 +30,7 @@ class PlusButtonWidget extends StatelessWidget {
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.add,
|
||||
color: ColorsManager.whiteColors,
|
||||
color: ColorsManager.white,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -60,7 +60,7 @@ class AssignTagDialog extends StatelessWidget {
|
||||
|
||||
return AlertDialog(
|
||||
title: Text(title),
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.white,
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
|
@ -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<Tag>;
|
||||
final processedSubspaces = List<SubspaceModel>.from(
|
||||
result['subspaces'] as List<dynamic>);
|
||||
final processedSubspaces =
|
||||
List<SubspaceModel>.from(result['subspaces'] as List<dynamic>);
|
||||
|
||||
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<Tag>.from(tags);
|
||||
final result =
|
||||
TagHelper.processTags(updatedTags, subspaces);
|
||||
final result = TagHelper.processTags(updatedTags, subspaces);
|
||||
|
||||
final processedTags = result['updatedTags'] as List<Tag>;
|
||||
final processedSubspaces = List<SubspaceModel>.from(
|
||||
|
@ -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<AssignTagModelBloc>()
|
||||
.add(DeleteTagModel(
|
||||
context.read<AssignTagModelBloc>().add(DeleteTagModel(
|
||||
tagToDelete: tag,
|
||||
tags: state.tags,
|
||||
));
|
||||
controllers.removeAt(index);
|
||||
},
|
||||
onTagDropDownSelected: (
|
||||
{required index, required tag}) {
|
||||
onTagDropDownSelected: ({required index, required tag}) {
|
||||
context.read<AssignTagModelBloc>().add(
|
||||
UpdateTag(
|
||||
index: index,
|
||||
|
@ -53,13 +53,12 @@ class RowOfSaveCancelWidget extends StatelessWidget {
|
||||
label: 'Add New Device',
|
||||
onPressed: () async {
|
||||
final updatedTags = List<Tag>.from(state.tags);
|
||||
final result = TagHelper.updateSubspaceTagModels(
|
||||
updatedTags, subspaces);
|
||||
final result =
|
||||
TagHelper.updateSubspaceTagModels(updatedTags, subspaces);
|
||||
|
||||
final processedTags = result['updatedTags'] as List<Tag>;
|
||||
final processedSubspaces =
|
||||
List<SubspaceTemplateModel>.from(
|
||||
result['subspaces'] as List<dynamic>);
|
||||
final processedSubspaces = List<SubspaceTemplateModel>.from(
|
||||
result['subspaces'] as List<dynamic>);
|
||||
|
||||
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<Tag>;
|
||||
final processedTags = result['updatedTags'] as List<Tag>;
|
||||
final processedSubspaces =
|
||||
List<SubspaceTemplateModel>.from(
|
||||
result['subspaces'] as List<dynamic>);
|
||||
|
||||
Navigator.of(context)
|
||||
.popUntil((route) => route.isFirst);
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
|
@ -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'),
|
||||
),
|
||||
),
|
||||
|
@ -60,7 +60,7 @@ class _CreateSubSpaceDialogState extends State<CreateSubSpaceDialog> {
|
||||
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,
|
||||
|
@ -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'),
|
||||
),
|
||||
),
|
||||
|
@ -43,7 +43,7 @@ class CreateSubSpaceModelDialog extends StatelessWidget {
|
||||
},
|
||||
child: BlocBuilder<SubSpaceModelBloc, SubSpaceModelState>(
|
||||
builder: (context, state) => Container(
|
||||
color: ColorsManager.whiteColors,
|
||||
color: ColorsManager.white,
|
||||
width: screenWidth * 0.3,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
|
@ -43,7 +43,7 @@ class CreateSubspaceModelFooterButtons extends StatelessWidget {
|
||||
borderRadius: 10,
|
||||
foregroundColor: errorMessage.isNotEmpty
|
||||
? ColorsManager.whiteColorsWithOpacity
|
||||
: ColorsManager.whiteColors,
|
||||
: ColorsManager.white,
|
||||
child: const Text('OK'),
|
||||
),
|
||||
),
|
||||
|
@ -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(
|
||||
|
@ -32,7 +32,7 @@ class LinkSpaceModelDialog extends StatelessWidget {
|
||||
builder: (context) {
|
||||
final bloc = context.read<LinkSpaceToModelBloc>();
|
||||
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,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -18,7 +18,10 @@ class SpaceModelPage extends StatelessWidget {
|
||||
final List<Tag> 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),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -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<CreateSpaceModelBloc>().add(UpdateSpaceTemplateName(
|
||||
name: value, allModels: otherSpaceModels ?? []));
|
||||
context.read<CreateSpaceModelBloc>().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<SpaceModelBloc>().add(
|
||||
CreateSpaceModel(newSpaceModel: newModel));
|
||||
pageContext!
|
||||
.read<SpaceModelBloc>()
|
||||
.add(CreateSpaceModel(
|
||||
newSpaceModel:
|
||||
newModel));
|
||||
pageContext!
|
||||
.read<SpaceManagementBloc>()
|
||||
.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<SpaceModelBloc>().state;
|
||||
final currentState = pageContext!
|
||||
.read<SpaceModelBloc>()
|
||||
.state;
|
||||
if (currentState is SpaceModelLoaded) {
|
||||
final spaceModels = List<SpaceTemplateModel>.from(
|
||||
currentState.spaceModels);
|
||||
final spaceModels =
|
||||
List<SpaceTemplateModel>.from(
|
||||
currentState.spaceModels);
|
||||
|
||||
final SpaceTemplateModel? currentSpaceModel =
|
||||
spaceModels.cast<SpaceTemplateModel?>().firstWhere(
|
||||
(sm) => sm?.uuid == updatedSpaceModel.uuid,
|
||||
final SpaceTemplateModel?
|
||||
currentSpaceModel = spaceModels
|
||||
.cast<SpaceTemplateModel?>()
|
||||
.firstWhere(
|
||||
(sm) =>
|
||||
sm?.uuid ==
|
||||
updatedSpaceModel.uuid,
|
||||
orElse: () => null,
|
||||
);
|
||||
if (currentSpaceModel != null) {
|
||||
context
|
||||
.read<CreateSpaceModelBloc>()
|
||||
.add(ModifySpaceTemplate(
|
||||
spaceTemplate: currentSpaceModel,
|
||||
updatedSpaceTemplate: updatedSpaceTemplate,
|
||||
spaceTemplate:
|
||||
currentSpaceModel,
|
||||
updatedSpaceTemplate:
|
||||
updatedSpaceTemplate,
|
||||
onUpdate: (newModel) {
|
||||
if (pageContext != null) {
|
||||
pageContext!.read<SpaceModelBloc>().add(
|
||||
UpdateSpaceModel(
|
||||
spaceModelUuid:
|
||||
newModel.uuid ?? ''));
|
||||
pageContext!
|
||||
.read<SpaceManagementBloc>()
|
||||
.add(UpdateSpaceModelCache(newModel));
|
||||
.read<SpaceModelBloc>()
|
||||
.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'),
|
||||
),
|
||||
),
|
||||
|
@ -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'),
|
||||
),
|
||||
),
|
||||
|
@ -17,8 +17,7 @@ class LinkSpaceModelSpacesDialog extends StatefulWidget {
|
||||
_LinkSpaceModelSpacesDialogState();
|
||||
}
|
||||
|
||||
class _LinkSpaceModelSpacesDialogState
|
||||
extends State<LinkSpaceModelSpacesDialog> {
|
||||
class _LinkSpaceModelSpacesDialogState extends State<LinkSpaceModelSpacesDialog> {
|
||||
@override
|
||||
void initState() {
|
||||
context.read<LinkSpaceToModelBloc>().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<LinkSpaceToModelBloc>()
|
||||
.add(
|
||||
LinkSpaceModelSelectedIdsEvent());
|
||||
context.read<LinkSpaceToModelBloc>().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),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -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',
|
||||
|
@ -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,
|
||||
|
@ -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<SubspaceNameDisplayWidget> {
|
||||
|
@ -111,7 +111,7 @@ class TagChipDisplay extends StatelessWidget {
|
||||
MapEntry<ProductModel, int> entry,
|
||||
) {
|
||||
return Chip(
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
backgroundColor: ColorsManager.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: const BorderSide(
|
||||
|
@ -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<AddDeviceTypeModelBloc, AddDeviceModelState>(
|
||||
builder: (context, state) {
|
||||
if (state is AddDeviceModelLoading) {
|
||||
@ -154,14 +154,14 @@ class AddDeviceTypeModelWidget extends StatelessWidget {
|
||||
width: 140,
|
||||
child: BlocBuilder<AddDeviceTypeModelBloc, AddDeviceModelState>(
|
||||
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<bool>(
|
||||
context: context,
|
||||
|
@ -34,7 +34,7 @@ class DeviceTypeTileWidget extends StatelessWidget {
|
||||
|
||||
return Card(
|
||||
elevation: 2,
|
||||
color: ColorsManager.whiteColors,
|
||||
color: ColorsManager.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
|
Reference in New Issue
Block a user