Reputation: 33
As my question says, pressing phone back button application is going back to custom splash screen rather than previous page. Any idea what would be the issue ? Following is main.dart code
void main() => runApp(new MaterialApp(
theme: ThemeData(primaryColor: Colors.red),
debugShowCheckedModeBanner: false,
home: SplashScreen(),
))
Splash screen closes after 3 seconds and app goes to login page.
Thanks in advance.
Upvotes: 1
Views: 840
Reputation: 76
Probably you incorrectly use navigator, use pushReplacement
to replace SplashScreen
with a new one. and use push
to open a new screen on top of the previous.
example:
// Close splash screen and open MainPage
Navigator.of(context).pushReplacement(MainPage.route());
// Open LoginPage on top of the previous page
Navigator.of(context).push(LoginPage.route());
Upvotes: 1