Revert "fix: loading exception when switching workspace"

This reverts commit 10a536b1a2e3100fa3da99ab05851702f701a3c0.
This commit is contained in:
Lucas.Xu 2025-04-21 17:20:35 +08:00
parent 4634b51edf
commit 343f7e4fd5
2 changed files with 4 additions and 13 deletions

View File

@ -40,11 +40,7 @@ class Loading {
void stop() { void stop() {
if (loadingContext != null) { if (loadingContext != null) {
if (loadingContext!.mounted) {
if (Navigator.canPop(loadingContext!)) {
Navigator.of(loadingContext!).pop(); Navigator.of(loadingContext!).pop();
}
}
loadingContext = null; loadingContext = null;
} }

View File

@ -32,10 +32,7 @@ class _SidebarWorkspaceState extends State<SidebarWorkspace> {
@override @override
void dispose() { void dispose() {
onHover.dispose(); onHover.dispose();
if (loadingIndicator != null) {
loadingIndicator?.stop();
loadingIndicator = null;
}
super.dispose(); super.dispose();
} }
@ -103,10 +100,8 @@ class _SidebarWorkspaceState extends State<SidebarWorkspace> {
if (isLoading) { if (isLoading) {
loadingIndicator ??= Loading(context)..start(); loadingIndicator ??= Loading(context)..start();
return; return;
} else if (loadingIndicator != null) { } else {
if (mounted) {
loadingIndicator?.stop(); loadingIndicator?.stop();
}
loadingIndicator = null; loadingIndicator = null;
} }