Skip to content

Interactive viewer doesn't appear to respect the trackpadScrollCauseScale #127111

@JsGjKJzi

Description

@JsGjKJzi

Is there an existing issue for this?

Steps to reproduce

#114280 seems to attempt creating an escape hatch for #112171. The docs for trackpadScrollCauseScale even spells out, scrolling on a track pad (two finger swipe up/down) should cause a zoom even when this parameter is set to true. However, setting this parameter appears to have no actual influence on the behavior of InteractiveViewer.

I am specifically compiling for web in this case using an M1 Macbook Pro and testing via flutter run -d chrome.

Expected results

I expect a two-finger swipe up/down on a trackpad to behave identically to a scroll up/down on a mouse and zoom the image in/out respectively.

Actual results

When the app first starts, a two-finger swipe in any direction on the trackpad does nothing to the image. After zooming in a little bit, either with an attached mouse with a scroll wheel or using pinch-to-zoom on the trackpad, a two finger swipe pans the image around. Neither a value of true or false to the InteractiveViewer.trackpadScrollCauseScale affects this behavior.

Code sample

Code sample
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const InteractiveViewerTesting(),
    );
  }
}

class InteractiveViewerTesting extends StatelessWidget {
  const InteractiveViewerTesting({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: InteractiveViewer(
        trackpadScrollCausesScale: true,
        child: Image.network(
          "https://storage.googleapis.com/cms-storage-bucket/ed2e069ee37807f5975a.jpg",
        ),
      ),
    );
  }
}

Screenshots or Video

The gif below was recorded with trackpadScrollCausesScale set to true. The first part of the gif is an attempt to scroll in/out using a two-finger swipe up/down on the trackpad to achieve a zoom in/out. Doing so has no effect. I then zoom in a little using a mouse with a scroll wheel, after which two-finger swipe on the trackpad still results in a pan.

Screenshots / Video demonstration

2023-05-18 11 38 27

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel master, 3.11.0-6.0.pre.134, on macOS 13.3.1 22E772610a darwin-arm64, locale en-US)
    • Flutter version 3.11.0-6.0.pre.134 on channel master at /Users/JsGjKJzi/Documents/Projects/flutter
    ! Warning: `flutter` on your path resolves to /Users/JsGjKJzi/development/flutter/bin/flutter, which is not inside your current Flutter
      SDK checkout at /Users/JsGjKJzi/Documents/Projects/flutter. Consider adding /Users/JsGjKJzi/Documents/Projects/flutter/bin to the front of
      your path.
    ! Warning: `dart` on your path resolves to /Users/JsGjKJzi/development/flutter/bin/dart, which is not inside your current Flutter SDK
      checkout at /Users/JsGjKJzi/Documents/Projects/flutter. Consider adding /Users/JsGjKJzi/Documents/Projects/flutter/bin to the front of
      your path.
    ! Upstream repository github:JsGjKJzi/flutter.git is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to github:JsGjKJzi/flutter.git to dismiss this error.
    • Framework revision f31dae2a80 (15 hours ago), 2023-05-17 17:18:51 -0700
    • Engine revision d970370779
    • Dart version 3.1.0 (build 3.1.0-118.0.dev)
    • DevTools version 2.23.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update
      checks and upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/JsGjKJzi/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.78.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 113.0.5672.126

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions