🐛 Fix logout will break something

This commit is contained in:
LittleSheep 2024-12-11 22:49:55 +08:00
parent f47f1b175a
commit 623095473e

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:hive/hive.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:provider/provider.dart';
import 'package:styled_widget/styled_widget.dart';
@ -118,19 +119,19 @@ class _AuthorizedAccountScreen extends StatelessWidget {
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leading: const Icon(Symbols.logout),
trailing: const Icon(Symbols.chevron_right),
onTap: () {
context
.showConfirmDialog(
onTap: () async {
final confirm = await context.showConfirmDialog(
'accountLogoutConfirmTitle'.tr(),
'accountLogoutConfirm'.tr(),
)
.then((value) {
);
if (!confirm) return;
if (!context.mounted) return;
if (value) ua.logoutUser();
ua.logoutUser();
final ws = context.read<WebSocketProvider>();
ws.disconnect();
Hive.deleteFromDisk();
});
await Hive.deleteFromDisk();
await Hive.initFlutter();
},
),
ListTile(