Skip to content

High performance self-hosted photo and video management solution.

fix(mobile): Widget overflow due to exception on logout (#3869)

shalong-tanwen1b0484fc4602
diff --git a/mobile/lib/modules/home/ui/home_page_app_bar.dart b/mobile/lib/modules/home/ui/home_page_app_bar.dart
index 7a4f7fd569..ce038d327e 100644
--- a/mobile/lib/modules/home/ui/home_page_app_bar.dart
+++ b/mobile/lib/modules/home/ui/home_page_app_bar.dart
@@ -30,9 +30,9 @@ class HomePageAppBar extends ConsumerWidget implements PreferredSizeWidget {
backupState.backgroundBackup || backupState.autoBackup;
final ServerInfoState serverInfoState = ref.watch(serverInfoProvider);
AuthenticationState authState = ref.watch(authenticationProvider);
- final user = Store.get(StoreKey.currentUser);
+ final user = Store.tryGet(StoreKey.currentUser);
buildProfilePhoto() {
- if (authState.profileImagePath.isEmpty) {
+ if (authState.profileImagePath.isEmpty || user == null) {
return IconButton(
splashRadius: 25,
icon: const Icon(
diff --git a/mobile/lib/modules/home/ui/profile_drawer/profile_drawer_header.dart b/mobile/lib/modules/home/ui/profile_drawer/profile_drawer_header.dart
index 11d3edcfa5..328d9cbc1f 100644
--- a/mobile/lib/modules/home/ui/profile_drawer/profile_drawer_header.dart
+++ b/mobile/lib/modules/home/ui/profile_drawer/profile_drawer_header.dart
@@ -20,16 +20,10 @@ class ProfileDrawerHeader extends HookConsumerWidget {
final uploadProfileImageStatus =
ref.watch(uploadProfileImageProvider).status;
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
- final user = Store.get(StoreKey.currentUser);
+ final user = Store.tryGet(StoreKey.currentUser);
buildUserProfileImage() {
- var userImage = UserCircleAvatar(
- radius: 35,
- size: 66,
- user: user,
- );
-
- if (authState.profileImagePath.isEmpty) {
+ if (authState.profileImagePath.isEmpty || user == null) {
return const CircleAvatar(
radius: 35,
backgroundImage: AssetImage('assets/immich-logo-no-outline.png'),
@@ -37,6 +31,12 @@ class ProfileDrawerHeader extends HookConsumerWidget {
);
}
+ var userImage = UserCircleAvatar(
+ radius: 35,
+ size: 66,
+ user: user,
+ );
+
if (uploadProfileImageStatus == UploadProfileStatus.idle) {
if (authState.profileImagePath.isNotEmpty) {
return userImage;