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

Can gallery mode support 'detect image edge' but not unlock when contained? #41

Closed
Shu-Ji opened this issue Oct 20, 2018 · 8 comments
Closed
Labels
enhancement New feature or request Gallery help wanted Extra attention is needed physics

Comments

@Shu-Ji
Copy link

Shu-Ji commented Oct 20, 2018

I find out that the gallery mode is something like twitter-mode: you can't change image if its scale is bigger than 1.0 or _locked = scaleState != PhotoViewScaleState.contained.

So, is there any way to make _locked = false, while swipe reaches the image's edge(left or right), no matter whats scale the image has. And also swipe up or swipe down to close when reaches the image's edge(top or bottom).

What I'm saying is something like this(WeChat app):

ezgif com-resize

But not use the _lock when contained happens:

// this is from the source
  void scaleStateChangedCallback(PhotoViewScaleState scaleState) {
    setState(() {
      _locked = scaleState != PhotoViewScaleState.contained;
    });
  }

// may be
  void scaleStateChangedCallback(PhotoViewScaleState scaleState) {
    setState(() {
      _locked = notReachTheImageEdge();
    });
  }
@renancaraujo renancaraujo added the enhancement New feature or request label Oct 23, 2018
@renancaraujo
Copy link
Member

That will be tricky due to PageView's behavior. Let's see what we can do about that.

@dasmikko
Copy link

dasmikko commented Dec 4, 2018

A possible solution:

Have a callback methods that fires each time the image panned and then returns ithe current state like so:

  • AtInitialSize
  • AtScreenEdge
  • Panning (Needs a better name, but it's neither at initialSize nor edge)

Then you simple can set the PageView's physics based on that,

Correct me if i'm wrong.

@renancaraujo
Copy link
Member

Great idea @dasmikko I will work on something like that soon (more callbacks).

@renancaraujo renancaraujo added the help wanted Extra attention is needed label Dec 29, 2018
@renancaraujo renancaraujo added this to the 0.2.0 milestone Jan 7, 2019
@LebenNNA
Copy link

LebenNNA commented Feb 18, 2019

When I implemented this scheme, I added a callback method to check the touch margin. When I touched the margin, I made locked=false, and at the same time judged the initial direction of the sliding gesture. Locked=true when sliding in the opposite direction. But the process of implementation I have encountered a problem, when my scrollListener listens to the reverse slide, making locked=true will make the page card master, and there is no error message. @Shu-Ji @dasmikko @renancaraujo

@LebenNNA
Copy link

LebenNNA commented Feb 18, 2019

Can you add a WeChat friend to solve this problem? @Shu-Ji My wechat Id NA0421

@Shu-Ji
Copy link
Author

Shu-Ji commented Feb 19, 2019

@LebenNNA I've tried that before, but failed. It's tricky like @renancaraujo said. Detecting gestures is a bit difficult in Flutter.
Maybe we should wait some genius to solve this problem...

@LebenNNA
Copy link

The basic effect I made but encountered a problem with the PageView's framwork, I have already submitted the issue @Shu-Ji @renancaraujo

@bluefireteam bluefireteam deleted a comment from qq326646683 Mar 1, 2019
@bluefireteam bluefireteam deleted a comment from qq326646683 Mar 1, 2019
criswonder pushed a commit to criswonder/photo_view that referenced this issue Aug 8, 2019
criswonder pushed a commit to criswonder/photo_view that referenced this issue Aug 8, 2019
criswonder pushed a commit to criswonder/photo_view that referenced this issue Aug 8, 2019
criswonder pushed a commit to criswonder/photo_view that referenced this issue Oct 9, 2019
renancaraujo pushed a commit to criswonder/photo_view that referenced this issue Oct 16, 2019
renancaraujo added a commit that referenced this issue Oct 16, 2019
Let user scroll to next page when PageView child is zooming (#41)
@renancaraujo
Copy link
Member

Released a tackle for this on 0.7.0. Thanks to @criswonder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Gallery help wanted Extra attention is needed physics
Projects
None yet
Development

No branches or pull requests

4 participants