From 8b8e1dabb0dfee1387f034998341077091fb525f Mon Sep 17 00:00:00 2001 From: Alexandru Mariuti Date: Mon, 25 Nov 2024 11:20:46 +0100 Subject: [PATCH] fix: update theme --- lib/src/components/time_picker.dart | 35 ++++--------------- ...ult_theme_no_secondary_border_variant.dart | 8 ++--- .../theme/themes/default_theme_variant.dart | 8 ++--- 3 files changed, 15 insertions(+), 36 deletions(-) diff --git a/lib/src/components/time_picker.dart b/lib/src/components/time_picker.dart index f1256d11..d1095981 100644 --- a/lib/src/components/time_picker.dart +++ b/lib/src/components/time_picker.dart @@ -710,8 +710,9 @@ class _ShadTimePickerFieldState extends State { height: 24 / 16, ); - final effectivePlaceholderStyle = - defaultPlaceholderStyle.merge(controller.placeholderStyle); + final effectivePlaceholderStyle = defaultPlaceholderStyle + .merge(theme.timePickerTheme.placeholderStyle) + .merge(controller.placeholderStyle); final defaultLabelStyle = theme.textTheme.small.copyWith(fontSize: 12); final effectiveLabelStyle = defaultLabelStyle.merge(widget.labelStyle); @@ -798,11 +799,6 @@ class ShadTimePickerTextEditingController extends TextEditingController { assert( !value.composing.isValid || !withComposing || value.isComposingRangeValid, ); - // If the composing range is out of range for the current text, ignore it to - // preserve the tree integrity, otherwise in release mode a RangeError will - // be thrown and this EditableText will be built with a broken subtree. - final composingRegionOutOfRange = - !value.isComposingRangeValid || !withComposing; final theme = ShadTheme.of(context); @@ -817,29 +813,12 @@ class ShadTimePickerTextEditingController extends TextEditingController { final intValue = int.tryParse(value.text); if (intValue == null) return const TextSpan(); - if (composingRegionOutOfRange) { - return TextSpan( - style: style, - children: [ - if (value.text.length == 1 && intValue < 10) - TextSpan(text: '0', style: effectivePlaceholderStyle), - TextSpan(text: text), - ], - ); - } - - final composingStyle = - style?.merge(const TextStyle(decoration: TextDecoration.underline)) ?? - const TextStyle(decoration: TextDecoration.underline); return TextSpan( style: style, - children: [ - TextSpan(text: value.composing.textBefore(value.text)), - TextSpan( - style: composingStyle, - text: value.composing.textInside(value.text), - ), - TextSpan(text: value.composing.textAfter(value.text)), + children: [ + if (value.text.length == 1 && intValue < 10) + TextSpan(text: '0', style: effectivePlaceholderStyle), + TextSpan(text: text), ], ); } diff --git a/lib/src/theme/themes/default_theme_no_secondary_border_variant.dart b/lib/src/theme/themes/default_theme_no_secondary_border_variant.dart index 9d174bf1..3da89ab1 100644 --- a/lib/src/theme/themes/default_theme_no_secondary_border_variant.dart +++ b/lib/src/theme/themes/default_theme_no_secondary_border_variant.dart @@ -885,11 +885,11 @@ class ShadDefaultThemeNoSecondaryBorderVariant extends ShadThemeVariant { fontSize: 16, height: 24 / 16, ), - placeholderStyle: defaultTextTheme.large.copyWith( - fontWeight: FontWeight.w500, - color: colorScheme.foreground, + placeholderStyle: effectiveTextTheme.muted.copyWith( + fontSize: 16, + height: 24 / 16, ), - labelStyle: defaultTextTheme.small.copyWith(fontSize: 12), + labelStyle: effectiveTextTheme.small.copyWith(fontSize: 12), fieldWidth: 58, fieldPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), periodHeight: 50, diff --git a/lib/src/theme/themes/default_theme_variant.dart b/lib/src/theme/themes/default_theme_variant.dart index 4f414b47..78cc216b 100644 --- a/lib/src/theme/themes/default_theme_variant.dart +++ b/lib/src/theme/themes/default_theme_variant.dart @@ -858,11 +858,11 @@ class ShadDefaultThemeVariant extends ShadThemeVariant { fontSize: 16, height: 24 / 16, ), - placeholderStyle: defaultTextTheme.large.copyWith( - fontWeight: FontWeight.w500, - color: colorScheme.foreground, + placeholderStyle: effectiveTextTheme.muted.copyWith( + fontSize: 16, + height: 24 / 16, ), - labelStyle: defaultTextTheme.small.copyWith(fontSize: 12), + labelStyle: effectiveTextTheme.small.copyWith(fontSize: 12), fieldWidth: 58, fieldPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), periodHeight: 50,