Skip to content

Commit 2a7ede8

Browse files
committed
Add labelStyle to configure label text style
1 parent d68e087 commit 2a7ede8

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.2.0] - 2020-04-05
2+
3+
* Add `labelStyle` to `ChipsChoiceItemConfig`
4+
15
## [1.1.0] - 2020-03-07
26

37
* Improve performance, since `Theme.of(context)` in default choice widget is moved outside, so this only fired once

example/lib/main.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ class _MyHomePageState extends State<MyHomePage> {
169169
)..insert(0, ChipsChoiceOption<int>(value: -1, label: 'All')),
170170
itemConfig: const ChipsChoiceItemConfig(
171171
showCheckmark: false,
172+
labelStyle: TextStyle(
173+
fontSize: 20
174+
),
172175
selectedBrightness: Brightness.dark,
173176
// unselectedBrightness: Brightness.dark,
174177
),

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ packages:
4242
path: ".."
4343
relative: true
4444
source: path
45-
version: "1.1.0"
45+
version: "1.2.0"
4646
collection:
4747
dependency: transitive
4848
description:

lib/chips_choice.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class _ChipsChoiceItem<T> extends StatelessWidget {
199199
child: FilterChip(
200200
label: Text(
201201
item.label,
202-
style: TextStyle(color: textColor),
202+
style: config?.labelStyle?.copyWith(color: textColor) ?? TextStyle(color: textColor),
203203
),
204204
avatar: item.avatar,
205205
shape: config.shapeBuilder?.call(selected) ?? StadiumBorder(
@@ -302,6 +302,9 @@ class ChipsChoiceItemConfig {
302302
/// whether the chips use checkmark or not
303303
final bool showCheckmark;
304304

305+
/// label style
306+
final TextStyle labelStyle;
307+
305308
/// Selected item color
306309
final Color selectedColor;
307310

@@ -336,6 +339,7 @@ class ChipsChoiceItemConfig {
336339
this.elevation = 0,
337340
this.pressElevation = 0,
338341
this.showCheckmark = true,
342+
this.labelStyle = const TextStyle(),
339343
this.selectedColor,
340344
this.unselectedColor,
341345
this.selectedBrightness = Brightness.light,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: chips_choice
22
description: Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips.
3-
version: 1.1.0
3+
version: 1.2.0
44
author: Irfan Vigma Taufik<davigmacode@gmail.com>
55
homepage: https://github.com/davigmacode/flutter_chips_choice
66

0 commit comments

Comments
 (0)