diff --git a/package/lib/src/controls/slider.dart b/package/lib/src/controls/slider.dart index 697b0b766..3d305f4cd 100644 --- a/package/lib/src/controls/slider.dart +++ b/package/lib/src/controls/slider.dart @@ -8,6 +8,7 @@ import '../flet_app_services.dart'; import '../models/app_state.dart'; import '../models/control.dart'; import '../protocol/update_control_props_payload.dart'; +import '../utils/colors.dart'; import 'create_control.dart'; class SliderControl extends StatefulWidget { @@ -108,6 +109,12 @@ class _SliderControlState extends State { max: max, divisions: divisions, label: label?.replaceAll("{value}", _value.toString()), + activeColor: HexColor.fromString(Theme.of(context), + widget.control.attrString("activeColor", "")!), + inactiveColor: HexColor.fromString(Theme.of(context), + widget.control.attrString("inactiveColor", "")!), + thumbColor: HexColor.fromString(Theme.of(context), + widget.control.attrString("thumbColor", "")!), onChanged: !disabled ? (double value) { onChange(value, dispatch); diff --git a/sdk/python/flet/slider.py b/sdk/python/flet/slider.py index 586d08842..a938173f0 100644 --- a/sdk/python/flet/slider.py +++ b/sdk/python/flet/slider.py @@ -51,6 +51,9 @@ def __init__( max: OptionalNumber = None, divisions: Optional[int] = None, autofocus: Optional[bool] = None, + active_color: Optional[str] = None, + inactive_color: Optional[str] = None, + thumb_color: Optional[str] = None, on_change=None, on_focus=None, on_blur=None, @@ -89,6 +92,9 @@ def __init__( self.max = max self.divisions = divisions self.autofocus = autofocus + self.active_color = active_color + self.inactive_color = inactive_color + self.thumb_color = thumb_color self.on_change = on_change self.on_focus = on_focus self.on_blur = on_blur @@ -155,6 +161,33 @@ def autofocus(self) -> Optional[bool]: def autofocus(self, value: Optional[bool]): self._set_attr("autofocus", value) + # active_color + @property + def active_color(self): + return self._get_attr("activeColor") + + @active_color.setter + def active_color(self, value): + self._set_attr("activeColor", value) + + # inactive_color + @property + def inactive_color(self): + return self._get_attr("inactiveColor") + + @inactive_color.setter + def inactive_color(self, value): + self._set_attr("inactiveColor", value) + + # thumb_color + @property + def thumb_color(self): + return self._get_attr("thumbColor") + + @thumb_color.setter + def thumb_color(self, value): + self._set_attr("thumbColor", value) + # on_change @property def on_change(self):