import 'package:car_for_her/config/palette.dart'; import 'package:car_for_her/views/client/home.dart'; import 'package:car_for_her/views/client/profile.dart'; import 'package:car_for_her/views/client/trip.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; class ClientBottomNavigator extends StatefulWidget { const ClientBottomNavigator({Key key}) : super(key: key); @override _ClientBottomNavigatorState createState() => _ClientBottomNavigatorState(); } class _ClientBottomNavigatorState extends State { int currentIndex = 0; final screen = [ ClientHome(), ClientTrip(), ClientProfile(), ]; Color mapColor=Colors.black; @override Widget build(BuildContext context) { return Scaffold( body: IndexedStack( index: currentIndex, children: screen, ), bottomNavigationBar: Container( height: 80, decoration: BoxDecoration( borderRadius: BorderRadius.only( topRight: Radius.circular(30), topLeft: Radius.circular(30)), boxShadow: [ BoxShadow(color: Colors.black38, spreadRadius: 0, blurRadius: 10), ], ), child: ClipRRect( borderRadius: BorderRadius.only( topRight: Radius.circular(30), topLeft: Radius.circular(30)), child: BottomNavigationBar( type: BottomNavigationBarType.fixed, selectedItemColor: Palette.primary, iconSize: 30, showUnselectedLabels: false, showSelectedLabels: false, currentIndex: currentIndex, onTap: (index) { setState(() { currentIndex = index; if(currentIndex==1){ setState(() { mapColor=Palette.primary; }); } else{ setState(() { mapColor=Colors.black; }); } }); }, items: [ BottomNavigationBarItem( icon: Icon(Icons.home_rounded), label: 'Home', ), BottomNavigationBarItem( icon: SvgPicture.asset('assets/icons/map.svg',color: mapColor,), label: 'Map', ), BottomNavigationBarItem( icon: Icon(Icons.person_rounded), label: 'Profile', ), ], ), ), ), ); } }