touchable
touchable copied to clipboard
Problems with Gesture Detector
Hi,
I'm using a GestureDetector around the CanvasTouchDetector, as I want to draw the shapes dynamically and the for example move the shapes per drag and drop!
When I use my coding
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
body: GestureDetector(
behavior: HitTestBehavior.translucent,
onPanUpdate: (details) {
setState(() {
RenderBox renderBox = context.findRenderObject() as RenderBox;
points.add(DrawingPoints(
points: renderBox.globalToLocal(details.globalPosition),
paint: Paint()
..strokeCap = strokeCap
..isAntiAlias = true
..color = selectedColor.withOpacity(opacity)
..strokeWidth = strokeWidth));
});
},
onPanStart: (details) {
setState(() {
RenderBox renderBox = context.findRenderObject() as RenderBox;
points.add(DrawingPoints(
points: renderBox.globalToLocal(details.globalPosition),
paint: Paint()
..strokeCap = strokeCap
..isAntiAlias = true
..color = selectedColor.withOpacity(opacity)
..strokeWidth = strokeWidth));
});
},
onPanEnd: (details) {
setState(() {
//points.add(null);
print("Area: ${_calcualteArea()}");
});
},
// child: CustomPaint(size: Size.infinite, painter: DrawingPainter(context, pointsList: points)),
child: CanvasTouchDetector(
builder: (context) => CustomPaint(size: Size.infinite, painter: DrawingPainter(context, pointsList: points)),
),
),
);
}
nothing happens no touch events where triggered :-/
Hi, any luck in figuring this out? I have the same issue.
Hi, any luck in figuring this out? I have the same issue.
I forked "touchable" and comment a few of events. Touchable preventing them to bubble up