@@ -42,7 +42,7 @@ class S2ChipsTile<T> extends StatelessWidget {
4242 final Widget placeholder;
4343
4444 /// Hide placeholder when the [values] is null
45- final bool placeholderIgnored ;
45+ final bool placeholderIgnore ;
4646
4747 /// Whether the chip list is scrollable or not
4848 final bool scrollable;
@@ -59,18 +59,30 @@ class S2ChipsTile<T> extends StatelessWidget {
5959 /// Chip brightness
6060 final Brightness chipBrightness;
6161
62- /// Chip action button color
63- final Color chipActionColor;
62+ /// Chip delete button color
63+ final Color chipDeleteColor;
64+
65+ /// Chip delete button icon
66+ final Icon chipDeleteIcon;
6467
6568 /// Chip spacing
6669 final double chipSpacing;
6770
6871 /// Chip run spacing
6972 final double chipRunSpacing;
7073
74+ /// Chip shape border
75+ final ShapeBorder chipShape;
76+
7177 /// Widget builder for chip item
7278 final IndexedWidgetBuilder chipBuilder;
7379
80+ /// Widget builder for chip label item
81+ final IndexedWidgetBuilder chipLabelBuilder;
82+
83+ /// Widget builder for chip avatar item
84+ final IndexedWidgetBuilder chipAvatarBuilder;
85+
7486 /// Called when the user delete the chip item.
7587 final ValueChanged <T > chipOnDelete;
7688
@@ -85,16 +97,20 @@ class S2ChipsTile<T> extends StatelessWidget {
8597 this .trailing,
8698 this .divider,
8799 this .placeholder,
88- this .placeholderIgnored = false ,
100+ this .placeholderIgnore = false ,
89101 this .scrollable = false ,
90102 this .padding,
91103 this .chipColor = Colors .black87,
92104 this .chipBorderOpacity,
93105 this .chipBrightness,
94- this .chipActionColor,
106+ this .chipDeleteColor,
107+ this .chipDeleteIcon,
95108 this .chipSpacing,
96109 this .chipRunSpacing,
110+ this .chipShape,
97111 this .chipBuilder,
112+ this .chipLabelBuilder,
113+ this .chipAvatarBuilder,
98114 this .chipOnDelete,
99115 }) : super (key: key);
100116
@@ -110,16 +126,20 @@ class S2ChipsTile<T> extends StatelessWidget {
110126 this .trailing,
111127 this .divider,
112128 this .placeholder,
113- this .placeholderIgnored = false ,
129+ this .placeholderIgnore = false ,
114130 this .scrollable = false ,
115131 this .padding,
116132 this .chipColor = Colors .black87,
117133 this .chipBorderOpacity,
118134 this .chipBrightness,
119- this .chipActionColor,
135+ this .chipDeleteColor,
136+ this .chipDeleteIcon,
120137 this .chipSpacing,
121138 this .chipRunSpacing,
139+ this .chipShape,
122140 this .chipBuilder,
141+ this .chipLabelBuilder,
142+ this .chipAvatarBuilder,
123143 this .chipOnDelete,
124144 }) :
125145 title = title ?? state.titleWidget,
@@ -149,7 +169,7 @@ class S2ChipsTile<T> extends StatelessWidget {
149169 }
150170
151171 Widget get _placeholder {
152- return placeholderIgnored != true
172+ return placeholderIgnore != true
153173 ? values? .isEmpty ?? true
154174 ? placeholder ?? const Text ('Select one or more' )
155175 : null
@@ -204,7 +224,7 @@ class S2ChipsTile<T> extends StatelessWidget {
204224 n,
205225 (i) {
206226 // build chip widget
207- Widget _chip = chipBuilder? .call (context, i) ?? _chipGenerator (i);
227+ Widget _chip = chipBuilder? .call (context, i) ?? _chipGenerator (context, i);
208228
209229 // add spacing if chip is scrollable
210230 if (scrollable) {
@@ -221,17 +241,17 @@ class S2ChipsTile<T> extends StatelessWidget {
221241 ).toList ();
222242 }
223243
224- Widget _chipGenerator (int i) {
244+ Widget _chipGenerator (BuildContext context, int i) {
225245 return Chip (
226- label: Text (
227- values[i].title,
228- style: TextStyle (
229- color: _chipIsDark ? Colors .white : chipColor
230- ),
246+ label: chipLabelBuilder? .call (context, i) ?? Text (values[i].title),
247+ labelStyle: TextStyle (
248+ color: _chipIsDark ? Colors .white : chipColor
231249 ),
250+ avatar: chipAvatarBuilder? .call (context, i),
232251 backgroundColor: _chipIsDark ? chipColor : Colors .white,
233- deleteIconColor: chipActionColor ?? _chipIsDark ? Colors .white : chipColor,
234- shape: StadiumBorder (
252+ deleteIconColor: chipDeleteColor ?? _chipIsDark ? Colors .white : chipColor,
253+ deleteIcon: chipDeleteIcon,
254+ shape: chipShape ?? StadiumBorder (
235255 side: BorderSide (
236256 color: _chipIsDark
237257 ? chipColor
0 commit comments