diff --git a/lib/presentation/views/main_menu/match_view/match_profile_view.dart b/lib/presentation/views/main_menu/match_view/match_profile_view.dart index 6c9241b..6558916 100644 --- a/lib/presentation/views/main_menu/match_view/match_profile_view.dart +++ b/lib/presentation/views/main_menu/match_view/match_profile_view.dart @@ -38,6 +38,8 @@ class MatchProfileView extends StatefulWidget { class _MatchProfileViewState extends State { late final AppDatabase db; + late Player? currentWinner; + /// All players who participated in the match late final List allPlayers; @@ -46,6 +48,7 @@ class _MatchProfileViewState extends State { super.initState(); db = Provider.of(context, listen: false); allPlayers = _getAllPlayers(); + currentWinner = widget.match.winner; } @override @@ -178,7 +181,7 @@ class _MatchProfileViewState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ /// TODO: Implement different ruleset results display - if (widget.match.winner != null) ...[ + if (currentWinner != null) ...[ Text( loc.winner, style: const TextStyle( @@ -187,7 +190,7 @@ class _MatchProfileViewState extends State { ), ), Text( - widget.match.winner?.name ?? '-', + currentWinner!.name, style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, @@ -221,7 +224,7 @@ class _MatchProfileViewState extends State { text: loc.enter_results, icon: Icons.note_add, onPressed: () async { - await Navigator.push( + currentWinner = await Navigator.push( context, adaptivePageRoute( fullscreenDialog: true, diff --git a/lib/presentation/views/main_menu/match_view/match_result_view.dart b/lib/presentation/views/main_menu/match_view/match_result_view.dart index 1deb385..8f20344 100644 --- a/lib/presentation/views/main_menu/match_view/match_result_view.dart +++ b/lib/presentation/views/main_menu/match_view/match_result_view.dart @@ -54,7 +54,7 @@ class _MatchResultViewState extends State { icon: const Icon(Icons.close), onPressed: () { widget.onWinnerChanged?.call(); - Navigator.of(context).pop(); + Navigator.of(context).pop(_selectedPlayer); }, ), title: Text(widget.match.name),