paint method
void
paint(})
Implementation
void paint(PaintingContext context,
Offset center, {
required Animation<double> activationAnimation,
required Animation<double> enableAnimation,
required double value,
required Size size,
required Offset thumbCenter,
}) {
final Canvas canvas = context.canvas;
final height = size.height;
final enabledThumbRadius = height / 2 - RoundThumbShape.marginRingWidth;
final disabledThumbRadius = height / 2 - RoundThumbShape.marginRingWidth;
final Tween<double> radiusTween = Tween<double>(
begin: disabledThumbRadius,
end: enabledThumbRadius,
);
Color thumbColor = _getCurrentColor(value, gradientColors, gradientStops);
final ColorTween thumbColorTween = ColorTween(
begin: Color.alphaBlend(thumbColor.withOpacity(0.5), Colors.black87),
end: thumbColor,
);
final ColorTween shadowColorTween = ColorTween(
begin: Colors.transparent,
end: Colors.black,
);
final Color color = thumbColorTween.evaluate(enableAnimation)!;
final Color shadowColor = shadowColorTween.evaluate(enableAnimation)!;
final double radius = radiusTween.evaluate(enableAnimation);
final Tween<double> elevationTween = Tween<double>(
begin: elevation,
end: pressedElevation,
);
final double evaluatedElevation = elevationTween.evaluate(activationAnimation);
final Path path = Path()
..addArc(Rect.fromCenter(center: center, width: 2 * radius, height: 2 * radius), 0, math.pi * 2);
canvas.drawShadow(path, shadowColor, evaluatedElevation, true);
canvas.drawCircle(
center,
(radius - marginRingWidth * (1 - activationAnimation.value)),
Paint()
..color = Colors.white
..style = PaintingStyle.stroke
..isAntiAlias = true
..strokeWidth = marginRingWidth,
);
canvas.drawCircle(center, radius + evaluatedElevation - 2 * marginRingWidth, Paint()
..color = color);
}