From 82a3c7a2c3cddb6f63452a6cb6fa062af26b3364 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 12 Jan 2026 13:03:20 -0800 Subject: [PATCH] fix(asset-page): fix scroll issue with LayoutBuilder and ConstrainedBox Wrap content in LayoutBuilder + ConstrainedBox to ensure proper scrolling behavior when content exceeds viewport height. Co-Authored-By: Claude Opus 4.5 --- .../presentation/pages/asset/asset_page.dart | 93 ++++++++++--------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart b/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart index 7f21a4fc..9033e3c7 100644 --- a/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart +++ b/frontend/mining-app/lib/presentation/pages/asset/asset_page.dart @@ -31,55 +31,62 @@ class AssetPage extends ConsumerWidget { backgroundColor: Colors.white, body: SafeArea( bottom: false, - child: RefreshIndicator( - onRefresh: () async { - ref.invalidate(shareAccountProvider(accountSequence)); - }, - child: SingleChildScrollView( - physics: const AlwaysScrollableScrollPhysics(), - child: Column( - children: [ - // 顶部导航栏 - _buildAppBar(context, user), - // 内容 - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), + child: LayoutBuilder( + builder: (context, constraints) { + return RefreshIndicator( + onRefresh: () async { + ref.invalidate(shareAccountProvider(accountSequence)); + }, + child: SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: constraints.maxHeight), child: Column( children: [ - const SizedBox(height: 8), - // 总资产卡片 - accountAsync.when( - data: (account) => _buildTotalAssetCard(account), - loading: () => _buildLoadingCard(), - error: (_, __) => _buildErrorCard('资产加载失败'), + // 顶部导航栏 + _buildAppBar(context, user), + // 内容 + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + children: [ + const SizedBox(height: 8), + // 总资产卡片 + accountAsync.when( + data: (account) => _buildTotalAssetCard(account), + loading: () => _buildLoadingCard(), + error: (_, __) => _buildErrorCard('资产加载失败'), + ), + const SizedBox(height: 24), + // 快捷操作按钮 + _buildQuickActions(), + const SizedBox(height: 24), + // 资产列表 + accountAsync.when( + data: (account) => _buildAssetList(account), + loading: () => _buildLoadingCard(), + error: (_, __) => const SizedBox.shrink(), + ), + const SizedBox(height: 24), + // 收益统计 + _buildEarningsCard(), + const SizedBox(height: 24), + // 账户列表 + accountAsync.when( + data: (account) => _buildAccountList(account), + loading: () => _buildLoadingCard(), + error: (_, __) => const SizedBox.shrink(), + ), + const SizedBox(height: 100), + ], + ), ), - const SizedBox(height: 24), - // 快捷操作按钮 - _buildQuickActions(), - const SizedBox(height: 24), - // 资产列表 - accountAsync.when( - data: (account) => _buildAssetList(account), - loading: () => _buildLoadingCard(), - error: (_, __) => const SizedBox.shrink(), - ), - const SizedBox(height: 24), - // 收益统计 - _buildEarningsCard(), - const SizedBox(height: 24), - // 账户列表 - accountAsync.when( - data: (account) => _buildAccountList(account), - loading: () => _buildLoadingCard(), - error: (_, __) => const SizedBox.shrink(), - ), - const SizedBox(height: 100), ], ), ), - ], - ), - ), + ), + ); + }, ), ), );