mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
fixed issue in creating space
This commit is contained in:
@ -457,7 +457,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
context: context,
|
||||
builder: (context) => AssignTagDialog(
|
||||
products: widget.products,
|
||||
subspaces: widget.subspaces,
|
||||
subspaces: subspaces,
|
||||
addedProducts: TagHelper
|
||||
.createInitialSelectedProductsForTags(
|
||||
tags ?? [], subspaces),
|
||||
@ -488,7 +488,6 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
enteredName,
|
||||
widget.isEdit,
|
||||
widget.products,
|
||||
subspaces,
|
||||
);
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
@ -617,9 +616,26 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
products: products,
|
||||
existingSubSpaces: existingSubSpaces,
|
||||
onSave: (slectedSubspaces) {
|
||||
final List<Tag> tagsToAppendToSpace = [];
|
||||
|
||||
if (slectedSubspaces != null) {
|
||||
final updatedIds =
|
||||
slectedSubspaces.map((s) => s.internalId).toSet();
|
||||
if (existingSubSpaces != null) {
|
||||
final deletedSubspaces = existingSubSpaces
|
||||
.where((s) => !updatedIds.contains(s.internalId))
|
||||
.toList();
|
||||
for (var s in deletedSubspaces) {
|
||||
if (s.tags != null) {
|
||||
tagsToAppendToSpace.addAll(s.tags!);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (slectedSubspaces != null) {
|
||||
setState(() {
|
||||
subspaces = slectedSubspaces;
|
||||
tags?.addAll(tagsToAppendToSpace);
|
||||
selectedSpaceModel = null;
|
||||
});
|
||||
}
|
||||
@ -629,7 +645,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
}
|
||||
|
||||
void _showTagCreateDialog(BuildContext context, String name, bool isEdit,
|
||||
List<ProductModel>? products, List<SubspaceModel>? subspaces) {
|
||||
List<ProductModel>? products) {
|
||||
isEdit
|
||||
? showDialog(
|
||||
context: context,
|
||||
|
Reference in New Issue
Block a user