Implementierung der Games #203
@@ -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;
|
||||
|
sneeex marked this conversation as resolved
|
||||
|
||||
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
ist das das callback wenn ein match im edit view/create view gemacht wurde und dann in der liste aktualisiert werden soll?
das ist der callback für die MatchDetailView an erster stelle, um dort das Match zu aktualisieren
ne das ist doch on match update, on matches updated ist doch was anderes?
Ja onMatchUpdate ist für ein einzelnes Match und onMatchesUpdate für alle Matches im MatchView