splash_page.dart 644 B

123456789101112131415161718192021222324252627282930
  1. import 'package:douyin_demo/routes.dart';
  2. import 'package:flutter/material.dart';
  3. class SplashPage extends StatefulWidget {
  4. const SplashPage({Key? key}) : super(key: key);
  5. @override
  6. _SplashPageState createState() => _SplashPageState();
  7. }
  8. class _SplashPageState extends State<SplashPage> {
  9. @override
  10. Widget build(BuildContext context) {
  11. return Scaffold(
  12. body: Text("闪屏页"),
  13. );
  14. }
  15. @override
  16. void didChangeDependencies() {
  17. super.didChangeDependencies();
  18. goMain();
  19. }
  20. void goMain() {
  21. Future.delayed(Duration(seconds: 1), () {
  22. Routes.popAndPushNamed(context, Routes.home);
  23. });
  24. }
  25. }