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.
119 lines
4.2 KiB
Dart
119 lines
4.2 KiB
Dart
import 'package:badges/badges.dart';
|
|
import 'package:doctor_app_flutter/config/config.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:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.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;
|
|
final String svgPath;
|
|
|
|
BottomNavigationItem(
|
|
{this.icon,
|
|
this.activeIcon,
|
|
this.changeIndex,
|
|
this.index,
|
|
this.currentIndex,
|
|
this.name,
|
|
this.dashboardViewModel,
|
|
this.svgPath});
|
|
|
|
@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: [
|
|
if (currentIndex == index)
|
|
Positioned(
|
|
top: 0,
|
|
child: Container(
|
|
color: AppGlobal.appRedColor,
|
|
width: 100,
|
|
height: 3,
|
|
)),
|
|
Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Container(
|
|
child: SvgPicture.asset(
|
|
svgPath,
|
|
width: SizeConfig.widthMultiplier * (10),
|
|
height: SizeConfig.getHeightMultiplier(
|
|
height: SizeConfig.heightMultiplier *
|
|
(SizeConfig.isHeightVeryShort
|
|
? 10
|
|
: SizeConfig.isHeightShort
|
|
? 8.5
|
|
: 7)) *
|
|
40,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
Expanded(
|
|
child: AppText(name ?? "",
|
|
textAlign: TextAlign.center,
|
|
fontSize:
|
|
SizeConfig.getTextMultiplierBasedOnWidth() * 2,
|
|
letterSpacing: -0.24,
|
|
color: AppGlobal.appTextColor,
|
|
fontWeight: FontWeight.w600) //#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: AppText(
|
|
dashboardViewModel.notRepliedCount.toString(),
|
|
color: Colors.white,
|
|
fontSize: 12.0),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|