You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
6.4 KiB
Dart
165 lines
6.4 KiB
Dart
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/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<int> changeIndex;
|
|
final int index;
|
|
final int currentIndex;
|
|
final String name;
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
BottomNavigationItem(
|
|
{this.icon,
|
|
this.activeIcon,
|
|
this.changeIndex,
|
|
this.index,
|
|
this.currentIndex,
|
|
this.name});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var model = Provider.of<ToDoCountProviderModel>(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: <Widget>[
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Container(
|
|
child: Icon(currentIndex == index ? activeIcon : icon,
|
|
color: currentIndex == index
|
|
? secondaryColor
|
|
: Colors.grey,
|
|
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: <Widget>[
|
|
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: <Widget>[
|
|
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,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|