Changed mode description text and return type of widget
This commit is contained in:
@@ -18,8 +18,12 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
];
|
];
|
||||||
final TextEditingController _gameTitleTextController =
|
final TextEditingController _gameTitleTextController =
|
||||||
TextEditingController();
|
TextEditingController();
|
||||||
|
|
||||||
|
/// Maximum number of players allowed in the game.
|
||||||
final int maxPlayers = 5;
|
final int maxPlayers = 5;
|
||||||
String? selectedMode; // Variable für den ausgewählten Spielmodus
|
|
||||||
|
/// Variable to store the selected game mode.
|
||||||
|
bool? selectedMode;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -45,7 +49,7 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
||||||
child: CupertinoTextField(
|
child: CupertinoTextField(
|
||||||
decoration: const BoxDecoration(),
|
decoration: const BoxDecoration(),
|
||||||
maxLength: 8,
|
maxLength: 16,
|
||||||
prefix: const Text('Name'),
|
prefix: const Text('Name'),
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
placeholder: 'Titel des Spiels',
|
placeholder: 'Titel des Spiels',
|
||||||
@@ -62,7 +66,9 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
suffix: Row(
|
suffix: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
selectedMode ?? 'Wähle einen Modus',
|
selectedMode == null
|
||||||
|
? 'Wähle einen Modus'
|
||||||
|
: (selectedMode! ? '101 Punkte' : 'Unbegrenzt'),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 3),
|
const SizedBox(width: 3),
|
||||||
const CupertinoListTileChevron(),
|
const CupertinoListTileChevron(),
|
||||||
@@ -277,8 +283,7 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
GameSession gameSession = GameSession(
|
GameSession gameSession = GameSession(
|
||||||
gameTitle: _gameTitleTextController.text,
|
gameTitle: _gameTitleTextController.text,
|
||||||
players: players,
|
players: players,
|
||||||
gameHasPointLimit:
|
gameHasPointLimit: selectedMode!,
|
||||||
selectedMode == '101 Pkt.' ? true : false,
|
|
||||||
);
|
);
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
|||||||
@@ -18,13 +18,12 @@ class ModeSelectionMenu extends StatelessWidget {
|
|||||||
child: CupertinoListTile(
|
child: CupertinoListTile(
|
||||||
title: Text('101 Punkte', style: Styles.modeTitle),
|
title: Text('101 Punkte', style: Styles.modeTitle),
|
||||||
subtitle: const Text(
|
subtitle: const Text(
|
||||||
'Es wird solange gespielt, bis einer Spieler die 101 Punkte '
|
'Es wird solange gespielt, bis einer Spieler mehr als 100 Punkte erreicht',
|
||||||
'genau erreicht oder überschreitet.',
|
|
||||||
style: Styles.modeDescription,
|
style: Styles.modeDescription,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context, '101 Punkte');
|
Navigator.pop(context, true);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -34,12 +33,12 @@ class ModeSelectionMenu extends StatelessWidget {
|
|||||||
title: Text('Unbegrenzt', style: theme.modeTitle),
|
title: Text('Unbegrenzt', style: theme.modeTitle),
|
||||||
subtitle: const Text(
|
subtitle: const Text(
|
||||||
'Dem Spiel sind keine Grenzen gesetzt. Es wird so lange '
|
'Dem Spiel sind keine Grenzen gesetzt. Es wird so lange '
|
||||||
'gespielt, bis die Spieler keine Lust mehr haben.',
|
'gespielt, bis Ihr keine Lust mehr habt.',
|
||||||
style: Styles.modeDescription,
|
style: Styles.modeDescription,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context, 'Unbegrenzt');
|
Navigator.pop(context, false);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user