fixed overwrite on internal copy, DST drift in widget anchors, inline errors without controller and removed dead room lookup

This commit is contained in:
2026-09-27 17:37:31 +02:00
parent ee1240f71a
commit 2664378b17
13 changed files with 86 additions and 152 deletions
@@ -154,20 +154,15 @@ class _ShareOptionsBodyState extends State<_ShareOptionsBody> {
_update(const ShareUpdateParams(password: ''));
Future<void> _confirmDelete() async {
// Use showDialog directly (not asDialog) so we get the AsyncDialogAction's
// `true` result and can close the options sheet afterwards — popping inside
// Close the options sheet only after the dialog returned — popping inside
// onConfirmAsync would target the dialog route, not the sheet.
final dialog = ConfirmDialog(
final deleted = await ConfirmDialog(
title: 'Freigabe löschen?',
content: 'Die Freigabe wird aufgehoben.',
confirmButton: 'Löschen',
onConfirmAsync: () => FileSharingApi().remove(_share.id),
);
final deleted = await showDialog<bool>(
context: context,
builder: dialog.build,
);
if (deleted != true || !mounted) return;
).ask(context);
if (!deleted || !mounted) return;
widget.onChanged();
if (Navigator.of(context).canPop()) Navigator.of(context).pop();
}
@@ -61,16 +61,11 @@ class _AccountSectionState extends State<AccountSection> {
if (result == null || !mounted) return;
if (result is AvatarRemoveResult) {
var confirmed = false;
await showDialog<void>(
context: context,
builder: (_) => ConfirmDialog(
title: 'Profilbild entfernen',
content: 'Möchtest du dein Profilbild wirklich entfernen?',
confirmButton: 'Entfernen',
onConfirm: () => confirmed = true,
),
);
final confirmed = await const ConfirmDialog(
title: 'Profilbild entfernen',
content: 'Möchtest du dein Profilbild wirklich entfernen?',
confirmButton: 'Entfernen',
).ask(context);
if (!confirmed || !mounted) return;
}
@@ -211,20 +206,17 @@ Future<void> _confirmLogout(BuildContext context) async {
// Flip AccountBloc state only after the dialog fully closes: doing it from
// inside the sign-out (the previous approach) raced AsyncDialogAction's
// pop(true) against the navigator teardown of the account switch.
final confirmed = await showDialog<bool>(
context: context,
builder: (dialogContext) => ConfirmDialog(
title: 'Abmelden?',
content: others > 0
? 'Möchtest du dich wirklich abmelden? Die App wechselt danach zu '
'einem deiner anderen Konten.'
: 'Möchtest du dich wirklich abmelden?',
confirmButton: 'Abmelden',
onConfirmAsync: () async =>
nextAccountId = await SessionLifecycle.signOut(),
),
);
if (confirmed != true) return;
final confirmed = await ConfirmDialog(
title: 'Abmelden?',
content: others > 0
? 'Möchtest du dich wirklich abmelden? Die App wechselt danach zu '
'einem deiner anderen Konten.'
: 'Möchtest du dich wirklich abmelden?',
confirmButton: 'Abmelden',
onConfirmAsync: () async =>
nextAccountId = await SessionLifecycle.signOut(),
).ask(context);
if (!confirmed) return;
accountBloc.activated(nextAccountId);
}
+5 -10
View File
@@ -108,16 +108,11 @@ class _ChatInfoState extends State<ChatInfo> {
if (result == null || !mounted) return;
if (result is AvatarRemoveResult) {
var confirmed = false;
await showDialog<void>(
context: context,
builder: (_) => ConfirmDialog(
title: 'Gruppenbild entfernen',
content: 'Möchtest du das Gruppenbild wirklich entfernen?',
confirmButton: 'Entfernen',
onConfirm: () => confirmed = true,
),
);
final confirmed = await const ConfirmDialog(
title: 'Gruppenbild entfernen',
content: 'Möchtest du das Gruppenbild wirklich entfernen?',
confirmButton: 'Entfernen',
).ask(context);
if (!confirmed || !mounted) return;
}
+9 -13
View File
@@ -32,17 +32,13 @@ class FavoriteToggleTile extends StatelessWidget {
/// Resolves to true once the room was left.
Future<bool> confirmLeaveRoom(BuildContext context, String token) async {
final chatList = context.read<ChatListBloc>();
final left = await showDialog<bool>(
context: context,
builder: (_) => ConfirmDialog(
title: 'Talk-Chat verlassen',
content: 'Du benötigst ggf. eine Einladung um erneut beizutreten.',
confirmButton: 'Verlassen',
onConfirmAsync: () async {
await LeaveRoom(token).run();
unawaited(chatList.refresh());
},
),
);
return left ?? false;
return ConfirmDialog(
title: 'Talk-Chat verlassen',
content: 'Du benötigst ggf. eine Einladung um erneut beizutreten.',
confirmButton: 'Verlassen',
onConfirmAsync: () async {
await LeaveRoom(token).run();
unawaited(chatList.refresh());
},
).ask(context);
}