Milad-Akarie / auto_route_library

Flutter route generator
MIT License
1.56k stars 394 forks source link

Deep linking with nested AutoTabsRouter.pageViews #1692

Open JohnnyRainbow81 opened 1 year ago

JohnnyRainbow81 commented 1 year ago

Hi!

I have an issue to initialize my Screens / Routes which the proper required callback functions when a user enters the app via deep link.

There is no problem to navigate to a Route from the parent page of the route which has all the necessary initialisation information. This works:

(When already being in LessonOverviewScreen): context.navigateTo(LearnRoute(showBackButton: (value) => true, changePage: (index, {bool? canSwipePage}) => doSomething(), animTrigger: _animTrigger));

But how do you handle such a case when you start into the app with a deep link? This doesn't work:

http://our-app.com/main/for-you/learncontent/{lesson-id}/lesson-overview/learn

I am using AutoRoute 7.8.0

Milad-Akarie commented 1 year ago

@JohnnyRainbow81 You either re-design your code to not rely on callbacks or re-build the deep-link yourself inside of deep-link builder, I'm afraid there isn't a better solution to this.

JohnnyRainbow81 commented 1 year ago

Hi @Milad-Akarie

Thank you for your answer. Yes, your proposed solution also became my strategy to solve the problem. I'm glad I could get rid of the callbacks and have to face minus one issue :)

Still wrestling with correctly deep linking to deeper nested views like

GrandParentPageView -> ParentPageView -> ChildPageView

The deep link only correctly navigates to the GrandParentPageView's page, but doesn't go 'further'.

Do you have any further suggestions?

Thank you very much.

Milad-Akarie commented 1 year ago

@JohnnyRainbow81 that might be related to the issue fixed in v7.8.3, update and see if you still have the issue

JohnnyRainbow81 commented 1 year ago

@Milad-Akarie Thank you for replying again. I updated to 7.8.3.

Unfortunately, this still does not work. It makes no difference if I start the app with

http://my_app.com/main/for-you/learncontent/ee2c0780-2ebb-4c60-b4da-2e855be5dfe8/lecture

or with

http://my_app.com/main/for-you/

In this case there are 3 nested pageviews, realized with AutoTabsRouter.pageView for /main /for-you and/learncontent. But only the first page of the /main-PageView (==/for-you) is addressed correctly.

Is there anything that I might be doing wrong?

JohnnyRainbow81 commented 1 year ago

Might be another issue: Setting homeIndex in AutoTabsRouter.pageView() has no effect in my case. It is ignored.

github-actions[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions