custom login implementation, period-based timetable layout with overlap handling, enhanced error dialogs, and unified bottom sheets
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../model/account_data.dart';
|
||||
import '../../../../state/app/modules/account/bloc/account_bloc.dart';
|
||||
import '../../../../state/app/modules/account/bloc/account_state.dart';
|
||||
import '../../../../widget/centered_leading.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
|
||||
@@ -15,21 +18,23 @@ class AccountSection extends StatelessWidget {
|
||||
onTap: () => _showLogoutDialog(context),
|
||||
);
|
||||
|
||||
void _showLogoutDialog(BuildContext context) {
|
||||
showDialog(
|
||||
Future<void> _showLogoutDialog(BuildContext context) async {
|
||||
// Sequential logout flow: dialog wipes secure storage, dialog closes
|
||||
// (single Navigator.pop), then we flip the AccountBloc state. The bloc
|
||||
// listener in main.dart pops the Settings route and runs the in-memory
|
||||
// wipe. Triggering setStatus from inside removeData (the previous
|
||||
// approach) raced AsyncDialogAction's pop(true) against popUntil(isFirst)
|
||||
// and could leave the navigator in an inconsistent state.
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (dialogContext) => ConfirmDialog(
|
||||
title: 'Abmelden?',
|
||||
content: 'Möchtest du dich wirklich abmelden?',
|
||||
confirmButton: 'Abmelden',
|
||||
// Cleanup of caches, hydrated bloc storage and bloc in-memory state is
|
||||
// handled by the AccountBloc listener in main.dart on the loggedOut
|
||||
// transition. Doing the cleanup *before* setting loggedOut caused
|
||||
// rebuilds in the still-mounted App tree (TimetableBloc/ChatListBloc
|
||||
// emitting empty states) which raced with the home-route swap and
|
||||
// produced a black screen.
|
||||
onConfirmAsync: () => AccountData().removeData(context: context),
|
||||
onConfirmAsync: AccountData().removeData,
|
||||
),
|
||||
);
|
||||
if (confirmed != true || !context.mounted) return;
|
||||
context.read<AccountBloc>().setStatus(AccountStatus.loggedOut);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user