2022-12-25 15:16:23 +00:00
|
|
|
import 'package:go_router/go_router.dart';
|
2022-12-25 18:57:47 +00:00
|
|
|
import 'package:mchess/pages/chess_game.dart';
|
2022-12-25 15:16:23 +00:00
|
|
|
import 'package:mchess/pages/lobby_selector.dart';
|
2023-05-28 12:54:46 +00:00
|
|
|
import 'package:mchess/pages/prepare_chess_game.dart';
|
2022-12-25 15:16:23 +00:00
|
|
|
|
2022-12-25 19:30:42 +00:00
|
|
|
class ChessAppRouter {
|
|
|
|
static final ChessAppRouter _instance = ChessAppRouter._internal();
|
|
|
|
|
|
|
|
ChessAppRouter._internal();
|
|
|
|
|
|
|
|
static ChessAppRouter getInstance() {
|
|
|
|
return _instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
final router = GoRouter(
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
path: '/',
|
2023-05-28 12:54:46 +00:00
|
|
|
name: 'lobbySelector',
|
2022-12-25 19:30:42 +00:00
|
|
|
builder: (context, state) => const LobbySelector(),
|
|
|
|
),
|
|
|
|
GoRoute(
|
2023-05-28 12:54:46 +00:00
|
|
|
path: '/play',
|
|
|
|
name: 'prepareChessGame',
|
|
|
|
builder: (context, state) {
|
|
|
|
Future future = state.extra as Future;
|
|
|
|
return PrepareChessGameWidget(responseFutureForRegistering: future);
|
|
|
|
})
|
2022-12-25 19:30:42 +00:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|