Skip to content

Commit

Permalink
fix(Chips): chip height altered by wrong label style, padding at the …
Browse files Browse the repository at this point in the history
…right (#962)
  • Loading branch information
Feichtmeier authored Nov 14, 2024
1 parent 9d1558b commit b907e6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions lib/src/themes/common_themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ SnackBarThemeData _createSnackBarTheme(ColorScheme colorScheme) {
ChipThemeData _createChipTheme({
required Color selectedColor,
required ColorScheme colorScheme,
required TextStyle? textStyle,
}) {
final isHC = colorScheme.isHighContrast == true;
final selectedBackgroundColor =
Expand All @@ -669,11 +670,9 @@ ChipThemeData _createChipTheme({

return ChipThemeData(
selectedColor: selectedBackgroundColor.withOpacity(isHC ? 1 : 0.4),
labelStyle: TextStyle(
color: colorScheme.onSurface,
),
labelStyle: textStyle?.copyWith(color: colorScheme.onSurface),
checkmarkColor: selectedForeGroundColor,
secondaryLabelStyle: TextStyle(
secondaryLabelStyle: textStyle?.copyWith(
color: selectedForeGroundColor,
fontWeight: isHC ? FontWeight.bold : FontWeight.normal,
),
Expand Down Expand Up @@ -809,6 +808,7 @@ ThemeData createYaruTheme({
chipTheme: _createChipTheme(
selectedColor: elevatedButtonColor ?? colorScheme.primary,
colorScheme: colorScheme,
textStyle: textTheme.bodyMedium,
),
);
}
Expand Down
15 changes: 8 additions & 7 deletions lib/src/widgets/yaru_choice_chip_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,15 @@ class _YaruChoiceChipBarState extends State<YaruChoiceChipBar> {
scrollDirection: Axis.horizontal,
controller: _controller,
children: children
.map(
(e) => Padding(
padding: EdgeInsets.only(
right: widget.spacing,
),
child: e,
),
.expand(
(item) sync* {
yield SizedBox(
width: widget.spacing,
);
yield item;
},
)
.skip(1)
.toList(),
);

Expand Down

0 comments on commit b907e6b

Please sign in to comment.