liuyuqi-dellpc 1 year ago
parent
commit
ffc4b6161a

+ 2 - 0
lib/factory/BlackThemeFactory.dart

@@ -7,4 +7,6 @@ class BlackThemeFactory extends ThemeFactory{
   Theme getTheme() {
     return BlackTheme();
   }
+
+  
 }

+ 5 - 3
lib/pages/home_page.dart

@@ -16,7 +16,9 @@ import '../flyweight/Position.dart';
 
 var width = 0.0;
 
-///简单的实现五子棋效果
+/// Description: home page
+/// Time       : 02/20/2024 Tuesday
+/// Author     : liuyuqi.gov@msn.cn
 class HomePage extends StatefulWidget {
   @override
   State<StatefulWidget> createState() => HomePageState();
@@ -238,7 +240,7 @@ class ChessPainter extends CustomPainter {
       return;
     }
     bool add = false;
-    double mWidth = size.width / 15;   // 每行/列 15 个
+    double mWidth = size.width / 15; // 每行/列 15 个
     double mHeight = size.height / 15;
     var mPaint = Paint();
     //求两个点之间的距离,让棋子正确的显示在坐标轴上面
@@ -358,4 +360,4 @@ class CrossOverBean {
   double _dy;
 
   CrossOverBean(this._dx, this._dy);
-}
+}

+ 54 - 0
lib/pages/splash/countdown.dart

@@ -0,0 +1,54 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+
+/// Description: count down for splash
+/// Time       : 02/21/2024 Wednesday
+/// Author     : liuyuqi.gov@msn.cn
+class Countdown extends StatefulWidget {
+  const Countdown({Key? key}) : super(key: key);
+
+  @override
+  State<Countdown> createState() => _CountdownState();
+}
+
+class _CountdownState extends State<Countdown> {
+  late Animation<double> _animation;
+  late AnimationController _controller;
+
+  @override
+  Widget build(BuildContext context) {
+    return GestureDetector(
+        child: Container(
+      color: const Color(0xFF1E90FF),
+      child: Center(
+        child: AnimatedBuilder(
+          animation: _animation,
+          builder: (context, child) {
+            return Text(
+              '${_animation.value.toInt()}',
+              style: const TextStyle(
+                fontSize: 60,
+                color: Colors.white,
+              ),
+            );
+          },
+        ),
+      ),
+    ));
+  }
+
+  @override
+  void initState() {
+    super.initState();
+    SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
+      statusBarBrightness: Brightness.light,
+      statusBarIconBrightness: Brightness.light,
+    ));
+  }
+
+  @override
+  void dispose() {
+    super.dispose();
+    _controller.dispose();
+  }
+}

+ 38 - 0
lib/pages/splash/splash_page.dart

@@ -0,0 +1,38 @@
+import 'package:flutter/material.dart';
+import 'package:gobang/pages/splash/countdown.dart';
+
+/// Description: splash page
+/// Time       : 02/20/2024 Tuesday
+/// Author     : liuyuqi.gov@msn.cn
+class SpalshPage extends StatefulWidget {
+  const SpalshPage({Key? key}) : super(key: key);
+
+  @override
+  State<SpalshPage> createState() => _SpalshPageState();
+}
+
+class _SpalshPageState extends State<SpalshPage> {
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      body: Stack(children: [
+        Positioned.fill(
+            child: Image.asset(
+          "assets/images/splash.jpg",
+          cacheWidth: 750,
+          fit: BoxFit.cover,
+        )),
+        Positioned(
+          right: 30,
+          top: 30,
+          child: Countdown(),
+        )
+      ]),
+    );
+  }
+
+  @override
+  void dispose() {
+    super.dispose();
+  }
+}

+ 0 - 19
lib/pages/splash_page.dart

@@ -1,19 +0,0 @@
-import 'package:flutter/src/widgets/framework.dart';
-import 'package:flutter/src/widgets/placeholder.dart';
-
-/// Description: splash page
-/// Time       : 02/20/2024 Tuesday
-/// Author     : liuyuqi.gov@msn.cn
-class SpalshPage extends StatefulWidget {
-  const SpalshPage({Key? key}) : super(key: key);
-
-  @override
-  State<SpalshPage> createState() => _SpalshPageState();
-}
-
-class _SpalshPageState extends State<SpalshPage> {
-  @override
-  Widget build(BuildContext context) {
-    return const Placeholder();
-  }
-}

+ 2 - 0
pubspec.yaml

@@ -15,3 +15,5 @@ dev_dependencies:
     sdk: flutter
 flutter:
   uses-material-design: true
+  assets:
+    - assets/images/