From ce485a1b625b7aae7b2c32ddc547c98bc9f50d8c Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Wed, 29 Jul 2026 08:42:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20SegSwitch=20=E7=94=A8=20FittedBox(sc?= =?UTF-8?q?aleDown)=20=E9=98=B2=E7=AA=84=E5=AE=B9=E5=99=A8=E6=88=AA?= =?UTF-8?q?=E6=96=AD=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加规则弹层的动作段选(Direct/Tunnel/Reject)在窄弹层里被 icon+文字挤到 ellipsis 截断 成「Dire…/Tun…/Reje…」。改:段内容包 FittedBox(scaleDown)——放得下原样(宽段选/goldens 不变),放不下整体等比缩放而非截断;padding 16→12 留余量。flutter test 265/265 无 golden 回归。 Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01A79VtQA1BwTuQN1ThpvYpo --- client/lib/widgets/seg_switch.dart | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/client/lib/widgets/seg_switch.dart b/client/lib/widgets/seg_switch.dart index 36924da..eb7952c 100644 --- a/client/lib/widgets/seg_switch.dart +++ b/client/lib/widgets/seg_switch.dart @@ -49,30 +49,32 @@ class SegSwitch extends StatelessWidget { child: AnimatedContainer( duration: const Duration(milliseconds: 140), curve: Curves.easeOut, - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( // .segswitch-opt.is-active:surface 底 + shadow-sm;未选透明 color: active ? c.surface : Colors.transparent, borderRadius: BorderRadius.circular(PangolinRadius.full), boxShadow: active ? PangolinShadow.sm : null, ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(o.icon, size: 16, color: active ? c.fg1 : c.fg2), - const SizedBox(width: 8), - Flexible( - child: Text( + // FittedBox(scaleDown):放得下则原样(宽段选不变),放不下则图标+文字整体 + // 等比缩放而非把文字 ellipsis 截断(窄弹层里 Direct/Tunnel/Reject 曾被截成 Dire…)。 + child: FittedBox( + fit: BoxFit.scaleDown, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(o.icon, size: 16, color: active ? c.fg1 : c.fg2), + const SizedBox(width: 8), + Text( o.label, maxLines: 1, - overflow: TextOverflow.ellipsis, style: PangolinText.sm.copyWith( color: active ? c.fg1 : c.fg2, fontWeight: FontWeight.w600, ), ), - ), - ], + ], + ), ), ), );