mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +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,
|
||||
children: [
|
||||
..._groupedTags.entries.map((entry) => _buildChip(context, entry)),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildEditChip(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -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,
|
||||
MapEntry<ProductModel, int> entry,
|
||||
) {
|
||||
|
Reference in New Issue
Block a user