Skip to content

Commit dcc820a

Browse files
committed
fix: Allow custom icons in ZetaFilterSelection
1 parent faaa6fe commit dcc820a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/src/components/filter_selection/filter_selection.dart

+9-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class ZetaFilterSelection extends ZetaStatelessWidget {
1313
required this.items,
1414
this.onPressed,
1515
this.buttonSemanticLabel,
16+
this.icon = ZetaIcons.filter,
1617
});
1718

1819
/// The filter items - list of [ZetaFilterChip].
@@ -26,6 +27,11 @@ class ZetaFilterSelection extends ZetaStatelessWidget {
2627
/// {@macro zeta-widget-semantic-label}
2728
final String? buttonSemanticLabel;
2829

30+
/// Icon for the filter button.
31+
///
32+
/// Default is [ZetaIcons.filter].
33+
final IconData icon;
34+
2935
@override
3036
Widget build(BuildContext context) {
3137
return SizedBox(
@@ -43,10 +49,7 @@ class ZetaFilterSelection extends ZetaStatelessWidget {
4349
child: IconButton(
4450
visualDensity: VisualDensity.compact,
4551
onPressed: onPressed,
46-
icon: const ZetaIcon(
47-
ZetaIcons.filter,
48-
size: ZetaSpacing.xl_2,
49-
),
52+
icon: ZetaIcon(icon, size: ZetaSpacing.xl_2),
5053
),
5154
),
5255
),
@@ -70,6 +73,7 @@ class ZetaFilterSelection extends ZetaStatelessWidget {
7073
properties
7174
..add(DiagnosticsProperty<bool>('rounded', rounded))
7275
..add(ObjectFlagProperty<VoidCallback?>.has('onPressed', onPressed))
73-
..add(StringProperty('buttonSemanticLabel', buttonSemanticLabel));
76+
..add(StringProperty('buttonSemanticLabel', buttonSemanticLabel))
77+
..add(DiagnosticsProperty<IconData>('icon', icon));
7478
}
7579
}

0 commit comments

Comments
 (0)