基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

launch_page.dart 1.0 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536
  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_base_widget/pages/home_page/home_page.dart';
  3. import 'package:zhiying_comm/util/application.dart';
  4. // 启动页,页面初始化等操作~跟原生启动页保持一致,防止白屏问题
  5. class LaunchPage extends StatefulWidget {
  6. final WidgetBuilder builder;
  7. const LaunchPage({Key key, this.builder}) : super(key: key);
  8. @override
  9. _LaunchPageState createState() => _LaunchPageState();
  10. }
  11. class _LaunchPageState extends State<LaunchPage> {
  12. @override
  13. void initState() {
  14. Application.init().then((_) {
  15. if (widget.builder != null) {
  16. Navigator.of(context)
  17. .pushReplacement(MaterialPageRoute(builder: widget.builder));
  18. } else {
  19. Navigator.of(context).pushReplacement(
  20. MaterialPageRoute(builder: (context) => HomePage()));
  21. }
  22. });
  23. super.initState();
  24. }
  25. @override
  26. Widget build(BuildContext context) {
  27. return Scaffold(
  28. body: Center(child: Text('这个是启动页,正在初始化...')),
  29. );
  30. }
  31. }