paint method
void
paint(
- PaintingContext context,
- Offset offset,
- Offset? thumbCenter,
- Offset? startThumbCenter,
- Offset? endThumbCenter, {
- required RenderBox parentBox,
- required SfSliderThemeData themeData,
- SfRangeValues? currentValues,
- dynamic currentValue,
- required Animation<
double> enableAnimation, - required Paint? inactivePaint,
- required Paint? activePaint,
- required TextDirection textDirection,
Paints the track based on the values passed to it.
Implementation
void paint(
PaintingContext context,
Offset offset,
Offset? thumbCenter,
Offset? startThumbCenter,
Offset? endThumbCenter, {
required RenderBox parentBox,
required SfSliderThemeData themeData,
SfRangeValues? currentValues,
dynamic currentValue,
required Animation<double> enableAnimation,
required Paint? inactivePaint,
required Paint? activePaint,
required TextDirection textDirection,
}) {
final Radius radius = Radius.circular(themeData.trackCornerRadius!);
final Rect inactiveTrackRect = getPreferredRect(
parentBox,
themeData,
offset,
isActive: false,
);
final Rect activeTrackRect = getPreferredRect(
parentBox,
themeData,
offset,
isActive: true,
);
if (inactivePaint == null) {
inactivePaint = Paint();
final ColorTween inactiveTrackColorTween = ColorTween(
begin: themeData.disabledInactiveTrackColor,
end: themeData.inactiveTrackColor,
);
inactivePaint.color = inactiveTrackColorTween.evaluate(enableAnimation)!;
}
if (activePaint == null) {
activePaint = Paint();
final ColorTween activeTrackColorTween = ColorTween(
begin: themeData.disabledActiveTrackColor,
end: themeData.activeTrackColor,
);
activePaint.color = activeTrackColorTween.evaluate(enableAnimation)!;
}
_drawTrackRect(
textDirection,
thumbCenter,
startThumbCenter,
endThumbCenter,
activePaint,
inactivePaint,
inactiveTrackRect,
radius,
context,
activeTrackRect,
// ignore: avoid_as
isVertical: _isVertical(parentBox as RenderBaseSlider),
isInversed: parentBox.isInversed,
);
}