mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-14 09:17:37 +00:00
flow
This commit is contained in:
@ -123,7 +123,6 @@ class AssignTagModelBloc
|
|||||||
|
|
||||||
bool _validateTags(List<TagModel> tags) {
|
bool _validateTags(List<TagModel> tags) {
|
||||||
if (tags.isEmpty) {
|
if (tags.isEmpty) {
|
||||||
print("tags empty");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final uniqueTags = tags.map((tag) => tag.tag?.trim() ?? '').toSet();
|
final uniqueTags = tags.map((tag) => tag.tag?.trim() ?? '').toSet();
|
||||||
|
@ -232,8 +232,6 @@ class AssignTagModelsDialog extends StatelessWidget {
|
|||||||
builder: (buttonContext) => CancelButton(
|
builder: (buttonContext) => CancelButton(
|
||||||
label: 'Add New Device',
|
label: 'Add New Device',
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.of(context).pop();
|
|
||||||
|
|
||||||
for (var tag in state.tags) {
|
for (var tag in state.tags) {
|
||||||
if (tag.location == null || subspaces == null) {
|
if (tag.location == null || subspaces == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -255,13 +253,13 @@ class AssignTagModelsDialog extends StatelessWidget {
|
|||||||
state.tags.removeWhere(
|
state.tags.removeWhere(
|
||||||
(t) => t.internalId == tag.internalId);
|
(t) => t.internalId == tag.internalId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (context.mounted) {
|
||||||
await showDialog<bool>(
|
await showDialog<bool>(
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
context:
|
context: context,
|
||||||
Navigator.of(context, rootNavigator: true)
|
builder: (dialogContext) =>
|
||||||
.context,
|
AddDeviceTypeModelWidget(
|
||||||
builder: (context) => AddDeviceTypeModelWidget(
|
|
||||||
products: products,
|
products: products,
|
||||||
subspaces: subspaces,
|
subspaces: subspaces,
|
||||||
isCreate: false,
|
isCreate: false,
|
||||||
@ -271,6 +269,7 @@ class AssignTagModelsDialog extends StatelessWidget {
|
|||||||
spaceTagModels: state.tags,
|
spaceTagModels: state.tags,
|
||||||
onUpdate: (tags, subspaces) {
|
onUpdate: (tags, subspaces) {
|
||||||
onUpdate?.call(state.tags, subspaces);
|
onUpdate?.call(state.tags, subspaces);
|
||||||
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -318,10 +317,8 @@ class AssignTagModelsDialog extends StatelessWidget {
|
|||||||
(t) => t.internalId == tag.internalId);
|
(t) => t.internalId == tag.internalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print("tryinh yo save");
|
|
||||||
|
|
||||||
onUpdate?.call(state.tags, subspaces);
|
onUpdate?.call(state.tags, subspaces);
|
||||||
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: const Text('Save'),
|
child: const Text('Save'),
|
||||||
|
@ -94,21 +94,20 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
context: navigatorContext,
|
context: navigatorContext,
|
||||||
builder: (context) => AssignTagModelsDialog(
|
builder: (context) => AssignTagModelsDialog(
|
||||||
products: products,
|
products: products,
|
||||||
subspaces: subspaces,
|
subspaces: subspaces,
|
||||||
allTags: allTags,
|
allTags: allTags,
|
||||||
initialTags: TagHelper.generateInitialTags(
|
initialTags: TagHelper.generateInitialTags(
|
||||||
subspaces: subspaces,
|
subspaces: subspaces,
|
||||||
spaceTagModels: spaceModel?.tags ?? []),
|
spaceTagModels: spaceModel?.tags ?? []),
|
||||||
title: 'Edit Device',
|
title: 'Edit Device',
|
||||||
addedProducts:
|
addedProducts:
|
||||||
TagHelper.createInitialSelectedProducts(
|
TagHelper.createInitialSelectedProducts(
|
||||||
spaceModel?.tags ?? [], subspaces),
|
spaceModel?.tags ?? [], subspaces),
|
||||||
spaceName: spaceModel?.modelName ?? '',
|
spaceName: spaceModel?.modelName ?? '',
|
||||||
onUpdate: (tags, subspaces){
|
onUpdate: (tags, subspaces) {
|
||||||
print("here");
|
onLoad?.call(tags, subspaces);
|
||||||
onLoad?.call(tags, subspaces);}
|
}),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -139,7 +138,12 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
allTags: allTags,
|
allTags: allTags,
|
||||||
spaceName: spaceNameController.text,
|
spaceName: spaceNameController.text,
|
||||||
isCreate: true,
|
isCreate: true,
|
||||||
onLoad: (tags, subspaces) => onLoad?.call(tags, subspaces),
|
onUpdate: (tags, subspaces) {
|
||||||
|
onLoad?.call(tags, subspaces);
|
||||||
|
},
|
||||||
|
onLoad: (tags, subspaces) {
|
||||||
|
onLoad?.call(tags, subspaces);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -41,12 +41,7 @@ class AddDeviceTypeModelWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
if (spaceTagModels != null) {
|
|
||||||
for (var tag in spaceTagModels!) {
|
|
||||||
print(tag.tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final size = MediaQuery.of(context).size;
|
final size = MediaQuery.of(context).size;
|
||||||
final crossAxisCount = size.width > 1200
|
final crossAxisCount = size.width > 1200
|
||||||
@ -149,7 +144,7 @@ class AddDeviceTypeModelWidget extends StatelessWidget {
|
|||||||
initialTags: state.initialTag,
|
initialTags: state.initialTag,
|
||||||
title: dialogTitle,
|
title: dialogTitle,
|
||||||
onUpdate: (tags, subspaces) {
|
onUpdate: (tags, subspaces) {
|
||||||
onLoad?.call(tags, subspaces);
|
onUpdate?.call(tags, subspaces);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user