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 5f16541d..027843ef 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 @@ -482,11 +482,23 @@ class _EditProfilePageState extends ConsumerState { /// 构建SVG或默认头像 Widget _buildSvgOrDefaultAvatar() { if (_avatarSvg != null) { - return SvgPicture.string( - _avatarSvg!, - width: 128, - height: 128, - fit: BoxFit.cover, + // 使用 SizedBox + RepaintBoundary 包装确保固定尺寸并隔离渲染,避免布局问题 + return RepaintBoundary( + child: SizedBox( + width: 128, + height: 128, + child: SvgPicture.string( + _avatarSvg!, + width: 128, + height: 128, + fit: BoxFit.cover, + placeholderBuilder: (context) => const Icon( + Icons.person, + size: 64, + color: Color(0xFF8B5A2B), + ), + ), + ), ); } return const Icon( diff --git a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart index ccc6ce4e..9462f804 100644 --- a/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart +++ b/frontend/mobile-app/lib/features/profile/presentation/pages/profile_page.dart @@ -1665,11 +1665,23 @@ class _ProfilePageState extends ConsumerState { // 检测是否是 SVG 字符串(随机生成的 SVG 头像) if (_avatarSvg!.contains(' const Icon( + Icons.person, + size: 40, + color: Color(0xFF8B5A2B), + ), + ), + ), ); }