paint method
Future<void>
paint(
- PaintingContext context,
- Offset center, {
- required RenderBox parentBox,
- required SliderThemeData sliderTheme,
- required Animation<
double> enableAnimation, - required TextDirection textDirection,
- required Offset thumbCenter,
- required bool isEnabled,
override
paint method
Implementation
@override
Future<void> paint(
PaintingContext context,
Offset center, {
required RenderBox parentBox,
required SliderThemeData sliderTheme,
required Animation<double> enableAnimation,
required TextDirection textDirection,
required Offset thumbCenter,
required bool isEnabled,
}) async {
switch (textDirection) {
case TextDirection.ltr:
break;
case TextDirection.rtl:
break;
}
/// array to store index
if (canvasXIndex.length != images.length) {
canvasXIndex.add(center.dx);
}
/// tick mark radius
final double tickMarkRadius = getPreferredSize(
isEnabled: isEnabled,
sliderTheme: sliderTheme,
).width /
3;
if (tickMarkRadius > 0) {
int index = 0;
for (var element in canvasXIndex) {
if (element == center.dx) {
break;
}
index++;
}
try {
/// draw image
if (images.isNotEmpty) {
Paint paint = Paint()..color = Colors.green;
context.canvas.save();
context.canvas.drawImage(images[index],
Offset(center.dx - 18, labelDirection == AssetDirection.below ? center.dy + 18 : center.dy - 48), paint);
context.canvas.restore();
}
} catch (exception) {
return;
}
}
}