SliderThemeData constructor Null safety
- {double? trackHeight,
- Color? activeTrackColor,
- Color? inactiveTrackColor,
- Color? disabledActiveTrackColor,
- Color? disabledInactiveTrackColor,
- Color? activeTickMarkColor,
- Color? inactiveTickMarkColor,
- Color? disabledActiveTickMarkColor,
- Color? disabledInactiveTickMarkColor,
- Color? thumbColor,
- Color? overlappingShapeStrokeColor,
- Color? disabledThumbColor,
- Color? overlayColor,
- Color? valueIndicatorColor,
- SliderComponentShape? overlayShape,
- SliderTickMarkShape? tickMarkShape,
- SliderComponentShape? thumbShape,
- SliderTrackShape? trackShape,
- SliderComponentShape? valueIndicatorShape,
- RangeSliderTickMarkShape? rangeTickMarkShape,
- RangeSliderThumbShape? rangeThumbShape,
- RangeSliderTrackShape? rangeTrackShape,
- RangeSliderValueIndicatorShape? rangeValueIndicatorShape,
- ShowValueIndicator? showValueIndicator,
- TextStyle? valueIndicatorTextStyle,
- double? minThumbSeparation,
- RangeThumbSelector? thumbSelector,
- MaterialStateProperty<
MouseCursor?> ? mouseCursor}
Create a SliderThemeData given a set of exact values.
This will rarely be used directly. It is used by lerp to create intermediate themes based on two themes.
The simplest way to create a SliderThemeData is to use copyWith on the one you get from SliderTheme.of, or create an entirely new one with SliderThemeData.fromPrimaryColors.
class Blissful extends StatefulWidget {
const Blissful({super.key});
@override
State createState() => BlissfulState();
}
class BlissfulState extends State<Blissful> {
double _bliss = 0;
@override
Widget build(BuildContext context) {
return SliderTheme(
data: SliderTheme.of(context).copyWith(activeTrackColor: const Color(0xff404080)),
child: Slider(
onChanged: (double value) { setState(() { _bliss = value; }); },
value: _bliss,
),
);
}
}
Implementation
const SliderThemeData({
this.trackHeight,
this.activeTrackColor,
this.inactiveTrackColor,
this.disabledActiveTrackColor,
this.disabledInactiveTrackColor,
this.activeTickMarkColor,
this.inactiveTickMarkColor,
this.disabledActiveTickMarkColor,
this.disabledInactiveTickMarkColor,
this.thumbColor,
this.overlappingShapeStrokeColor,
this.disabledThumbColor,
this.overlayColor,
this.valueIndicatorColor,
this.overlayShape,
this.tickMarkShape,
this.thumbShape,
this.trackShape,
this.valueIndicatorShape,
this.rangeTickMarkShape,
this.rangeThumbShape,
this.rangeTrackShape,
this.rangeValueIndicatorShape,
this.showValueIndicator,
this.valueIndicatorTextStyle,
this.minThumbSeparation,
this.thumbSelector,
this.mouseCursor,
});