From dc27fe9e447a415b56421c25e7ae4b039202ec1c Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 2 Mar 2026 09:05:36 -0800 Subject: [PATCH] =?UTF-8?q?fix(mining-app):=20=E4=BF=AE=E5=A4=8D=20Profile?= =?UTF-8?q?Page.=5FbuildUserHeader=20=E7=BC=BA=E5=B0=91=20ref=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=AF=BC=E8=87=B4=E7=BC=96=E8=AF=91=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _buildNotificationIcon 需要 WidgetRef ref 来 watch 未读通知数, 但 _buildUserHeader 方法签名未声明该参数,导致编译错误: "The getter 'ref' isn't defined for the type 'ProfilePage'" 修复:将 ref 从 build() 透传给 _buildUserHeader() Co-Authored-By: Claude Opus 4.6 --- .../lib/presentation/pages/profile/profile_page.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/mining-app/lib/presentation/pages/profile/profile_page.dart b/frontend/mining-app/lib/presentation/pages/profile/profile_page.dart index 5eefcd3b..551460ae 100644 --- a/frontend/mining-app/lib/presentation/pages/profile/profile_page.dart +++ b/frontend/mining-app/lib/presentation/pages/profile/profile_page.dart @@ -77,7 +77,7 @@ class ProfilePage extends ConsumerWidget { child: Column( children: [ // 用户头部信息 - _buildUserHeader(context, user), + _buildUserHeader(context, user, ref), const SizedBox(height: 16), @@ -127,7 +127,7 @@ class ProfilePage extends ConsumerWidget { ); } - Widget _buildUserHeader(BuildContext context, UserState user) { + Widget _buildUserHeader(BuildContext context, UserState user, WidgetRef ref) { final avatarColor = _avatarColors[user.avatarIndex % _avatarColors.length]; return Container(