paint method

  1. @override
void paint (PaintingContext context, Offset thumbCenter, { Animation<double> activationAnimation, Animation<double> enableAnimation, bool isDiscrete, TextPainter labelPainter, RenderBox parentBox, SliderThemeData sliderTheme, TextDirection textDirection, double value })
override

Paints the shape, taking into account the state passed to it.

activationAnimation is an animation triggered when the user beings to interact with the slider. It reverses when the user stops interacting with the slider.

enableAnimation is an animation triggered when the Slider is enabled, and it reverses when the slider is disabled.

value is the current parametric value (from 0.0 to 1.0) of the slider.

If labelPainter is non-null, then labelPainter.paint should be called with the location that the label should appear. If the labelPainter passed is null, then no label was supplied to the Slider.

Implementation

@override
void paint(
  PaintingContext context,
  Offset thumbCenter, {
  Animation<double> activationAnimation,
  Animation<double> enableAnimation,
  bool isDiscrete,
  TextPainter labelPainter,
  RenderBox parentBox,
  SliderThemeData sliderTheme,
  TextDirection textDirection,
  double value,
}) {
  final Canvas canvas = context.canvas;
  final Tween<double> radiusTween = Tween<double>(
    begin: _disabledThumbRadius,
    end: _thumbRadius,
  );
  final ColorTween colorTween = ColorTween(
    begin: sliderTheme.disabledThumbColor,
    end: sliderTheme.thumbColor,
  );
  canvas.drawCircle(
    thumbCenter,
    radiusTween.evaluate(enableAnimation),
    Paint()..color = colorTween.evaluate(enableAnimation),
  );
}