GappedSliderTrackShape class

The gapped shape of a Slider's track.

The GappedSliderTrackShape consists of active and inactive tracks. The active track uses the SliderThemeData.activeTrackColor and the inactive track uses the SliderThemeData.inactiveTrackColor.

The track shape uses circular corner radius for the edge corners and a corner radius of 2 pixels for the inside corners.

Between the active and inactive tracks there is a gap of size SliderThemeData.trackGap. If the SliderThemeData.thumbShape is HandleThumbShape and the thumb is pressed, the thumb's width is reduced; as a result, the track gap size in GappedSliderTrackShape is also reduced.

If SliderThemeData.trackGap is null, then the track gap size defaults to 6 pixels.

This is the default track shape for Slider. If ThemeData.useMaterial3 is false, then the default track shape is RoundedRectSliderTrackShape.

See also:

  • Slider, which includes an overlay defined by this shape.
  • SliderTheme, which can be used to configure the overlay shape of all sliders in a widget subtree.
Inheritance
Mixed-in types

Constructors

GappedSliderTrackShape()
Create a slider track that draws two rectangles with rounded outer edges.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isRounded bool
Whether the track shape is rounded.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getPreferredRect({required RenderBox parentBox, Offset offset = Offset.zero, required SliderThemeData sliderTheme, bool isEnabled = false, bool isDiscrete = false}) Rect
Returns a rect that represents the track bounds that fits within the Slider.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(PaintingContext context, Offset offset, {required RenderBox parentBox, required SliderThemeData sliderTheme, required Animation<double> enableAnimation, required TextDirection textDirection, required Offset thumbCenter, Offset? secondaryOffset, bool isDiscrete = false, bool isEnabled = false, double additionalActiveTrackHeight = 2}) → void
Paints the track shape based on the state passed to it.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited