import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; import '../../core/theme/app_colors.dart'; import '../../l10n/app_strings.dart'; class PredBottomNav extends StatelessWidget { const PredBottomNav({ super.key, required this.selectedIndex, required this.onTap, this.showAdmin = false, }); final int selectedIndex; final ValueChanged onTap; final bool showAdmin; @override Widget build(BuildContext context) { final s = context.strings; final isDark = Theme.of(context).brightness == Brightness.dark; final items = [ _Item(Icons.dashboard_rounded, s.navHome), _Item(Icons.sports_esports_rounded, s.navPredict, highlight: true), _Item(Icons.account_balance_wallet_rounded, s.navWallet), _Item(Icons.person_rounded, s.navProfile), if (showAdmin) _Item(Icons.admin_panel_settings_rounded, s.settings), ]; return Container( decoration: BoxDecoration( color: isDark ? AppColors.surfaceElevated : Colors.white, border: Border(top: BorderSide(color: isDark ? AppColors.border : const Color(0xFFE2E8F0))), boxShadow: [ BoxShadow( color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.06), blurRadius: 20, offset: const Offset(0, -4), ), ], ), child: SafeArea( top: false, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: List.generate(items.length, (i) { final item = items[i]; final selected = selectedIndex == i; final navKey = switch (i) { 0 => const Key('nav_home'), 1 => const Key('nav_predict'), 2 => const Key('nav_wallet'), 3 => const Key('nav_profile'), _ => const Key('nav_admin'), }; return Expanded( child: InkWell( key: navKey, onTap: () => onTap(i), borderRadius: BorderRadius.circular(16), child: AnimatedContainer( duration: const Duration(milliseconds: 200), padding: const EdgeInsets.symmetric(vertical: 10), decoration: BoxDecoration( color: selected ? AppColors.primary.withValues(alpha: 0.12) : Colors.transparent, borderRadius: BorderRadius.circular(16), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ Icon( item.icon, color: selected ? (item.highlight ? AppColors.primary : AppColors.primary) : AppColors.textMuted, size: item.highlight ? 28 : 24, ), const SizedBox(height: 4), Text( item.label, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 11, fontWeight: selected ? FontWeight.w700 : FontWeight.w500, color: selected ? AppColors.primary : AppColors.textMuted, ), ), ], ), ), ).animate(target: selected ? 1 : 0).scale( begin: const Offset(0.95, 0.95), end: const Offset(1, 1), duration: 200.ms, ), ); }), ), ), ), ); } } class _Item { const _Item(this.icon, this.label, {this.highlight = false}); final IconData icon; final String label; final bool highlight; }