feat(home): 重构首页为底部导航栏布局,支持首页与个人页面切换
This commit is contained in:
@@ -75,10 +75,31 @@ class _NavItem extends StatelessWidget {
|
||||
final bool selected;
|
||||
final VoidCallback onTap;
|
||||
|
||||
IconData get _filledIcon {
|
||||
switch (icon) {
|
||||
case Icons.home:
|
||||
return Icons.home;
|
||||
case Icons.person:
|
||||
return Icons.person;
|
||||
default:
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
||||
IconData get _outlinedIcon {
|
||||
switch (icon) {
|
||||
case Icons.home:
|
||||
return Icons.home_outlined;
|
||||
case Icons.person:
|
||||
return Icons.person_outline;
|
||||
default:
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final iconColor = colors.primary;
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
@@ -87,12 +108,12 @@ class _NavItem extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, color: iconColor),
|
||||
Icon(selected ? _filledIcon : _outlinedIcon, color: colors.primary),
|
||||
const SizedBox(height: AppSpacing.xs),
|
||||
Text(
|
||||
label,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: iconColor,
|
||||
color: colors.primary,
|
||||
fontWeight: selected ? FontWeight.w600 : FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user