mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 06:14:56 +00:00
@ -9,6 +9,7 @@ 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';
|
||||
@ -98,9 +99,9 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isSpaceModelDisabled = tags != null && tags!.isNotEmpty ||
|
||||
subspaces != null && subspaces!.isNotEmpty;
|
||||
final isTagsAndSubspaceModelDisabled = (selectedSpaceModel != null);
|
||||
bool isSpaceModelDisabled = (tags != null && tags!.isNotEmpty ||
|
||||
subspaces != null && subspaces!.isNotEmpty);
|
||||
bool isTagsAndSubspaceModelDisabled = (selectedSpaceModel != null);
|
||||
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
return AlertDialog(
|
||||
@ -297,7 +298,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
} else if (isNameFieldExist) {
|
||||
return;
|
||||
} else {
|
||||
final newName = enteredName.isNotEmpty
|
||||
String newName = enteredName.isNotEmpty
|
||||
? enteredName
|
||||
: (widget.name ?? '');
|
||||
if (newName.isNotEmpty) {
|
||||
@ -380,7 +381,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
products: products,
|
||||
existingSubSpaces: existingSubSpaces,
|
||||
onSave: (slectedSubspaces, updatedSubSpaces) {
|
||||
final tagsToAppendToSpace = <Tag>[];
|
||||
final List<Tag> tagsToAppendToSpace = [];
|
||||
|
||||
if (slectedSubspaces != null && slectedSubspaces.isNotEmpty) {
|
||||
final updatedIds =
|
||||
@ -389,11 +390,11 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
final deletedSubspaces = existingSubSpaces
|
||||
.where((s) => !updatedIds.contains(s.internalId))
|
||||
.toList();
|
||||
for (final s in deletedSubspaces) {
|
||||
for (var s in deletedSubspaces) {
|
||||
if (s.tags != null) {
|
||||
for (final tag in s.tags!) {
|
||||
tag.location = null;
|
||||
}
|
||||
s.tags!.forEach(
|
||||
(tag) => tag.location = null,
|
||||
);
|
||||
tagsToAppendToSpace.addAll(s.tags!);
|
||||
}
|
||||
}
|
||||
@ -402,11 +403,11 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
if (existingSubSpaces != null) {
|
||||
final deletedSubspaces = existingSubSpaces;
|
||||
|
||||
for (final s in deletedSubspaces) {
|
||||
for (var s in deletedSubspaces) {
|
||||
if (s.tags != null) {
|
||||
for (final tag in s.tags!) {
|
||||
tag.location = null;
|
||||
}
|
||||
s.tags!.forEach(
|
||||
(tag) => tag.location = null,
|
||||
);
|
||||
tagsToAppendToSpace.addAll(s.tags!);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,10 +2,9 @@ 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) {
|
||||
final title = isSpace ? 'Delete Space' : 'Delete Community';
|
||||
final subtitle = 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'
|
||||
: 'All the data in the community will be lost';
|
||||
|
||||
@ -14,8 +13,7 @@ void showDeleteConfirmationDialog(
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||
child: SizedBox(
|
||||
width: 500,
|
||||
child: Container(
|
||||
@ -43,8 +41,7 @@ void showDeleteConfirmationDialog(
|
||||
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.whiteColors)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -57,17 +54,15 @@ void showDeleteConfirmationDialog(
|
||||
);
|
||||
}
|
||||
|
||||
void showProcessingPopup(
|
||||
BuildContext context, bool isSpace, VoidCallback onDelete) {
|
||||
final title = isSpace ? 'Delete Space' : 'Delete Community';
|
||||
void showProcessingPopup(BuildContext context, bool isSpace, VoidCallback onDelete) {
|
||||
final String title = isSpace ? 'Delete Space' : 'Delete Community';
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||
child: SizedBox(
|
||||
width: 500,
|
||||
child: Container(
|
||||
@ -80,8 +75,7 @@ void showProcessingPopup(
|
||||
const SizedBox(height: 20),
|
||||
_buildDialogTitle(context, title),
|
||||
const SizedBox(height: 10),
|
||||
_buildDialogSubtitle(
|
||||
context, 'Are you sure you want to delete?'),
|
||||
_buildDialogSubtitle(context, 'Are you sure you want to delete?'),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
@ -89,8 +83,7 @@ void showProcessingPopup(
|
||||
ElevatedButton(
|
||||
onPressed: onDelete,
|
||||
style: _dialogButtonStyle(ColorsManager.warningRed),
|
||||
child: const Text('Delete',
|
||||
style: TextStyle(color: ColorsManager.whiteColors)),
|
||||
child: const Text('Delete', style: TextStyle(color: ColorsManager.whiteColors)),
|
||||
),
|
||||
CancelButton(
|
||||
label: 'Cancel',
|
||||
@ -111,7 +104,7 @@ Widget _buildWarningIcon() {
|
||||
return Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorsManager.warningRed,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
@ -130,10 +123,7 @@ 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),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,8 @@ import 'package:syncrow_web/utils/color_manager.dart';
|
||||
class DuplicateProcessDialog extends StatefulWidget {
|
||||
final VoidCallback onDuplicate;
|
||||
|
||||
const DuplicateProcessDialog({required this.onDuplicate, super.key});
|
||||
const DuplicateProcessDialog({required this.onDuplicate, Key? key})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_DuplicateProcessDialogState createState() => _DuplicateProcessDialogState();
|
||||
@ -19,7 +20,7 @@ class _DuplicateProcessDialogState extends State<DuplicateProcessDialog> {
|
||||
_startDuplication();
|
||||
}
|
||||
|
||||
Future<void> _startDuplication() async {
|
||||
void _startDuplication() async {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
widget.onDuplicate();
|
||||
});
|
||||
@ -54,7 +55,7 @@ class _DuplicateProcessDialogState extends State<DuplicateProcessDialog> {
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Text(
|
||||
'Duplicating in progress',
|
||||
"Duplicating in progress",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.headlineSmall
|
||||
@ -69,7 +70,7 @@ class _DuplicateProcessDialogState extends State<DuplicateProcessDialog> {
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Text(
|
||||
'Duplicating successful',
|
||||
"Duplicating successful",
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
|
||||
@ -7,10 +7,10 @@ class IconSelectionDialog extends StatelessWidget {
|
||||
final Function(String selectedIcon) onIconSelected;
|
||||
|
||||
const IconSelectionDialog({
|
||||
super.key,
|
||||
Key? key,
|
||||
required this.spaceIconList,
|
||||
required this.onIconSelected,
|
||||
});
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -21,23 +21,21 @@ 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,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: ColorsManager.blackColor
|
||||
.withValues(alpha: 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
|
||||
),
|
||||
],
|
||||
),
|
||||
child: AlertDialog(
|
||||
title: Text('Space Icon',
|
||||
style: Theme.of(context).textTheme.headlineMedium),
|
||||
title: Text('Space Icon',style: Theme.of(context).textTheme.headlineMedium),
|
||||
backgroundColor: ColorsManager.whiteColors,
|
||||
content: Container(
|
||||
width: screenWidth * 0.4,
|
||||
|
||||
Reference in New Issue
Block a user