Previous episode: 11. Display the Splash Screen
Next episode: 13. Navigate to the Home Page
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Now that we have displayed the splash screen successfully, we want to display the login screen after two seconds of the delay. We have already given the condition in our pages array to display the login screen. Now, we have to change the isInitialized value to true when our init is done, so that our appStateManager will communicate with a router and display the login page. Now, navigate to the splash screen and override a stateful function called as didChangeDependencies. The didChangeDependencies will be called when the dependencies are changed or is reloaded. We do not need the initState function, so I will remove the initState function from our file. We are going to call the appStateManager's initialized function in our didChangeDependencies function. And we will be using Provider to do that. Our initializeApp function has a timer, which after two seconds makes the initialized value as two, and we notify the listener. Now let us reload our application to see what we get. So we have the splash screen, and after two seconds we get the login screen. Now let us navigate to sign up page from login page. In our book_router_delegate, I will add the sign up page with a condition. The condition will make sure that our app is initialized and the isSignUp is also true. Now let us change the isSignUp bool value when the user taps on, "Don't have an account! Sign In" button. So in a login screen, scroll down to the button, "Don't have an account! Sign In." And on the onTap, where we have a function which navigates to the sign up screen, we will set the value to true. Now, let us load the application and see if you're able to go to the sign up page from the login page, and you can see we are at the sign up page.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.