added all tags

This commit is contained in:
hannathkadher
2025-01-29 12:24:12 +04:00
parent e4262d08a5
commit c173df934d
4 changed files with 98 additions and 76 deletions

View File

@ -295,6 +295,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
return CreateSpaceDialog(
products: widget.products,
spaceModels: widget.spaceModels,
allTags: _getAllTagValues(spaces),
parentSpace: parentIndex != null ? spaces[parentIndex] : null,
onCreateSpace: (String name,
String icon,
@ -354,6 +355,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
tags: widget.selectedSpace?.tags,
subspaces: widget.selectedSpace?.subspaces,
isEdit: true,
allTags: _getAllTagValues(spaces),
onCreateSpace: (String name,
String icon,
List<SelectedProduct> selectedProducts,
@ -745,4 +747,14 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
duplicateRecursive(space, space.position, duplicatedParent);
}
}
List<String> _getAllTagValues(List<SpaceModel> spaces) {
final List<String> allTags = [];
for (final space in spaces) {
if (space.tags != null) {
allTags.addAll(space.listAllTagValues());
}
}
return allTags;
}
}

View File

@ -39,6 +39,7 @@ class CreateSpaceDialog extends StatefulWidget {
final List<SpaceTemplateModel>? spaceModels;
final List<SubspaceModel>? subspaces;
final List<Tag>? tags;
final List<String>? allTags;
const CreateSpaceDialog(
{super.key,
@ -49,6 +50,7 @@ class CreateSpaceDialog extends StatefulWidget {
this.icon,
this.isEdit = false,
this.editSpace,
this.allTags,
this.selectedProducts = const [],
this.spaceModels,
this.subspaces,
@ -628,7 +630,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
spaceName: name,
products: products,
subspaces: subspaces,
allTags: [],
allTags: widget.allTags,
onSave: (selectedSpaceTags, selectedSubspaces) {
setState(() {
tags = selectedSpaceTags;
@ -660,7 +662,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
subspaces: subspaces,
spaceTags: tags,
isCreate: true,
allTags: [],
allTags: widget.allTags,
initialSelectedProducts:
TagHelper.createInitialSelectedProductsForTags(
tags, subspaces),