I am using Getx for route management.
When coming from deepLink and the app is terminated, I want the app to launch (with splashscreen) and then go to a specific /match/:match_id route (I have the id in the deepLink).
This works well. The problem is that I want to push below this match page, the home page so that when the user goes back he can go there.
Within the initState of the LaunchScreen widget I am doing
Get.offNamed("/home"); // remove `LaunchScreen` and push `Home`
Get.offNamed("/match/:" + match_id); // push `Match`
This works. However there is some inconsistency with animations. I see for few seconds the Home page and then immediately the Match
I would like to jump directly to Match and the user not even seeing the Home one
Related
There is an issue with my navigation and it's parsed value from previous screen for web application.
Actually, I go via Get.toNamed(Routes.VISAS); to next screen and next screen's back button is not working when I reload the web application so I have implemented own back button then try to called Get.back(); or Navigator.of(context).pop(); manually but still not working. so I thought during reload the web app it removes all previous navigation and it's parsed value from previous screen as well and this is a big issue for my web app.
so I was thinking to get rid of this issue , first of all I fetch the navigation history if there is no push screen in stack so I will navigate to my home screen else go back to previous screen().
and 2nd issue : when I parsed value via constructor it remove as well when reload the web application so I Will use SharedPreferences() to resolve this. I know this is not a good approach. Help me out to get navigation history in flutter application.
GOTO NEXT SCREEN :
Get.toNamed(Routes.VISAS);
FOR BACK :
Get.back(); // Not working when I reload the web application
//Navigator.of(context).pop();
From :
TO:
Meaning if I go from a job screen to a client screen (the client the job was for), to another job screen (another job done for the client) etc, how can I display job > client > job?
And including parameters, so I could display Job 12 > SomeCompany > Job 17.
Sub routes aren't sufficient because the stack can repeat through multiple of the same pages infinitely.
I'm not sure about checking the whole stack , but in case of anybody needed to check if there is a page on the stack , GoRouter has a canPop() method:
/// Returns `true` if there is more than 1 page on the stack. bool canPop() => GoRouter.of(this).canPop();
This isn't possible with go_router. auto_route has an API to check the stack, but go_router shows no search results for stack.
Instead of GoRouter.of like in this answer, you could use the extension method BuildContext#canPop. For example, in my onboarding page, I have this logic to pop if I can, and if not possible (the first time someone launches the app), I replace the page.:
if (context.canPop()) {
context.pop();
} else {
context.replace(Routes.dashboard);
// Or alternatively, allow the user to navigate back to onboarding with:
// context.push(Routes.dashboard);
}
I need more than one page to be pushed at boot time. In main, therefore, "homepage: screen class name" is not good. I have to carry out this procedure also later, outside the main. But I read that in this case you can use two or more Navigator.push
I use Getx for route management in my Flutter application.
When a certain notification arrives and the app starts from terminated state I want:
launch the / route (launch screen)
go to potm/:match_id route
when user presses back go to match/:match_id route
when user presses back go to home route
Basically I want to have this stack: home -> match/:match_id -> potm:/match_id and then popping from the top will bring me back at home
In the / page initState method I do the following
var matchId = getMatchId();
Get.offToNamed("/home"); // place home on stack and remove /
Get.toNamed("/match/" + matchId); // place /match/:match_id on stack
await Get.toNamed("/potm/" + matchId); // go to /potm/:match_id
this kind of works but in some devices I see a very fast transition from / to /home which I don't want to see
What is the best way to achieve my desired stack here?
I'm working on an app that contains more than one workspace to switch between them.
The user can receive notifications from the workspaces (all of them, even if he is not in this workspace)
When he clicks on the notification, it switches the workspaces (switch then reset the di and every thing then make the rebirth action using flutter_phoenix) then he should navigate to the specific page
The app works very well until finished the rebirth action, then didn't navigate to the specific page, just the home page after switching.
An example with this block of code:
Phoenix.rebirth(navigatorKey.currentContext!);
navigatorKey.currentState!.pushNamed(
taskDetailsRoute,
arguments: TaskDetailsPageArgs(
taskId: taskId,
),
);
That happens only after making this rebirth, It works very well if wanted to navigate if it's in the same workspace.