getPreferredSize method Null safety
- {required SliderThemeData sliderTheme,
- required bool isEnabled}
override
Returns the preferred size of the shape.
It is used to help position the tick marks within the slider.
the sliderTheme
argument is the theme assigned to the Slider that this
shape belongs to.
The isEnabled
argument is false when Slider.onChanged is null and true
otherwise. When true, the slider will respond to input.
Implementation
@override
Size getPreferredSize({
required SliderThemeData sliderTheme,
required bool isEnabled,
}) {
assert(sliderTheme != null);
assert(sliderTheme.trackHeight != null);
assert(isEnabled != null);
// The tick marks are tiny circles. If no radius is provided, then the
// radius is defaulted to be a fraction of the
// [SliderThemeData.trackHeight]. The fraction is 1/4.
return Size.fromRadius(tickMarkRadius ?? sliderTheme.trackHeight! / 4);
}