match_magic/lib/widgets/overlays/game_overlay/pause_button.dart

33 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:match_magic/game/board.dart';
import 'package:match_magic/screens/pause_screen.dart';
import 'package:match_magic/widgets/icon_widgets/pause_circle_icon.dart';
import 'package:match_magic/widgets/overlays/game_overlay/hint_button.dart';
import 'package:match_magic/widgets/overlays/game_overlay/restart_button.dart';
class PauseButton extends StatelessWidget {
final Board gameRef;
static const String id = 'PauseButton';
const PauseButton({Key? key, required this.gameRef}) : super(key: key);
@override
Widget build(BuildContext context) {
return Positioned(
top: 46,
left: 10,
child: IconButton(
onPressed: () {
// AdManager.loadInterstitialAd();
gameRef.pauseEngine();
gameRef.overlays.add(PauseMenu.id);
gameRef.overlays.remove(PauseButton.id);
gameRef.overlays.remove(RestartButton.id);
gameRef.overlays.remove(HintButton.id);
},
icon: PauseCircleIcon(),
),
);
}
}