import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; import 'package:eatvio_app/widgets/custom_navigation_menu.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; int currentBottomNavBarIndex = 0; class BottomNavigationBarWidget extends StatefulWidget { final Widget child; const BottomNavigationBarWidget({ super.key, required this.child, }); @override State createState() => _BottomNavigationBarWidgetState(); } class _BottomNavigationBarWidgetState extends State { void _onItemTapped(int index) { if (currentBottomNavBarIndex != index) { setState(() { currentBottomNavBarIndex = index; }); } switch (currentBottomNavBarIndex) { case 0: GoRouter.of(context).replace('/my-profile-screen'); break; case 1: GoRouter.of(context).replace('/feed-screen'); break; case 2: GoRouter.of(context).replace('/diary-screen'); break; case 3: GoRouter.of(context).replace('/chat-select-screen'); break; case 4: break; case 5: final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox; final size = overlay.size; showMenu( context: context, color: Colors.white, shadowColor: Colors.white, surfaceTintColor: Colors.white, items: [ PopupMenuItem( child: CustomNavigationMenu(), ) ], position: RelativeRect.fromLTRB(size.width, size.height, 0, 0), ); break; } } @override Widget build(BuildContext context) { return Scaffold( body: widget.child, bottomNavigationBar: BottomNavigationBar( type: BottomNavigationBarType.fixed, onTap: _onItemTapped, selectedFontSize: 12, unselectedFontSize: 12, selectedItemColor: appTheme.blueA400, currentIndex: currentBottomNavBarIndex, items: [ BottomNavigationBarItem( label: '', icon: SvgPicture.asset( ImageConstant.imgLogo, ), ), BottomNavigationBarItem( label: 'Лента', icon: SvgPicture.asset( width: 24, height: 24, ImageConstant.imgFeed, ), activeIcon: SvgPicture.asset( ImageConstant.imgFeed, width: 24, height: 24, colorFilter: ColorFilter.mode( appTheme.blueA400, BlendMode.srcIn, ), ), ), BottomNavigationBarItem( label: "diary".tr, icon: SvgPicture.asset( ImageConstant.imgDiary, width: 24, height: 24, ), activeIcon: SvgPicture.asset( ImageConstant.imgDiary, width: 24, height: 24, colorFilter: ColorFilter.mode( appTheme.blueA400, BlendMode.srcIn, ), ), ), BottomNavigationBarItem( label: "chat".tr, icon: SvgPicture.asset( ImageConstant.imgChat, width: 24, height: 24, ), activeIcon: SvgPicture.asset( ImageConstant.imgChat, width: 24, height: 24, colorFilter: ColorFilter.mode( appTheme.blueA400, BlendMode.srcIn, ), ), ), BottomNavigationBarItem( label: '', icon: SvgPicture.asset( ImageConstant.imgBell, width: 24, height: 24, ), activeIcon: SvgPicture.asset( ImageConstant.imgBell, width: 24, height: 24, colorFilter: ColorFilter.mode( appTheme.blueA400, BlendMode.srcIn, ), ), ), BottomNavigationBarItem( label: '', icon: Image.asset( ImageConstant.imgEllipse1, width: 32, height: 32, ), ), ], ), ); } }