InkHighlight constructor

InkHighlight({@required MaterialInkController controller, @required RenderBox referenceBox, @required Color color, @required TextDirection textDirection, BoxShape shape: BoxShape.rectangle, BorderRadius borderRadius, ShapeBorder customBorder, RectCallback rectCallback, VoidCallback onRemoved })

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 MaterialInkController controller,
  @required RenderBox referenceBox,
  @required Color color,
  @required TextDirection textDirection,
  BoxShape shape = BoxShape.rectangle,
  BorderRadius borderRadius,
  ShapeBorder customBorder,
  RectCallback rectCallback,
  VoidCallback onRemoved,
}) : assert(color != null),
     assert(shape != null),
     assert(textDirection != null),
     _shape = shape,
     _borderRadius = borderRadius ?? BorderRadius.zero,
     _customBorder = customBorder,
     _textDirection = textDirection,
     _rectCallback = rectCallback,
     super(controller: controller, referenceBox: referenceBox, color: color, onRemoved: onRemoved) {
  _alphaController = AnimationController(duration: _kHighlightFadeDuration, vsync: controller.vsync)
    ..addListener(controller.markNeedsPaint)
    ..addStatusListener(_handleAlphaStatusChanged)
    ..forward();
  _alpha = _alphaController.drive(IntTween(
    begin: 0,
    end: color.alpha,
  ));

  controller.addInkFeature(this);
}