|
@@ -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
|