mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 18:54:55 +00:00
added validation
This commit is contained in:
@ -16,8 +16,9 @@ import '../../models/subspace_template_model.dart';
|
||||
|
||||
class CreateSpaceModelDialog extends StatelessWidget {
|
||||
final List<ProductModel>? products;
|
||||
final List<String>? allTags;
|
||||
|
||||
const CreateSpaceModelDialog({Key? key, this.products}) : super(key: key);
|
||||
const CreateSpaceModelDialog({Key? key, this.products, this.allTags}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -79,6 +80,7 @@ class CreateSpaceModelDialog extends StatelessWidget {
|
||||
builder: (context) => AddDeviceTypeModelWidget(
|
||||
products: products,
|
||||
subspaces: subspaces,
|
||||
allTags: allTags,
|
||||
),
|
||||
);
|
||||
if (result == true) {
|
||||
|
||||
@ -69,7 +69,8 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
spacing: 3.0,
|
||||
runSpacing: 3.0,
|
||||
children: [
|
||||
for (var subspace in model.subspaceModels!.take(3))
|
||||
for (var subspace in model.subspaceModels!
|
||||
.take(calculateTakeCount(context)))
|
||||
SubspaceChipWidget(subspace: subspace.subspaceName),
|
||||
],
|
||||
),
|
||||
@ -126,4 +127,16 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
int calculateTakeCount(BuildContext context) {
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
// Adjust the count based on the screen width
|
||||
if (screenWidth > 1500) {
|
||||
return 3; // For large screens
|
||||
} else if (screenWidth > 1200) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1; // For smaller screens
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user