mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
added all tags
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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),
|
||||
|
@ -112,14 +112,14 @@ class SpaceModelPage extends StatelessWidget {
|
||||
double _calculateChildAspectRatio(BuildContext context) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
if (screenWidth > 1600) {
|
||||
return 2;
|
||||
return 1.5; // Decrease to make cards taller
|
||||
}
|
||||
if (screenWidth > 1200) {
|
||||
return 3;
|
||||
return 2.0;
|
||||
} else if (screenWidth > 800) {
|
||||
return 3.5;
|
||||
return 2.5;
|
||||
} else {
|
||||
return 4.0;
|
||||
return 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,9 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
bool showOnlyName = constraints.maxWidth < 250;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
@ -57,6 +60,7 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (!showOnlyName) ...[
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
child: Row(
|
||||
@ -80,7 +84,8 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (productTagCount.isNotEmpty && model.subspaceModels != null)
|
||||
if (productTagCount.isNotEmpty &&
|
||||
model.subspaceModels != null)
|
||||
Container(
|
||||
width: 1.0,
|
||||
color: ColorsManager.softGray,
|
||||
@ -105,8 +110,11 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user