mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
refactor: extract EditChip into a private method for improved readability
This commit is contained in:
@ -67,30 +67,7 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: [
|
children: [
|
||||||
..._groupedTags.entries.map((entry) => _buildChip(context, entry)),
|
..._groupedTags.entries.map((entry) => _buildChip(context, entry)),
|
||||||
EditChip(
|
_buildEditChip(context),
|
||||||
onTap: () => showDialog<void>(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AssignTagModelsDialog(
|
|
||||||
products: products,
|
|
||||||
allSpaceModels: allSpaceModels,
|
|
||||||
subspaces: subspaces,
|
|
||||||
pageContext: pageContext,
|
|
||||||
allTags: allTags,
|
|
||||||
spaceModel: spaceModel,
|
|
||||||
otherSpaceModels: otherSpaceModels,
|
|
||||||
initialTags: TagHelper.generateInitialTags(
|
|
||||||
subspaces: subspaces,
|
|
||||||
spaceTagModels: spaceModel?.tags ?? []),
|
|
||||||
title: 'Edit Device',
|
|
||||||
addedProducts: TagHelper.createInitialSelectedProducts(
|
|
||||||
spaceModel?.tags ?? [],
|
|
||||||
subspaces,
|
|
||||||
),
|
|
||||||
spaceName: spaceModel?.modelName ?? '',
|
|
||||||
projectTags: projectTags,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -100,7 +77,35 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Chip _buildChip(
|
Widget _buildEditChip(BuildContext context) {
|
||||||
|
return EditChip(
|
||||||
|
onTap: () => showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AssignTagModelsDialog(
|
||||||
|
products: products,
|
||||||
|
allSpaceModels: allSpaceModels,
|
||||||
|
subspaces: subspaces,
|
||||||
|
pageContext: pageContext,
|
||||||
|
allTags: allTags,
|
||||||
|
spaceModel: spaceModel,
|
||||||
|
otherSpaceModels: otherSpaceModels,
|
||||||
|
initialTags: TagHelper.generateInitialTags(
|
||||||
|
subspaces: subspaces,
|
||||||
|
spaceTagModels: spaceModel?.tags ?? [],
|
||||||
|
),
|
||||||
|
title: 'Edit Device',
|
||||||
|
addedProducts: TagHelper.createInitialSelectedProducts(
|
||||||
|
spaceModel?.tags ?? [],
|
||||||
|
subspaces,
|
||||||
|
),
|
||||||
|
spaceName: spaceModel?.modelName ?? '',
|
||||||
|
projectTags: projectTags,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildChip(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
MapEntry<ProductModel, int> entry,
|
MapEntry<ProductModel, int> entry,
|
||||||
) {
|
) {
|
||||||
|
Reference in New Issue
Block a user