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

pop without scroll view #1

Closed
aytunch opened this issue May 31, 2021 · 8 comments
Closed

pop without scroll view #1

aytunch opened this issue May 31, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@aytunch
Copy link

aytunch commented May 31, 2021

Hi @luunc thanks for this great library and the nice gif representations.
I want to ask why you are limiting the package to only be used in scroll views?
For instance I want to use this package for stories just like in instagram. Sometimes they are only one story videos and the user needs to be able to dismiss/pop them towards the direction of their finger (not towards one of the 4 up, down, left, right)
Do you think it is a good idea?

@luunc
Copy link
Owner

luunc commented May 31, 2021

Do you mean something like this?

Demo

At beginning, the main purpose is for ScrollView only, if you need this feature I will create a new Widget for this purpose: a full screen scaffold that can drag anywhere to pop?

@luunc luunc added the enhancement New feature or request label May 31, 2021
@aytunch
Copy link
Author

aytunch commented May 31, 2021

@luunc yes something like that but not just for an image but a full page. When the front page is being dragged, it starts moving towards users finger + sizing down and fading out all at the same time. I added 2 screen recordings to give you an inspiration. If you open a new repo for this, please inform here so I can watch and star the repo :)

RPReplay_Final1622457703.mov

Also you can find a question here. As you can see from the answers, there is no exact package which solves this need:
https://www.reddit.com/r/FlutterDev/comments/ndz41l/which_flutter_package_enables_the_page_dismiss/

@luunc
Copy link
Owner

luunc commented Jun 1, 2021

I already created a Widget called DragToPop.
Please take a look at the document for detail.

Demo

@aytunch
Copy link
Author

aytunch commented Jun 1, 2021

I will be testing this tomorrow. The gif looks amazing 👍

@luunc luunc closed this as completed Jun 3, 2021
@aytunch
Copy link
Author

aytunch commented Jun 6, 2021

hi @luunc
Sorry for the late reply, I tried the DragToPop widget and the responsiveness is very good. However I have 2 small problems.

1- I can not see the previous Page behind the current page while dismissing. There is just a black screen. I am not sure if this is caused by this package. Do you have any idea what might be the cause?
2- Normally I have a video player in my pushed screen as the top child of a Stack and there is Gesture Recogniser which allows the video to be paused when a finger is being touched. This prevents DragToPop widget to receive gestures so for the time being I removed the video. That is why you see a white screen. How can I make this widget and the video player receive touches?

Here is a video to illustrate the first issue:

vidma_recorder_06062021_174827.mp4

@luunc
Copy link
Owner

luunc commented Jun 6, 2021

  1. To see under-layer route, you need to push a route which is not opaque, something like this:
Navigator.of(context).push(
            PageRouteBuilder(
              transitionDuration: const Duration(milliseconds: 250),
              reverseTransitionDuration: const Duration(milliseconds: 250),
              fullscreenDialog: true,
              opaque: false,
              transitionsBuilder:
                  (_, Animation<double> animation, __, Widget child) =>
                      FadeTransition(opacity: animation, child: child),
              pageBuilder: (_, __, ___) => FullScreenDetail(url: images[index]),
            ),
          )

(see example here)

  1. Which gesture do you use to pause the video? If that gesture overlaps DragToPop widget. I think you should create your own one following the code in this package, it will be more efficient.

@aytunch
Copy link
Author

aytunch commented Jun 6, 2021

Which gesture do you use to pause the video? If that gesture overlaps DragToPop widget. I think you should create your own one following the code in this package, it will be more efficient.

Can you show a code snippet please? I am using onScaleStart, onScaleUpdate and onDoubleTap

@luunc
Copy link
Owner

luunc commented Jun 7, 2021

The full code of DragToPop widget: https://github.com/luunc/overscroll_pop/blob/main/lib/drag_to_pop.dart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants