From 33340bc34c3ee7cb16936fc65b0d3259af1f48fb Mon Sep 17 00:00:00 2001 From: Bruno D'Luka Date: Fri, 29 Dec 2023 16:09:31 -0300 Subject: [PATCH] fix: `SliderThemeData.labelForegroundColor` is correctly applied (Fixes #1000) --- CHANGELOG.md | 1 + lib/src/controls/inputs/slider.dart | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42f5d8f72..25f33bbdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## [next] * fix: `ScaffoldPage.padding` is correctly applied ([#986](https://github.com/bdlukaa/fluent_ui/issues/986)) +* fix: `SliderThemeData.labelForegroundColor` is correctly applied ([#1000](https://github.com/bdlukaa/fluent_ui/issues/1000)) ## 4.8.2 diff --git a/lib/src/controls/inputs/slider.dart b/lib/src/controls/inputs/slider.dart index f1e9e6baa..9c1ca726b 100644 --- a/lib/src/controls/inputs/slider.dart +++ b/lib/src/controls/inputs/slider.dart @@ -244,7 +244,6 @@ class _SliderState extends m.State { Widget build(BuildContext context) { assert(debugCheckHasFluentTheme(context)); assert(debugCheckHasDirectionality(context)); - final theme = FluentTheme.of(context); final style = SliderTheme.of(context).merge(widget.style); final direction = Directionality.of(context); @@ -270,6 +269,9 @@ class _SliderState extends m.State { showValueIndicator: m.ShowValueIndicator.always, thumbColor: style.thumbColor?.resolve(states), overlayShape: const m.RoundSliderOverlayShape(overlayRadius: 0), + valueIndicatorTextStyle: TextStyle( + color: style.labelForegroundColor, + ), thumbShape: SliderThumbShape( pressedElevation: 1.0, useBall: style.useThumbBall ?? true, @@ -281,10 +283,10 @@ class _SliderState extends m.State { disabledThumbRadius: style.thumbRadius?.resolve(states), ), valueIndicatorShape: _RectangularSliderValueIndicatorShape( + strokeColor: style.labelBackgroundColor, backgroundColor: style.labelBackgroundColor, vertical: widget.vertical, ltr: direction == TextDirection.ltr, - strokeColor: theme.resources.controlSolidFillColorDefault, ), trackHeight: style.trackHeight?.resolve(states), trackShape: _CustomTrackShape(), @@ -642,6 +644,8 @@ class SliderThemeData with Diagnosticable { ButtonState.lerp(a.inactiveColor, b.inactiveColor, t, Color.lerp), labelBackgroundColor: Color.lerp(a.labelBackgroundColor, b.labelBackgroundColor, t), + labelForegroundColor: + Color.lerp(a.labelForegroundColor, b.labelForegroundColor, t), useThumbBall: t < 0.5 ? a.useThumbBall : b.useThumbBall, ); } @@ -654,6 +658,7 @@ class SliderThemeData with Diagnosticable { activeColor: style?.activeColor ?? activeColor, inactiveColor: style?.inactiveColor ?? inactiveColor, labelBackgroundColor: style?.labelBackgroundColor ?? labelBackgroundColor, + labelForegroundColor: style?.labelForegroundColor ?? labelForegroundColor, useThumbBall: style?.useThumbBall ?? useThumbBall, trackHeight: style?.trackHeight ?? trackHeight, ); @@ -667,7 +672,8 @@ class SliderThemeData with Diagnosticable { ..add(DiagnosticsProperty('thumbColor', thumbColor)) ..add(DiagnosticsProperty('activeColor', activeColor)) ..add(DiagnosticsProperty('inactiveColor', inactiveColor)) - ..add(ColorProperty('labelBackgroundColor', labelBackgroundColor)); + ..add(ColorProperty('labelBackgroundColor', labelBackgroundColor)) + ..add(ColorProperty('labelForegroundColor', labelForegroundColor)); } }