Implemented new game same settings features
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import 'package:cabo_counter/data/game_session.dart';
|
import 'package:cabo_counter/data/game_session.dart';
|
||||||
import 'package:cabo_counter/l10n/app_localizations.dart';
|
import 'package:cabo_counter/l10n/app_localizations.dart';
|
||||||
import 'package:cabo_counter/utility/custom_theme.dart';
|
import 'package:cabo_counter/utility/custom_theme.dart';
|
||||||
|
import 'package:cabo_counter/views/create_game_view.dart';
|
||||||
import 'package:cabo_counter/views/graph_view.dart';
|
import 'package:cabo_counter/views/graph_view.dart';
|
||||||
import 'package:cabo_counter/views/round_view.dart';
|
import 'package:cabo_counter/views/round_view.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@@ -144,9 +145,21 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context)
|
AppLocalizations.of(context)
|
||||||
.new_game_same_settings,
|
.new_game_same_settings,
|
||||||
style: const TextStyle(
|
),
|
||||||
color: Colors.white30,
|
onTap: () {
|
||||||
))),
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (_) => CreateGameView(
|
||||||
|
gameTitle:
|
||||||
|
widget.gameSession.gameTitle,
|
||||||
|
isPointsLimitEnabled: widget
|
||||||
|
.gameSession
|
||||||
|
.isPointsLimitEnabled,
|
||||||
|
players: widget.gameSession.players,
|
||||||
|
)));
|
||||||
|
},
|
||||||
|
),
|
||||||
CupertinoListTile(
|
CupertinoListTile(
|
||||||
title:
|
title:
|
||||||
Text(AppLocalizations.of(context).export_game,
|
Text(AppLocalizations.of(context).export_game,
|
||||||
|
|||||||
@@ -7,18 +7,25 @@ import 'package:cabo_counter/views/active_game_view.dart';
|
|||||||
import 'package:cabo_counter/views/mode_selection_view.dart';
|
import 'package:cabo_counter/views/mode_selection_view.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
class CreateGame extends StatefulWidget {
|
class CreateGameView extends StatefulWidget {
|
||||||
const CreateGame({super.key});
|
final String? gameTitle;
|
||||||
|
final bool? isPointsLimitEnabled;
|
||||||
|
final List<String>? players;
|
||||||
|
|
||||||
|
const CreateGameView({
|
||||||
|
super.key,
|
||||||
|
this.gameTitle,
|
||||||
|
this.isPointsLimitEnabled,
|
||||||
|
this.players,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
// ignore: library_private_types_in_public_api
|
// ignore: library_private_types_in_public_api
|
||||||
_CreateGameState createState() => _CreateGameState();
|
_CreateGameViewState createState() => _CreateGameViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CreateGameState extends State<CreateGame> {
|
class _CreateGameViewState extends State<CreateGameView> {
|
||||||
final List<TextEditingController> _playerNameTextControllers = [
|
late List<TextEditingController> _playerNameTextControllers = [];
|
||||||
TextEditingController()
|
|
||||||
];
|
|
||||||
final TextEditingController _gameTitleTextController =
|
final TextEditingController _gameTitleTextController =
|
||||||
TextEditingController();
|
TextEditingController();
|
||||||
|
|
||||||
@@ -28,6 +35,21 @@ class _CreateGameState extends State<CreateGame> {
|
|||||||
/// Variable to store the selected game mode.
|
/// Variable to store the selected game mode.
|
||||||
bool? selectedMode;
|
bool? selectedMode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
selectedMode = widget.isPointsLimitEnabled;
|
||||||
|
_gameTitleTextController.text = widget.gameTitle ?? '';
|
||||||
|
if (widget.players != null) {
|
||||||
|
_playerNameTextControllers = [];
|
||||||
|
for (var player in widget.players!) {
|
||||||
|
_playerNameTextControllers.add(TextEditingController(text: player));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_playerNameTextControllers = [TextEditingController()];
|
||||||
|
}
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class _MainMenuViewState extends State<MainMenuView> {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => const CreateGame(),
|
builder: (context) => const CreateGameView(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -82,7 +82,8 @@ class _MainMenuViewState extends State<MainMenuView> {
|
|||||||
onTap: () => Navigator.push(
|
onTap: () => Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
builder: (context) => const CreateGame(),
|
builder: (context) =>
|
||||||
|
const CreateGameView(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
|
|||||||
@@ -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.3.4+267
|
version: 0.3.5+269
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user