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

Question - Is there a way to enable the "swipe to go back" gesture? #3

Closed
orenagiv opened this issue Feb 23, 2021 · 7 comments
Closed

Comments

@orenagiv
Copy link

Hi there,

First - Amazing package!

Quick question:
I've noticed the "swipe from the edge" doesn't work out of the box.
Is there a way to enable it in Vrouter? or specifically to a "Vstack"?

@orenagiv orenagiv changed the title Question - Is there a way to enable a "swipe to go back" gesture? Question - Is there a way to enable the "swipe to go back" gesture? Feb 23, 2021
@lulupointu
Copy link
Owner

Thanks !

Concerning your question, "swipe from the edge" in a functionality linked to the Route. Currently I'm using a custom route that you can not customize so it's not possible. Moreover, since I based it on MaterialPageRoute, its matching material guidelines (i.e. no swipe to back).

I will find a way:

  1. Enable Cupertino animation by default on IOS
  2. Enable more customization regarding routes

I am currently working on adding declarative to the package but I will tackle this issue right after, I will post an update here once it's done.

@lulupointu
Copy link
Owner

This should be fixed now. It's enabled by default, if their is a need for more customization I might had an option but for now this should be enough for you.

@orenagiv
Copy link
Author

Thx!
I'll try it ASAP.

Is that included in v0.0.13+1?

@lulupointu
Copy link
Owner

Yes it is !

@orenagiv
Copy link
Author

Thanks!

Tried, but couldn't get it to work. Maybe I'm doing something wrong?
Here is how I'm using Vrouter:

Vrouter(
  mode: VRouterModes.history,
  routes: [
    VStacked(path: kSplashPath, widget: SplashScreen()),
    VStacked(path: kLoginPath, widget: LoginScreen()),
    VStacked(path: kRootPath, widget: HomeScreen()),
    VStacked(path: kUnknownPath, widget: UnknownScreen()),
    VRouteRedirector(path: r':_(.*)', redirectTo: kUnknownPath),
  ],
  ...

Tested Vrouter v0.0.13+1 with Flutter v1.26.0 on iOS 14 (tried on an actual iPhone 10 device, as well as on the iOS Simulator of iPhone 12)

@lulupointu
Copy link
Owner

In order to stack widget one on top on each other, you have to use subroutes.

Here is an example in which the UnknownScreen is stacked on top of the HomeScreen:

VRouter(
  mode: VRouterModes.history,
  routes: [
    VStacked(path: kSplashPath, widget: SplashScreen()),
    VStacked(path: kLoginPath, widget: LoginScreen()),
    VStacked(path: kRootPath, widget: HomeScreen(), subroutes: [
      VStacked(path: kUnknownPath, widget: UnknownScreen()),
    ]),
    VRouteRedirector(path: r':_(.*)', redirectTo: kUnknownPath),
  ],
)

I admit that the doc are missleading, I will update them. I also recently updated the example to reflect this use of VStacked. I hope you will get what you want !

@orenagiv
Copy link
Author

THANKS!
Works like a charm!! :)

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

No branches or pull requests

2 participants