diff --git a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart index beaa8c2a..98058bcf 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart @@ -27,13 +27,13 @@ class AddBloodPressurePage extends StatefulWidget { const AddBloodPressurePage( {Key key, - this.bloodSugarDate, - this.measureTimeSelectedType, - this.isUpdate = false, - this.lineItemNo, - this.model, - this.bloodSystolicValue, - this.bloodDiastolicValue}) + this.bloodSugarDate, + this.measureTimeSelectedType, + this.isUpdate = false, + this.lineItemNo, + this.model, + this.bloodSystolicValue, + this.bloodDiastolicValue}) : super(key: key); @override @@ -80,44 +80,38 @@ class _AddBloodPressurePageState extends State { return AppScaffold( isShowAppBar: true, - appBarTitle: widget.isUpdate - ? TranslationBase.of(context).update - : TranslationBase.of(context).add, + appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, appBarIcons: widget.isUpdate - ? [ - IconButton( - icon: Icon(Icons.delete), - color: Colors.white, - onPressed: () { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: 'Remove this measure', - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); + ? [ + IconButton( + icon: Icon(Icons.delete), + color: Colors.white, + onPressed: () { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: 'Remove this measure', + okText: TranslationBase.of(context).ok, + cancelText: TranslationBase.of(context).cancel, + okFunction: () async { + ConfirmDialog.closeAlertDialog(context); - GifLoaderDialogUtils.showMyDialog(context); - widget.model - .deactivateDiabeticStatus( - lineItemNo: widget.lineItemNo) - .then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.ErrorLocal) - AppToast.showErrorToast( - message: widget.model.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - }, - ) - ] + GifLoaderDialogUtils.showMyDialog(context); + widget.model.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.model.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.model.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.model.error); + }); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + }, + ) + ] : null, body: SingleChildScrollView( physics: BouncingScrollPhysics(), @@ -156,9 +150,7 @@ class _AddBloodPressurePageState extends State { padding: EdgeInsets.all(12), width: double.infinity, height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -180,22 +172,18 @@ class _AddBloodPressurePageState extends State { showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { - setState( - () { - bloodSugarDate = date; - }, - ); + setState( + () { + bloodSugarDate = date; }, - currentTime: bloodSugarDate, - locale: projectViewModel.localeType); + ); + }, currentTime: bloodSugarDate, locale: projectViewModel.localeType); }, child: Container( padding: EdgeInsets.all(12), width: double.infinity, height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -210,30 +198,22 @@ class _AddBloodPressurePageState extends State { ), InkWell( onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, - onConfirm: (date) { - setState( - () { - timeSugarDate = date; - }, - ); + DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { + setState( + () { + timeSugarDate = date; }, - currentTime: timeSugarDate, - locale: projectViewModel.localeType); + ); + }, currentTime: timeSugarDate, locale: projectViewModel.localeType); }, child: Container( padding: EdgeInsets.all(12), width: double.infinity, height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).time), - Texts(getTime()) - ], + children: [Texts(TranslationBase.of(context).time), Texts(getTime())], ), ), ), @@ -251,23 +231,18 @@ class _AddBloodPressurePageState extends State { loading: widget.model.state == ViewState.BusyLocal, label: TranslationBase.of(context).save.toUpperCase(), textColor: Colors.white, - color: isButtonDisabled - ? Colors.grey[900] - : Colors.grey, + color: isButtonDisabled ? Colors.grey[900] : Colors.grey, onTap: () async { - if (_bloodSystolicValueController.text.isNotEmpty && - _bloodDiastolicValueController.text.isNotEmpty) { + if (_bloodSystolicValueController.text.isNotEmpty && _bloodDiastolicValueController.text.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); widget.model .addORUpdateDiabtecResult( isUpdate: widget.isUpdate, bloodPressureDate: - '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - diastolicPressure: - _bloodDiastolicValueController.text.toString(), - systolicePressure: - _bloodSystolicValueController.text.toString(), + '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + diastolicPressure: _bloodDiastolicValueController.text.toString(), + systolicePressure: _bloodSystolicValueController.text.toString(), measuredArm: measuredArm, ) .then((value) { @@ -315,7 +290,7 @@ class _AddBloodPressurePageState extends State { } void validateForm() { - print("_bloodSystolicValueController "+_bloodSystolicValueController.text.length.toString()); + print("_bloodSystolicValueController " + _bloodSystolicValueController.text.length.toString()); if (measureTimeSelectedType != 'Left Arm' && _bloodSystolicValueController.text.length > 0 && _bloodDiastolicValueController.text.length > 0) { @@ -345,5 +320,4 @@ class _AddBloodPressurePageState extends State { // }); // } } - } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 139aa093..5636de56 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -195,9 +195,7 @@ class Utils { List medical = List(); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(5) - ? Navigator.push(context, FadePage(page: MyAppointments())) - : null, + onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null, child: isLogin ? Stack(children: [ MedicalProfileItem( @@ -206,26 +204,27 @@ class Utils { subTitle: TranslationBase.of(context).myAppointmentsList, hasBadge: true, isEnable: projectViewModel.havePrivilege(5)), - Positioned( - right: 0.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(count.toString(), style: TextStyle(color: Colors.white, fontSize: 16.0)), - ), + Positioned( + right: 0.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(count.toString(), style: TextStyle(color: Colors.white, fontSize: 16.0)), ), ), - ]) - : MedicalProfileItem( - title: TranslationBase.of(context).myAppointments, - imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, - hasBadge: true,isEnable: projectViewModel.havePrivilege(5), + ), + ]) + : MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + isEnable: projectViewModel.havePrivilege(5), ), )); if (projectViewModel.havePrivilege(10)) { @@ -239,11 +238,9 @@ class Utils { )); } - - medical.add(InkWell( - onTap: () =>projectViewModel.havePrivilege(7) - ? Navigator.push(context, FadePage(page: RadiologyHomePage())) - : null, + medical.add(InkWell( + onTap: () => + projectViewModel.havePrivilege(7) ? Navigator.push(context, FadePage(page: RadiologyHomePage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).radiology, imagePath: 'radiology_icon.png', @@ -253,9 +250,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(12) - ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) - : null, + onTap: () => + projectViewModel.havePrivilege(12) ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).medicines, imagePath: 'prescription_icon.png', @@ -279,11 +275,9 @@ class Utils { ), )); - - medical.add(InkWell( - onTap: () =>projectViewModel.havePrivilege(48) - ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) - : null, + medical.add(InkWell( + onTap: () => + projectViewModel.havePrivilege(48) ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).myMedical, imagePath: 'active_medications.png', @@ -309,9 +303,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(14) - ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) - : null, + onTap: () => + projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).eye, imagePath: 'eye_measurement_icon.png', @@ -321,9 +314,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(22) - ? Navigator.push(context, FadePage(page: InsuranceCard())) - : null, + onTap: () => projectViewModel.havePrivilege(22) ? Navigator.push(context, FadePage(page: InsuranceCard())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).insurance, imagePath: 'insurance_card_icon.png', @@ -344,9 +335,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(18) - ? Navigator.push(context, FadePage(page: InsuranceApproval())) - : null, + onTap: () => + projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).insuranceApproval, imagePath: 'insurance_approvals_icon.png', @@ -356,9 +346,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(23) - ? Navigator.push(context, FadePage(page: AllergiesPage())) - : null, + onTap: () => projectViewModel.havePrivilege(23) ? Navigator.push(context, FadePage(page: AllergiesPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).allergies, imagePath: 'my_allergies_icon.png', @@ -368,9 +356,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(26) - ? Navigator.push(context, FadePage(page: MyVaccines())) - : null, + onTap: () => projectViewModel.havePrivilege(26) ? Navigator.push(context, FadePage(page: MyVaccines())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).myVaccines, imagePath: 'my_vaccines_icon.png', @@ -380,9 +366,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(20) - ? Navigator.push(context, FadePage(page: HomeReportPage())) - : null, + onTap: () => + projectViewModel.havePrivilege(20) ? Navigator.push(context, FadePage(page: HomeReportPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).medical, imagePath: 'medical_reports_icon.png', @@ -392,9 +377,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(19) - ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) - : null, + onTap: () => + projectViewModel.havePrivilege(19) ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).monthly, imagePath: 'monthly_reports_icon.png', @@ -404,9 +388,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(16) - ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) - : null, + onTap: () => + projectViewModel.havePrivilege(16) ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).sick, imagePath: 'sick_leaves_icons.png', @@ -416,9 +399,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(47) - ? Navigator.push(context, FadePage(page: MyBalancePage())) - : null, + onTap: () => projectViewModel.havePrivilege(47) ? Navigator.push(context, FadePage(page: MyBalancePage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).myBalance, imagePath: 'check-in.png', @@ -436,9 +417,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(24) - ? Navigator.push(context, FadePage(page: MyTrackers())) - : null, + onTap: () => projectViewModel.havePrivilege(24) ? Navigator.push(context, FadePage(page: MyTrackers())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).myTrackers, imagePath: 'my_tracker_icon.png', @@ -448,9 +427,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(30) - ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) - : null, + onTap: () => + projectViewModel.havePrivilege(30) ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).smartWatches, imagePath: 'smartwatch_icon.png', @@ -460,9 +438,8 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(28) - ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) - : null, + onTap: () => + projectViewModel.havePrivilege(28) ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) : null, child: MedicalProfileItem( title: TranslationBase.of(context).askYour, imagePath: 'ask_doctor_icon.png', @@ -501,9 +478,7 @@ class Utils { } medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(40) - ? launch('whatsapp://send?phone=18885521858&text=') - : null, + onTap: () => projectViewModel.havePrivilege(40) ? launch('whatsapp://send?phone=18885521858&text=') : null, child: MedicalProfileItem( title: TranslationBase.of(context).chatbot, imagePath: 'insurance_approvals_icon.png', @@ -515,8 +490,7 @@ class Utils { return medical; } - static Widget loadNetworkImage( - {@required String url, BoxFit fitting = BoxFit.cover}) { + static Widget loadNetworkImage({@required String url, BoxFit fitting = BoxFit.cover}) { return CachedNetworkImage( placeholderFadeInDuration: Duration(milliseconds: 250), fit: fitting, @@ -569,8 +543,7 @@ extension IndexedIterable on Iterable { openAppStore({String androidPackageName, String iOSAppID}) async { if (Platform.isAndroid) { - assert(!(androidPackageName == null), - "Should have valid value in androidPackageName parameter"); + assert(!(androidPackageName == null), "Should have valid value in androidPackageName parameter"); if ((await FlutterHmsGmsAvailability.isGmsAvailable)) launch("market://details?id=com.ejada.hmg"); if ((await FlutterHmsGmsAvailability.isHmsAvailable)) launch("appmarket://details?id=com.ejada.hmg"); } else if (Platform.isIOS) {