我想实现一个动画启动画面
一般来说,在 MaterialApp 中,我们有一个名为 home 的属性,但是当我使用自动路由(MaterialApp.router)时,我无法在其中找到一个 home,那么如何使用自动路由实现启动屏幕
main.dart 文件
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
runApp(
EasyLocalization(
supportedLocales: const <Locale>[Locale('en')],
path: 'assets/i18n',
fallbackLocale: const Locale('en'),
child: const App(),
),
);
}
class Appp extends StatefulWidget {
const Appp({Key? key}) : super(key: key);
@override
State<Appp> createState() =>
_ApppState();
}
class _ApppState extends State<Appp> {
final _themeStore = ThemeStore();
final _appRouter = AppRouter();
@override
Widget build(BuildContext context) {
return MaterialApp.router(
debugShowCheckedModeBanner: false,
title: 'App',
theme: _themeStore.selectedThemeData,
routerDelegate: _appRouter.delegate(),
routeInformationParser: _appRouter.defaultRouteParser(), …Run Code Online (Sandbox Code Playgroud) flutter ×1