import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:muaawana/config/lang_enum.dart'; import 'package:provider/provider.dart'; import '../../config/app_constant.dart'; import '../../config/provider.dart'; import '../../config/style.dart'; import '../../providers/language_provider.dart'; import '../../providers/navbar_provider/bottomnavbar_visibility_provider.dart'; import '../../providers/navbar_provider/client_bottom_nav_provider.dart'; import '../../providers/ThemeProvider.dart'; // Make sure ThemeProvider is imported import '../../utils/text_style.dart'; class HomeClientView extends StatelessWidget { const HomeClientView({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Consumer3( builder: (context, bottomVisibility, bottomNavProvider, themeProvider, child) { final langProvider = Provider.of(context); return Scaffold( body: Stack( children: [ bottomNavProvider.currentScreen, if (bottomVisibility.isVisible && bottomNavProvider.showNavigationBar) Positioned( bottom: 0, left: 0, right: 0, child: Column( children: [ BottomNavigationBar( backgroundColor: Theme.of(context).cardColor, selectedItemColor: AppNewStyle.primaryButton, elevation: 0, iconSize: 20, showUnselectedLabels: true, unselectedItemColor: Theme.of(context).colorScheme.onSurface.withOpacity(0.6), unselectedLabelStyle: tS("lato_regular", 10, FontWeight.w600, Theme.of(context).colorScheme.onSurface.withOpacity(0.7)), selectedLabelStyle: tS("lato_bold", 12, FontWeight.bold, AppNewStyle.primaryButton), currentIndex: bottomNavProvider.currentIndex, onTap: (index) { bottomNavProvider.setCurrentIndex(index); }, type: BottomNavigationBarType.fixed, // Add this to prevent layout issues items: [ BottomNavigationBarItem( icon: Padding( padding: const EdgeInsets.only(bottom: 5.0), child: SvgPicture.asset( Consts.homeIcon, height: 20, color: bottomNavProvider.currentIndex == 0 ? AppNewStyle.primaryButton : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), ), ), label: langProvider.translate('Home'), ), BottomNavigationBarItem( icon: Padding( padding: const EdgeInsets.only(bottom: 5.0), child: SvgPicture.asset( Consts.bookingIcon, height: 20, color: bottomNavProvider.currentIndex == 1 ? AppNewStyle.primaryButton : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), ), ), label: langProvider.translate('Booking'), ), BottomNavigationBarItem( icon: Padding( padding: const EdgeInsets.only(bottom: 5.0), child: SvgPicture.asset( Consts.saveIcon, height: 20, color: bottomNavProvider.currentIndex == 2 ? AppNewStyle.primaryButton : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), ), ), label: langProvider.translate('Save'), ), BottomNavigationBarItem( icon: Stack( children: [ Padding( padding: const EdgeInsets.only(bottom: 5.0), child: SvgPicture.asset( Consts.messageIcon, height: 20, color: bottomNavProvider.currentIndex == 3 ? AppNewStyle.primaryButton : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), ), ), bottomNavProvider.messageNotRead ? Positioned( top: 0, right: langProvider.currentLangCode == Language.en ? 0 : null, left: langProvider.currentLangCode == Language.ar ? 0 : null, child: Container( height: 10, width: 10, decoration: BoxDecoration( shape: BoxShape.circle, color: Theme.of(context).colorScheme.error, ), ), ) : const SizedBox.shrink(), ], ), label: langProvider.translate('Message'), ), BottomNavigationBarItem( icon: Padding( padding: const EdgeInsets.all(5.0), child: SvgPicture.asset( Consts.profileIcon, height: 18, color: bottomNavProvider.currentIndex == 4 ? AppNewStyle.primaryButton : Theme.of(context).colorScheme.onSurface.withOpacity(0.6), ), ), label: langProvider.translate('Profile'), ), ], ), ], ), ), ], ), ); }, ); } }