mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 03:44:56 +00:00
refactor: extract EditChip into a private method for improved readability
This commit is contained in:
@ -67,7 +67,18 @@ 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),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return _buildAddDevicesButton(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEditChip(BuildContext context) {
|
||||||
|
return EditChip(
|
||||||
onTap: () => showDialog<void>(
|
onTap: () => showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AssignTagModelsDialog(
|
builder: (context) => AssignTagModelsDialog(
|
||||||
@ -80,7 +91,8 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
otherSpaceModels: otherSpaceModels,
|
otherSpaceModels: otherSpaceModels,
|
||||||
initialTags: TagHelper.generateInitialTags(
|
initialTags: TagHelper.generateInitialTags(
|
||||||
subspaces: subspaces,
|
subspaces: subspaces,
|
||||||
spaceTagModels: spaceModel?.tags ?? []),
|
spaceTagModels: spaceModel?.tags ?? [],
|
||||||
|
),
|
||||||
title: 'Edit Device',
|
title: 'Edit Device',
|
||||||
addedProducts: TagHelper.createInitialSelectedProducts(
|
addedProducts: TagHelper.createInitialSelectedProducts(
|
||||||
spaceModel?.tags ?? [],
|
spaceModel?.tags ?? [],
|
||||||
@ -90,17 +102,10 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
projectTags: projectTags,
|
projectTags: projectTags,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
return _buildAddDevicesButton(context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Chip _buildChip(
|
Widget _buildChip(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
MapEntry<ProductModel, int> entry,
|
MapEntry<ProductModel, int> entry,
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user