Fixed merge issues
This commit is contained in:
@@ -193,7 +193,8 @@ class _CreateGameViewState extends State<CreateGameView> {
|
||||
child: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
CupertinoIcons.add_circled_solid,
|
||||
@@ -201,28 +202,29 @@ class _CreateGameViewState extends State<CreateGameView> {
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
AppLocalizations.of(context).add_player,
|
||||
style:
|
||||
TextStyle(color: CustomTheme.primaryColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
AppLocalizations.of(context)
|
||||
.add_player,
|
||||
style: TextStyle(
|
||||
color:
|
||||
CustomTheme.primaryColor),
|
||||
),
|
||||
]),
|
||||
onPressed: () {
|
||||
if (_playerNameTextControllers.length < maxPlayers) {
|
||||
if (_playerNameTextControllers.length <
|
||||
maxPlayers) {
|
||||
setState(() {
|
||||
_playerNameTextControllers
|
||||
.add(TextEditingController());
|
||||
});
|
||||
} else {
|
||||
showFeedbackDialog(CreateStatus.maxPlayers);
|
||||
showFeedbackDialog(
|
||||
CreateStatus.maxPlayers);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
})));
|
||||
} else {
|
||||
// Spieler-Einträge
|
||||
// Player entries
|
||||
return Padding(
|
||||
key: ValueKey(_playerNameTextControllers[index]),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0, horizontal: 5),
|
||||
child: Row(
|
||||
@@ -251,13 +253,11 @@ class _CreateGameViewState extends State<CreateGameView> {
|
||||
decoration: const BoxDecoration(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
}
|
||||
})),
|
||||
Center(
|
||||
child: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
@@ -319,18 +319,26 @@ class _CreateGameViewState extends State<CreateGameView> {
|
||||
),
|
||||
],
|
||||
))));
|
||||
}
|
||||
|
||||
Future<void> _createGame() async {
|
||||
/*var uuid = const Uuid();
|
||||
id = uuid.v1();*/
|
||||
|
||||
List<String> players = [];
|
||||
for (var controller in _playerNameTextControllers) {
|
||||
players.add(controller.text);
|
||||
}
|
||||
|
||||
bool isPointsLimitEnabled = gameMode == GameMode.pointLimit;
|
||||
|
||||
GameSession gameSession = GameSession(
|
||||
createdAt: DateTime.now(),
|
||||
gameTitle: _gameTitleTextController.text,
|
||||
players: players,
|
||||
pointLimit: Globals.pointLimit,
|
||||
caboPenalty: Globals.caboPenalty,
|
||||
isPointsLimitEnabled: _isPointsLimitEnabled!,
|
||||
pointLimit: ConfigService.getPointLimit(),
|
||||
caboPenalty: ConfigService.getCaboPenalty(),
|
||||
isPointsLimitEnabled: isPointsLimitEnabled,
|
||||
);
|
||||
final index = await gameManager.addGameSession(gameSession);
|
||||
final session = gameManager.gameList[index];
|
||||
@@ -361,6 +369,63 @@ class _CreateGameViewState extends State<CreateGameView> {
|
||||
});
|
||||
}
|
||||
|
||||
void _checkAllGameAttributes() {
|
||||
if (_gameTitleTextController.text == '') {
|
||||
_showDialog((
|
||||
AppLocalizations.of(context).no_gameTitle_title,
|
||||
AppLocalizations.of(context).no_gameTitle_message
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
if (gameMode == GameMode.none) {
|
||||
_showDialog(
|
||||
(
|
||||
AppLocalizations.of(context).no_mode_title,
|
||||
AppLocalizations.of(context).no_mode_message
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_playerNameTextControllers.length < 2) {
|
||||
_showDialog(
|
||||
(
|
||||
AppLocalizations.of(context).min_players_title,
|
||||
AppLocalizations.of(context).min_players_message
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!everyPlayerHasAName()) {
|
||||
_showDialog((
|
||||
AppLocalizations.of(context).no_name_title,
|
||||
AppLocalizations.of(context).no_name_message
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
_createGame();
|
||||
}
|
||||
|
||||
void _showDialog((String, String) content) {
|
||||
final (title, message) = content;
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(message),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(AppLocalizations.of(context).ok),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns the title and message for the dialog based on the [CreateStatus].
|
||||
(String, String) _getDialogContent(CreateStatus status) {
|
||||
switch (status) {
|
||||
|
||||
@@ -2,7 +2,7 @@ name: cabo_counter
|
||||
description: "Mobile app for the card game Cabo"
|
||||
publish_to: 'none'
|
||||
|
||||
version: 0.5.0+554
|
||||
version: 0.5.0+556
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.4
|
||||
|
||||
Reference in New Issue
Block a user