正如我的问题所述,按下电话后退按钮应用程序将返回自定义启动屏幕,而不是上一页。知道会有什么问题吗?以下是main.dart代码
void main() => runApp(new MaterialApp(
theme: ThemeData(primaryColor: Colors.red),
debugShowCheckedModeBanner: false,
home: SplashScreen(),
))
启动屏幕3秒后关闭,应用程序进入登录页面。
谢谢。
答案 0 :(得分:1)
可能您不正确地使用了导航器,使用pushReplacement
将SplashScreen
替换为新的导航器。并使用push
打开上一个屏幕。
示例:
// 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());