id gets added to gameSession class at creation
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:cabo_counter/services/config_service.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
|
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
|
||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
enum CreateStatus {
|
enum CreateStatus {
|
||||||
noGameTitle,
|
noGameTitle,
|
||||||
@@ -268,8 +269,8 @@ class _CreateGameViewState extends State<CreateGameView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _createGame() async {
|
Future<void> _createGame() async {
|
||||||
/*var uuid = const Uuid();
|
var uuid = const Uuid();
|
||||||
id = uuid.v1();*/
|
final String id = uuid.v1();
|
||||||
|
|
||||||
List<String> players = [];
|
List<String> players = [];
|
||||||
for (var controller in _playerNameTextControllers) {
|
for (var controller in _playerNameTextControllers) {
|
||||||
@@ -279,6 +280,7 @@ class _CreateGameViewState extends State<CreateGameView> {
|
|||||||
bool isPointsLimitEnabled = gameMode == GameMode.pointLimit;
|
bool isPointsLimitEnabled = gameMode == GameMode.pointLimit;
|
||||||
|
|
||||||
GameSession gameSession = GameSession(
|
GameSession gameSession = GameSession(
|
||||||
|
id: id,
|
||||||
createdAt: DateTime.now(),
|
createdAt: DateTime.now(),
|
||||||
gameTitle: _gameTitleTextController.text,
|
gameTitle: _gameTitleTextController.text,
|
||||||
players: players,
|
players: players,
|
||||||
@@ -286,8 +288,8 @@ class _CreateGameViewState extends State<CreateGameView> {
|
|||||||
caboPenalty: ConfigService.getCaboPenalty(),
|
caboPenalty: ConfigService.getCaboPenalty(),
|
||||||
isPointsLimitEnabled: isPointsLimitEnabled,
|
isPointsLimitEnabled: isPointsLimitEnabled,
|
||||||
);
|
);
|
||||||
final index = await gameManager.addGameSession(gameSession);
|
gameManager.addGameSession(gameSession);
|
||||||
final session = gameManager.gameList[index];
|
final session = gameManager.getGameSessionById(id)!;
|
||||||
|
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context,
|
context,
|
||||||
|
|||||||
Reference in New Issue
Block a user