Change the point in time when the board gets cleared.
This commit is contained in:
parent
d55c7bbe1a
commit
e27f1c7c22
@ -6,9 +6,8 @@ typedef ChessMoveHistory = List<ChessMove>;
|
|||||||
|
|
||||||
class ChessPosition {
|
class ChessPosition {
|
||||||
static ChessPosition _instance = ChessPosition._internal();
|
static ChessPosition _instance = ChessPosition._internal();
|
||||||
final ChessPositionType position;
|
|
||||||
|
|
||||||
static ChessMoveHistory history = ChessMoveHistory.empty(growable: true);
|
static ChessMoveHistory history = ChessMoveHistory.empty(growable: true);
|
||||||
|
final ChessPositionType position;
|
||||||
|
|
||||||
static ChessPosition getInstance() {
|
static ChessPosition getInstance() {
|
||||||
return _instance;
|
return _instance;
|
||||||
|
@ -73,7 +73,6 @@ class ServerConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleIncomingColorDeterminedMessage(ApiWebsocketMessage apiMessage) {
|
void handleIncomingColorDeterminedMessage(ApiWebsocketMessage apiMessage) {
|
||||||
ChessBloc.getInstance().add(InitBoard());
|
|
||||||
ChessBloc.getInstance().add(
|
ChessBloc.getInstance().add(
|
||||||
ColorDetermined(myColor: ChessColor.fromApiColor(apiMessage.color!)));
|
ColorDetermined(myColor: ChessColor.fromApiColor(apiMessage.color!)));
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:mchess/api/register.dart';
|
import 'package:mchess/api/register.dart';
|
||||||
|
import 'package:mchess/chess_bloc/chess_bloc.dart';
|
||||||
|
import 'package:mchess/chess_bloc/chess_events.dart';
|
||||||
import 'package:mchess/pages/chess_game.dart';
|
import 'package:mchess/pages/chess_game.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
@ -21,6 +23,7 @@ class _PrepareChessGameWidgetState extends State<PrepareChessGameWidget> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
ChessBloc.getInstance().add(InitBoard());
|
||||||
randomGameResponse = registerForRandomGame();
|
randomGameResponse = registerForRandomGame();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user