fix: fix not correctly working multiplayer

This commit is contained in:
Patryk Hegenberg 2026-02-19 21:44:27 +01:00
parent 58e79147c7
commit b772b39be6

View file

@ -1194,21 +1194,20 @@ class _BattleScreenState extends ConsumerState<BattleScreen> {
void _showAbandonDialog(AppLocalizations l10n) { void _showAbandonDialog(AppLocalizations l10n) {
showDialog( showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (dialogContext) => AlertDialog(
title: Text(l10n.battleAbandonTitle), title: Text(l10n.battleAbandonTitle),
content: Text(l10n.battleAbandonBody), content: Text(l10n.battleAbandonBody),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(dialogContext).pop(),
child: Text(l10n.cancelButton), child: Text(l10n.cancelButton),
), ),
TextButton( TextButton(
onPressed: () async { onPressed: () async {
Navigator.of(context).pop(); Navigator.of(dialogContext).pop();
if (widget.partyId != null) { if (widget.partyId != null) {
final userId = final user = await ref.read(userRepositoryProvider).getLocalUser();
(await ref.read(userRepositoryProvider).getLocalUser()) final userId = user?.serverId;
?.serverId;
if (userId != null) { if (userId != null) {
await ref await ref
.read(partyRepositoryProvider) .read(partyRepositoryProvider)