// widgets/ds/m_tab_bar.dart — 移动底部 tab 栏(镜像原型 mobile-atoms .m-tabbar / .m-tab)。 // min-height 56 / surface 底 / border-top / SafeArea bottom; // 项 = 22px 图标 + fs-xs 文案,激活 primary,未激活 muted。 import 'package:flutter/material.dart'; import '../../core/theme/app_dims.g.dart'; import '../../core/theme/context_tokens.dart'; class MTabItem { final IconData icon; final String label; const MTabItem(this.icon, this.label); } class MTabBar extends StatelessWidget { final List items; final int currentIndex; final ValueChanged onTap; const MTabBar({ super.key, required this.items, required this.currentIndex, required this.onTap, }); @override Widget build(BuildContext context) { final t = context.tokens; // Material 自带(InkWell 水波 + golden 直挂无 Scaffold 场景) return Material( color: t.surface, shape: Border(top: BorderSide(color: t.border)), child: SafeArea( top: false, child: SizedBox( height: 56, child: Row(children: [ for (var i = 0; i < items.length; i++) Expanded( child: InkWell( onTap: () => onTap(i), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(items[i].icon, size: 22, color: i == currentIndex ? t.primary : t.muted), const SizedBox(height: 3), Text(items[i].label, style: TextStyle( fontSize: AppDims.fsXs, fontWeight: i == currentIndex ? FontWeight.w600 : FontWeight.w400, color: i == currentIndex ? t.primary : t.muted)), ], ), ), ), ]), ), ), ); } }