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, ), ), - ), - ], + ], + ), ), ), );