InkHighlight constructor
- required MaterialInkController controller,
- required RenderBox referenceBox,
- required Color color,
- required TextDirection textDirection,
- BoxShape shape = BoxShape.rectangle,
- double? radius,
- BorderRadius? borderRadius,
- ShapeBorder? customBorder,
- RectCallback? rectCallback,
- VoidCallback? onRemoved,
- Duration fadeDuration = _kDefaultHighlightFadeDuration,
Begin a highlight animation.
The controller
argument is typically obtained via
Material.of(context)
.
If a rectCallback
is given, then it provides the highlight rectangle,
otherwise, the highlight rectangle is coincident with the referenceBox.
When the highlight is removed, onRemoved
will be called.
Implementation
InkHighlight({
required super.controller,
required super.referenceBox,
required super.color,
required TextDirection textDirection,
BoxShape shape = BoxShape.rectangle,
double? radius,
BorderRadius? borderRadius,
super.customBorder,
RectCallback? rectCallback,
super.onRemoved,
Duration fadeDuration = _kDefaultHighlightFadeDuration,
}) : _shape = shape,
_radius = radius,
_borderRadius = borderRadius ?? BorderRadius.zero,
_textDirection = textDirection,
_rectCallback = rectCallback {
_alphaController = AnimationController(duration: fadeDuration, vsync: controller.vsync)
..addListener(controller.markNeedsPaint)
..addStatusListener(_handleAlphaStatusChanged)
..forward();
_alpha = _alphaController.drive(IntTween(
begin: 0,
end: color.alpha,
));
controller.addInkFeature(this);
}