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.
94 lines
3.7 KiB
Dart
94 lines
3.7 KiB
Dart
import 'package:badges/badges.dart';
|
|
import 'package:doctor_app_flutter/config/size_config.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<int> changeIndex;
|
|
final int? index;
|
|
final int currentIndex;
|
|
final String? name;
|
|
final DashboardViewModel? dashboardViewModel;
|
|
|
|
|
|
BottomNavigationItem(
|
|
{this.icon, this.activeIcon, required this.changeIndex, this.index, required this.currentIndex, this.name, this.dashboardViewModel});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Expanded(
|
|
child: SizedBox(
|
|
height: SizeConfig.heightMultiplier *
|
|
(SizeConfig.isHeightVeryShort ? 10 :SizeConfig.isHeightShort ? 8: 8),
|
|
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: <Widget>[
|
|
SizedBox(height: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier *
|
|
(SizeConfig.isHeightVeryShort ? 12:SizeConfig.isHeightShort ?10 : 9) ) * 10,),
|
|
Container(
|
|
margin: EdgeInsets.only(bottom: 3),
|
|
child: Icon(currentIndex == index ? activeIcon : icon,
|
|
color: currentIndex == index ? Color(0xFF333C45) : Color(0xFF989898), size: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier *
|
|
(SizeConfig.isHeightVeryShort ? 10:SizeConfig.isHeightShort ?8.5 : 7) ) * 40,),
|
|
),
|
|
SizedBox(
|
|
height: SizeConfig.getHeightMultiplier(height:SizeConfig.heightMultiplier *
|
|
(SizeConfig.isHeightVeryShort ? 10 : 6) ) * 0.5,
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
name ?? "",
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2,color: currentIndex == index ? Color(0xFF333C45) : Color(0xFF989898)//#989898,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
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)),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|