mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-26 11:14:55 +00:00
added tags and subspace to update space
This commit is contained in:
@ -79,6 +79,8 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
widget.selectedProducts.isNotEmpty ? widget.selectedProducts : [];
|
||||
isOkButtonEnabled =
|
||||
enteredName.isNotEmpty || nameController.text.isNotEmpty;
|
||||
tags = widget.tags ?? [];
|
||||
subspaces = widget.subspaces ?? [];
|
||||
}
|
||||
|
||||
@override
|
||||
@ -237,7 +239,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
width: screenWidth * 0.35,
|
||||
width: screenWidth * 0.25,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10.0, horizontal: 16.0),
|
||||
decoration: BoxDecoration(
|
||||
@ -312,7 +314,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
subspaces == null
|
||||
subspaces == null || subspaces!.isEmpty
|
||||
? TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
@ -344,21 +346,29 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
runSpacing: 8.0,
|
||||
children: [
|
||||
if (subspaces != null)
|
||||
...subspaces!.map((subspace) =>
|
||||
SubspaceNameDisplayWidget(
|
||||
validateName: (updatedName) {
|
||||
return !subspaces!.any((s) =>
|
||||
s != subspace &&
|
||||
s.subspaceName == updatedName);
|
||||
},
|
||||
text: subspace.subspaceName,
|
||||
onNameChanged: (updatedName) {
|
||||
setState(() {
|
||||
subspace.subspaceName =
|
||||
updatedName;
|
||||
});
|
||||
},
|
||||
)),
|
||||
...subspaces!.map((subspace) {
|
||||
return Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SubspaceNameDisplayWidget(
|
||||
text: subspace.subspaceName,
|
||||
validateName: (updatedName) {
|
||||
return subspaces!.any((s) =>
|
||||
s != subspace &&
|
||||
s.subspaceName ==
|
||||
updatedName);
|
||||
},
|
||||
onNameChanged: (updatedName) {
|
||||
setState(() {
|
||||
subspace.subspaceName =
|
||||
updatedName;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
EditChip(
|
||||
onTap: () async {
|
||||
_showSubSpaceDialog(context, enteredName,
|
||||
@ -425,14 +435,29 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
),
|
||||
|
||||
EditChip(onTap: () async {
|
||||
_showTagCreateDialog(
|
||||
context,
|
||||
enteredName,
|
||||
widget.isEdit,
|
||||
widget.products,
|
||||
subspaces,
|
||||
final result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AssignTagDialog(
|
||||
products: widget.products,
|
||||
subspaces: widget.subspaces,
|
||||
addedProducts: TagHelper
|
||||
.createInitialSelectedProductsForTags(
|
||||
tags ?? [], subspaces),
|
||||
title: 'Edit Device',
|
||||
initialTags:
|
||||
TagHelper.generateInitialForTags(
|
||||
spaceTags: tags,
|
||||
subspaces: subspaces),
|
||||
spaceName: widget.name ?? '',
|
||||
onSave:
|
||||
(updatedTags, updatedSubspaces) {
|
||||
setState(() {
|
||||
tags = updatedTags;
|
||||
subspaces = updatedSubspaces;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
// Edit action
|
||||
})
|
||||
],
|
||||
),
|
||||
@ -547,6 +572,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
setState(() {
|
||||
selectedSpaceModel = selectedModel;
|
||||
subspaces = null;
|
||||
tags = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -610,6 +636,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
||||
products: products,
|
||||
subspaces: subspaces,
|
||||
spaceTags: tags,
|
||||
isCreate: true,
|
||||
allTags: [],
|
||||
initialSelectedProducts:
|
||||
TagHelper.createInitialSelectedProductsForTags(
|
||||
|
||||
Reference in New Issue
Block a user