PR suggestion

This commit is contained in:
Erick Zanardo
2020-04-14 08:57:44 -03:00
parent e3e1c8d630
commit 4df24f71e7
2 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import 'package:flame/palette.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() { void main() {
final game = MyGame()..runOnCreation = false; final game = MyGame();
runApp(game.widget); runApp(game.widget);
} }
@ -54,7 +54,7 @@ class Square extends PositionComponent with HasGameRef<MyGame> {
class MyGame extends BaseGame with TapDetector { class MyGame extends BaseGame with TapDetector {
final double squareSize = 128; final double squareSize = 128;
bool running = false; bool running = true;
MyGame() { MyGame() {
add(Square()); add(Square());

View File

@ -397,8 +397,9 @@ class GameRenderBox extends RenderBox with WidgetsBindingObserver {
void _unscheduleTick() { void _unscheduleTick() {
_running = false; _running = false;
if (_frameCallbackId != null) if (_frameCallbackId != null) {
SchedulerBinding.instance.cancelFrameCallbackWithId(_frameCallbackId); SchedulerBinding.instance.cancelFrameCallbackWithId(_frameCallbackId);
}
} }
void _tick(Duration timestamp) { void _tick(Duration timestamp) {