Browse Source

Merge branch 'hotfix/blush-puma' of lyq/flutter_canteen into master

天问 1 year ago
parent
commit
6f5f9bc901

+ 1 - 0
.devcontainer/Dockerfile

@@ -0,0 +1 @@
+FROM jianboy/flutter-dev-container:2.10.5

+ 45 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,45 @@
+// java8 + android env
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.233.0/containers/java-8
+{
+    "name": "Java 8",
+    "build": {
+        "dockerfile": "Dockerfile",
+        "args": {
+            // Use the VARIANT arg to pick a Debian OS version: buster, bullseye
+            // Use bullseye when running on local arm64/Apple Silicon.
+            "VARIANT": "buster",
+            // Options
+            "INSTALL_MAVEN": "true",
+            "INSTALL_GRADLE": "true",
+            "NODE_VERSION": "lts/*"
+        }
+    },
+    // Set *default* container specific settings.json values on container create.
+    "settings": {
+        "java.home": "/docker-java-home",
+        "java.import.gradle.java.home": "/usr/local/sdkman/candidates/java/current",
+        "java.configuration.runtimes": [
+            {
+                "default": true,
+                "name": "JavaSE-1.8",
+                "path": "/usr/local/sdkman/candidates/java/current"
+            }
+        ]
+    },
+    // Add the IDs of extensions you want installed when the container is created.
+    "extensions": [
+        "vscjava.vscode-java-pack",
+        "dart-code.dart-code",
+        "dart-code.flutter"
+    ],
+    // Use 'forwardPorts' to make a list of ports inside the container available locally.
+    // "forwardPorts": [],
+    // Use 'postCreateCommand' to run commands after the container is created.
+    // "postCreateCommand": "java -version",
+    // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
+    "remoteUser": "vscode",
+    "features": {
+        "docker-in-docker": "latest"
+    }
+}

+ 2 - 15
android/app/build.gradle

@@ -22,11 +22,10 @@ if (flutterVersionName == null) {
 }
 
 apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
 
 android {
-    compileSdkVersion 30
+    compileSdkVersion 31
     signingConfigs {
         release {
             storeFile file("../sign/release.jks")
@@ -40,18 +39,10 @@ android {
         targetCompatibility JavaVersion.VERSION_1_8
     }
 
-    kotlinOptions {
-        jvmTarget = '1.8'
-    }
-
-    sourceSets {
-        main.java.srcDirs += 'src/main/kotlin'
-    }
-
     defaultConfig {
         applicationId "com.chzn.canteen.canteen"
         minSdkVersion 16
-        targetSdkVersion 30
+        targetSdkVersion 31
         versionCode flutterVersionCode.toInteger()
         versionName flutterVersionName
     }
@@ -66,7 +57,3 @@ android {
 flutter {
     source '../..'
 }
-
-dependencies {
-    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
-}

+ 6 - 0
android/app/src/main/java/com/chzn/canteen/canteen/MainActivity.java

@@ -0,0 +1,6 @@
+package com.chzn.canteen.canteen;
+
+import io.flutter.embedding.android.FlutterActivity;
+
+public class MainActivity extends FlutterActivity {
+}

+ 0 - 6
android/app/src/main/kotlin/com/chzn/canteen/canteen/MainActivity.kt

@@ -1,6 +0,0 @@
-package com.chzn.canteen.canteen
-
-import io.flutter.embedding.android.FlutterActivity
-
-class MainActivity: FlutterActivity() {
-}

+ 0 - 2
android/build.gradle

@@ -1,5 +1,4 @@
 buildscript {
-    ext.kotlin_version = '1.3.50'
     repositories {
         google()
         mavenCentral()
@@ -7,7 +6,6 @@ buildscript {
 
     dependencies {
         classpath 'com.android.tools.build:gradle:4.1.0'
-        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
     }
 }
 

+ 0 - 3
lib/utils/sp_util.dart

@@ -1,3 +0,0 @@
-class SpUtil{
-  
-}

+ 51 - 0
lib/utils/sp_utils.dart

@@ -0,0 +1,51 @@
+import 'package:shared_preferences/shared_preferences.dart';
+
+class SpUtil {
+  static Future<SharedPreferences> sharedPreferences = SharedPreferences.getInstance();
+
+  static Future<T> get<T>(String key) {
+    key ??= '';
+    return sharedPreferences.then((s) {
+      return s.get(key) as T;
+    });
+  }
+
+  static Future<bool> save<T>(String key, T value) async {
+    key ??= '';
+    return sharedPreferences.then((s) {
+      if (value == null) {
+        return s.remove(key);
+      } else {
+        if (value is int) {
+          return s.setInt(key, value);
+        }
+        if (value is double) {
+          return s.setDouble(key, value);
+        }
+        if (value is String) {
+          return s.setString(key, value);
+        }
+        if (value is List<String>) {
+          return s.setStringList(key, value);
+        }
+        if (value is bool) {
+          return s.setBool(key, value);
+        }
+      }
+      return false;
+    });
+  }
+
+  static Future<bool> remove(String key) {
+    key ??= '';
+    return sharedPreferences.then((s) {
+      return s.remove(key);
+    });
+  }
+
+  static Future<bool> clear() {
+    return sharedPreferences.then((s) {
+      return s.clear();
+    });
+  }
+}

+ 1 - 1
lib/views/chzn_expansion_panel_list.dart

@@ -263,7 +263,7 @@ class _ExpansionPanelListState extends State<ChznExpansionPanelList> {
     return MergeableMaterial(
       hasDividers: true,
       dividerColor: widget.dividerColor,
-      elevation: widget.elevation.toInt(),
+      elevation: widget.elevation.toDouble(),
       children: items,
     );
   }

+ 15 - 8
pubspec.lock

@@ -7,7 +7,7 @@ packages:
       name: async
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.6.1"
+    version: "2.8.2"
   boolean_selector:
     dependency: transitive
     description:
@@ -21,14 +21,14 @@ packages:
       name: characters
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.1.0"
+    version: "1.2.0"
   charcode:
     dependency: transitive
     description:
       name: charcode
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.2.0"
+    version: "1.3.1"
   clock:
     dependency: transitive
     description:
@@ -87,14 +87,21 @@ packages:
       name: matcher
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "0.12.10"
+    version: "0.12.11"
+  material_color_utilities:
+    dependency: transitive
+    description:
+      name: material_color_utilities
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "0.1.3"
   meta:
     dependency: transitive
     description:
       name: meta
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.3.0"
+    version: "1.7.0"
   path:
     dependency: transitive
     description:
@@ -148,7 +155,7 @@ packages:
       name: test_api
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "0.3.0"
+    version: "0.4.8"
   typed_data:
     dependency: transitive
     description:
@@ -162,6 +169,6 @@ packages:
       name: vector_math
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.1.0"
+    version: "2.1.1"
 sdks:
-  dart: ">=2.12.0 <3.0.0"
+  dart: ">=2.14.0 <3.0.0"