From 350c5430a4bb607009c694748871ea6ffe4f01a4 Mon Sep 17 00:00:00 2001 From: Mathis Kirchner Date: Sat, 9 May 2026 12:57:42 +0200 Subject: [PATCH] implement updateMatchStateAfterSave to refresh match scores --- .../main_menu/match_view/match_detail_view.dart | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/presentation/views/main_menu/match_view/match_detail_view.dart b/lib/presentation/views/main_menu/match_view/match_detail_view.dart index 6f09301..3b52505 100644 --- a/lib/presentation/views/main_menu/match_view/match_detail_view.dart +++ b/lib/presentation/views/main_menu/match_view/match_detail_view.dart @@ -205,7 +205,7 @@ class _MatchDetailViewState extends State { match: match, onWinnerChanged: () { widget.onMatchUpdate.call(); - setState(() {}); + updateMatchStateAfterSave(); }, ), ), @@ -230,6 +230,17 @@ class _MatchDetailViewState extends State { widget.onMatchUpdate.call(); } + /// Updates the match scores after saving in MatchResultView + Future updateMatchStateAfterSave() async { + final scores = await db.scoreEntryDao.getAllMatchScores(matchId: match.id); + + if (!mounted) return; + + setState(() { + match.scores = scores; + }); + } + /// Returns the widget to be displayed in the result [InfoTile] Widget getResultWidget(AppLocalizations loc) { if (isSingleRowResult()) {