-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Description
My macos
app uses an InteractiveViewer
.
When built with Flutter 3.0.5
I can zoom/scale the viewer content using the mouse scroll wheel. Using a trackpad I can zoom with a "2-finger vertical-pan" gesture.
When built with a recent Flutter 3.3.x
version I can no longer zoom the content via the mouse. If I use a trackpad I can zoom using a pinch gesture.
I suspect this change in behavior is related to #107005, but not sure.
Are there docs that I'm not finding that describe this change in behavior?
What I want to know is how to zoom the InteractiveViewer
using the old behavior, on macos
. Do I need to do this by capturing the events and programmatically zooming using a TransformationController
?
Steps to Reproduce
- Install Flutter 3.0.5 (
git checkout 3.0.5
,flutter doctor
) - Execute
flutter run
on the code sample
Expected and Actual results:
Zooming works using the mouse scroll wheel and trackpad 2-finger vertical-pan gesture.
- Install current Flutter 3.3.x (
flutter channel stable
flutter upgrade
) - Execute
flutter run
on the code sample
Expected results:
Able to zoom using the mouse scroll wheel and trackpad 2-finger vertical-pan gesture..
Actual results:
Only able to scroll via trackpad pinch gesture.
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const MyStatelessWidget(),
),
);
}
}
class MyStatelessWidget extends StatelessWidget {
const MyStatelessWidget({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: InteractiveViewer(
boundaryMargin: const EdgeInsets.all(double.infinity),
minScale: 0.1,
maxScale: 1.6,
child: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: <Color>[Colors.orange, Colors.red],
stops: <double>[0.0, 1.0],
),
),
),
),
);
}
}
Logs
[✓] Flutter (Channel stable, 3.3.6, on macOS 12.5.1 21G83 darwin-x64, locale en-US)
• Flutter version 3.3.6 on channel stable at /Applications/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 6928314d50 (3 days ago), 2022-10-25 16:34:41 -0400
• Engine revision 3ad69d7be3
• Dart version 2.18.2
• DevTools version 2.15.0
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13F100
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] VS Code (version 1.72.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.50.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 12.5.1 21G83 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.