- 我开始在main.dart中开发应用程序的“主页”。
- 然后我创建了“Login.dart”页面,现在我希望我的应用程序从“Login.dart”页面开始。
我是Flutter的新手。
- 我开始在main.dart中开发应用程序的“主页”。
- 然后我创建了“Login.dart”页面,现在我希望我的应用程序从“Login.dart”页面开始。
我是Flutter的新手。
-t
参数支持各种命令(运行,构建等),请使用它。
flutter run -t lib/my_other_main.dart
如果您想使用位于 lib/config/main_production.dart 以外的文件作为发布应用程序的主入口点,则必须按照以下方式进行操作:
flutter build apk -t lib/config/main_production.dart
flutter run -t lib/main_admin.dart
中的 t
表示目标,其默认值为 lib/main.dart。如果您没有指定 -t
,则会转到 lib/main.dart。
您还可以通过在 flutter run 命令中传递 --flavor
来加载不同的风格,例如生产、开发和测试,来使用相同的入口点。
main.dart
中,您可以指定应用程序打开的第一个屏幕:runApp(new MaterialApp(
debugShowCheckedModeBanner: false,
theme: //theme
title: "Title",
home: new Login(), //Here you can specify the screen the app starts on.
routes: <String, WidgetBuilder>{
//routes
},
));