8000 Touch event fire multi times unexpected · Issue #54 · nateshmbhat/touchable · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Touch event fire multi times unexpected #54
Open
@taosimple

Description

@taosimple
  @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 ?

Workaround: add UniqueKey to CanvasTouchDetector

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0