Skip to content

InteractiveViewer sometimes treats Scale as Pan #63999

@justinmc

Description

@justinmc

Steps to reproduce

  1. Run the code given below.
  2. Attempt many different scale gestures.
  3. Eventually, one may get stuck as a pan. You'll have two fingers on the screen, but no amount of pinching them together/apart will cause a zoom. Lifting one or more fingers will reset it.
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Demo',
      home: Scaffold(
        appBar: AppBar(title: Text('Demo')),
        body: Center(
          child: ClipRect(
            child: InteractiveViewer(
              child: Container(
                color: Colors.brown,
                child: Image.network(
                  'https://1001freedownloads.s3.amazonaws.com/vector/thumb/116435/go_board_09x09.png',
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Cause

_onScaleUpdate always receives a scale of 1.0 during this stuck gesture. That would make me think that it's a bug with GestureDetector, but I was unable to reproduce this with a lone GestureDetector. There must be something with InteractiveViewer's widget tree or configuration that causes the bug to show up.

Moved to new issue from some discussion in #63006.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: gesturesflutter/packages/flutter/gestures repository.found in release: 1.21Found to occur in 1.21frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions