refactored lesson details, centralized logout logic, and added resume re-fetch
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../../../model/account_data.dart';
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../../widget/centered_leading.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
import '../../../../widget/debug/cache_view.dart';
|
||||
|
||||
class AccountSection extends StatelessWidget {
|
||||
const AccountSection({super.key});
|
||||
@@ -26,16 +22,13 @@ class AccountSection extends StatelessWidget {
|
||||
title: 'Abmelden?',
|
||||
content: 'Möchtest du dich wirklich abmelden?',
|
||||
confirmButton: 'Abmelden',
|
||||
onConfirmAsync: () async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
PaintingBinding.instance.imageCache.clear();
|
||||
if (!context.mounted) return;
|
||||
await context.read<SettingsCubit>().reset();
|
||||
await const CacheView().clear();
|
||||
if (!context.mounted) return;
|
||||
await AccountData().removeData(context: context);
|
||||
},
|
||||
// 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),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user