TouchyCanvas constructor
TouchyCanvas(
- BuildContext context,
- Canvas _canvas, {
- ScrollController? scrollController,
- AxisDirection scrollDirection = AxisDirection.down,
TouchyCanvas helps you add gesture callbacks to the shapes you draw.
context
is the BuildContext that is obtained from the CanvasTouchDetector widget's builder function.
The parameter canvas
is the Canvas object that you get in your paint
method inside CustomPainter
Implementation
TouchyCanvas(
BuildContext context,
this._canvas, {
ScrollController? scrollController,
AxisDirection scrollDirection = AxisDirection.down,
}) {
var touchController = TouchDetectionController.of(context);
touchController?.addListener((event) {
_shapeHandler.handleGestureEvent(
event,
scrollController: scrollController,
direction: scrollDirection,
);
});
}