From dd26b9f48f269d401efa59f287a675e739d5012d Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 7 Dec 2025 23:32:42 -0800 Subject: [PATCH] fix(mobile-app): refresh avatar on profile page after upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add _hasChanges flag to track changes and pass result when navigating back 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../profile/presentation/pages/edit_profile_page.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/mobile-app/lib/features/profile/presentation/pages/edit_profile_page.dart b/frontend/mobile-app/lib/features/profile/presentation/pages/edit_profile_page.dart index 95e64d9b..5f16541d 100644 --- a/frontend/mobile-app/lib/features/profile/presentation/pages/edit_profile_page.dart +++ b/frontend/mobile-app/lib/features/profile/presentation/pages/edit_profile_page.dart @@ -43,6 +43,9 @@ class _EditProfilePageState extends ConsumerState { // 是否正在上传头像 bool _isUploadingAvatar = false; + // 是否有数据变更(用于返回时通知上一页刷新) + bool _hasChanges = false; + @override void initState() { super.initState(); @@ -76,7 +79,7 @@ class _EditProfilePageState extends ConsumerState { /// 返回上一页 void _goBack() { - context.pop(); + context.pop(_hasChanges); } /// 显示头像选择底部弹窗 @@ -167,6 +170,7 @@ class _EditProfilePageState extends ConsumerState { _avatarUrl = newAvatarUrl; _selectedImageFile = null; // 清除本地文件引用 _isUploadingAvatar = false; + _hasChanges = true; // 标记有变更 }); ScaffoldMessenger.of(context).showSnackBar(