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