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

147 lines
5.4 KiB
Dart

7 months ago
import 'package:hmg_patient_app/config/config.dart';
import 'package:hmg_patient_app/config/shared_pref_kay.dart';
import 'package:hmg_patient_app/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/models/Authentication/select_device_imei_res.dart';
import 'package:hmg_patient_app/routes.dart';
import 'package:hmg_patient_app/services/authentication/auth_provider.dart';
import 'package:hmg_patient_app/uitl/app_shared_preferences.dart';
import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart';
import 'package:hmg_patient_app/widgets/data_display/text.dart';
5 years ago
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
5 years ago
class BottomNavPharmacyItem extends StatelessWidget {
2 years ago
final String? title;
final IconData? icon;
5 years ago
final ValueChanged<int> changeIndex;
2 years ago
final int? index;
final int? currentIndex;
final VoidCallbackAction? onTap;
final bool? isHome;
5 years ago
2 years ago
final IconData? activeIcon;
2 years ago
BottomNavPharmacyItem({required this.icon, required this.changeIndex, this.index, this.currentIndex, this.activeIcon, this.title, this.onTap, this.isHome = false});
AppSharedPreferences sharedPref = AppSharedPreferences();
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(
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).isLogin && (currentIndex == 2 || currentIndex == 3))
login(context);
4 years ago
else
2 years ago
changeIndex(currentIndex!);
4 years ago
},
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
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,
2 years ago
color: isHome!
4 years ago
? 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(
2 years ago
title!,
4 years ago
textAlign: TextAlign.center,
color: currentIndex == index ? Colors.grey : Colors.grey,
fontWeight: currentIndex == index ? FontWeight.normal : FontWeight.w400,
4 years ago
fontSize: currentIndex == index ? 11 : 9,
4 years ago
),
],
5 years ago
),
4 years ago
),
5 years ago
),
if (currentIndex == 3 && Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount!=null && 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
),
),
);
}
void setUserValues(value) async {
if (value != null) sharedPref.setObject(IMEI_USER_DATA, value);
}
login(BuildContext context) async {
final authService = new AuthProvider();
var data = await sharedPref.getObject(IMEI_USER_DATA);
sharedPref.remove(REGISTER_DATA_FOR_LOGIIN);
if (data != null) {
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
GifLoaderDialogUtils.showMyDialog(context);
Merge branch 'development_v3.3' of http://34.17.52.79/Haroon6138/diplomatic-quarter into dev_v3.13.6 # Conflicts: # lib/config/config.dart # lib/core/model/labs/patient_lab_orders.dart # lib/core/model/labs/request_patient_lab_special_result.dart # lib/core/model/labs/request_send_lab_report_email.dart # lib/core/model/radiology/final_radiology.dart # lib/core/model/radiology/request_send_rad_report_email.dart # lib/core/model/rate/appoitment_rated.dart # lib/core/service/client/base_app_client.dart # lib/core/service/medical/labs_service.dart # lib/core/service/medical/radiology_service.dart # lib/core/viewModels/medical/labs_view_model.dart # lib/core/viewModels/medical/radiology_view_model.dart # lib/models/Authentication/check_activation_code_request.dart # lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart # lib/pages/BookAppointment/BookSuccess.dart # lib/pages/BookAppointment/QRCode.dart # lib/pages/DrawerPages/family/my-family.dart # lib/pages/DrawerPages/notifications/notification_details_page.dart # lib/pages/MyAppointments/AppointmentDetails.dart # lib/pages/MyAppointments/MyAppointments.dart # lib/pages/MyAppointments/widgets/AppointmentActions.dart # lib/pages/ToDoList/ToDo.dart # lib/pages/landing/landing_page.dart # lib/pages/livecare/widgets/clinic_list.dart # lib/pages/login/confirm-login.dart # lib/pages/login/login.dart # lib/pages/medical/labs/laboratory_result_page.dart # lib/pages/medical/radiology/radiology_details_page.dart # lib/services/authentication/auth_provider.dart # lib/splashPage.dart # lib/uitl/push-notification-handler.dart # lib/widgets/drawer/app_drawer_widget.dart
2 years ago
authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) {
GifLoaderDialogUtils.hideDialog(context);
if (value != null) {
setUserValues(value);
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
});
}
}
5 years ago
}