mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +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,82 +31,90 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 5,
|
||||
offset: const Offset(0, 3),
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
bool showOnlyName = constraints.maxWidth < 250;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 5,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
model.modelName,
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
// Left Container
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
model.modelName,
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (!showOnlyName) ...[
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
flex: 1, // Distribute space proportionally
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: DynamicRoomWidget(
|
||||
subspaceModels: model.subspaceModels,
|
||||
maxWidth: constraints.maxWidth,
|
||||
maxHeight: constraints.maxHeight,
|
||||
child: Row(
|
||||
children: [
|
||||
// Left Container
|
||||
Expanded(
|
||||
flex: 1, // Distribute space proportionally
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: DynamicRoomWidget(
|
||||
subspaceModels: model.subspaceModels,
|
||||
maxWidth: constraints.maxWidth,
|
||||
maxHeight: constraints.maxHeight,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
if (productTagCount.isNotEmpty &&
|
||||
model.subspaceModels != null)
|
||||
Container(
|
||||
width: 1.0,
|
||||
color: ColorsManager.softGray,
|
||||
margin: const EdgeInsets.symmetric(vertical: 6.0),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1, // Distribute space proportionally
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: DynamicProductWidget(
|
||||
productTagCount: productTagCount,
|
||||
maxWidth: constraints.maxWidth,
|
||||
maxHeight: constraints.maxHeight));
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (productTagCount.isNotEmpty && model.subspaceModels != null)
|
||||
Container(
|
||||
width: 1.0,
|
||||
color: ColorsManager.softGray,
|
||||
margin: const EdgeInsets.symmetric(vertical: 6.0),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1, // Distribute space proportionally
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: DynamicProductWidget(
|
||||
productTagCount: productTagCount,
|
||||
maxWidth: constraints.maxWidth,
|
||||
maxHeight: constraints.maxHeight));
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user