1import 'package:flutter/material.dart';
2import 'package:flutter_screenutil/flutter_screenutil.dart';
3import 'package:go_router/go_router.dart';
4import 'package:hugeicons/hugeicons.dart';
7 final StatefulNavigationShell navigationShell;
9 const CustomNavBar(this.navigationShell, {super.key, this.body});
15class _CustomNavBarState
extends State<CustomNavBar>
16 with TickerProviderStateMixin {
22 HugeIcons.strokeRoundedDashboardSpeed02,
23 HugeIcons.strokeRoundedMortarboard02,
24 HugeIcons.strokeRoundedMenuCircle,
25 HugeIcons.strokeRoundedUser,
26 HugeIcons.strokeRoundedSettings01,
38 (index) => AnimationController(
39 duration:
const Duration(milliseconds: 50),
45 return Tween<double>(begin: 1.0, end: 0.85).animate(
48 curve: Curves.easeInOut,
69 widget.navigationShell.goBranch(
71 initialLocation: index == widget.navigationShell.currentIndex,
76 Widget
build(BuildContext context) {
79 body: widget.navigationShell,
80 bottomNavigationBar: Container(
81 decoration: BoxDecoration(
82 color: Theme.of(context).colorScheme.surface,
87 padding: EdgeInsets.symmetric(horizontal: 8.sp),
89 mainAxisAlignment: MainAxisAlignment.spaceAround,
90 children: List.generate(
103 final item =
_icons[index];
105 return GestureDetector(
112 child: ScaleTransition(
117 mainAxisSize: MainAxisSize.min,
120 duration:
const Duration(milliseconds: 50),
121 curve: Curves.easeInOut,
124 decoration: BoxDecoration(
129 ? Theme.of(context).colorScheme.primary
130 : Colors.transparent,
138 ? Theme.of(context).colorScheme.primary
139 : Theme.of(context).hintColor.withOpacity(0.2),
void _initializeAnimations()
late List< Animation< double > > _scaleAnimations
final List< IconData > _icons
void _handleTap(int index) async
override void initState()
late List< AnimationController > _animationControllers
Widget _buildNavItem(int index)
class NavBarWrapper extends StatefulWidget _selectedIndex
override Widget build(BuildContext context)