fix: callbacks when game deletes matches
This commit is contained in:
@@ -177,6 +177,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
if (result.delete) {
|
||||
setState(() {
|
||||
widget.games.removeAt(originalIndex);
|
||||
widget.onGamesUpdated?.call();
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
|
||||
@@ -28,10 +28,13 @@ class CreateMatchView extends StatefulWidget {
|
||||
this.onWinnerChanged,
|
||||
this.matchToEdit,
|
||||
this.onMatchUpdated,
|
||||
this.onMatchesUpdated,
|
||||
});
|
||||
|
||||
final VoidCallback? onWinnerChanged;
|
||||
|
||||
final VoidCallback? onMatchesUpdated;
|
||||
|
||||
final void Function(Match)? onMatchUpdated;
|
||||
|
||||
/// An optional match to prefill the fields for editing.
|
||||
@@ -138,6 +141,7 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
builder: (context) => ChooseGameView(
|
||||
games: gamesList,
|
||||
initialGameId: selectedGame?.id ?? '',
|
||||
onGamesUpdated: widget.onMatchesUpdated,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -118,8 +118,10 @@ class _MatchViewState extends State<MatchView> {
|
||||
Navigator.push(
|
||||
context,
|
||||
adaptivePageRoute(
|
||||
builder: (context) =>
|
||||
CreateMatchView(onWinnerChanged: loadMatches),
|
||||
builder: (context) => CreateMatchView(
|
||||
onWinnerChanged: loadMatches,
|
||||
onMatchesUpdated: loadMatches,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user