From 5a1910bee4141468f254d440abce944e7bb05c1e Mon Sep 17 00:00:00 2001 From: lxh2875931338 Date: Sun, 1 Nov 2026 12:08:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E5=B0=8F=E7=AA=97=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E9=A1=B5=E5=86=85=E5=AE=B9=E6=92=91=E6=BB=A1=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 紧凑模式原来用 SingleChildScrollView 直接包内容, 内容不足窗口高度时底部会留一大片空白。 改为 LayoutBuilder + ConstrainedBox(minHeight) + IntrinsicHeight: - 内容不足时撑满并让 Spacer 把控件推到底部 - 内容超出时仍可滚动,不会把控件挤出屏幕 真机(Flyme 小窗)验证:封面缩小、歌词页隐藏、五个控件完整贴底。 --- lib/pages/player_page.dart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/pages/player_page.dart b/lib/pages/player_page.dart index 9f61612..3b2d605 100644 --- a/lib/pages/player_page.dart +++ b/lib/pages/player_page.dart @@ -431,8 +431,7 @@ class _PlayerPageState extends BaseState { ), ], - if (!compact) const Spacer(), - if (compact) const SizedBox(height: 12), + const Spacer(), // ---- 进度 ---- _buildProgressSection(service), @@ -446,10 +445,17 @@ class _PlayerPageState extends BaseState { ), ); - // 小窗/横屏:内容超出时允许滚动,避免控件被挤出屏幕 - return compact - ? SingleChildScrollView(child: padded) - : padded; + if (!compact) return padded; + + // 小窗/横屏:内容超高时可滚动;内容不足时撑满,避免底部大片空白 + return LayoutBuilder( + builder: (context, constraints) => SingleChildScrollView( + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: constraints.maxHeight), + child: IntrinsicHeight(child: padded), + ), + ), + ); } /// 左页:文件信息