Bearbeiten und Löschen von Matches #171

Merged
sneeex merged 64 commits from feature/120-bearbeiten-und-loeschen-von-matches into development 2026-03-08 08:28:10 +00:00
2 changed files with 8 additions and 11 deletions
Showing only changes of commit 4bcb10df81 - Show all commits

View File

@@ -315,6 +315,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
matchId: widget.match!.id,
playerId: player.id,
);
if (widget.match!.winner?.id == player.id) {
updatedMatch.winner = null;
}
}
}

View File

@@ -40,15 +40,12 @@ class MatchDetailView extends StatefulWidget {
class _MatchDetailViewState extends State<MatchDetailView> {
late final AppDatabase db;
late Player? currentWinner;
late Match match;
@override
void initState() {
super.initState();
db = Provider.of<AppDatabase>(context, listen: false);
currentWinner = widget.match.winner;
match = widget.match;
}
@@ -184,7 +181,7 @@ class _MatchDetailViewState extends State<MatchDetailView> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
/// TODO: Implement different ruleset results display
if (currentWinner != null) ...[
if (match.winner != null) ...[
Text(
loc.winner,
style: const TextStyle(
@@ -193,13 +190,11 @@ class _MatchDetailViewState extends State<MatchDetailView> {
),
),
Text(
currentWinner!.name,
style: TextStyle(
match.winner!.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: match.winner != null
? CustomTheme.primaryColor
: CustomTheme.textColor,
color: CustomTheme.primaryColor,
),
),
] else ...[
@@ -239,7 +234,7 @@ class _MatchDetailViewState extends State<MatchDetailView> {
text: loc.enter_results,
icon: Icons.emoji_events,
onPressed: () async {
currentWinner = await Navigator.push(
match.winner = await Navigator.push(
context,
adaptivePageRoute(
fullscreenDialog: true,
@@ -252,7 +247,6 @@ class _MatchDetailViewState extends State<MatchDetailView> {
),
),
);
match.winner = currentWinner;
},
),
],