fix(mobile-app): refresh avatar on profile page after upload
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 <noreply@anthropic.com>
This commit is contained in:
parent
0622dd14d9
commit
dd26b9f48f
|
|
@ -43,6 +43,9 @@ class _EditProfilePageState extends ConsumerState<EditProfilePage> {
|
|||
// 是否正在上传头像
|
||||
bool _isUploadingAvatar = false;
|
||||
|
||||
// 是否有数据变更(用于返回时通知上一页刷新)
|
||||
bool _hasChanges = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
|
@ -76,7 +79,7 @@ class _EditProfilePageState extends ConsumerState<EditProfilePage> {
|
|||
|
||||
/// 返回上一页
|
||||
void _goBack() {
|
||||
context.pop();
|
||||
context.pop(_hasChanges);
|
||||
}
|
||||
|
||||
/// 显示头像选择底部弹窗
|
||||
|
|
@ -167,6 +170,7 @@ class _EditProfilePageState extends ConsumerState<EditProfilePage> {
|
|||
_avatarUrl = newAvatarUrl;
|
||||
_selectedImageFile = null; // 清除本地文件引用
|
||||
_isUploadingAvatar = false;
|
||||
_hasChanges = true; // 标记有变更
|
||||
});
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
|
|
|
|||
Loading…
Reference in New Issue