import 'package:badges/badges.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../Constants.dart'; class BottomNavigationItem extends StatelessWidget { final IconData icon; final IconData activeIcon; final ValueChanged changeIndex; final int index; final int currentIndex; final String name; AuthenticatedUserObject authenticatedUserObject = locator(); BottomNavigationItem( {this.icon, this.activeIcon, this.changeIndex, this.index, this.currentIndex, this.name}); @override Widget build(BuildContext context) { var model = Provider.of(context); return Expanded( child: SizedBox( // height: 72.0, child: Material( type: MaterialType.transparency, child: InkWell( highlightColor: Colors.transparent, splashColor: Colors.transparent, onTap: () => changeIndex(currentIndex), child: currentIndex != 4 ? Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: 15, ), Container( child: Icon(currentIndex == index ? activeIcon : icon, color: currentIndex == index ? secondaryColor : Theme.of(context).dividerColor, size: 22.0), ), SizedBox( height: 2, ), Texts( name, textAlign: TextAlign.center, color: currentIndex == index ? secondaryColor : Colors.grey, fontSize: 11, ), SizedBox( height: 7, ), ], ) : (authenticatedUserObject.isLogin && model.isShowBadge) ? Stack( alignment: AlignmentDirectional.center, children: [ Positioned( right: 18.0, bottom: 28.0, child: Badge( toAnimate: false, position: BadgePosition.topEnd(), shape: BadgeShape.circle, badgeColor: secondaryColor.withOpacity(1.0), borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), child: Text(model.count.toString(), style: TextStyle( color: Colors.white, fontSize: 14.0)), ), ), ), Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: 15, ), Container( child: Icon( currentIndex == index ? activeIcon : icon, color: currentIndex == index ? secondaryColor : Theme.of(context).dividerColor, size: 22.0), ), SizedBox( height: 2, ), Texts( name, textAlign: TextAlign.center, color: currentIndex == index ? Theme.of(context).primaryColor : Colors.grey, fontSize: 11, ), SizedBox( height: 7, ), ], ), ], ) : Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: 15, ), Container( child: Icon( currentIndex == index ? activeIcon : icon, color: currentIndex == index ? secondaryColor : Theme.of(context).dividerColor, size: 22.0), ), SizedBox( height: 2, ), Texts( name, textAlign: TextAlign.center, color: currentIndex == index ? secondaryColor : Colors.grey, fontSize: 11, ), SizedBox( height: 7, ), ], ), ), ), ), ); } }