Open taosimple opened 1 year ago
@override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Expanded( child: CustomPaint( foregroundPainter: SelectionPainter(notifier: notifierForeground), child: RepaintBoundary( child: CanvasTouchDetector( //key: UniqueKey(), gesturesToOverride: const [ GestureType.onTapDown, ], builder: (BuildContext context) { return CustomPaint( isComplex: true, willChange: false, painter: ChartPainter<D, Rx, Ry>( onItemSelected: (List<Rect> selectionRects, item, index, xAxisIndex, layer, tapEvent) { notifierForeground.value = selectionRects; _showTooltip(selectionRects); }, ), ); }, ), ), ), ), ], ); }
After state.build called multi times, onTapDown event will also fire multi times with one click. It seems pre touch rects not cleared ?
state.build
Workaround: add UniqueKey to CanvasTouchDetector
UniqueKey
CanvasTouchDetector
@taosimple workaround didn't help in my case. I have it wrapped in an InteractiveViewer. It still fires it multiple times
After
state.build
called multi times, onTapDown event will also fire multi times with one click. It seems pre touch rects not cleared ?Workaround: add
UniqueKey
toCanvasTouchDetector