|
- import 'package:flutter/material.dart';
- import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
- import 'package:zhiying_comm/util/application.dart';
-
- // 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题
- class LaunchPage extends StatefulWidget {
- final WidgetBuilder builder;
-
- const LaunchPage({Key key, this.builder}) : super(key: key);
-
- @override
- _LaunchPageState createState() => _LaunchPageState();
- }
-
- class _LaunchPageState extends State<LaunchPage> {
- @override
- void initState() {
- Application.init().then((_) {
- if (widget.builder != null) {
- Navigator.of(context)
- .pushReplacement(MaterialPageRoute(builder: widget.builder));
- } else {
- Navigator.of(context).pushReplacement(
- MaterialPageRoute(builder: (context) => HomePage()));
- }
- });
- super.initState();
- }
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Center(child: Text('这个是启动页,正在初始化...')),
- );
- }
- }
|