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.
HMG_Patient_App/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart

135 lines
4.6 KiB
Dart

5 years ago
import 'package:diplomaticquarterapp/Constants.dart';
4 years ago
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
5 years ago
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
5 years ago
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
5 years ago
4 years ago
import '../../locator.dart';
5 years ago
class BottomNavPharmacyItem extends StatelessWidget {
final String title;
final IconData icon;
final ValueChanged<int> changeIndex;
final int index;
final int currentIndex;
final Function onTap;
final bool isHome;
5 years ago
final IconData activeIcon;
BottomNavPharmacyItem(
{this.icon,
this.changeIndex,
this.index,
this.currentIndex,
this.activeIcon,
this.title,
this.onTap,
this.isHome = false});
5 years ago
@override
Widget build(BuildContext context) {
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
ProjectViewModel projectViewModel = Provider.of(context);
5 years ago
return Expanded(
child: SizedBox(
4 years ago
height: 66.0,
4 years ago
child: Stack(
clipBehavior: Clip.none,
children: [
Material(
type: MaterialType.transparency,
child: InkWell(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () {
if (!Provider.of<ProjectViewModel>(context, listen: false)
4 years ago
.isLogin &&
4 years ago
(currentIndex == 2 || currentIndex == 3))
Navigator.push(
context,
FadePage(page: WelcomeLogin()),
);
else
changeIndex(currentIndex);
},
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
4 years ago
// SizedBox(
// height: 15,
// ),
4 years ago
currentIndex == index
? Divider(
4 years ago
color: Color(0xff5AB133),
4 years ago
thickness: 3.5,
)
4 years ago
: Divider(
4 years ago
thickness: 0,
),
4 years ago
4 years ago
Container(
child: Icon(currentIndex == index ? activeIcon : icon,
color: isHome
? Color(0xff5AB145)
: currentIndex == index
4 years ago
? Colors.grey
: Colors.grey,
4 years ago
size: 20.0),
4 years ago
),
SizedBox(
height: 11,
),
5 years ago
4 years ago
// Added TextAlign Property
Texts(
title,
textAlign: TextAlign.center,
color: currentIndex == index ? Colors.grey : Colors.grey,
4 years ago
fontWeight: currentIndex == index
4 years ago
? FontWeight.normal
4 years ago
: FontWeight.w400,
4 years ago
fontSize: currentIndex == index ? 11 : 9,
4 years ago
),
],
5 years ago
),
4 years ago
),
5 years ago
),
4 years ago
if (currentIndex == 3 &&
Provider.of<OrderPreviewViewModel>(context, listen: false)
.cartResponse
.quantityCount !=
0)
4 years ago
Positioned(
4 years ago
top: 11.5,
4 years ago
right: -3.5,
4 years ago
child: Container(
decoration: BoxDecoration(
4 years ago
color: Colors.red,
borderRadius: BorderRadius.circular(15),
4 years ago
),
4 years ago
padding: EdgeInsets.only(left: 6.5, right: 6.5),
4 years ago
height: 18,
4 years ago
child: Center(
child: Texts(
orderPreviewViewModel.cartResponse.quantityCount.toString(),
style: "caption",
medium: true,
color: Colors.white,
)),
4 years ago
),
)
],
5 years ago
),
),
);
}
}