fix(ui): SegSwitch 用 FittedBox(scaleDown) 防窄容器截断文字
添加规则弹层的动作段选(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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A79VtQA1BwTuQN1ThpvYpo
This commit is contained in:
@@ -49,30 +49,32 @@ class SegSwitch extends StatelessWidget {
|
|||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 140),
|
duration: const Duration(milliseconds: 140),
|
||||||
curve: Curves.easeOut,
|
curve: Curves.easeOut,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
// .segswitch-opt.is-active:surface 底 + shadow-sm;未选透明
|
// .segswitch-opt.is-active:surface 底 + shadow-sm;未选透明
|
||||||
color: active ? c.surface : Colors.transparent,
|
color: active ? c.surface : Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(PangolinRadius.full),
|
borderRadius: BorderRadius.circular(PangolinRadius.full),
|
||||||
boxShadow: active ? PangolinShadow.sm : null,
|
boxShadow: active ? PangolinShadow.sm : null,
|
||||||
),
|
),
|
||||||
child: Row(
|
// FittedBox(scaleDown):放得下则原样(宽段选不变),放不下则图标+文字整体
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// 等比缩放而非把文字 ellipsis 截断(窄弹层里 Direct/Tunnel/Reject 曾被截成 Dire…)。
|
||||||
children: [
|
child: FittedBox(
|
||||||
Icon(o.icon, size: 16, color: active ? c.fg1 : c.fg2),
|
fit: BoxFit.scaleDown,
|
||||||
const SizedBox(width: 8),
|
child: Row(
|
||||||
Flexible(
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Text(
|
children: [
|
||||||
|
Icon(o.icon, size: 16, color: active ? c.fg1 : c.fg2),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
o.label,
|
o.label,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: PangolinText.sm.copyWith(
|
style: PangolinText.sm.copyWith(
|
||||||
color: active ? c.fg1 : c.fg2,
|
color: active ? c.fg1 : c.fg2,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user