splash_page.dart 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:get/get.dart';
  4. import 'package:gobang/themes/app_colors.dart';
  5. import 'package:gobang/routes/app_routes.dart';
  6. class SplashPage extends StatefulWidget {
  7. const SplashPage({super.key});
  8. @override
  9. State<SplashPage> createState() => _SplashPageState();
  10. }
  11. class _SplashPageState extends State<SplashPage>
  12. with SingleTickerProviderStateMixin {
  13. late final AnimationController _c;
  14. late final Animation<double> _fade;
  15. late final Animation<double> _scale;
  16. @override
  17. void initState() {
  18. super.initState();
  19. _c = AnimationController(
  20. vsync: this,
  21. duration: const Duration(milliseconds: 900),
  22. );
  23. _fade = CurvedAnimation(parent: _c, curve: Curves.easeOut);
  24. _scale = Tween(begin: 0.86, end: 1.0).animate(
  25. CurvedAnimation(parent: _c, curve: Curves.easeOutBack),
  26. );
  27. _c.forward();
  28. Future.delayed(const Duration(milliseconds: 1400), () {
  29. if (mounted) Get.offNamed(AppRoutes.home);
  30. });
  31. }
  32. @override
  33. void dispose() {
  34. _c.dispose();
  35. super.dispose();
  36. }
  37. @override
  38. Widget build(BuildContext context) {
  39. return AnnotatedRegion<SystemUiOverlayStyle>(
  40. value: SystemUiOverlayStyle.light,
  41. child: Scaffold(
  42. body: Container(
  43. width: double.infinity,
  44. decoration: const BoxDecoration(
  45. gradient: LinearGradient(
  46. begin: Alignment.topLeft,
  47. end: Alignment.bottomRight,
  48. colors: [
  49. Color(0xFF0A2F28),
  50. AppColors.ink,
  51. AppColors.pumpkin,
  52. ],
  53. stops: [0, 0.55, 1],
  54. ),
  55. ),
  56. child: FadeTransition(
  57. opacity: _fade,
  58. child: ScaleTransition(
  59. scale: _scale,
  60. child: Column(
  61. mainAxisAlignment: MainAxisAlignment.center,
  62. children: [
  63. Container(
  64. width: 108,
  65. height: 108,
  66. decoration: BoxDecoration(
  67. shape: BoxShape.circle,
  68. gradient: const LinearGradient(
  69. begin: Alignment.topLeft,
  70. end: Alignment.bottomRight,
  71. colors: [AppColors.pumpkinSoft, AppColors.pumpkin],
  72. ),
  73. boxShadow: [
  74. BoxShadow(
  75. color: Colors.black.withValues(alpha: 0.35),
  76. blurRadius: 28,
  77. offset: const Offset(0, 12),
  78. ),
  79. ],
  80. ),
  81. ),
  82. const SizedBox(height: 28),
  83. const Text(
  84. '南瓜五子棋',
  85. style: TextStyle(
  86. color: AppColors.ivory,
  87. fontSize: 34,
  88. fontWeight: FontWeight.w800,
  89. letterSpacing: 1.2,
  90. ),
  91. ),
  92. const SizedBox(height: 10),
  93. Text(
  94. '对决决策树 · 落子有声',
  95. style: TextStyle(
  96. color: AppColors.ivory.withValues(alpha: 0.72),
  97. fontSize: 14,
  98. ),
  99. ),
  100. ],
  101. ),
  102. ),
  103. ),
  104. ),
  105. ),
  106. );
  107. }
  108. }