-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InteractiveViewer scale detection fails on Android device (cannot zoom in or out) #63006
Comments
cc @justinmc |
Thanks for filing this! I wasn't seeing this happening on an emulator, is this only on a physical device? I suspect this might be related to #58636. There is some weirdness with scale gestures in general due to having multiple gesture detectors listening on top of each other. |
Yes, this is on a physical device (Pixel 2 XL, Android 10). I saw #58636 but I don't think it's directly responsible. The code in question is literally just the |
I think this is also the case with the web. In the interactive example there is a |
Looks like the zoom is not working neither in emulator nor in a device(mi A1). I also tested in flutter web master channel and same result. The code I used is just the the sample code from the documentation. |
Able to reproduce in flutter doctor -v
|
I'm also able to reproduce this in my Android One Plus 5 device. I'm using the code given in the documentation.
@pedromassango : This seems to be in release |
I tested in release |
I'm also experiencing this issue on iOS (both device and simulator). Flutter version: 1.20.0 |
I also see same issue in flutter version 1.20.0. Anyone can give other version not meet this issue? thanks |
The best way to have this fixed is to thumbs up this issue so that it will take priority over other issues. |
I can repro this on both a physical device when tapping at different times (SM G950F) as the author suggested. and an Android 11 emulator so this is not just a physical device issue. flutter doctor -v
|
Bring my tests result to here: Failures are following steps below:
Succeeds are following steps below, and have some specific cases: ①: Fingers pressed one-by-one (~100%):
②: Rapidly scaling on the screen (~65%):
③: Place two fingers close (~85%):
|
I was able to reproduce this on a physical Pixel 2 and I tracked the problem down to some scale gestures reporting a scale value of 1.0 at first, so they got interpreted as pans by InteractiveViewer. The fix is in #63543 and it seems to feel much much better to me. |
Should be fixed in #63543 on master now. If anyone still sees this let me know. |
I can also still repro this behavior on iOS and Android (both emulator and physical). It's gotten better but it's still pretty easy to get some weird behavior here. Should this be re-opened @justinmc? |
Could anyone who can reproduce this issue provides the layout you currently implemented? Because if you're using something like As a prettier format: Layout
|
Not using a Stack. If there is a differentiable effect on the usability maybe it should be opened as a separate issue. Used code sampleimport '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: InteractiveViewer(
child: Container(
color: Colors.brown,
child: Image.network(
'https://1001freedownloads.s3.amazonaws.com/vector/thumb/116435/go_board_09x09.png',
),
),
),
),
),
);
}
} |
@justinmc Should we reopen this? |
Thanks everyone for following up on this. I tried @markusaksli-nc's code above and was able to reproduce some weirdness. I've created a new issue, is this what everyone is seeing? #63999 Also watch out for this somewhat related issue: #58636 |
Thanks @justinmc for the quick fix! Would it make sense to cherry pick this into the next stable hotfix? The bug is currently in |
@justinmc The new issue describes most of what I meant. The only seemingly outright failure of gesture detection I can still easily reproduce is zooming out from the close to the corners of the screen (zooming in works fine from the corners). Though on emulator this often just results in the panning problem so it's unclear if it's a separate issue. |
@filiph No problem! That's a good idea, I'll look into it. |
@markusaksli-nc That problem seems to a mistake in the demo code. I'll respond with a full explanation over in #63999. |
I discussed this with my team and the conclusion was that it is not vital enough for a cherry pick. The next stable release cutoff is September 7th, so it shouldn't be too long of a wait. I'll remove the CP label. FYI @pcsosinski. |
@justinmc Thanks for the information. I personally would suggest to cherry pick it for a hotfix as the InteractiveView is just not usable in production. But IMHO a stable branch should only include stable widgets. We transformed our self made zoom and pan technology to InteractiveViewer and can not release because of this bug (don't want to release with master branch). Waiting until September 7th is a long time though. |
@Patcher56 Ah so sorry for interfering with your release. You may be able to get the fix a little earlier if you're able to use the dev channel. It doesn't contain the fix now, but it should be updated before stable. |
This bug makes InteractiveViewer useless. It's shame. |
@fichna This bug has been fixed and the fix is in the current stable release. If you're still seeing similar problems with InteractiveViewer, please do report. Ideally in a new bug that references this one. |
Here it is. I realized it's not problem when child is |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
flutter create bug
.main.dart
with the contents of the interactive sample in https://api.flutter.dev/flutter/widgets/InteractiveViewer-class.htmlCode listing
Here's the code in https://api.flutter.dev/flutter/widgets/InteractiveViewer-class.html as of today.
Expected results:
I can consistently zoom in and out.
Actual results:
I can almost never zoom in or out. I found a way in which I place one finger slightly before the second one and keep it stationary while the other finger moves. But even then the result is hit or miss. When trying it at first, my success rate of actually zooming in was about 5%. Very frustrating.
Logs
Discussion
I was wondering whether I'll see the same issue with vanilla
GestureDetector
. I made a tiny test and saw no problem (except when I put one finger outside the red box, but that's to be expected):Test code
For comparison, here's me trying to scale the
InteractiveViewer
in the example app. I succeed maybe two times out of many.The text was updated successfully, but these errors were encountered: