paint method

void paint(
  1. PaintingContext context,
  2. Offset offset,
  3. Offset? thumbCenter,
  4. Offset? startThumbCenter,
  5. Offset? endThumbCenter, {
  6. required RenderBox parentBox,
  7. required SfSliderThemeData themeData,
  8. SfRangeValues? currentValues,
  9. dynamic currentValue,
  10. required Animation<double> enableAnimation,
  11. required Paint? inactivePaint,
  12. required Paint? activePaint,
  13. 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,
  );
}