0

Based on the issue issue 47 I implemented the way they mentioned but still I'm not able to fix the issue

The below code is my implementation of flutter touchable library

// ignore_for_file: non_constant_identifier_names, must_be_immutable

import 'package:flutter/material.dart';
import 'package:touchable/touchable.dart';

class Bevel extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: CanvasTouchDetector(
        gesturesToOverride: const [GestureType.onTapDown],
        builder: (context) => CustomPaint(
          painter: MyPainter(context),
        ),
      ),
    );
  }
}

class MyPainter extends CustomPainter {
  final BuildContext context;
  MyPainter(this.context);

  @override
  void paint(Canvas canvas, Size size) {
    TouchyCanvas touchyCanvas = TouchyCanvas(context, canvas);

    var blueCircle = Offset(size.width / 2, size.height / 2 - 100);
    var greenCircle = Offset(size.width / 2, size.height / 2 + 100);

    touchyCanvas.drawCircle(blueCircle, 60, Paint()..color = Colors.blue,
        onTapDown: (_) {
      print('You clicked BLUE circle');
    });

    touchyCanvas.drawCircle(greenCircle, 30, Paint()..color = Colors.green,
        onLongPressStart: (_) {
      print('long pressed on GREEN circle');
    });
  }

  @override
  bool shouldRepaint(MyPainter oldDelegate) {
    return false;
  }
}

this code is not triggering the onLongPressStart and onTapDown events. Please help me out to fix the issue

0 Answers0