flutter - 当我启动时,第一页(Dart 文件)将在 Flutter App 中运行
问题描述
我编写了一个包含多个飞镖文件的颤振应用程序。但是 apk 包如何决定,当应用程序在手机上启动时首先运行哪个 dart 文件?我的意思是我想将一个 dart 文件设置为我的应用程序的主页/主页,我想先运行它。我如何设置它?
解决方案
在main.dart文件上使用类似的东西
main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: appThemeData(),
title: 'YOUR_APP_NAME',
initialRoute: '/',
routes: {
'/': (context) => LoginPage(),
'/mainMenu': (context) => MainMenu(),
'/splash': (context) => SplashScreen(),
},
);
}
}
推荐阅读
- stack - s2i haskell 堆栈未能构建 cardano-sl
- .net - 创建控制器实体框架 ASP.NET 的问题
- android - 无法在 GitLab CI 中生成签名的 APK
- php - 在模型中对列名使用访问器会出现“未定义的 App\ModelName::$column_name”错误
- ios - 如何调试从后台返回时发生的崩溃
- amazon-web-services - 为什么为 AspNetCore Lambda 函数配置的 AWS ALB 在重定向后会给出 502?
- c++ - 为什么 C 和 C++ 版本的代码的 CRC 计算不同?
- azure - AZCopy:摘要以及 /V 中的详细信息:参数
- xamarin.forms - 在包“android”中找不到属性“configchanges”的资源标识符
- python - Python 3 Pandas Dataframe - 使用股票数据实现一个简单的 shift()