getPreferredRect method Null safety

Rect getPreferredRect(
  1. {required RenderBox parentBox,
  2. Offset offset = Offset.zero,
  3. required SliderThemeData sliderTheme,
  4. bool isEnabled,
  5. bool isDiscrete}
)

Returns the preferred bounds of the shape.

It is used to provide horizontal boundaries for the thumb's position, and to help position the slider thumb and tick marks relative to the track.

The parentBox argument can be used to help determine the preferredRect relative to attributes of the render box of the slider itself, such as size.

The offset argument is relative to the caller's bounding box. It can be used to convert gesture coordinates from global to slider-relative coordinates.

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.

The isDiscrete argument is true if Slider.divisions is non-null. When true, the slider will render tick marks on top of the track.

Implementation

Rect getPreferredRect({
  required RenderBox parentBox,
  Offset offset = Offset.zero,
  required SliderThemeData sliderTheme,
  bool isEnabled,
  bool isDiscrete,
});