Skip to content
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

Gallery stopped working on Android after Flutter 1.20 upgrade #304

Closed
brusinovic opened this issue Aug 7, 2020 · 13 comments
Closed

Gallery stopped working on Android after Flutter 1.20 upgrade #304

brusinovic opened this issue Aug 7, 2020 · 13 comments
Labels
Projects

Comments

@brusinovic
Copy link

brusinovic commented Aug 7, 2020

Cannot browse gallery images. Images do not respond to slides and taps, only to resize.
This is on Android only. iPhone works as expected.
This started after Flutter 1.2 upgrade.

@brusinovic brusinovic changed the title Gallery stopped working after Flutter 1.2 upgrade Gallery stopped working on Android after Flutter 1.2 upgrade Aug 7, 2020
@clragon
Copy link

clragon commented Aug 8, 2020

Yup, this is also happening to me.
If you want to compile your project while we wait for this to be resolved, you can use
flutter downgrade
to revert to a previous version that should work again.

@Creolophus
Copy link

flutter 1.2 or 1.20?

@brusinovic
Copy link
Author

flutter 1.2 or 1.20?

If you knew the math you wouldn't be asking:), but if you insist, it is 1.20.0 and also confirmed on 1.20.1

https://flutter.dev/docs/development/tools/sdk/releases

@renancaraujo
Copy link
Member

Gonna look into it asap.

If you knew the math you wouldn't be asking

And if you knew package versioning semantics you wouldn't be that rude.

@renancaraujo renancaraujo changed the title Gallery stopped working on Android after Flutter 1.2 upgrade Gallery stopped working on Android after Flutter 1.20 upgrade Aug 10, 2020
@renancaraujo renancaraujo added bug Something isn't working Framework bug P1 labels Aug 10, 2020
@renancaraujo renancaraujo added this to Todo in Bug solving via automation Aug 10, 2020
@renancaraujo renancaraujo moved this from Todo to In progress in Bug solving Aug 10, 2020
@renancaraujo
Copy link
Member

Ca I see your flutter doctor?
Also, which photo_view version are you using?

Couldnt reproduce over on channel master SDK version 1.21

@brusinovic
Copy link
Author

Please note: This issue is only on Android phone. On iPhone it works as expected.
photo_view-0.9.2

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.14.6 18G3020, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.45.1)
[✓] Connected device (3 available)

Thanks

@renancaraujo
Copy link
Member

renancaraujo commented Aug 10, 2020

Is the example gallery working fine for you?
Tested in the following conditions:

[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.5 19F101, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.43.2)
[✓] Connected device (1 available)

On an Android 10 device and simulator, I can not reproduce this bug.

@brusinovic
Copy link
Author

brusinovic commented Aug 10, 2020

Running example on multiple devices. Here is the summary:
Works fine on Pixel 3 emulator with Android 10
Does not work on Honor 7X BND-L24 with Android 8.0.0
Works on my old Honor 5 with Android 6.0.1
Works on Pixel 2 emulator with Android 8.0.0
Does not work on Huawei Mate SE BND-L34 with Android 8.0.0

I wonder what device was used by other user who was able to reproduce it.
Thanks

@renancaraujo
Copy link
Member

May be relate to: #293

@malvinpratama
Copy link

i think you can check this
dnfield/flutter_svg#368

@renancaraujo renancaraujo moved this from In progress to Todo in Bug solving Aug 20, 2020
@renancaraujo renancaraujo moved this from Todo to In progress in Bug solving Aug 24, 2020
@renancaraujo
Copy link
Member

News about this:

After some days over this, I think we can have two approaches to fix, the red and the blue pill.

The red pill:

We (PhotoViewGestureDetector) fight harder but wiser in the gesture arena.

Happens that the ScaleGestureRecognizer is the "weakest" recognizer of all, and the DragGestureRecognizer ( applied by PageView; this is what PhotoViewGallery uses) is waaaay "stronger".

DragGestureRecognizer declares itself winner with a movement of 18 pixels, whilst ScaleGestureRecognizer waits for 36.
With the original ScaleGestureRecognizer we can't have scale and pan gestures unless we extend it, as we did on PhotoViewGestureRecognizer.

This is where we fight harder. We can modify the handleEvent method to declare it winner earlier than our opponent.

This brings the problem that we always will win over the DragGestureRecognizer and lose the ability to change pages in the gallery.

This is where we fight wiser. PhotoViewGestureRecognizer should know when to lose and this is why we have HitCornersDetector. When the panning gestures hit the image edges, we have to give up on the gesture.

The bug lies in the fact that the current implementation of our recognizer and HitCornersDetector are failing to be that wise.

I'm working on that here: https://github.com/renancaraujo/photo_view/compare/detector-refactor

The Blue pill:

We (PhotoViewGestureDetector) don't fight in the gesture arena. Rather than that, we make the GestureRecognizer from the gallery's PageView give up in certain conditions.

I haven't worked on this approach yet.

@Mawrte
Copy link

Mawrte commented Sep 10, 2020

Any progress on this issue?

@tangjingyuan
Copy link

Any progress on this issue?

#326 should fixed it.

You can try to ref the lib in your pubspec.yaml as the following code:

  photo_view:
    git:
      url: https://github.com/fireslime/photo_view.git
      ref: master

@renancaraujo renancaraujo moved this from In progress to Todo in Bug solving Nov 15, 2020
Bug solving automation moved this from Todo to awaiting release Sep 16, 2021
@renancaraujo renancaraujo moved this from awaiting release to Done in Bug solving Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Bug solving
  
Done
Development

No branches or pull requests

7 participants