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 <noreply@anthropic.com>
This commit is contained in:
parent
61da3652f5
commit
82a3c7a2c3
|
|
@ -31,55 +31,62 @@ class AssetPage extends ConsumerWidget {
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
bottom: false,
|
bottom: false,
|
||||||
child: RefreshIndicator(
|
child: LayoutBuilder(
|
||||||
onRefresh: () async {
|
builder: (context, constraints) {
|
||||||
ref.invalidate(shareAccountProvider(accountSequence));
|
return RefreshIndicator(
|
||||||
},
|
onRefresh: () async {
|
||||||
child: SingleChildScrollView(
|
ref.invalidate(shareAccountProvider(accountSequence));
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
},
|
||||||
child: Column(
|
child: SingleChildScrollView(
|
||||||
children: [
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
// 顶部导航栏
|
child: ConstrainedBox(
|
||||||
_buildAppBar(context, user),
|
constraints: BoxConstraints(minHeight: constraints.maxHeight),
|
||||||
// 内容
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 8),
|
// 顶部导航栏
|
||||||
// 总资产卡片
|
_buildAppBar(context, user),
|
||||||
accountAsync.when(
|
// 内容
|
||||||
data: (account) => _buildTotalAssetCard(account),
|
Padding(
|
||||||
loading: () => _buildLoadingCard(),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
error: (_, __) => _buildErrorCard('资产加载失败'),
|
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),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue