Change behavior of promotion dialog.

This commit is contained in:
Marco 2023-07-06 00:06:03 +02:00
parent fea24c8274
commit 95fba78d0c

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:mchess/chess_bloc/promotion_bloc.dart';
import 'package:mchess/utils/chess_utils.dart';
@ -27,8 +26,8 @@ class PromotionDialog extends StatelessWidget {
children: [
IconButton(
onPressed: () {
Navigator.pop(context);
pieceChosen(ChessPieceClass.queen);
context.pop();
},
icon: SvgPicture.asset(chessPiecesAssets[ChessPieceAssetKey(
pieceClass: ChessPieceClass.queen, color: sideColor)]!),
@ -36,8 +35,8 @@ class PromotionDialog extends StatelessWidget {
),
IconButton(
onPressed: () {
Navigator.pop(context);
pieceChosen(ChessPieceClass.rook);
context.pop();
},
icon: SvgPicture.asset(chessPiecesAssets[ChessPieceAssetKey(
pieceClass: ChessPieceClass.rook, color: sideColor)]!),
@ -45,8 +44,8 @@ class PromotionDialog extends StatelessWidget {
),
IconButton(
onPressed: () {
Navigator.pop(context);
pieceChosen(ChessPieceClass.knight);
context.pop();
},
icon: SvgPicture.asset(chessPiecesAssets[ChessPieceAssetKey(
pieceClass: ChessPieceClass.knight, color: sideColor)]!),
@ -54,8 +53,8 @@ class PromotionDialog extends StatelessWidget {
),
IconButton(
onPressed: () {
Navigator.pop(context);
pieceChosen(ChessPieceClass.bishop);
context.pop();
},
icon: SvgPicture.asset(chessPiecesAssets[ChessPieceAssetKey(
pieceClass: ChessPieceClass.bishop, color: sideColor)]!),