Browse Source

Automatic Commit By liuyuqi

liuyuqi-dellpc 3 years ago
parent
commit
17a29bdca5

+ 5 - 5
android/app/build.gradle

@@ -22,7 +22,7 @@ if (flutterVersionName == null) {
 }
 
 apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
+//apply plugin: 'kotlin-android'
 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
 
 android {
@@ -60,8 +60,8 @@ flutter {
 }
 
 dependencies {
-    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
-    testImplementation 'junit:junit:4.12'
-    androidTestImplementation 'androidx.test:runner:1.1.1'
-    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
+//    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+//    testImplementation 'junit:junit:4.12'
+//    androidTestImplementation 'androidx.test:runner:1.1.1'
+//    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
 }

+ 6 - 0
android/app/src/main/java/tech/soit/flutter_tetris/MainActivity.java

@@ -0,0 +1,6 @@
+package tech.soit.flutter_tetris;
+
+import io.flutter.embedding.android.FlutterActivity;
+
+public class MainActivity extends FlutterActivity {
+}

+ 2 - 2
android/build.gradle

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

+ 4 - 3
lib/gamer/gamer.dart

@@ -2,8 +2,8 @@ import 'dart:async';
 
 import 'package:flutter/material.dart';
 import 'package:tetris/gamer/block.dart';
-import 'package:tetris/main.dart';
 import 'package:tetris/material/audios.dart';
+import 'package:tetris/model/config.dart';
 
 ///the height of game pad
 const GAME_PAD_MATRIX_H = 20;
@@ -52,7 +52,7 @@ class Game extends StatefulWidget {
   }
 
   static GameControl of(BuildContext context) {
-    final state = context.ancestorStateOfType(TypeMatcher<GameControl>());
+    final state = context.findAncestorStateOfType<GameControl>();
     assert(state != null, "must wrap this context with [Game]");
     return state;
   }
@@ -423,7 +423,8 @@ class GameState extends InheritedWidget {
   final Block next;
 
   static GameState of(BuildContext context) {
-    return (context.inheritFromWidgetOfExactType(GameState) as GameState);
+    return (context.dependOnInheritedWidgetOfExactType(aspect: GameState)
+        as GameState);
   }
 
   @override

+ 4 - 0
lib/gamer/keyboard.dart

@@ -14,13 +14,16 @@ class KeyboardController extends StatefulWidget {
 }
 
 class _KeyboardControllerState extends State<KeyboardController> {
+
   @override
   void initState() {
     super.initState();
+    // 监听按钮
     RawKeyboard.instance.addListener(_onKey);
   }
 
   void _onKey(RawKeyEvent event) {
+
     if (event is RawKeyUpEvent) {
       return;
     }
@@ -57,4 +60,5 @@ class _KeyboardControllerState extends State<KeyboardController> {
   Widget build(BuildContext context) {
     return widget.child;
   }
+
 }

+ 1 - 1
lib/income/donation_dialog.dart

@@ -38,7 +38,7 @@ class DonationDialog extends StatelessWidget {
             await Clipboard.setData(ClipboardData(text: HONG_BAO));
             final data = await Clipboard.getData(Clipboard.kTextPlain);
             if (data.text == HONG_BAO) {
-              showSimpleNotification(context, Text("已复制到粘贴板 (≧y≦*)"));
+              showSimpleNotification(Text("已复制到粘贴板 (≧y≦*)"));
             } else {
               await showDialog(
                   context: context,

+ 1 - 6
lib/main.dart

@@ -8,6 +8,7 @@ import 'package:tetris/pages/home_page.dart';
 import 'package:tetris/utils/app_util.dart';
 
 import 'gamer/keyboard.dart';
+import 'model/config.dart';
 
 void main() {
   debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
@@ -37,9 +38,3 @@ class MyApp extends StatelessWidget {
     );
   }
 }
-
-final RouteObserver<ModalRoute> routeObserver = RouteObserver<ModalRoute>();
-//边框
-const SCREEN_BORDER_WIDTH = 3.0;
-
-const BACKGROUND_COLOR = const Color(0xffefcc19);

+ 1 - 1
lib/material/audios.dart

@@ -13,7 +13,7 @@ class Sound extends StatefulWidget {
   SoundState createState() => SoundState();
 
   static SoundState of(BuildContext context) {
-    final state = context.ancestorStateOfType(const TypeMatcher<SoundState>());
+    final state = context.findAncestorStateOfType<SoundState>();
     assert(state != null, 'can not find Sound widget');
     return state;
   }

+ 1 - 1
lib/material/briks.dart

@@ -17,7 +17,7 @@ class BrikSize extends InheritedWidget {
   final Size size;
 
   static BrikSize of(BuildContext context) {
-    final brikSize = context.inheritFromWidgetOfExactType(BrikSize) as BrikSize;
+    final brikSize = context.dependOnInheritedWidgetOfExactType(aspect: BrikSize) as BrikSize;
     assert(brikSize != null, "....");
     return brikSize;
   }

+ 1 - 1
lib/material/material.dart

@@ -13,7 +13,7 @@ class GameMaterial extends StatefulWidget {
 
   static ui.Image getMaterial(BuildContext context) {
     final _GameMaterialState state =
-        context.ancestorStateOfType(const TypeMatcher<_GameMaterialState>());
+        context.findAncestorStateOfType<_GameMaterialState>();
     assert(state != null, "can not find GameMaterial widget");
     return state.material;
   }

+ 8 - 0
lib/model/config.dart

@@ -1,3 +1,11 @@
+
+import 'package:flutter/material.dart';
+
+final RouteObserver<ModalRoute> routeObserver = RouteObserver<ModalRoute>();
+//边框
+const SCREEN_BORDER_WIDTH = 3.0;
+const BACKGROUND_COLOR = const Color(0xffefcc19);
+
 class Config {
 
 }

+ 1 - 0
lib/panel/page_portrait.dart

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
 import 'package:tetris/generated/i18n.dart';
 import 'package:tetris/income/donation_dialog.dart';
 import 'package:tetris/main.dart';
+import 'package:tetris/model/config.dart';
 import 'package:tetris/panel/controller.dart';
 import 'package:tetris/panel/screen.dart';
 

+ 5 - 4
pubspec.yaml

@@ -10,16 +10,17 @@ dependencies:
   flutter_localizations:
     sdk: flutter
 
-  overlay_support: ^0.0.4
-  soundpool: ^1.0.1
+  overlay_support: ^1.2.1
+  soundpool: ^2.3.0
 
 dev_dependencies:
   flutter_test:
     sdk: flutter
+
 flutter:
   uses-material-design: true
   assets:
     - assets/material.png
     - assets/audios/
-    - assets/alipay.jpg
-    - assets/wechat.png
+#    - assets/alipay.jpg
+#    - assets/wechat.png