splash_page.dart 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'package:flutter/material.dart';
  2. import 'package:gobang/pages/splash/countdown.dart';
  3. import 'package:gobang/routes.dart';
  4. /// Description: splash page
  5. /// 加载缓存ad pic,倒计时3秒,if login go index else go login page
  6. /// Time : 02/20/2024 Tuesday
  7. /// Author : liuyuqi.gov@msn.cn
  8. class SpalshPage extends StatefulWidget {
  9. const SpalshPage({Key? key}) : super(key: key);
  10. @override
  11. State<SpalshPage> createState() => _SpalshPageState();
  12. }
  13. class _SpalshPageState extends State<SpalshPage> {
  14. @override
  15. Widget build(BuildContext context) {
  16. return Scaffold(
  17. body: Stack(children: [
  18. Positioned.fill(
  19. child: Image.asset(
  20. "assets/images/splash.jpg",
  21. cacheWidth: 750,
  22. fit: BoxFit.cover,
  23. )),
  24. Positioned(
  25. right: 30,
  26. top: 30,
  27. child: Countdown(),
  28. )
  29. ]),
  30. );
  31. }
  32. @override
  33. void dispose() {
  34. super.dispose();
  35. }
  36. @override
  37. void didChangeDependencies() {
  38. super.didChangeDependencies();
  39. goMain();
  40. }
  41. void goMain() async {
  42. Routes.popAndPushNamed(context, Routes.index);
  43. }
  44. }