mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-04 04:47:13 +08:00
PR suggestions
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:flame/gestures.dart';
|
||||
import 'package:flame/palette.dart';
|
||||
|
||||
class ExampleGame extends Game with HasWidgetsOverlay, TapDetector {
|
||||
bool isPaused = false;
|
||||
@ -11,23 +12,23 @@ class ExampleGame extends Game with HasWidgetsOverlay, TapDetector {
|
||||
@override
|
||||
void render(Canvas canvas) {
|
||||
canvas.drawRect(const Rect.fromLTWH(100, 100, 100, 100),
|
||||
Paint()..color = const Color(0xFFFFFFFF));
|
||||
Paint()..color = BasicPalette.white.color);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTap() {
|
||||
if (isPaused) {
|
||||
removeWidgetOverlay("PauseMenu");
|
||||
removeWidgetOverlay('PauseMenu');
|
||||
isPaused = false;
|
||||
} else {
|
||||
addWidgetOverlay(
|
||||
"PauseMenu",
|
||||
'PauseMenu',
|
||||
Center(
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
color: const Color(0xFFFF0000),
|
||||
child: const Center(child: const Text("Paused")),
|
||||
child: const Center(child: const Text('Paused')),
|
||||
),
|
||||
));
|
||||
isPaused = true;
|
||||
|
||||
Reference in New Issue
Block a user