Skip to content

Commit

Permalink
fix: SliderThemeData.labelForegroundColor is correctly applied (Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Dec 29, 2023
1 parent d69d866 commit 33340bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 9 additions & 3 deletions lib/src/controls/inputs/slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ class _SliderState extends m.State<Slider> {
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);

Expand All @@ -270,6 +269,9 @@ class _SliderState extends m.State<Slider> {
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,
Expand All @@ -281,10 +283,10 @@ class _SliderState extends m.State<Slider> {
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(),
Expand Down Expand Up @@ -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,
);
}
Expand All @@ -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,
);
Expand All @@ -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));
}
}

Expand Down

0 comments on commit 33340bc

Please sign in to comment.