import 'package:badges/badges.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../locator.dart'; class BottomNavigationItem extends StatelessWidget { final IconData icon; final IconData activeIcon; final ValueChanged changeIndex; final int index; final int currentIndex; final String name; final DashboardViewModel dashboardViewModel; BottomNavigationItem( {this.icon, this.activeIcon, this.changeIndex, this.index, this.currentIndex, this.name, this.dashboardViewModel}); @override Widget build(BuildContext context) { return Expanded( child: SizedBox( height: 70.0, child: Material( type: MaterialType.transparency, child: InkWell( highlightColor: Colors.transparent, splashColor: Colors.transparent, onTap: () => changeIndex(currentIndex), child: Stack( alignment: AlignmentDirectional.center, children: [ Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: 15,), Container( child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? Color(0xFF333C45) : Theme.of(context).dividerColor, size: 22.0), ), SizedBox(height: 5,), Expanded( child: Text( name, style: TextStyle( color: currentIndex == index ? Theme.of(context).primaryColor : Theme.of(context).dividerColor, ), ), ), ], ), if(currentIndex == 3 && dashboardViewModel.notRepliedCount != 0) Positioned( right: 18.0, bottom: 40.0, child: Badge( toAnimate: false, position: BadgePosition.topEnd(), shape: BadgeShape.circle, badgeColor: Colors.red[800], borderRadius: BorderRadius.circular(8), badgeContent: Container( // padding: EdgeInsets.all(2.0), child: Text(dashboardViewModel.notRepliedCount.toString(), style: TextStyle( color: Colors.white, fontSize: 12.0)), ), ), ), ], ), ), ), ), ); } }