mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
Extracted Chip into a private method.
This commit is contained in:
@ -66,31 +66,7 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
children: [
|
children: [
|
||||||
..._groupedTags.entries.map((entry) {
|
..._groupedTags.entries.map((entry) => _buildChip(context, entry)),
|
||||||
return Chip(
|
|
||||||
avatar: SizedBox(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
entry.key.icon ?? 'assets/icons/gateway.svg',
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
label: Text(
|
|
||||||
'x${entry.value}',
|
|
||||||
style: context.textTheme.bodySmall!.copyWith(
|
|
||||||
color: ColorsManager.spaceColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: ColorsManager.whiteColors,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(16),
|
|
||||||
side: const BorderSide(
|
|
||||||
color: ColorsManager.spaceColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
EditChip(
|
EditChip(
|
||||||
onTap: () => showDialog<void>(
|
onTap: () => showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -124,6 +100,35 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Chip _buildChip(
|
||||||
|
BuildContext context,
|
||||||
|
MapEntry<ProductModel, int> entry,
|
||||||
|
) {
|
||||||
|
return Chip(
|
||||||
|
avatar: SizedBox(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
entry.key.icon ?? 'assets/icons/gateway.svg',
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
label: Text(
|
||||||
|
'${entry.value}',
|
||||||
|
style: context.textTheme.bodySmall!.copyWith(
|
||||||
|
color: ColorsManager.spaceColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: ColorsManager.whiteColors,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
side: const BorderSide(
|
||||||
|
color: ColorsManager.spaceColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildAddDevicesButton(BuildContext context) {
|
Widget _buildAddDevicesButton(BuildContext context) {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
onPressed: () => showDialog<void>(
|
onPressed: () => showDialog<void>(
|
||||||
|
Reference in New Issue
Block a user