Skip to content

InteractiveViewer's trackpadScrollCausesScale not reliable on web platform #165049

@pathconnected

Description

@pathconnected

Intro

This is related to the fact that currently there is no reliable way to distinguish mouse / trackpad scroll events on the web:

Therefore on Firefox or on some OS trackpad events are registered as mouse events.

Steps to reproduce

  1. Have an InteractiveViewer widget in a project with trackpadScrollCausesScale field set to false.
  2. Open the project in Firefox, or on other browsers on windows / linux.
  3. Scroll with a trackpad on top of it.

Expected results

The InteractiveViewer child is not scaled.

Actual results

The InteractiveViewer child is scaled.

Code sample

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(title),
      ),
      body: Center(
        child: SizedBox.square(
          dimension: 300,
          child: InteractiveViewer(
            trackpadScrollCausesScale: false,
            child: Placeholder(),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

Flutter Doctor output

Doctor output
[cloud@psi ~]$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.1, on Arch Linux 6.13.3-arch1-1, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2024.2)
[✓] IntelliJ IDEA Community Edition (version 2024.3)
[✓] Connected device (2 available)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions