getPreferredSize method Null safety

  1. @override
Size getPreferredSize(
  1. {required SliderThemeData sliderTheme,
  2. bool isEnabled = false}
)
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 RangeSlider that this shape belongs to.

The isEnabled argument is false when RangeSlider.onChanged is null and true otherwise. When true, the slider will respond to input.

Implementation

@override
Size getPreferredSize({
  required SliderThemeData sliderTheme,
  bool isEnabled = false,
}) {
  assert(sliderTheme != null);
  assert(sliderTheme.trackHeight != null);
  assert(isEnabled != null);
  return Size.fromRadius(tickMarkRadius ?? sliderTheme.trackHeight! / 4);
}