From b907e6bf9d84ee3b15bfe0cb9c6cb58b45ca3fe2 Mon Sep 17 00:00:00 2001 From: Frederik Feichtmeier Date: Thu, 14 Nov 2024 21:05:59 +0100 Subject: [PATCH] fix(Chips): chip height altered by wrong label style, padding at the right (#962) --- lib/src/themes/common_themes.dart | 8 ++++---- lib/src/widgets/yaru_choice_chip_bar.dart | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/src/themes/common_themes.dart b/lib/src/themes/common_themes.dart index c031473b..ed3670a2 100644 --- a/lib/src/themes/common_themes.dart +++ b/lib/src/themes/common_themes.dart @@ -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 = @@ -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, ), @@ -809,6 +808,7 @@ ThemeData createYaruTheme({ chipTheme: _createChipTheme( selectedColor: elevatedButtonColor ?? colorScheme.primary, colorScheme: colorScheme, + textStyle: textTheme.bodyMedium, ), ); } diff --git a/lib/src/widgets/yaru_choice_chip_bar.dart b/lib/src/widgets/yaru_choice_chip_bar.dart index 98ffbd45..e1f71707 100644 --- a/lib/src/widgets/yaru_choice_chip_bar.dart +++ b/lib/src/widgets/yaru_choice_chip_bar.dart @@ -196,14 +196,15 @@ class _YaruChoiceChipBarState extends State { 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(), );