refactor: rename callback for game creation/editing to onGameChanged
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 38s
Pull Request Pipeline / lint (pull_request) Successful in 44s

This commit is contained in:
2026-03-08 20:02:50 +01:00
parent 487a921def
commit 16dc9746bc
3 changed files with 7 additions and 7 deletions

View File

@@ -73,7 +73,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
context, context,
adaptivePageRoute( adaptivePageRoute(
builder: (context) => CreateGameView( builder: (context) => CreateGameView(
onGameCreatedOrEdited: () { onGameChanged: () {
widget.onGamesUpdated?.call(); widget.onGamesUpdated?.call();
}, },
), ),
@@ -138,7 +138,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
adaptivePageRoute( adaptivePageRoute(
builder: (context) => CreateGameView( builder: (context) => CreateGameView(
gameToEdit: game, gameToEdit: game,
onGameCreatedOrEdited: () { onGameChanged: () {
widget.onGamesUpdated?.call(); widget.onGamesUpdated?.call();
}, },
), ),

View File

@@ -392,6 +392,5 @@ class _CreateMatchViewState extends State<CreateMatchView> {
setState(() { setState(() {
gamesList = result; gamesList = result;
}); });
print(gamesList.map((g) => g.name).join(', '));
} }
} }

View File

@@ -18,19 +18,19 @@ import 'package:tallee/presentation/widgets/tiles/choose_tile.dart';
/// A stateful widget for creating or editing a game. /// A stateful widget for creating or editing a game.
/// - [gameToEdit] An optional game to prefill the fields /// - [gameToEdit] An optional game to prefill the fields
/// - [onGameCreatedOrEdited] Callback to invoke when the game is created or edited /// - [onGameChanged] Callback to invoke when the game is created or edited
class CreateGameView extends StatefulWidget { class CreateGameView extends StatefulWidget {
const CreateGameView({ const CreateGameView({
super.key, super.key,
this.gameToEdit, this.gameToEdit,
required this.onGameCreatedOrEdited, required this.onGameChanged,
}); });
/// An optional game to prefill the fields /// An optional game to prefill the fields
final Game? gameToEdit; final Game? gameToEdit;
/// Callback to invoke when the game is created or edited /// Callback to invoke when the game is created or edited
final VoidCallback onGameCreatedOrEdited; final VoidCallback onGameChanged;
@override @override
State<CreateGameView> createState() => _CreateGameViewState(); State<CreateGameView> createState() => _CreateGameViewState();
@@ -164,6 +164,7 @@ class _CreateGameViewState extends State<CreateGameView> {
); );
if (!context.mounted) return; if (!context.mounted) return;
if (success) { if (success) {
widget.onGameChanged.call();
Navigator.of( Navigator.of(
context, context,
).pop((game: widget.gameToEdit, delete: true)); ).pop((game: widget.gameToEdit, delete: true));
@@ -267,7 +268,7 @@ class _CreateGameViewState extends State<CreateGameView> {
} else { } else {
await handleGameCreation(newGame); await handleGameCreation(newGame);
} }
widget.onGameCreatedOrEdited.call(); widget.onGameChanged.call();
if (context.mounted) { if (context.mounted) {
Navigator.of( Navigator.of(
context, context,