liuyuqi-dellpc 1 year ago
parent
commit
de2cf9a491

+ 38 - 0
.github/ISSUE_TEMPLATE/bug_report.md

@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. iOS]
+ - Browser [e.g. chrome, safari]
+ - Version [e.g. 22]
+
+**Smartphone (please complete the following information):**
+ - Device: [e.g. iPhone6]
+ - OS: [e.g. iOS8.1]
+ - Browser [e.g. stock browser, safari]
+ - Version [e.g. 22]
+
+**Additional context**
+Add any other context about the problem here.

+ 20 - 0
.github/ISSUE_TEMPLATE/feature_request.md

@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.

+ 16 - 1
android/app/build.gradle

@@ -25,6 +25,12 @@ apply plugin: 'com.android.application'
 apply plugin: 'kotlin-android'
 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
 
+def keystoreProperties = new Properties()
+def keystorePropertiesFile = rootProject.file('key.properties')
+if (keystorePropertiesFile.exists()) {
+    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
+}
+
 android {
     compileSdkVersion 33
     ndkVersion flutter.ndkVersion
@@ -34,9 +40,18 @@ android {
         targetCompatibility JavaVersion.VERSION_1_8
     }
 
+    signingConfigs {
+        release {
+            keyAlias keystoreProperties['keyAlias']
+            keyPassword keystoreProperties['keyPassword']
+            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
+            storePassword keystoreProperties['storePassword']
+        }
+    }
+
     defaultConfig {
         // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
-        applicationId "me.yoqi.flutter.flutter_chinese_chees"
+        applicationId "me.yoqi.flutter.chinese_chees"
         // You can update the following values to match your application needs.
         // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
         minSdkVersion flutter.minSdkVersion

+ 5 - 3
android/app/src/main/AndroidManifest.xml

@@ -1,6 +1,6 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="me.yoqi.flutter.chinese_chees">
-    <<uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -8,10 +8,12 @@
     <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
 
     <uses-permission android:name="android.permission.LOCATION_HARDWARE" />
-
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
 
    <application
-        android:label="chinese_chees"
+        android:label="中国象棋"
         android:name="${applicationName}"
         android:icon="@mipmap/ic_launcher">
         <activity

+ 25 - 0
lib/dao/user_dao.dart

@@ -0,0 +1,25 @@
+import 'package:flutter_chinese_chees/model/user_model.dart';
+
+/// Description: 用户数据访问层
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
+class UserDao {
+  /// 登录
+  Future<UserModel> login() async {
+    return UserModel.fromJson({"name": "张三", "id": 1, "email": "", "age": 18});
+  }
+
+  /// 注册
+  /// [name] 用户名
+  /// [password] 密码
+  /// [email] 邮箱
+  Future<UserModel> register(String name, String password, String email) async {
+    return UserModel.fromJson(
+        {"name": name, "id": 1, "email": email, "age": 18});
+  }
+
+  /// 退出登录
+  Future<bool> logout() async {
+    return true;
+  }
+}

+ 9 - 4
lib/main.dart

@@ -2,14 +2,17 @@ import 'dart:io';
 
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
-import 'package:flutter_chinese_chees/pages/home_page.dart';
+import 'package:flutter_chinese_chees/pages/splash_page.dart';
+import 'package:flutter_chinese_chees/routes.dart';
 
 /// Description: enter point
 /// Time       : 04/28/2023 Friday
 /// Author     : liuyuqi.gov@msn.cn
 void main() async {
   WidgetsFlutterBinding.ensureInitialized();
+
   runApp(const MyApp());
+
   if (Platform.isAndroid) {
     SystemUiOverlayStyle systemUiOverlayStyle =
         const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
@@ -24,12 +27,14 @@ class MyApp extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return MaterialApp(
-      title: 'Flutter Demo',
+      title: '中国象棋',
       debugShowCheckedModeBanner: false,
       theme: ThemeData(
         primarySwatch: Colors.blue,
       ),
-      home: const HomePage(),
+      home: const SplashPage(),
+      onGenerateRoute: Routes.onGenerateRoute,
+      initialRoute: Routes.home,
     );
   }
-}
+}

+ 6 - 0
lib/model/base_model.dart

@@ -0,0 +1,6 @@
+/// Description: 基类
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
+class BaseModel {
+  
+}

+ 9 - 0
lib/model/config.dart

@@ -0,0 +1,9 @@
+class Config {
+  static String host = "https://xx.com";
+  static String login = "$host/login";
+  static String register = "$host/register";
+  static String logout = "$host/logout";
+
+
+  
+}

+ 24 - 0
lib/model/user_model.dart

@@ -0,0 +1,24 @@
+import 'base_model.dart';
+
+class UserModel extends BaseModel {
+  String name = "";
+  int id = 0;
+  String email = "";
+  int age = 0;
+
+  UserModel.fromJson(Map<String, dynamic> json) {
+    name = json['name'];
+    id = json['id'];
+    email = json['email'];
+    age = json['age'];
+  }
+
+  Map<String, dynamic> toJson() {
+    final Map<String, dynamic> data = <String, dynamic>{};
+    data['name'] = name;
+    data['id'] = id;
+    data['email'] = email;
+    data['age'] = age;
+    return data;
+  }
+}

+ 27 - 0
lib/pages/about_me_page.dart

@@ -0,0 +1,27 @@
+import 'package:flutter/material.dart';
+
+/// Description: 关于我们
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
+class AboutMePage extends StatefulWidget {
+  const AboutMePage({super.key});
+
+  @override
+  State<AboutMePage> createState() => _AboutMePageState();
+}
+
+class _AboutMePageState extends State<AboutMePage> {
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      appBar: AppBar(actions: [
+        IconButton(
+          icon: Icon(Icons.logout),
+          onPressed: () {},
+        )
+      ]),
+      body: Container(
+        child: Text("home page"),
+      ),);
+  }
+}

+ 18 - 0
lib/pages/guide_page.dart

@@ -0,0 +1,18 @@
+import 'package:flutter/material.dart';
+
+/// Description: 引导页
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
+class GuidePage extends StatefulWidget {
+  const GuidePage({super.key});
+
+  @override
+  State<GuidePage> createState() => _GuidePageState();
+}
+
+class _GuidePageState extends State<GuidePage> {
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(body: Text("x"),);
+  }
+}

+ 28 - 6
lib/pages/home_page.dart

@@ -1,5 +1,8 @@
 import 'package:flutter/material.dart';
 
+/// Description: 主页
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
 class HomePage extends StatefulWidget {
   const HomePage({super.key});
 
@@ -11,12 +14,31 @@ class _HomePageState extends State<HomePage> {
   @override
   Widget build(BuildContext context) {
     return Scaffold(
-      appBar: AppBar(actions: [
-        IconButton(
-          icon: Icon(Icons.logout),
-          onPressed: () {},
-        )
-      ]),
+      appBar: AppBar(
+          title: Text("context.l10n.appTitle"),
+          leading: Builder(builder: (context) {
+            return IconButton(
+              icon: Icon(Icons.menu),
+              onPressed: () {
+                Scaffold.of(context).openDrawer();
+              },
+            );
+          }),
+          actions: [
+            IconButton(
+              icon: Icon(Icons.logout),
+              onPressed: () {},
+            )
+          ]),
+      drawer: Drawer(
+          child: ListView(children: [
+        UserAccountsDrawerHeader(
+            accountName: Text("张三"), accountEmail: Text(""))
+      ])),
+      body: SafeArea(
+          child: Column(
+        children: [],
+      )),
     );
   }
 }

+ 43 - 0
lib/pages/login_page.dart

@@ -0,0 +1,43 @@
+import 'package:flutter/material.dart';
+
+/// Description: 登录页
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
+class LoginPage extends StatefulWidget {
+  const LoginPage({super.key});
+
+  @override
+  State<LoginPage> createState() => _LoginPageState();
+}
+
+class _LoginPageState extends State<LoginPage> {
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+      body: Stack(
+        children: [
+          Image.asset("assets/images/bg.png"),
+          Column(
+            children: [
+              Text("用户名:"),
+              TextField(),
+              Text("密码:"),
+              TextField(),
+              TextButton(onPressed: login, child: Text("登录")),
+              TextButton(onPressed: register, child: Text("注册")),
+              TextButton(onPressed: withoutLogin, child: Text("游客")),
+              TextButton(onPressed: back, child: Text("返回")),
+            ],
+          )
+        ],
+      ),
+    );
+  }
+
+  void login() {}
+  void register() {}
+  void withoutLogin() {}
+  void back() {
+    Navigator.pop(context);
+  }
+}

+ 46 - 0
lib/pages/register_page.dart

@@ -0,0 +1,46 @@
+import 'package:flutter/material.dart';
+
+/// Description: 注册
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
+class RegisterPage extends StatefulWidget {
+  const RegisterPage({super.key});
+
+  @override
+  State<RegisterPage> createState() => _RegisterPageState();
+}
+
+class _RegisterPageState extends State<RegisterPage> {
+  @override
+  Widget build(BuildContext context) {
+    return Scaffold(
+        body: Stack(
+      children: [
+        Image.asset("assets/images/bg.png"),
+        Column(
+          children: [
+            Text("用户名:"),
+            TextField(),
+            Text("密码:"),
+            TextField(),
+            Text("确认密码:"),
+            TextField(),
+            Text("建议填写以下信息,用于找回密码", style: TextStyle(color: Colors.yellow)),
+            Text("邮箱:"),
+            TextField(),
+            TextButton(onPressed: register, child: Text("注册")),
+            TextButton(onPressed: back, child: Text("返回")),
+          ],
+        )
+      ],
+    ));
+  }
+
+  void register() {
+    Navigator.pushNamed(context, "/login");
+  }
+
+  void back() {
+    Navigator.pushNamed(context, "/login");
+  }
+}

+ 30 - 0
lib/pages/splash_page.dart

@@ -0,0 +1,30 @@
+import 'package:flutter/material.dart';
+
+/// Description: 闪屏页
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
+class SplashPage extends StatefulWidget {
+  const SplashPage({super.key});
+
+  @override
+  State<SplashPage> createState() => _SplashPageState();
+}
+
+class _SplashPageState extends State<SplashPage> {
+  bool isAd = false; // 是否显示广告
+
+  Widget showAd(bool isAd) {
+    if (isAd) {
+      return const Text("广告");
+    } else {
+      return const Text("无广告");
+    }
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return const Scaffold(
+      body: Text("x"),
+    );
+  }
+}

+ 27 - 0
lib/routes.dart

@@ -0,0 +1,27 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_chinese_chees/pages/splash_page.dart';
+
+class Routes {
+  static const String home = '/';
+  static const String login = '/login';
+  static const String register = '/register';
+  static const String logout = '/logout';
+  static const String splash = '/splash';
+
+  static Route onGenerateRoute(RouteSettings settings) {
+    switch (settings.name) {
+      case home:
+        return MaterialPageRoute(builder: (_) => const SplashPage());
+      case login:
+        return MaterialPageRoute(builder: (_) => const SplashPage());
+      case register:
+        return MaterialPageRoute(builder: (_) => const SplashPage());
+      case logout:
+        return MaterialPageRoute(builder: (_) => const SplashPage());
+      case splash:
+        return MaterialPageRoute(builder: (_) => const SplashPage());
+      default:
+        return MaterialPageRoute(builder: (_) => const SplashPage());
+    }
+  }
+}

+ 6 - 0
lib/theme.dart

@@ -0,0 +1,6 @@
+/// Description: Theme: dark or light
+/// Time       : 04/28/2023 Friday
+/// Author     : liuyuqi.gov@msn.cn
+class Theme {
+  
+}

+ 8 - 2
pubspec.yaml

@@ -1,8 +1,8 @@
 name: flutter_chinese_chees
-description: A new Flutter project.
+description: 象棋app.
 publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 
-version: 1.0.0+1
+version: 1.1.0+1
 
 environment:
   sdk: '>=3.0.0-21.0.dev <4.0.0'
@@ -22,3 +22,9 @@ dev_dependencies:
 
 flutter:
   uses-material-design: true
+  
+  assets:
+    - assets/skins/woods/
+    - assets/images/
+    - assets/engines/
+    - assets/sounds/