Skip to content

Commit

Permalink
Add labelStyle to configure label text style
Browse files Browse the repository at this point in the history
  • Loading branch information
davigmacode committed Apr 5, 2020
1 parent d68e087 commit 2a7ede8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.2.0] - 2020-04-05

* Add `labelStyle` to `ChipsChoiceItemConfig`

## [1.1.0] - 2020-03-07

* Improve performance, since `Theme.of(context)` in default choice widget is moved outside, so this only fired once
Expand Down
3 changes: 3 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ class _MyHomePageState extends State<MyHomePage> {
)..insert(0, ChipsChoiceOption<int>(value: -1, label: 'All')),
itemConfig: const ChipsChoiceItemConfig(
showCheckmark: false,
labelStyle: TextStyle(
fontSize: 20
),
selectedBrightness: Brightness.dark,
// unselectedBrightness: Brightness.dark,
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.1.0"
version: "1.2.0"
collection:
dependency: transitive
description:
Expand Down
6 changes: 5 additions & 1 deletion lib/chips_choice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class _ChipsChoiceItem<T> extends StatelessWidget {
child: FilterChip(
label: Text(
item.label,
style: TextStyle(color: textColor),
style: config?.labelStyle?.copyWith(color: textColor) ?? TextStyle(color: textColor),
),
avatar: item.avatar,
shape: config.shapeBuilder?.call(selected) ?? StadiumBorder(
Expand Down Expand Up @@ -302,6 +302,9 @@ class ChipsChoiceItemConfig {
/// whether the chips use checkmark or not
final bool showCheckmark;

/// label style
final TextStyle labelStyle;

/// Selected item color
final Color selectedColor;

Expand Down Expand Up @@ -336,6 +339,7 @@ class ChipsChoiceItemConfig {
this.elevation = 0,
this.pressElevation = 0,
this.showCheckmark = true,
this.labelStyle = const TextStyle(),
this.selectedColor,
this.unselectedColor,
this.selectedBrightness = Brightness.light,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: chips_choice
description: Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips.
version: 1.1.0
version: 1.2.0
author: Irfan Vigma Taufik<davigmacode@gmail.com>
homepage: https://github.com/davigmacode/flutter_chips_choice

Expand Down

0 comments on commit 2a7ede8

Please sign in to comment.