fix: 仪表盘概览卡片等高对齐

- Row 外层包 IntrinsicHeight + CrossAxisAlignment.stretch,三卡自动等高
- Loading/Error 卡片去掉固定 height:140,改为 padding + stretch 拉伸

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-23 04:28:40 -08:00
parent 4e55e9a616
commit 68004409a3
1 changed files with 27 additions and 32 deletions

View File

@ -165,17 +165,17 @@ class DashboardPage extends ConsumerWidget {
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
Row( IntrinsicHeight(
children: [ child: Row(
// Server card crossAxisAlignment: CrossAxisAlignment.stretch,
Expanded(child: _buildServerCard(serverAsync)), children: [
const SizedBox(width: 12), Expanded(child: _buildServerCard(serverAsync)),
// Alert card const SizedBox(width: 12),
Expanded(child: _buildAlertCard(alertAsync)), Expanded(child: _buildAlertCard(alertAsync)),
const SizedBox(width: 12), const SizedBox(width: 12),
// Tasks card Expanded(child: _buildTasksCard(recentOpsAsync)),
Expanded(child: _buildTasksCard(recentOpsAsync)), ],
], ),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
// ------------- Recent operations -------------------------------- // ------------- Recent operations --------------------------------
@ -399,8 +399,8 @@ class _SummaryCardLoading extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const Card( return const Card(
color: AppColors.surface, color: AppColors.surface,
child: SizedBox( child: Padding(
height: 140, padding: EdgeInsets.all(14),
child: Center(child: CircularProgressIndicator(strokeWidth: 2)), child: Center(child: CircularProgressIndicator(strokeWidth: 2)),
), ),
); );
@ -415,26 +415,21 @@ class _SummaryCardError extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Card( return Card(
color: AppColors.surface, color: AppColors.surface,
child: SizedBox( child: Padding(
height: 140, padding: const EdgeInsets.all(14),
child: Center( child: Column(
child: Padding( mainAxisAlignment: MainAxisAlignment.center,
padding: const EdgeInsets.all(12), children: [
child: Column( const Icon(Icons.error_outline, color: AppColors.error, size: 28),
mainAxisAlignment: MainAxisAlignment.center, const SizedBox(height: 6),
children: [ Text(
const Icon(Icons.error_outline, color: AppColors.error, size: 28), message,
const SizedBox(height: 6), style: const TextStyle(color: AppColors.error, fontSize: 11),
Text( textAlign: TextAlign.center,
message, maxLines: 3,
style: const TextStyle(color: AppColors.error, fontSize: 11), overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
],
), ),
), ],
), ),
), ),
); );