Merge pull request 'Fehlende Umbenennungen' (#106) from refactoring/105-fehlende-umbenennungen into development

Reviewed-on: #106
Reviewed-by: Mathis Kirchner <mathis.kirchner.mk@gmail.com>
This commit was merged in pull request #106.
This commit is contained in:
2025-12-31 16:27:29 +00:00
5 changed files with 21 additions and 21 deletions

View File

@@ -28,8 +28,8 @@ class _CreateMatchViewState extends State<CreateMatchView> {
/// Reference to the app database /// Reference to the app database
late final AppDatabase db; late final AppDatabase db;
/// Controller for the game name input field /// Controller for the match name input field
final TextEditingController _gameNameController = TextEditingController(); final TextEditingController _matchNameController = TextEditingController();
/// List of all groups from the database /// List of all groups from the database
List<Group> groupsList = []; List<Group> groupsList = [];
@@ -95,7 +95,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_gameNameController.addListener(() { _matchNameController.addListener(() {
setState(() {}); setState(() {});
}); });
@@ -119,7 +119,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
backgroundColor: CustomTheme.backgroundColor, backgroundColor: CustomTheme.backgroundColor,
scrolledUnderElevation: 0, scrolledUnderElevation: 0,
title: const Text( title: const Text(
'Create new game', 'Create new match',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
), ),
centerTitle: true, centerTitle: true,
@@ -131,8 +131,8 @@ class _CreateMatchViewState extends State<CreateMatchView> {
Container( Container(
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5), margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
child: TextInputField( child: TextInputField(
controller: _gameNameController, controller: _matchNameController,
hintText: 'Game name', hintText: 'Match name',
), ),
), ),
ChooseTile( ChooseTile(
@@ -222,13 +222,13 @@ class _CreateMatchViewState extends State<CreateMatchView> {
), ),
), ),
CustomWidthButton( CustomWidthButton(
text: 'Create game', text: 'Create match',
sizeRelativeToWidth: 0.95, sizeRelativeToWidth: 0.95,
buttonType: ButtonType.primary, buttonType: ButtonType.primary,
onPressed: _enableCreateGameButton() onPressed: _enableCreateGameButton()
? () async { ? () async {
Match match = Match( Match match = Match(
name: _gameNameController.text.trim(), name: _matchNameController.text.trim(),
createdAt: DateTime.now(), createdAt: DateTime.now(),
group: selectedGroup, group: selectedGroup,
players: selectedPlayers, players: selectedPlayers,
@@ -239,7 +239,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
context, context,
CupertinoPageRoute( CupertinoPageRoute(
fullscreenDialog: true, fullscreenDialog: true,
builder: (context) => GameResultView( builder: (context) => MatchResultView(
match: match, match: match,
onWinnerChanged: widget.onWinnerChanged, onWinnerChanged: widget.onWinnerChanged,
), ),
@@ -258,7 +258,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
/// Determines whether the "Create Game" button should be enabled based on /// Determines whether the "Create Game" button should be enabled based on
/// the current state of the input fields. /// the current state of the input fields.
bool _enableCreateGameButton() { bool _enableCreateGameButton() {
return _gameNameController.text.isNotEmpty && return _matchNameController.text.isNotEmpty &&
(selectedGroup != null || (selectedGroup != null ||
(selectedPlayers != null && selectedPlayers!.length > 1)) && (selectedPlayers != null && selectedPlayers!.length > 1)) &&
selectedRuleset != null; selectedRuleset != null;

View File

@@ -6,17 +6,17 @@ import 'package:game_tracker/data/dto/player.dart';
import 'package:game_tracker/presentation/widgets/tiles/custom_radio_list_tile.dart'; import 'package:game_tracker/presentation/widgets/tiles/custom_radio_list_tile.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class GameResultView extends StatefulWidget { class MatchResultView extends StatefulWidget {
final Match match; final Match match;
final VoidCallback? onWinnerChanged; final VoidCallback? onWinnerChanged;
const GameResultView({super.key, required this.match, this.onWinnerChanged}); const MatchResultView({super.key, required this.match, this.onWinnerChanged});
@override @override
State<GameResultView> createState() => _GameResultViewState(); State<MatchResultView> createState() => _MatchResultViewState();
} }
class _GameResultViewState extends State<GameResultView> { class _MatchResultViewState extends State<MatchResultView> {
late final List<Player> allPlayers; late final List<Player> allPlayers;
late final AppDatabase db; late final AppDatabase db;
Player? _selectedPlayer; Player? _selectedPlayer;
@@ -142,12 +142,12 @@ class _GameResultViewState extends State<GameResultView> {
widget.onWinnerChanged?.call(); widget.onWinnerChanged?.call();
} }
List<Player> getAllPlayers(Match game) { List<Player> getAllPlayers(Match match) {
if (game.group == null && game.players != null) { if (match.group == null && match.players != null) {
return [...game.players!]; return [...match.players!];
} else if (game.group != null && game.players != null) { } else if (match.group != null && match.players != null) {
return [...game.players!, ...game.group!.members]; return [...match.players!, ...match.group!.members];
} }
return [...game.group!.members]; return [...match.group!.members];
} }
} }

View File

@@ -80,7 +80,7 @@ class _MatchViewState extends State<MatchView> {
context, context,
CupertinoPageRoute( CupertinoPageRoute(
fullscreenDialog: true, fullscreenDialog: true,
builder: (context) => GameResultView( builder: (context) => MatchResultView(
match: matches[index], match: matches[index],
onWinnerChanged: loadGames, onWinnerChanged: loadGames,
), ),