touchable icon indicating copy to clipboard operation
touchable copied to clipboard

Incorrect Gesture Arguments

Open Adityabhaumik opened this issue 3 years ago • 3 comments

Error : "The following assertion was thrown building CanvasTouchDetector(dirty, state: _CanvasTouchDetectorState#56194): Incorrect GestureDetector arguments.

Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan.

Just use the scale gesture recognizer."

I wanted to use only tap so deleting other gesture detectors solved the problem for me

Adityabhaumik avatar Aug 12 '22 14:08 Adityabhaumik

I started getting same error once I upgraded Flutter to 3.0.5

Fixed by specifying used gestures: gesturesToOverride: [GestureType.onTapDown]

srdjan86 avatar Aug 19 '22 13:08 srdjan86

That's it! Thank your so much, @srdjan86 !

S-Man42 avatar Aug 27 '22 14:08 S-Man42

Even I was facing the same issue so I implemented what others have suggested, after implementing it I'm able to see the drawing but not able to trigger the events. Below given is m code snippet please help me out with this

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; } }

ShivakumarM-Logycent avatar Jun 30 '23 01:06 ShivakumarM-Logycent