diff --git a/lib/analytics/flows/todo_list.dart b/lib/analytics/flows/todo_list.dart index 694363f1..a3ff21f2 100644 --- a/lib/analytics/flows/todo_list.dart +++ b/lib/analytics/flows/todo_list.dart @@ -10,7 +10,7 @@ class TodoList{ // R047.1 to_do_list_pay_now(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_pay_now', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, @@ -21,7 +21,7 @@ class TodoList{ // R047.2 to_do_list_more_details(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_more_details', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, @@ -32,7 +32,7 @@ class TodoList{ // R048 to_do_list_confirm_payment_details(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_confirm_payment_details', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, @@ -43,7 +43,7 @@ class TodoList{ // R048 to_do_list_cancel_payment_details(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_cancel_payment_details', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, @@ -56,7 +56,7 @@ class TodoList{ // R049.2 to_do_list_cancel_appointment(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_cancel_appointment', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, @@ -67,7 +67,7 @@ class TodoList{ // R049.3 to_do_list_confirm_appointment(AppoitmentAllHistoryResultList appointment){ logger('confirm_appointment', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular', 'flow_type' : 'todo list', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, @@ -79,7 +79,7 @@ class TodoList{ // R050 to_do_list_check_in(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_check_in', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, @@ -90,7 +90,7 @@ class TodoList{ // R051 to_do_list_nfc(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_nfc', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment! ? 'livecare' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, @@ -101,7 +101,7 @@ class TodoList{ // R052 to_do_list_nfc_cancel(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_nfc_cancel', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment != null ? appointment.isLiveCareAppointment ? 'livecare' : 'regular' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment != null ? appointment.isLiveCareAppointment! ? 'livecare' : 'regular' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, diff --git a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart index 864dcaa7..23ee31c0 100644 --- a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart @@ -108,7 +108,7 @@ class H2OViewModel extends BaseViewModel { minValue = -1; } return [ - new charts.Series( + new charts.series( id: 'Global Revenue', domainFn: (ChartSeries sales, _) => sales.y, measureFn: (ChartSeries sales, _) => sales.x, diff --git a/lib/core/viewModels/qr_view_model.dart b/lib/core/viewModels/qr_view_model.dart index c62634ab..7d952820 100644 --- a/lib/core/viewModels/qr_view_model.dart +++ b/lib/core/viewModels/qr_view_model.dart @@ -47,8 +47,11 @@ class QrViewModel extends BaseViewModel { return (await BarcodeScanner.scan()).rawContent; } else { if (Platform.isAndroid) { - Utils.showPermissionConsentDialog(AppGlobal.context, TranslationBase.of(AppGlobal.context).cameraPermissionDialog, () async { - return (await BarcodeScanner.scan()).rawContent; + Utils.showPermissionConsentDialog(AppGlobal.context, TranslationBase.of(AppGlobal.context).cameraPermissionDialog, () async { + await BarcodeScanner.scan().then((value) { + return value.rawContent; + //Chnanges by Aamir + }); }); } else { return (await BarcodeScanner.scan()).rawContent; diff --git a/lib/main.dart b/lib/main.dart index 36e86ed9..e8f17f0f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -81,7 +81,7 @@ class _MyApp extends State { PlatformBridge.init(context); LocalNotification.init(onNotificationClick: (payload) { - LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); + LocalNotification.getInstance()!.showNow(title: "Payload", subtitle: payload, payload: payload); }); // SystemChrome.setPreferredOrientations([ diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart index 7cd1eaea..d0dd1094 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -35,7 +35,7 @@ class CMCLocationPage extends StatefulWidget { final double longitude; final dynamic model; - const CMCLocationPage({ Key? key, required this.onPick, required this.latitude, required this.longitude, this.model}) : super(key: key); + const CMCLocationPage({Key? key, required this.onPick, required this.latitude, required this.longitude, this.model}) : super(key: key); @override _CMCLocationPageState createState() => _CMCLocationPageState(); @@ -65,8 +65,8 @@ class _CMCLocationPageState extends State { appMap = AppMap( _kGooglePlex.toMap() as Map, // changed by Aamir - onCameraMove: (cam) { - _updatePosition(cam as gmaps.CameraPosition); + onCameraMove: () { + _updatePosition(_kGooglePlex); // changed by Aamir Huawei & Google Issue may Be }, onMapCreated: () { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 70a6433a..d75aecaa 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -97,10 +97,10 @@ class _NewCMCStepTowPageState extends State { appMap = AppMap( cameraPosition.toMap() as Map, // Changed by Aamir - onCameraMove: (camera) { - setState(() {}); + onCameraMove: () { + // setState(() {}); // Changed by Aamir - _updatePosition(camera as gmaps.CameraPosition); + _updatePosition(cameraPosition); }, onMapCreated: () { print("_getUserLocation"); diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 37f8660c..372a1861 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -24,7 +24,7 @@ import '../DoctorProfile.dart'; class DoctorView extends StatelessWidget { final DoctorList doctor; - bool isLiveCareAppointment; + bool? isLiveCareAppointment; bool isObGyneAppointment; bool isShowFlag; bool isDoctorNameSearch; @@ -33,7 +33,7 @@ class DoctorView extends StatelessWidget { DoctorView( {required this.doctor, - required this.isLiveCareAppointment, + this.isLiveCareAppointment, this.isObGyneAppointment = false, this.isDoctorNameSearch = false, this.isShowFlag = true, @@ -263,7 +263,7 @@ class DoctorView extends StatelessWidget { FadePage( page: DoctorProfile( doctor: docObject, - isLiveCareAppointment: isLiveCareAppointment, + isLiveCareAppointment: isLiveCareAppointment!, docProfileList: docProfile, isOpenAppt: isAppo, isDoctorNameSearch: isDoctorNameSearch, diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 9e555d9d..d19a16db 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -17,9 +17,9 @@ import '../base/base_view.dart'; import 'insurance_approval_detail_screen.dart'; class InsuranceApproval extends StatefulWidget { - int appointmentNo; + int? appointmentNo; - InsuranceApproval({required this.appointmentNo}); + InsuranceApproval({ this.appointmentNo}); @override _InsuranceApprovalState createState() => _InsuranceApprovalState(); diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 2a96b2d4..0bdca4a8 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -19,9 +19,9 @@ import 'package:flutter/material.dart'; import '../base/base_view.dart'; class InsuranceCard extends StatefulWidget { - int appointmentNo; + int? appointmentNo; - InsuranceCard({required this.appointmentNo}); + InsuranceCard({ this.appointmentNo}); @override _InsuranceCardState createState() => _InsuranceCardState(); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index a6cd128f..0ed24c82 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -469,9 +469,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { child: AppBar( elevation: 0, backgroundColor: CustomColors.backgroudGreyColor, - textTheme: TextTheme( - headline6: TextStyle(color: Theme.of(context).textTheme.headline1!.color, fontWeight: FontWeight.bold), - ), + //Changed By Aamir + // textTheme: TextTheme( + // headline6: TextStyle(color: Theme.of(context).textTheme.headline1!.color, fontWeight: FontWeight.bold), + // ), title: Text( getText(currentTab).toUpperCase(), style: TextStyle( diff --git a/lib/pages/livecare/clinic_timings_page.dart b/lib/pages/livecare/clinic_timings_page.dart index cd1652f2..781dfbe3 100644 --- a/lib/pages/livecare/clinic_timings_page.dart +++ b/lib/pages/livecare/clinic_timings_page.dart @@ -15,14 +15,14 @@ class ClinicTimingsPage extends StatefulWidget { final clinicName; final List patientERGetClinicsServiceTimingsList; - ClinicTimingsPage({@required this.clinicName, @required this.patientERGetClinicsServiceTimingsList}); + ClinicTimingsPage({required this.clinicName, required this.patientERGetClinicsServiceTimingsList}); @override _LiveCarePatmentPageState createState() => _LiveCarePatmentPageState(); } class _LiveCarePatmentPageState extends State { - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -80,7 +80,7 @@ class _LiveCarePatmentPageState extends State { Expanded( flex: 2, child: Text( - item.dayOfWeekStr, + item.dayOfWeekStr!, style: TextStyle( fontSize: 18, letterSpacing: -0.72, @@ -98,9 +98,9 @@ class _LiveCarePatmentPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - for (int i = 0; i < item.shiftTimings.length; i++) + for (int i = 0; i < item.shiftTimings!.length; i++) Text( - TranslationBase.of(context).from + " " + item.shiftTimings[i].startTime + " " + TranslationBase.of(context).to + " " + item.shiftTimings[i].endTime, + TranslationBase.of(context).from + " " + item.shiftTimings![i].startTime! + " " + TranslationBase.of(context).to + " " + item.shiftTimings![i].endTime!, style: TextStyle( fontSize: 13, letterSpacing: -0.42, diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index 7cea1153..7983e529 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -20,19 +20,19 @@ import '../../config/config.dart'; class IncomingCall extends StatefulWidget { IncomingCallData incomingCallData; - IncomingCall({@required this.incomingCallData}); + IncomingCall({required this.incomingCallData}); @override _IncomingCallState createState() => _IncomingCallState(); } class _IncomingCallState extends State with SingleTickerProviderStateMixin { - AnimationController _animationController; + late AnimationController _animationController; bool openCallInWeb = true; final player = AudioPlayer(); - CameraController _controller; - Future _initializeControllerFuture; + late CameraController _controller; + late Future _initializeControllerFuture; bool isCameraReady = false; // Signaling signaling = Signaling()..init(); @@ -74,7 +74,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt // child: new BackdropFilter( // filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), child: new Container( - decoration: new BoxDecoration(color: Colors.grey[800].withOpacity(0.8)), + decoration: new BoxDecoration(color: Colors.grey[800]!.withOpacity(0.8)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, @@ -96,7 +96,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Text( - widget.incomingCallData.doctorname, + widget.incomingCallData.doctorname!, style: TextStyle(fontSize: 21, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: -1.26, height: 23 / 12), ), Text( @@ -128,14 +128,14 @@ class _IncomingCallState extends State with SingleTickerProviderSt Container( padding: const EdgeInsets.only(left: 16.0, right: 16.0), child: Text( - widget.incomingCallData.appointmentdate + ", " + widget.incomingCallData.appointmenttime, + widget.incomingCallData.appointmentdate! + ", " + widget.incomingCallData.appointmenttime!, style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600), ), ), Container( padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 21.0), child: Text( - widget.incomingCallData.clinicname, + widget.incomingCallData.clinicname!, style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600), ), ), @@ -232,8 +232,8 @@ class _IncomingCallState extends State with SingleTickerProviderSt // }else{ return OpenTokConnectCallPage( apiKey: OPENTOK_API_KEY, - sessionId: widget.incomingCallData.sessionId, - token: widget.incomingCallData.token + sessionId: widget.incomingCallData.sessionId!, + token: widget.incomingCallData.token! ); // } @@ -247,14 +247,14 @@ class _IncomingCallState extends State with SingleTickerProviderSt } catch (err) { print(err); await PlatformExceptionAlertDialog( - exception: err, + exception: Exception(err), ).show(context); } } void changeCallStatusAPI(int sessionStatus) { LiveCareService service = new LiveCareService(); - service.endCallAPI(widget.incomingCallData.sessionId, sessionStatus, context).then((res) { + service.endCallAPI(widget.incomingCallData.sessionId!, sessionStatus, context).then((res) { }).catchError((err) { print(err); }); diff --git a/lib/pages/livecare/live_care_payment_page.dart b/lib/pages/livecare/live_care_payment_page.dart index 78627450..cbca8e58 100644 --- a/lib/pages/livecare/live_care_payment_page.dart +++ b/lib/pages/livecare/live_care_payment_page.dart @@ -26,7 +26,7 @@ class LiveCarePatmentPage extends StatefulWidget { bool isPharmaLiveCare; String pharmaLiveCareClientID; - LiveCarePatmentPage({@required this.getERAppointmentFeesList, @required this.waitingTime, @required this.clinicName, this.isPharmaLiveCare = false, this.pharmaLiveCareClientID = ""}); + LiveCarePatmentPage({required this.getERAppointmentFeesList, required this.waitingTime, required this.clinicName, this.isPharmaLiveCare = false, this.pharmaLiveCareClientID = ""}); @override _LiveCarePatmentPageState createState() => _LiveCarePatmentPageState(); @@ -35,8 +35,8 @@ class LiveCarePatmentPage extends StatefulWidget { class _LiveCarePatmentPageState extends State { int _selected = 0; - ProjectViewModel projectViewModel; - LocationUtils locationUtils; + late ProjectViewModel projectViewModel; + late LocationUtils locationUtils; @override Widget build(BuildContext context) { @@ -127,7 +127,7 @@ class _LiveCarePatmentPageState extends State { ), Expanded( child: Text( - widget.getERAppointmentFeesList.amount + " " + widget.getERAppointmentFeesList.currency, + widget.getERAppointmentFeesList.amount! + " " + widget.getERAppointmentFeesList.currency!, style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -155,7 +155,7 @@ class _LiveCarePatmentPageState extends State { ), Expanded( child: Text( - widget.getERAppointmentFeesList.tax + " " + widget.getERAppointmentFeesList.currency, + widget.getERAppointmentFeesList.tax! + " " + widget.getERAppointmentFeesList.currency!, style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -183,7 +183,7 @@ class _LiveCarePatmentPageState extends State { ), Expanded( child: Text( - widget.getERAppointmentFeesList.total + " " + widget.getERAppointmentFeesList.currency, + widget.getERAppointmentFeesList.total! + " " + widget.getERAppointmentFeesList.currency!, style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -229,7 +229,9 @@ class _LiveCarePatmentPageState extends State { Radio( value: 1, groupValue: _selected, - onChanged: onRadioChanged, + onChanged: (val) { + onRadioChanged(val!); + }, ), Text( TranslationBase.of(context).agreeTo, @@ -243,7 +245,9 @@ class _LiveCarePatmentPageState extends State { mWidth(4), InkWell( onTap: () { - launch("https://hmg.com/en/Pages/Privacy.aspx"); + launchUrl(Uri.parse( + "https://hmg.com/en/Pages/Privacy.aspx", + )); }, child: Text( TranslationBase.of(context).termsConditoins, @@ -304,7 +308,7 @@ class _LiveCarePatmentPageState extends State { askVideoCallPermission().then((value) async { if (value == true) { locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); - locationUtils.getCurrentLocation(callBack: (value) { + locationUtils.getCurrentLocation(callBack: (value) { print(value); }); if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) { @@ -341,9 +345,10 @@ class _LiveCarePatmentPageState extends State { } Future askVideoCallPermission() async { + bool result = false; if (Platform.isIOS) { if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted) || !(await Permission.location.request().isGranted)) { - return false; + result = false; } } else { await showDialog( @@ -357,12 +362,15 @@ class _LiveCarePatmentPageState extends State { !(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted) || !(await Permission.location.request().isGranted)) { - return false; + { + result = false; + } } }, )); } - return true; + result = true; + return result; // if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted) || !(await Permission.location.request().isGranted)) { // return false; // } @@ -415,7 +423,7 @@ class _LiveCarePatmentPageState extends State { }); } - void onRadioChanged(int value) { + onRadioChanged(int value) { setState(() { _selected = value; }); diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index e50f3bb3..4c14eeb2 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -20,24 +20,24 @@ class LiveCareHome extends StatefulWidget { final bool isPharmacyLiveCare; final String pharmacyLiveCareQRCode; - const LiveCareHome({Key key, this.isPharmacyLiveCare = false, this.pharmacyLiveCareQRCode = ""}) : super(key: key); + const LiveCareHome({Key? key, this.isPharmacyLiveCare = false, this.pharmacyLiveCareQRCode = ""}) : super(key: key); @override _LiveCareHomeState createState() => _LiveCareHomeState(); } class _LiveCareHomeState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; bool isDataLoaded = false; bool hasLiveCareRequest = false; List imagesInfo =[]; - List erRequestHistoryList; + late List erRequestHistoryList; - ErRequestHistoryList pendingERRequestHistoryList; + late ErRequestHistoryList pendingERRequestHistoryList; - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; AppSharedPreferences sharedPref = AppSharedPreferences(); @override @@ -157,11 +157,11 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt GifLoaderDialogUtils.hideDialog(context); setState(() { if (res['ErRequestHistoryList'].length != 0) { - patientERVirtualHistoryResponse = PatientERVirtualHistoryResponse.fromJson(res); - erRequestHistoryList = patientERVirtualHistoryResponse.erRequestHistoryList; + patientERVirtualHistoryResponse = PatientERVirtualHistoryResponse.fromJson(res as Map); + erRequestHistoryList = patientERVirtualHistoryResponse.erRequestHistoryList!; - if (patientERVirtualHistoryResponse.erRequestHistoryList[0].callStatus < 4) { - pendingERRequestHistoryList = patientERVirtualHistoryResponse.erRequestHistoryList[0]; + if (patientERVirtualHistoryResponse.erRequestHistoryList![0].callStatus! < 4) { + pendingERRequestHistoryList = patientERVirtualHistoryResponse.erRequestHistoryList![0]; hasLiveCareRequest = true; } else { hasLiveCareRequest = false; diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart index 6f6bf571..f3900c5e 100644 --- a/lib/pages/livecare/livecare_type_select.dart +++ b/lib/pages/livecare/livecare_type_select.dart @@ -22,7 +22,7 @@ class _LiveCareTypeSelectState extends State { var languageID; AppSharedPreferences sharedPref = AppSharedPreferences(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; String pharmacyLiveCareQRCode = ""; @override @@ -195,7 +195,10 @@ class _LiveCareTypeSelectState extends State { } readQRCode() async { - pharmacyLiveCareQRCode = (await BarcodeScanner.scan())?.rawContent; + //Changed By Aamir + pharmacyLiveCareQRCode = await BarcodeScanner.scan().then((value) { + return value.rawContent; + }); if (pharmacyLiveCareQRCode != "") { GifLoaderDialogUtils.showMyDialog(context); LiveCareService service = new LiveCareService(); diff --git a/lib/pages/livecare/pharma_livecare_intro_page.dart b/lib/pages/livecare/pharma_livecare_intro_page.dart index 56890c32..c7120c08 100644 --- a/lib/pages/livecare/pharma_livecare_intro_page.dart +++ b/lib/pages/livecare/pharma_livecare_intro_page.dart @@ -14,14 +14,14 @@ import 'package:provider/provider.dart'; import '../../uitl/utils.dart'; class PharmaLiveCareIntroPage extends StatefulWidget { - const PharmaLiveCareIntroPage({Key key}) : super(key: key); + const PharmaLiveCareIntroPage({Key? key}) : super(key: key); @override State createState() => _PharmaLiveCareIntroPageState(); } class _PharmaLiveCareIntroPageState extends State { - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; String pharmacyLiveCareQRCode = ""; @override @@ -186,7 +186,9 @@ class _PharmaLiveCareIntroPageState extends State { } readQRCode() async { - pharmacyLiveCareQRCode = (await BarcodeScanner.scan())?.rawContent; + pharmacyLiveCareQRCode = await BarcodeScanner.scan().then((value) { + return value.rawContent; + }); if (pharmacyLiveCareQRCode != "") { GifLoaderDialogUtils.showMyDialog(context); LiveCareService service = new LiveCareService(); diff --git a/lib/pages/livecare/video-call-web-page.dart b/lib/pages/livecare/video-call-web-page.dart index 9cc20020..46a29924 100644 --- a/lib/pages/livecare/video-call-web-page.dart +++ b/lib/pages/livecare/video-call-web-page.dart @@ -8,12 +8,12 @@ class VideoCallWebPage extends StatelessWidget{ final GlobalKey webViewKey = GlobalKey(); // InAppWebViewController webViewController; - InAppWebViewController controller; + InAppWebViewController? controller; - URLRequest request; + URLRequest? request; final String receiverId; final String callerId; - VideoCallWebPage({@required this.receiverId, @required this.callerId}){ + VideoCallWebPage({required this.receiverId, required this.callerId}){ request = URLRequest(url: Uri.parse("https://vcallapi.hmg.com/Mobileindex.html?username=$receiverId&doctorid=$callerId")); } @@ -92,18 +92,18 @@ class VideoCallWebPage extends StatelessWidget{ print(consoleMessage); } - onError(InAppWebViewController controller, Uri url, int code, String message) { + onError(InAppWebViewController? controller, Uri? url, int code, String message) { } - onLoadStart(InAppWebViewController controller, Uri url) { + onLoadStart(InAppWebViewController? controller, Uri? url) { print(url); if(url.toString().toLowerCase().contains("endcallpage")){ LandingPage.isOpenCallPage = false; if(LandingPage.isOpenCallPage == true) { print("END CALL!!!"); // controller.goBack(); - Navigator.pop(webViewKey.currentContext); + Navigator.pop(webViewKey.currentContext!); } } } @@ -114,7 +114,7 @@ class VideoCallWebPage extends StatelessWidget{ // Navigator.pop(webViewKey.currentContext); // } if(uri.toString().toLowerCase().contains("endcallpage")){ - Navigator.pop(webViewKey.currentContext); + Navigator.pop(webViewKey.currentContext!); } return NavigationActionPolicy.ALLOW; diff --git a/lib/pages/livecare/widgets/ClinicTimingsDialog.dart b/lib/pages/livecare/widgets/ClinicTimingsDialog.dart index df0a5286..5f827fad 100644 --- a/lib/pages/livecare/widgets/ClinicTimingsDialog.dart +++ b/lib/pages/livecare/widgets/ClinicTimingsDialog.dart @@ -4,12 +4,9 @@ import 'package:flutter/material.dart'; class ClinicTimingsDialog extends StatefulWidget { final clinicName; - final List - patientERGetClinicsServiceTimingsList; + final List patientERGetClinicsServiceTimingsList; - ClinicTimingsDialog( - {@required this.clinicName, - @required this.patientERGetClinicsServiceTimingsList}); + ClinicTimingsDialog({required this.clinicName, required this.patientERGetClinicsServiceTimingsList}); @override _ClinicTimingsDialogState createState() => _ClinicTimingsDialogState(); @@ -29,8 +26,7 @@ class _ClinicTimingsDialogState extends State { final double itemWidth = size.width / 2; return Container( child: Dialog( - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( height: 580.0, margin: EdgeInsets.all(20.0), @@ -42,10 +38,7 @@ class _ClinicTimingsDialogState extends State { Container( alignment: Alignment.center, margin: EdgeInsets.only(bottom: 10.0), - child: Text(TranslationBase.of(context).clinicSchedule, - textAlign: TextAlign.center, - style: - TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).clinicSchedule, textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), ), Divider( thickness: 1.0, @@ -53,9 +46,7 @@ class _ClinicTimingsDialogState extends State { ), Container( margin: EdgeInsets.only(bottom: 20.0, top: 10.0), - child: Text(widget.clinicName, - style: - TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + child: Text(widget.clinicName, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), ), CustomScrollView( primary: false, @@ -72,10 +63,8 @@ class _ClinicTimingsDialogState extends State { height: 10.0, child: Column( children: [ - Text(e.dayOfWeekStr), - Text(e.shiftTimings[0].startTime + - " - " + - e.shiftTimings[0].endTime), + Text(e.dayOfWeekStr!), + Text(e.shiftTimings![0].startTime! + " - " + e.shiftTimings![0].endTime!), ], ), )) diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index cf89b766..61b6f64f 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -20,8 +20,8 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class LiveCareHistoryCard extends StatefulWidget { - ErRequestHistoryList erRequestHistoryList; - int isFirstOrLast; + ErRequestHistoryList? erRequestHistoryList; + int? isFirstOrLast; LiveCareHistoryCard({this.erRequestHistoryList, this.isFirstOrLast}); @@ -33,7 +33,7 @@ class _LiveCareHistoryCardState extends State { AuthenticatedUser authUser = new AuthenticatedUser(); AppSharedPreferences sharedPref = AppSharedPreferences(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override void initState() { @@ -77,7 +77,7 @@ class _LiveCareHistoryCardState extends State { mainAxisSize: MainAxisSize.min, children: [ Text( - widget.erRequestHistoryList.stringCallStatus , + widget.erRequestHistoryList!.stringCallStatus! , style: TextStyle( fontSize: 10.0, fontWeight: FontWeight.w600, @@ -88,7 +88,7 @@ class _LiveCareHistoryCardState extends State { ), mHeight(12), Text( - TranslationBase.of(context).requestedDate + ": " + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.erRequestHistoryList.arrivalTime)), + TranslationBase.of(context).requestedDate + ": " + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.erRequestHistoryList!.arrivalTime!)), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.w600, @@ -103,7 +103,7 @@ class _LiveCareHistoryCardState extends State { style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, letterSpacing: -0.4, color: CustomColors.textColor), ), Text( - getCallTime(widget.erRequestHistoryList.callDuration), + getCallTime(widget.erRequestHistoryList!.callDuration!), textAlign: TextAlign.center, style: TextStyle( fontSize: 12.0, @@ -215,7 +215,7 @@ class _LiveCareHistoryCardState extends State { } rateLiveCareAppo() { - if (widget.erRequestHistoryList.isAppointmentHaveRating) { + if (widget.erRequestHistoryList!.isAppointmentHaveRating!) { AppToast.showErrorToast(message: TranslationBase.of(context).alreadyRated); } else {} } @@ -224,7 +224,7 @@ class _LiveCareHistoryCardState extends State { showDialog( context: context, builder: (cxt) => ConfirmSendEmailDialog( - email: projectViewModel.user.emailAddress, + email: projectViewModel.user!.emailAddress, onTapSendEmail: () { sendInvoiceEmail(context); }, @@ -239,7 +239,7 @@ class _LiveCareHistoryCardState extends State { sendInvoiceEmail(context) { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.sendLiveCareInvoiceEmail(widget.erRequestHistoryList.appointmentNo.toString(), widget.erRequestHistoryList.projectID, authUser.emailAddress, context).then((res) { + service.sendLiveCareInvoiceEmail(widget.erRequestHistoryList!.appointmentNo.toString(), widget.erRequestHistoryList!.projectID!, authUser.emailAddress!, context).then((res) { GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully); }).catchError((err) { diff --git a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart index 1e2eaa1b..de3cb248 100644 --- a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart +++ b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart @@ -11,10 +11,7 @@ class LiveCarePaymentDialog extends StatefulWidget { int waitingTime; String clinicName; - LiveCarePaymentDialog( - {@required this.getERAppointmentFeesList, - @required this.waitingTime, - @required this.clinicName}); + LiveCarePaymentDialog({required this.getERAppointmentFeesList, required this.waitingTime, required this.clinicName}); @override _LiveCarePaymentDialogState createState() => _LiveCarePaymentDialogState(); @@ -23,7 +20,7 @@ class LiveCarePaymentDialog extends StatefulWidget { class _LiveCarePaymentDialogState extends State { int _selected = 0; - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -34,8 +31,7 @@ class _LiveCarePaymentDialogState extends State { return Container( child: Dialog( - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( height: 600.0, margin: EdgeInsets.all(20.0), @@ -49,10 +45,7 @@ class _LiveCarePaymentDialogState extends State { Container( alignment: Alignment.center, margin: EdgeInsets.only(bottom: 10.0), - child: Text(TranslationBase.of(context).onlineConsultation, - textAlign: TextAlign.center, - style: - TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).onlineConsultation, textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), ), Divider( thickness: 1.0, @@ -62,31 +55,22 @@ class _LiveCarePaymentDialogState extends State { direction: Axis.horizontal, children: [ Expanded( - child: Text(TranslationBase.of(context).expectedWaiting, - textAlign: TextAlign.end, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).expectedWaiting, textAlign: TextAlign.end, style: TextStyle(fontSize: 13.0)), ), Expanded( child: Container( - child: Icon(Icons.access_time, - size: 36.0, color: Colors.red[800]), + child: Icon(Icons.access_time, size: 36.0, color: Colors.red[800]), ), ), Expanded( child: Text(widget.waitingTime.toString() + " " + TranslationBase.of(context).minute, - textAlign: TextAlign.start, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, - color: Colors.red[900])), + textAlign: TextAlign.start, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.red[900])), ), ], ), Container( margin: EdgeInsets.only(bottom: 10.0, top: 10.0), - child: Text(widget.clinicName, - style: - TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), + child: Text(widget.clinicName, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), ), Container( width: MediaQuery.of(context).size.width, @@ -100,12 +84,7 @@ class _LiveCarePaymentDialogState extends State { alignment: Alignment.center, margin: EdgeInsets.only(top: 5.0), padding: EdgeInsets.all(5.0), - child: Text(TranslationBase.of(context).erConsultFee, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold, - color: Colors.white)), + child: Text(TranslationBase.of(context).erConsultFee, textAlign: TextAlign.center, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.white)), ), Container( decoration: BoxDecoration( @@ -117,34 +96,16 @@ class _LiveCarePaymentDialogState extends State { child: Table( children: [ TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientShareToDo)), - TableCell( - child: _getNormalText( - widget.getERAppointmentFeesList.amount + - " " + - widget.getERAppointmentFeesList.currency)), + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)), + TableCell(child: _getNormalText(widget.getERAppointmentFeesList.amount! + " " + widget.getERAppointmentFeesList.currency!)), ]), TableRow(children: [ - TableCell( - child: _getNormalText( - TranslationBase.of(context).patientTaxToDo)), - TableCell( - child: _getNormalText( - widget.getERAppointmentFeesList.tax + - " " + - widget.getERAppointmentFeesList.currency)), + TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)), + TableCell(child: _getNormalText(widget.getERAppointmentFeesList.tax! + " " + widget.getERAppointmentFeesList.currency!)), ]), TableRow(children: [ - TableCell( - child: _getMarginText(TranslationBase.of(context) - .patientShareTotalToDo)), - TableCell( - child: _getMarginText( - widget.getERAppointmentFeesList.total + - " " + - widget.getERAppointmentFeesList.currency)), + TableCell(child: _getMarginText(TranslationBase.of(context).patientShareTotalToDo)), + TableCell(child: _getMarginText(widget.getERAppointmentFeesList.total! + " " + widget.getERAppointmentFeesList.currency!)), ]), ], ), @@ -155,7 +116,7 @@ class _LiveCarePaymentDialogState extends State { borderRadius: new BorderRadius.all( const Radius.circular(5.0), ), - color: Colors.green[200].withOpacity(0.5)), + color: Colors.green[200]!.withOpacity(0.5)), margin: EdgeInsets.only(top: 20.0), child: Row( children: [ @@ -163,8 +124,7 @@ class _LiveCarePaymentDialogState extends State { Container( margin: EdgeInsets.only(left: 10.0, right: 10.0), width: MediaQuery.of(context).size.width * 0.55, - child: Text(TranslationBase.of(context).insuredPatient, - style: TextStyle(fontSize: 13.0)), + child: Text(TranslationBase.of(context).insuredPatient, style: TextStyle(fontSize: 13.0)), ), ], ), @@ -177,7 +137,9 @@ class _LiveCarePaymentDialogState extends State { child: new Radio( value: 1, groupValue: _selected, - onChanged: onRadioChanged, + onChanged:(val){ + onRadioChanged(val!); + }, ), ), Container( @@ -217,10 +179,7 @@ class _LiveCarePaymentDialogState extends State { Navigator.pop(context, false); }, child: Container( - child: Text(TranslationBase.of(context).cancel, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 18.0, color: Colors.red[700])), + child: Text(TranslationBase.of(context).cancel, textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0, color: Colors.red[700])), ), ), ), @@ -228,9 +187,7 @@ class _LiveCarePaymentDialogState extends State { child: InkWell( onTap: () { if (_selected == 0) { - AppToast.showErrorToast( - message: TranslationBase.of(context) - .pleaseAcceptTerms); + AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); } else { Navigator.pop(context, true); } @@ -254,7 +211,7 @@ class _LiveCarePaymentDialogState extends State { ); } - void onRadioChanged(int value) { + onRadioChanged(int value) { setState(() { _selected = value; }); @@ -263,25 +220,14 @@ class _LiveCarePaymentDialogState extends State { _getNormalText(text) { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0), - child: Text(text, - textAlign: TextAlign.start, - style: TextStyle( - fontSize: 14, - letterSpacing: 0.5, - color: Colors.black)), + child: Text(text, textAlign: TextAlign.start, style: TextStyle(fontSize: 14, letterSpacing: 0.5, color: Colors.black)), ); } _getMarginText(text) { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0, bottom: 10.0), - child: Text(text, - textAlign: TextAlign.start, - style: TextStyle( - fontSize: 14, - letterSpacing: 0.5, - fontWeight: FontWeight.bold, - color: Colors.black)), + child: Text(text, textAlign: TextAlign.start, style: TextStyle(fontSize: 14, letterSpacing: 0.5, fontWeight: FontWeight.bold, color: Colors.black)), ); } } diff --git a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart index a5392c8d..9eb5b9f9 100644 --- a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart +++ b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart @@ -15,10 +15,10 @@ import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class LiveCarePendingRequest extends StatefulWidget { - ErRequestHistoryList pendingERRequestHistoryList; + ErRequestHistoryList? pendingERRequestHistoryList; final Function getLiveCareHistory; - LiveCarePendingRequest({@required this.getLiveCareHistory, this.pendingERRequestHistoryList}); + LiveCarePendingRequest({required this.getLiveCareHistory, this.pendingERRequestHistoryList}); @override _LiveCarePendingRequestState createState() => _LiveCarePendingRequestState(); @@ -56,7 +56,7 @@ class _LiveCarePendingRequestState extends State { transform: Matrix4.translationValues(0.0, -10.0, 0.0), alignment: Alignment.center, child: CircularCountDownTimer( - duration: widget.pendingERRequestHistoryList.watingtimeInteger * 60, + duration: widget.pendingERRequestHistoryList!.watingtimeInteger! * 60, width: MediaQuery.of(context).size.width / 2, height: MediaQuery.of(context).size.height / 2, ringColor: Colors.white, @@ -84,16 +84,16 @@ class _LiveCarePendingRequestState extends State { Container( decoration: cardRadius(15.0, color: Color(0xffCC9B14)), padding: const EdgeInsets.all(5.0), - child: Text(widget.pendingERRequestHistoryList.stringCallStatus, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4)), + child: Text(widget.pendingERRequestHistoryList!.stringCallStatus!, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4)), ), Container( padding: const EdgeInsets.all(5.0), child: MyRichText(TranslationBase.of(context).requestedDateLiveCare, - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.pendingERRequestHistoryList.arrivalTime)), projectViewModel.isArabic), + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.pendingERRequestHistoryList!.arrivalTime!)), projectViewModel.isArabic), ), Container( padding: const EdgeInsets.all(5.0), - child: Text(TranslationBase.of(context).yourTurn + " " + widget.pendingERRequestHistoryList.patCount.toString() + " " + TranslationBase.of(context).patients, + child: Text(TranslationBase.of(context).yourTurn + " " + widget.pendingERRequestHistoryList!.patCount.toString() + " " + TranslationBase.of(context).patients, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.48)), ), // Row( @@ -131,7 +131,7 @@ class _LiveCarePendingRequestState extends State { cancelLiveCareRequest() { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.cancelLiveCareRequest(widget.pendingERRequestHistoryList.vCID, context).then((res) { + service.cancelLiveCareRequest(widget.pendingERRequestHistoryList!.vCID!, context).then((res) { GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: "LiveCare request cancelled successfully"); widget.getLiveCareHistory(); diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index d6fb745a..8aa0280a 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -18,12 +18,12 @@ import 'ClinicTimingsDialog.dart'; // ignore: must_be_immutable class ClinicCard extends StatefulWidget { - bool isSelected; + bool? isSelected; final PatientERGetClinicsList patientERGetClinicsList; var languageID; - int isOnline; + int? isOnline; - ClinicCard({this.isSelected, this.languageID, this.isOnline, @required this.patientERGetClinicsList}){ + ClinicCard({this.isSelected, this.languageID, this.isOnline, required this.patientERGetClinicsList}){ } @@ -32,7 +32,7 @@ class ClinicCard extends StatefulWidget { } class _State extends State { - ClinicsServiceTimingsResponse clinicsServiceTimingsResponse; + late ClinicsServiceTimingsResponse clinicsServiceTimingsResponse; @override void initState() { @@ -51,7 +51,7 @@ class _State extends State { borderRadius: BorderRadius.all( Radius.circular(10.0), ), - border: Border.all(width: widget.isSelected ? 3 : 0, color: widget.isSelected ? CustomColors.green : Colors.transparent), + border: Border.all(width: widget.isSelected! ? 3 : 0, color: widget.isSelected! ? CustomColors.green : Colors.transparent), boxShadow: [ BoxShadow( color: Color(0xff000000).withOpacity(.05), @@ -72,10 +72,10 @@ class _State extends State { margin: EdgeInsets.only( left: projectViewModel.isArabic ? 0 - : widget.isSelected + : widget.isSelected! ? 4 : 6, - right: projectViewModel.isArabic ? widget.isSelected + right: projectViewModel.isArabic ? widget.isSelected! ? 4 : 6: 0), padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12), @@ -96,7 +96,7 @@ class _State extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - widget.languageID == 'ar' ? widget.patientERGetClinicsList.serviceNameN : widget.patientERGetClinicsList.serviceName, + widget.languageID == 'ar' ? widget.patientERGetClinicsList.serviceNameN! : widget.patientERGetClinicsList.serviceName!, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -166,16 +166,16 @@ class _State extends State { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, context).then((res) { + service.getLivecareClinicTiming(patientERGetClinicsList.serviceID!, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { - clinicsServiceTimingsResponse = ClinicsServiceTimingsResponse.fromJson(res); - print(clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList.length); + clinicsServiceTimingsResponse = ClinicsServiceTimingsResponse.fromJson(res as Map); + print(clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList!.length); navigateTo(context, ClinicTimingsPage( clinicName: patientERGetClinicsList.serviceName, - patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList, + patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList!, )); // showGeneralDialog( // barrierColor: Colors.black.withOpacity(0.5), @@ -206,6 +206,6 @@ class _State extends State { print(err); }); - locator().liveCare.livecare_clinic_schedule(clinic: patientERGetClinicsList.serviceName); + locator().liveCare.livecare_clinic_schedule(clinic: patientERGetClinicsList.serviceName!); } } diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 9dc9421d..5e2097d4 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -43,7 +43,7 @@ class ClinicList extends StatefulWidget { bool isPharmacyLiveCare; String pharmacyLiveCareQRCode; - ClinicList({@required this.getLiveCareHistory, this.isPharmacyLiveCare = false, this.pharmacyLiveCareQRCode = ""}); + ClinicList({required this.getLiveCareHistory, this.isPharmacyLiveCare = false, this.pharmacyLiveCareQRCode = ""}); @override _clinic_listState createState() => _clinic_listState(); @@ -51,44 +51,44 @@ class ClinicList extends StatefulWidget { class _clinic_listState extends State { int currentSelectedIndex = 0; - LiveCareClinicsListResponse liveCareClinicsListResponse; + late LiveCareClinicsListResponse liveCareClinicsListResponse; - List liveCareOnlineClinicsListResponse; - List liveCareOfflineClinicsListResponse; + late List liveCareOnlineClinicsListResponse; + late List liveCareOfflineClinicsListResponse; - LiveCareScheduleClinicsListResponse liveCareScheduleClinicsListResponse; + late LiveCareScheduleClinicsListResponse liveCareScheduleClinicsListResponse; bool isDataLoaded = false; var languageID; var currentSelectedLiveCareType; - int selectedClinicID; + late int selectedClinicID; String selectedClinicName = "-"; AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; + late AuthenticatedUser authUser; AuthProvider authProvider = new AuthProvider(); - MyInAppBrowser browser; + late MyInAppBrowser browser; - String liveCareClinicIDs; + late String liveCareClinicIDs; - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; String selectedPaymentMethod = ""; String amount = ""; - String tamaraPaymentStatus; - String tamaraOrderID; - String selectedInstallmentPlan; + late String tamaraPaymentStatus; + late String tamaraOrderID; + late String selectedInstallmentPlan; @override void initState() { liveCareClinicsListResponse = new LiveCareClinicsListResponse(); - liveCareOnlineClinicsListResponse = new[]; - liveCareOfflineClinicsListResponse = new[]; + liveCareOnlineClinicsListResponse = []; + liveCareOfflineClinicsListResponse = []; liveCareScheduleClinicsListResponse = new LiveCareScheduleClinicsListResponse(); @@ -126,10 +126,10 @@ class _clinic_listState extends State { isError = true; showLiveCareCancelDialog(res['ErrorEndUserMessage'], res); } else { - erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res); + erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res as Map); isError = false; } - if (!isError) getERAppointmentTime(erAppointmentFeesResponse.getERAppointmentFeesList); + if (!isError) getERAppointmentTime(erAppointmentFeesResponse.getERAppointmentFeesList!); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); @@ -208,7 +208,7 @@ class _clinic_listState extends State { (value) { if (value) { if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { - addNewCallForPatientER(projectViewModel.user.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); + addNewCallForPatientER(projectViewModel.user!.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); } else { navigateToPaymentMethod(getERAppointmentFeesList, context); } @@ -311,17 +311,17 @@ class _clinic_listState extends State { context, FadePage( page: PaymentMethod( - onSelectedMethod: (String metohd, [String selectedInstallmentPlan]) { + onSelectedMethod: (String metohd, [String? selectedInstallmentPlan]) { setState(() {}); }, - patientShare: num.parse(getERAppointmentFeesList.total), + patientShare: num.parse(getERAppointmentFeesList.total!), isFromAdvancePayment: widget.isPharmacyLiveCare, ))).then((value) { print(value); widget.isPharmacyLiveCare = isPharmacyLiveCare; widget.pharmacyLiveCareQRCode = pharmaLiveCareQRCodeValue; if (value != null) { - openPayment(value, authUser, num.parse(getERAppointmentFeesList.total), appo); + openPayment(value, authUser, num.parse(getERAppointmentFeesList.total!), appo); projectViewModel.analytics.liveCare.payment_method(appointment_type: 'livecare', clinic: selectedClinicName, payment_method: value[0], payment_type: 'appointment'); } }); @@ -337,12 +337,12 @@ class _clinic_listState extends State { browser.openPaymentBrowser( amount, "LiveCare Payment", - widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), + widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), "12", - authenticatedUser.emailAddress, + authenticatedUser.emailAddress!, paymentMethod[0], authenticatedUser.patientType, - authenticatedUser.firstName, + authenticatedUser.firstName!, authenticatedUser.patientID, authenticatedUser, browser, @@ -364,12 +364,12 @@ class _clinic_listState extends State { if (selectedPaymentMethod == "TAMARA") { if (Platform.isAndroid) { Uri uri = new Uri.dataFromString(url); - tamaraPaymentStatus = uri.queryParameters['status']; - tamaraOrderID = uri.queryParameters['AuthorizePaymentId']; + tamaraPaymentStatus = uri.queryParameters['status']!; + tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!; } else { Uri uri = new Uri.dataFromString(url); - tamaraPaymentStatus = uri.queryParameters['paymentStatus']; - tamaraOrderID = uri.queryParameters['orderId']; + tamaraPaymentStatus = uri.queryParameters['paymentStatus']!; + tamaraOrderID = uri.queryParameters['orderId']!; } } @@ -394,7 +394,7 @@ class _clinic_listState extends State { print("onBrowserExit Called!!!!"); try { if (selectedPaymentMethod == "TAMARA") { - checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo); + checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), appo); // if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { // updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallmentPlan), appo); // } else { @@ -415,10 +415,10 @@ class _clinic_listState extends State { service.getTamaraPaymentStatus(orderID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res["status"].toString().toLowerCase() == "success") { - updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID, num.parse(selectedInstallmentPlan), appo); + updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID, int.parse(selectedInstallmentPlan), appo); } else { updateTamaraRequestStatus( - "Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallmentPlan), appo); + "Failed", "00", Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), tamaraOrderID != null ? tamaraOrderID : "", int.parse(selectedInstallmentPlan), appo); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -428,14 +428,14 @@ class _clinic_listState extends State { } updateTamaraRequestStatus(String responseMessage, String status, String clientRequestID, String tamaraOrderID, int selectedInstallments, AppoitmentAllHistoryResultList appo) { - final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; + final currency = projectViewModel.user!.outSA == 0 ? "sar" : 'aed'; GifLoaderDialogUtils.showMyDialog(context); try { DoctorsListService service = new DoctorsListService(); service.updateTamaraRequestStatus(responseMessage, status, clientRequestID, tamaraOrderID, selectedInstallments).then((res) { GifLoaderDialogUtils.hideDialog(context); if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") { - addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo)); + addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!)); } else { AppToast.showErrorToast(message: res['Response_Message']); projectViewModel.analytics.liveCare.livecare_immediate_consultation_payment_failed( @@ -459,19 +459,19 @@ class _clinic_listState extends State { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { String amount; String payment_method; - final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; + final currency = projectViewModel.user!.outSA == 0 ? "sar" : 'aed'; DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); service .checkPaymentStatus( - widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), widget.isPharmacyLiveCare, context) + widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), widget.isPharmacyLiveCare, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); String paymentInfo = res['Response_Message']; amount = res['Amount'].toString(); payment_method = res['PaymentMethod']; if (paymentInfo == 'Success') { - addNewCallForPatientER(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo)); + addNewCallForPatientER(widget.isPharmacyLiveCare ? widget.pharmacyLiveCareQRCode : Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!)); } else { AppToast.showErrorToast(message: res['Response_Message']); projectViewModel.analytics.liveCare.livecare_immediate_consultation_payment_failed( @@ -517,9 +517,9 @@ class _clinic_listState extends State { if (res['MessageStatus'] == 1) { setState(() { liveCareOnlineClinicsListResponse.clear(); - liveCareClinicsListResponse = LiveCareClinicsListResponse.fromJson(res); + liveCareClinicsListResponse = LiveCareClinicsListResponse.fromJson(res as Map); - liveCareClinicsListResponse.patientERGetClinicsList.forEach((clinic) { + liveCareClinicsListResponse.patientERGetClinicsList!.forEach((clinic) { if (clinic.isOnline == 1) { liveCareOnlineClinicsListResponse.add(clinic); } else { @@ -530,8 +530,8 @@ class _clinic_listState extends State { selectedClinicID = int.parse(liveCareClinicIDs.split("-")[2]); selectedClinicName = liveCareClinicIDs.split("-")[0]; } else { - selectedClinicID = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceID; - selectedClinicName = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceName; + selectedClinicID = liveCareClinicsListResponse.patientERGetClinicsList![0].serviceID!; + selectedClinicName = liveCareClinicsListResponse.patientERGetClinicsList![0].serviceName!; } isDataLoaded = true; }); @@ -554,9 +554,9 @@ class _clinic_listState extends State { print(res['ClinicsHaveScheduleList'].length); if (res['MessageStatus'] == 1) { setState(() { - liveCareScheduleClinicsListResponse = LiveCareScheduleClinicsListResponse.fromJson(res); - selectedClinicID = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[0].serviceID; - selectedClinicName = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[0].clinicDesc; + liveCareScheduleClinicsListResponse = LiveCareScheduleClinicsListResponse.fromJson(res as Map); + selectedClinicID = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList![0].serviceID!; + selectedClinicName = liveCareScheduleClinicsListResponse.clinicsHaveScheduleList![0].clinicDesc!; isDataLoaded = true; }); } else { @@ -629,7 +629,7 @@ class _clinic_listState extends State { isDataLoaded ? Expanded( child: Container( - child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 + child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList!.length > 0 ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -639,15 +639,15 @@ class _clinic_listState extends State { shrinkWrap: true, physics: ScrollPhysics(), padding: EdgeInsets.all(0.0), - itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, + itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList!.length, itemBuilder: (context, index) { return InkWell( onTap: () { - updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); + updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList![index]); }, child: ScheduleClinicCard( - isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, - clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], + isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList![index].serviceID ? true : false, + clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList![index], languageID: languageID, ), ); @@ -778,7 +778,7 @@ class _clinic_listState extends State { .toList(); if (doctorByHospital.length != 0) { - _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); } else { _patientDoctorAppointmentListHospital .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); @@ -803,15 +803,15 @@ class _clinic_listState extends State { updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { setState(() { - selectedClinicID = patientERGetClinicsList.serviceID; - selectedClinicName = patientERGetClinicsList.serviceName; + selectedClinicID = patientERGetClinicsList.serviceID!; + selectedClinicName = patientERGetClinicsList.serviceName!; }); } updateSelectedScheduleIndex(ClinicsHaveScheduleList patientERGetClinicsList) { setState(() { - selectedClinicID = patientERGetClinicsList.serviceID; - selectedClinicName = patientERGetClinicsList.clinicDesc; + selectedClinicID = patientERGetClinicsList.serviceID!; + selectedClinicName = patientERGetClinicsList.clinicDesc!; }); } } diff --git a/lib/pages/livecare/widgets/livecare_logs.dart b/lib/pages/livecare/widgets/livecare_logs.dart index 8898faa6..92e1f0ab 100644 --- a/lib/pages/livecare/widgets/livecare_logs.dart +++ b/lib/pages/livecare/widgets/livecare_logs.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; class LiveCareLogs extends StatefulWidget { List erRequestHistoryList; - LiveCareLogs({@required this.erRequestHistoryList}); + LiveCareLogs({required this.erRequestHistoryList}); @override _LiveCareLogsState createState() => _LiveCareLogsState(); @@ -30,7 +30,7 @@ class _LiveCareLogsState extends State { padding: EdgeInsets.all(0.0), itemCount: widget.erRequestHistoryList.length, itemBuilder: (context, index) { - return widget.erRequestHistoryList[index].callStatus < 4 + return widget.erRequestHistoryList[index].callStatus! < 4 ? Container() : LiveCareHistoryCard( erRequestHistoryList: widget.erRequestHistoryList[index], diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 73012bd5..eaafa552 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -35,15 +35,16 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:intl/intl.dart'; -import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; +import 'package:local_auth_ios/local_auth_ios.dart'; class ConfirmLogin extends StatefulWidget { - final Function changePageViewIndex; + final Function? changePageViewIndex; final fromRegistration; - final bool isDubai; - const ConfirmLogin({Key key, this.changePageViewIndex, this.fromRegistration = false, this.isDubai =false}) : super(key: key); + final bool isDubai; + + const ConfirmLogin({Key? key, this.changePageViewIndex, this.fromRegistration = false, this.isDubai = false}) : super(key: key); @override _ConfirmLogin createState() => _ConfirmLogin(); @@ -53,12 +54,12 @@ class _ConfirmLogin extends State { final LocalAuthentication auth = LocalAuthentication(); var _availableBiometrics; var sharedPref = new AppSharedPreferences(); - bool authenticated; + late bool authenticated; final authService = new AuthProvider(); PharmacyModuleViewModel pharmacyModuleViewModel = locator(); - int mobileNumber; + late int mobileNumber; String errorMsg = ''; - SelectDeviceIMEIRES user; + late SelectDeviceIMEIRES user; bool isLoading = false; var registerd_data; bool isMoreOption = false; @@ -74,25 +75,25 @@ class _ConfirmLogin extends State { var lastLogin; - int selectedOption; + late int selectedOption; bool onlySMSBox = false; var userData; - static BuildContext _context; + late BuildContext _context; - static bool _loading; + late bool _loading; - int fingrePrintBefore; + late int fingrePrintBefore; AuthenticatedUserObject authenticatedUserObject = locator(); AppointmentRateViewModel appointmentRateViewModel = locator(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; - ToDoCountProviderModel toDoProvider; + late ToDoCountProviderModel toDoProvider; var dob; - int isHijri; + late int isHijri; var healthId; @override @@ -138,7 +139,7 @@ class _ConfirmLogin extends State { style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), ), Text( - user.name.toLowerCase().capitalizeFirstofEach, + user.name!.toLowerCase().capitalizeFirstofEach, style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44), ), SizedBox(height: 10), @@ -172,9 +173,9 @@ class _ConfirmLogin extends State { ), Text( user.editedOn != null - ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.editedOn)) + ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.editedOn!)) : user.createdOn != null - ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.createdOn)) + ? DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(user.createdOn!)) : '--', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), ), @@ -203,9 +204,9 @@ class _ConfirmLogin extends State { Expanded(child: SizedBox()), Text( user.editedOn != null - ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.editedOn), false) + ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.editedOn!), false) : user.createdOn != null - ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.createdOn), false) + ? DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(user.createdOn!), false) : '--', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.48), ), @@ -291,7 +292,7 @@ class _ConfirmLogin extends State { try { availableBiometrics = await auth.getAvailableBiometrics(); } on PlatformException catch (e) { - AppToast.showErrorToast(message: e.message); + AppToast.showErrorToast(message: e.message!); print(e); } if (!mounted) return; @@ -303,7 +304,7 @@ class _ConfirmLogin extends State { int login_method = 0; - authenticateUser(int type, {int isActive}) { + authenticateUser(int type, {int? isActive}) { GifLoaderDialogUtils.showMyDialog(context); if (type == 2 || type == 3) { fingrePrintBefore = type; @@ -320,10 +321,10 @@ class _ConfirmLogin extends State { this.loginWithSMS(type); break; case 2: - this.loginWithFingurePrintFace(type, isActive); + this.loginWithFingurePrintFace(type, isActive!); break; case 3: - this.loginWithFingurePrintFace(type, isActive); + this.loginWithFingurePrintFace(type, isActive!); break; case 4: this.loginWithSMS(type); @@ -386,9 +387,9 @@ class _ConfirmLogin extends State { request.sMSSignature = await SMSOTP.getSignature(); GifLoaderDialogUtils.showMyDialog(context); if (healthId != null || widget.isDubai) { - if(!widget.isDubai){ - request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); - } + if (!widget.isDubai) { + request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); + } request.healthId = healthId; request.isHijri = isHijri; await this.authService.sendActivationCodeRegister(request).then((result) { @@ -435,11 +436,17 @@ class _ConfirmLogin extends State { loginWithFingurePrintFace(type, int isActive) async { if (isActive == 1 || isActive == 0) { - const iosStrings = - const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'); - try { - authenticated = await auth.authenticateWithBiometrics(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings); + authenticated = await auth.authenticate( + localizedReason: 'Scan your fingerprint to authenticate', + options: AuthenticationOptions( + useErrorDialogs: true, + stickyAuth: true, + ), + authMessages: [ + IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please reenable your Touch ID'), + ], + ); } on PlatformException catch (e) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: 'Please enable your Touch or Face ID'); @@ -499,7 +506,7 @@ class _ConfirmLogin extends State { this.registerd_data = CheckPatientAuthenticationReq.fromJson(await sharedPref.getObject(REGISTER_DATA_FOR_LOGIIN)); } - this.mobileNumber = this.registerd_data != null ? this.registerd_data.patientMobileNumber : int.parse(this.user.mobile); + this.mobileNumber = this.registerd_data != null ? this.registerd_data.patientMobileNumber : int.parse(this.user.mobile!); this.zipCode = this.registerd_data != null ? this.registerd_data.zipCode : this.user.outSA == true @@ -568,7 +575,7 @@ class _ConfirmLogin extends State { var request = this.getCommonRequest().toJson(); dynamic res; if (healthId != null || widget.isDubai) { - if(!widget.isDubai) { + if (!widget.isDubai) { request['DOB'] = dob; } request['HealthId'] = healthId; @@ -580,11 +587,11 @@ class _ConfirmLogin extends State { res = result, if (result is Map) { - result = CheckActivationCode.fromJson(result), + result = CheckActivationCode.fromJson(result as Map), if (this.registerd_data != null && this.registerd_data.isRegister == true) { - // if(widget.isDubai ==false){ - widget.changePageViewIndex(1), + // if(widget.isDubai ==false){ + widget.changePageViewIndex!(1), Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)), } } @@ -614,10 +621,10 @@ class _ConfirmLogin extends State { res = result, if (result is Map) { - result = CheckActivationCode.fromJson(result), + result = CheckActivationCode.fromJson(result as Map), if (this.registerd_data != null && this.registerd_data.isRegister == true) { - widget.changePageViewIndex(1), + widget.changePageViewIndex!(1), Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)), } else @@ -732,7 +739,7 @@ class _ConfirmLogin extends State { }); } - Widget _loginOptionButton(String _title, String _icon, int _flag, int _loginIndex) { + Widget _loginOptionButton(String _title, String _icon, int _flag, int? _loginIndex) { bool isDisable = (_flag == 3 && !checkIfBiometricAvailable(BiometricType.face) || _flag == 2 && !checkIfBiometricAvailable(BiometricType.fingerprint)); return InkWell( onTap: isDisable @@ -812,7 +819,7 @@ class _ConfirmLogin extends State { Image.asset( 'assets/images/login/more_icon.png', height: 45, - width: SizeConfig.imageSizeMultiplier * 16, + width: SizeConfig.imageSizeMultiplier! * 16, ), projectViewModel.isArabic ? SizedBox( @@ -821,7 +828,7 @@ class _ConfirmLogin extends State { : SizedBox( height: 20, ), - Texts(TranslationBase.of(context).moreVerification, fontSize: SizeConfig.textMultiplier * 1.8, textAlign: TextAlign.center, color: Colors.black) + Texts(TranslationBase.of(context).moreVerification, fontSize: SizeConfig.textMultiplier! * 1.8, textAlign: TextAlign.center, color: Colors.black) ], ), ), diff --git a/lib/pages/login/forgot-password.dart b/lib/pages/login/forgot-password.dart index 10b3dc48..7207e602 100644 --- a/lib/pages/login/forgot-password.dart +++ b/lib/pages/login/forgot-password.dart @@ -23,7 +23,7 @@ class ForgotPassword extends StatefulWidget { class _ForgotPassword extends State { String selectedType = 'Saudi Arabia'; String countryCode = '966'; - final TextEditingController nationalIDorFile = null; + final TextEditingController nationalIDorFile = TextEditingController(); String mobileNo = ""; var con; @@ -100,14 +100,14 @@ class _ForgotPassword extends State { body: SingleChildScrollView( child: Container( padding: EdgeInsets.only(top: 10, left: 20, right: 20), - height: SizeConfig.realScreenHeight * .8, + height: SizeConfig.realScreenHeight! * .8, width: SizeConfig.realScreenWidth, child: Column(children: [ Expanded( flex: 1, child: AppText( TranslationBase.of(context).forgotDesc, - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, textAlign: TextAlign.start, marginTop: 10.0, )), diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index adcc4820..b8cf2a91 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -40,7 +40,7 @@ class _Login extends State { final nationalIDorFile = TextEditingController(); final mobileNumberController = TextEditingController(); int loginType = LoginType.loginType; - String mobileNo; + late String mobileNo; String countryCode = '966'; bool isButtonDisabled = true; final authService = new AuthProvider(); @@ -51,8 +51,8 @@ class _Login extends State { AuthenticatedUserObject authenticatedUserObject = locator(); - ProjectViewModel projectViewModel; - ToDoCountProviderModel toDoProvider; + late ProjectViewModel projectViewModel; + late ToDoCountProviderModel toDoProvider; var familyFileProvider = FamilyFilesProvider(); @@ -138,7 +138,7 @@ class _Login extends State { ); } - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false}) { return Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), alignment: Alignment.center, diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 1b81dbfb..d7ee12e8 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -34,10 +34,10 @@ import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; class RegisterInfo extends StatefulWidget { - final Function changePageViewIndex; + final Function? changePageViewIndex; final int page; - const RegisterInfo({Key key, this.changePageViewIndex, this.page = 1}) : super(key: key); + const RegisterInfo({Key? key, this.changePageViewIndex, this.page = 1}) : super(key: key); @override _RegisterInfo createState() => _RegisterInfo(); @@ -47,14 +47,14 @@ class _RegisterInfo extends State { final authService = new AuthProvider(); final sharedPref = new AppSharedPreferences(); RegisterInfoResponse registerInfo = RegisterInfoResponse(); - bool isLoading; - int page; + late bool isLoading; + late int page; final List locationList = [ new Location(name: 'KSA', value: '1', nameAr: "السعودية"), new Location(name: 'Dubai', value: '2', nameAr: "دبي"), ]; String language = '1'; - CheckPatientAuthenticationReq registerd_data; + late CheckPatientAuthenticationReq registerd_data; final List languageList = [ new Language(name: 'English', value: '2', nameAr: "إنجليزي"), new Language(name: 'Arabic', value: '1', nameAr: "عربي"), @@ -70,16 +70,16 @@ class _RegisterInfo extends State { ]; String email = ''; List countriesList = []; - ToDoCountProviderModel toDoProvider; + late ToDoCountProviderModel toDoProvider; String location = '1'; AuthenticatedUserObject authenticatedUserObject = locator(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; AppointmentRateViewModel appointmentRateViewModel = locator(); bool isDubai = false; RegisterInfoResponse data = RegisterInfoResponse(); - CheckPatientAuthenticationReq data2; + late CheckPatientAuthenticationReq data2; String gender = 'M'; String maritalStatus = 'M'; String nationality = 'SAU'; @@ -160,7 +160,7 @@ class _RegisterInfo extends State { elevation: 16, onChanged: (value) => { setState(() { - gender = value; + gender = value!; registerInfo.gender = value; }) }, @@ -168,7 +168,7 @@ class _RegisterInfo extends State { return DropdownMenuItem( value: value.value, child: Text( - projectViewModel.isArabic == 1 ? value.nameAr : value.name, + projectViewModel.isArabic == 1 ? value.nameAr! : value.name!, ), ); }).toList()))), @@ -187,7 +187,7 @@ class _RegisterInfo extends State { elevation: 16, onChanged: (value) => { setState(() { - maritalStatus = value; + maritalStatus = value!; registerInfo.maritalStatusCode = value; }) }, @@ -195,7 +195,7 @@ class _RegisterInfo extends State { return DropdownMenuItem( value: value.value, child: Text( - projectViewModel.isArabic == 1 ? value.nameAr : value.name, + projectViewModel.isArabic == 1 ? value.nameAr! : value.name!, ), ); }).toList()))), @@ -211,7 +211,7 @@ class _RegisterInfo extends State { elevation: 16, onChanged: (value) => { setState(() { - nationality = value; + nationality = value!; registerInfo.nationalityCode = value; }) }, @@ -219,7 +219,7 @@ class _RegisterInfo extends State { return DropdownMenuItem( value: value.iD, child: Text( - value.name, + value.name!, ), ); }).toList())))), @@ -284,14 +284,14 @@ class _RegisterInfo extends State { elevation: 16, onChanged: (value) => { setState(() { - language = value; + language = value!; }) }, items: languageList.map>((Language value) { return DropdownMenuItem( value: value.value, child: Text( - projectViewModel.isArabic == 1 ? value.nameAr : value.name, + projectViewModel.isArabic == 1 ? value.nameAr! : value.name!, ), ); }).toList()))) @@ -326,14 +326,14 @@ class _RegisterInfo extends State { elevation: 16, onChanged: (value) => { setState(() { - location = value; + location = value!; }) }, items: locationList.map>((Location value) { return DropdownMenuItem( value: value.value, child: Text( - projectViewModel.isArabic == 1 ? value.nameAr : value.name, + projectViewModel.isArabic == 1 ? value.nameAr! : value.name!, ), ); }).toList()))) @@ -425,9 +425,9 @@ class _RegisterInfo extends State { if (page == 1) { if (isDubai) { await setRegisterData(); - widget.changePageViewIndex(2); + widget.changePageViewIndex!(2); } else { - widget.changePageViewIndex(2); + widget.changePageViewIndex!(2); } } else { registerNow(); @@ -533,13 +533,13 @@ class _RegisterInfo extends State { getTempUserRequest() { DateFormat dateFormat = DateFormat("mm/dd/yyyy"); - print(dateFormat.parse(registerInfo.dateOfBirth)); - var hDate = new HijriCalendar.fromDate(dateFormat.parse(registerInfo.dateOfBirth)); + print(dateFormat.parse(registerInfo.dateOfBirth!)); + var hDate = new HijriCalendar.fromDate(dateFormat.parse(registerInfo.dateOfBirth!)); var date = hDate.toString(); return { "Patientobject": { "TempValue": true, - "PatientIdentificationType": registerInfo.idNumber.substring(0, 1) == "1" ? 1 : 2, + "PatientIdentificationType": registerInfo.idNumber!.substring(0, 1) == "1" ? 1 : 2, "PatientIdentificationNo": registerInfo.idNumber, "MobileNumber": registerd_data.patientMobileNumber, "PatientOutSA": (registerd_data.zipCode == '966' || registerd_data.zipCode == '+966') ? 0 : 1, @@ -550,7 +550,7 @@ class _RegisterInfo extends State { "LastNameN": registerInfo.lastNameAr, "LastName": registerInfo.lastNameEn, "StrDateofBirth": registerInfo.dateOfBirth, - "DateofBirth": DateUtil.convertISODateToJsonDate(registerInfo.dateOfBirth.replaceAll('/', '-')), + "DateofBirth": DateUtil.convertISODateToJsonDate(registerInfo.dateOfBirth!.replaceAll('/', '-')), "Gender": registerInfo.gender == 'M' ? 1 : 2, "NationalityID": registerInfo.nationalityCode, "eHealthIDField": registerInfo.healthId, @@ -572,8 +572,8 @@ class _RegisterInfo extends State { getTempUserRequestDubai() { DateFormat dateFormat = DateFormat("mm/dd/yyyy"); registerInfo = projectViewModel.registerInfo; - print(dateFormat.parse(registerd_data.dob)); - var hDate = new HijriCalendar.fromDate(dateFormat.parse(registerd_data.dob)); + print(dateFormat.parse(registerd_data.dob!)); + var hDate = new HijriCalendar.fromDate(dateFormat.parse(registerd_data.dob!)); var date = hDate.toString(); final DateFormat dateFormat1 = DateFormat('MM/dd/yyyy'); final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); @@ -581,7 +581,7 @@ class _RegisterInfo extends State { return { "Patientobject": { "TempValue": true, - "PatientIdentificationType": registerd_data.patientIdentificationID.substring(0, 1) == "1" ? 1 : 2, + "PatientIdentificationType": registerd_data.patientIdentificationID!.substring(0, 1) == "1" ? 1 : 2, "PatientIdentificationNo": registerd_data.patientIdentificationID, "MobileNumber": registerd_data.patientMobileNumber, "PatientOutSA": (registerd_data.zipCode == '966' || registerd_data.zipCode == '+966') ? 0 : 1, @@ -591,8 +591,8 @@ class _RegisterInfo extends State { "MiddleName": registerInfo.secondNameEn ?? ".", "LastNameN": registerInfo.lastNameAr ?? "", "LastName": registerInfo.lastNameEn ?? "", - "StrDateofBirth": dateFormat1.format(dateFormat2.parse(registerd_data.dob)), - "DateofBirth": DateUtil.convertISODateToJsonDate(registerd_data.dob.replaceAll('/', '-')), + "StrDateofBirth": dateFormat1.format(dateFormat2.parse(registerd_data.dob!)), + "DateofBirth": DateUtil.convertISODateToJsonDate(registerd_data.dob!.replaceAll('/', '-')), "Gender": registerInfo.gender == 'M' ? 1 : 2, "NationalityID": registerInfo.nationalityCode, "eHealthIDField": null, @@ -760,7 +760,7 @@ class _RegisterInfo extends State { }); } - Widget inputWidget(String _labelText, String _hintText, String name, {String prefix, bool isEnable = true, bool hasSelection = false}) { + Widget inputWidget(String _labelText, String _hintText, String name, {String? prefix, bool isEnable = true, bool hasSelection = false}) { return Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 5, top: 5), alignment: Alignment.center, @@ -875,17 +875,17 @@ class _RegisterInfo extends State { } class Language { - final String name; - final String value; - final String nameAr; + final String? name; + final String? value; + final String? nameAr; Language({this.name, this.value, this.nameAr}); } class Location { - final String name; - final String value; - final String nameAr; + final String? name; + final String? value; + final String? nameAr; Location({this.name, this.value, this.nameAr}); } diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index c3e8a275..eecb1a94 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -27,9 +27,9 @@ import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:intl/intl.dart' as intl; class Register extends StatefulWidget { - final Function changePageViewIndex; + final Function? changePageViewIndex; - const Register({Key key, this.changePageViewIndex}) : super(key: key); + const Register({Key? key, this.changePageViewIndex}) : super(key: key); @override _Register createState() => _Register(); @@ -38,11 +38,11 @@ class Register extends StatefulWidget { class _Register extends State { final nationalIDorFile = TextEditingController(); final int loginType = LoginType.loginType; - String mobileNo; + late String mobileNo; String countryCode = '966'; var isHijri; final util = Utils(); - DateTime selectedDate; + late DateTime selectedDate; TextEditingController dob = TextEditingController(); TextEditingController dobEn = TextEditingController(); @@ -50,7 +50,7 @@ class _Register extends State { final authService = new AuthProvider(); final sharedPref = new AppSharedPreferences(); - bool isLoading; + late bool isLoading; @override Widget build(BuildContext context) { @@ -119,7 +119,7 @@ class _Register extends State { ), Row(children: [ Container( - width: SizeConfig.realScreenWidth * .89, + width: SizeConfig.realScreenWidth! * .89, child: isHijri == 1 ? Directionality( textDirection: TextDirection.ltr, @@ -195,7 +195,7 @@ class _Register extends State { ); } - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false, bool isNumber = true, Icon suffix}) { + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false, bool isNumber = true, Icon? suffix}) { return Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), alignment: Alignment.center, @@ -400,7 +400,7 @@ class _Register extends State { GifLoaderDialogUtils.hideDialog(context), if (result is Map) { - result = CheckUserStatusResponse.fromJson(result), + result = CheckUserStatusResponse.fromJson(result as Map), sharedPref.setObject(NHIC_DATA, result), Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true))), } diff --git a/lib/pages/login/register_new.dart b/lib/pages/login/register_new.dart index 90b9d225..cac18634 100644 --- a/lib/pages/login/register_new.dart +++ b/lib/pages/login/register_new.dart @@ -21,17 +21,17 @@ class RegisterNew extends StatefulWidget { class _RegisterNew extends State { final nationalIDorFile = TextEditingController(); final int loginType = LoginType.loginType; - String mobileNo; + late String mobileNo; String countryCode = '966'; var isHijri; final util = Utils(); - DateTime selectedDate; - String dob; + late DateTime selectedDate; + late String dob; bool isButtonDisabled = true; final authService = new AuthProvider(); final sharedPref = new AppSharedPreferences(); - PageController _controller; - bool isLoading; + late PageController _controller; + late bool isLoading; int _currentIndex = 0; @override @@ -59,7 +59,7 @@ class _RegisterNew extends State { showNewAppBarTitle: true, body: SingleChildScrollView( child: Container( - height: SizeConfig.realScreenHeight * .9, + height: SizeConfig.realScreenHeight! * .9, width: SizeConfig.realScreenWidth, child: Column(children: [ Container( @@ -145,7 +145,7 @@ class _RegisterNew extends State { ); } - Widget showProgress({String title, String status, Color color, bool isNeedBorder = true}) { + Widget showProgress({String? title, String? status, Color? color, bool isNeedBorder = true}) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -157,7 +157,7 @@ class _RegisterNew extends State { Container( width: 26, height: 26, - decoration: containerRadius(color, 200), + decoration: containerRadius(color!, 200), child: Icon( Icons.done, color: Colors.white, @@ -174,7 +174,7 @@ class _RegisterNew extends State { ), mHeight(8), Text( - title, + title!, style: TextStyle( fontSize: 11, fontWeight: FontWeight.w600, @@ -184,9 +184,9 @@ class _RegisterNew extends State { mHeight(2), Container( padding: EdgeInsets.all(5), - decoration: containerRadius(color.withOpacity(0.2), 4), + decoration: containerRadius(color!.withOpacity(0.2), 4), child: Text( - status, + status!, style: TextStyle( fontSize: 8, fontWeight: FontWeight.w600, diff --git a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart index 5ee9975d..2744183e 100644 --- a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart +++ b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart @@ -38,7 +38,7 @@ class ActiveMedicationsPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - model.activePrescriptionReport[index].itemDescription, + model.activePrescriptionReport[index].itemDescription!, style: TextStyle( fontSize: 16, letterSpacing: -0.64, @@ -82,7 +82,7 @@ class ActiveMedicationsPage extends StatelessWidget { ), ), Text( - DateUtil.getDayMonthYearDateFormatted(model.activePrescriptionReport[index].orderDate), + DateUtil.getDayMonthYearDateFormatted(model.activePrescriptionReport[index].orderDate!), style: TextStyle( fontSize: 13, letterSpacing: -0.48, @@ -103,7 +103,7 @@ class ActiveMedicationsPage extends StatelessWidget { ), ), Text( - model.activePrescriptionReport[index].frequency, + model.activePrescriptionReport[index].frequency!, style: TextStyle( fontSize: 13, letterSpacing: -0.48, @@ -124,7 +124,7 @@ class ActiveMedicationsPage extends StatelessWidget { ), ), Text( - model.activePrescriptionReport[index].route, + model.activePrescriptionReport[index].route!, style: TextStyle( fontSize: 13, letterSpacing: -0.48, @@ -166,9 +166,9 @@ class ActiveMedicationsPage extends StatelessWidget { context, FadePage( page: ReminderPage( - frequency: model.activePrescriptionReport[index].frequencyNumber, - days: model.activePrescriptionReport[index].days, - itemDescription: model.activePrescriptionReport[index].itemDescription, + frequency: model.activePrescriptionReport[index].frequencyNumber!, + days: model.activePrescriptionReport[index].days!, + itemDescription: model.activePrescriptionReport[index].itemDescription!, ), ), ); diff --git a/lib/pages/medical/active_medications/DayCheckBoxDialog.dart b/lib/pages/medical/active_medications/DayCheckBoxDialog.dart index 5cb4020c..49e6e1f6 100644 --- a/lib/pages/medical/active_medications/DayCheckBoxDialog.dart +++ b/lib/pages/medical/active_medications/DayCheckBoxDialog.dart @@ -20,7 +20,7 @@ class DayCheckBoxDialog extends StatefulWidget { ]; DayCheckBoxDialog( - {Key key, this.onValueSelected, this.selectedDaysOfWeek, this.title}); + {Key? key, required this.onValueSelected, required this.selectedDaysOfWeek, required this.title}); @override _DayCheckBoxDialogState createState() => _DayCheckBoxDialogState(); diff --git a/lib/pages/medical/active_medications/reminder_page.dart b/lib/pages/medical/active_medications/reminder_page.dart index 45e6cf7d..b6d96f90 100644 --- a/lib/pages/medical/active_medications/reminder_page.dart +++ b/lib/pages/medical/active_medications/reminder_page.dart @@ -18,20 +18,20 @@ import 'DayCheckBoxDialog.dart'; // ignore: must_be_immutable class ReminderPage extends StatefulWidget { - final int frequency; - final int days; - final String itemDescription; + final int? frequency; + final int? days; + final String? itemDescription; List _scheduleList =[]; List daysOfWeek = [DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday]; - DateTime startDay; - DateTime endDay; + late DateTime startDay; + late DateTime endDay; - ReminderPage({Key key, this.frequency, this.days, this.itemDescription}) { + ReminderPage({Key? key, this.frequency, this.days, this.itemDescription}) { startDay = DateTime.now(); - endDay = DateTime.now().add(Duration(days: days)); - int hour = (24 ~/ frequency).round(); + endDay = DateTime.now().add(Duration(days: days!)); + int hour = (24 ~/ frequency!).round(); int durations = 24 ~/ hour; for (int count = 0; count < durations; count++) { _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, (hour * count))); diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index c73b0fd6..b96a6992 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -16,9 +16,9 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class ViewDoctorResponsesPage extends StatefulWidget { - final DoctorResponse doctorResponse; + final DoctorResponse? doctorResponse; - const ViewDoctorResponsesPage({Key key, this.doctorResponse}) : super(key: key); + const ViewDoctorResponsesPage({Key? key, this.doctorResponse}) : super(key: key); @override State createState() => _ViewDoctorResponsesPageState(); @@ -27,13 +27,13 @@ class ViewDoctorResponsesPage extends StatefulWidget { class _ViewDoctorResponsesPageState extends State { int rate = 1; TextEditingController textController = new TextEditingController(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.updateReadStatus(transactionNo: widget.doctorResponse.transactionNo), + onModelReady: (model) => model.updateReadStatus(transactionNo: widget.doctorResponse!.transactionNo!), builder: (_, model, w) => AppScaffold( isShowAppBar: true, showNewAppBar: true, @@ -82,7 +82,7 @@ class _ViewDoctorResponsesPageState extends State { children: [ Container( child: Text( - (widget.doctorResponse.doctorName ?? ""), + (widget.doctorResponse!.doctorName ?? ""), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -93,7 +93,7 @@ class _ViewDoctorResponsesPageState extends State { ), Container( child: Text( - (DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.doctorResponse.createdOn)) ?? ""), + (DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.doctorResponse!.createdOn!)) ?? ""), style: TextStyle( fontSize: 14, color: Color(0xff2E303A), @@ -104,7 +104,7 @@ class _ViewDoctorResponsesPageState extends State { Container( margin: EdgeInsets.only(top: 10.0), child: Text( - widget.doctorResponse.transactions[_index]['DoctorResponse'], + widget.doctorResponse!.transactions![_index]['DoctorResponse'], style: TextStyle( fontSize: 16, color: Color(0xff2E303A), @@ -127,7 +127,7 @@ class _ViewDoctorResponsesPageState extends State { ); }, separatorBuilder: (context, index) => SizedBox(height: 14), - itemCount: widget.doctorResponse.transactions.length); + itemCount: widget.doctorResponse!.transactions!.length); } void openResponseRateDialog(BuildContext context) { @@ -234,14 +234,14 @@ class _ViewDoctorResponsesPageState extends State { AskDoctorService service = new AskDoctorService(); service .rateDoctorResponse( - transactionNo: widget.doctorResponse.transactionNo, - questionType: widget.doctorResponse.requestType, + transactionNo: widget.doctorResponse!.transactionNo!, + questionType: widget.doctorResponse!.requestType!, rate: rate, notes: textController.text, - mobileNo: projectViewModel.user.mobileNumber, - idNo: projectViewModel.user.patientIdentificationNo, - patientName: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, - projectID: widget.doctorResponse.projectID, + mobileNo: projectViewModel.user!.mobileNumber!, + idNo: projectViewModel.user!.patientIdentificationNo!, + patientName: projectViewModel.user!.firstName! + " " + projectViewModel.user!.lastName!, + projectID: widget.doctorResponse!.projectID, language: projectViewModel.isArabic ? "ar" : "en") .then((res) { GifLoaderDialogUtils.hideDialog(context); @@ -257,7 +257,7 @@ class _ViewDoctorResponsesPageState extends State { }); } - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false}) { return Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), alignment: Alignment.center, diff --git a/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart index 0332fd91..ee6860a0 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_home_page.dart @@ -17,7 +17,7 @@ class AskDoctorHomPage extends StatefulWidget { } class _AskDoctorHomPageState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; int filterType = 0; diff --git a/lib/pages/medical/ask_doctor/ask_doctor_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_page.dart index 463f7fb9..1081ef52 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_page.dart @@ -50,7 +50,7 @@ class AskDoctorPage extends StatelessWidget { ); }, itemBuilder: (context, index) { - List _doctorList = _patientDoctorAppointmentList[index].patientDoctorAppointmentList; + List _doctorList = _patientDoctorAppointmentList[index].patientDoctorAppointmentList!; return AppExpandableNotifier( title: _patientDoctorAppointmentList[index].filterName, bodyWidget: ListView.separated( diff --git a/lib/pages/medical/ask_doctor/doctor_response.dart b/lib/pages/medical/ask_doctor/doctor_response.dart index 1ff9def7..0f7c1a09 100644 --- a/lib/pages/medical/ask_doctor/doctor_response.dart +++ b/lib/pages/medical/ask_doctor/doctor_response.dart @@ -62,7 +62,7 @@ class DoctorResponse extends StatelessWidget { return InkWell( onTap: () { ///go to page ViewDoctorResponsesPage - if (doctor.transactions != null && doctor.transactions.isNotEmpty) { + if (doctor.transactions != null && doctor.transactions!.isNotEmpty) { Navigator.push( context, FadePage( @@ -81,7 +81,7 @@ class DoctorResponse extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: Colors.white, - border: Border.all(color: Colors.grey[300]), + border: Border.all(color: Colors.grey[300]!), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -150,7 +150,7 @@ class DoctorResponse extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: Colors.white, - border: Border.all(color: Colors.grey[300]), + border: Border.all(color: Colors.grey[300]!), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 4c21e826..3bff9a19 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -11,9 +11,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class RequestTypePage extends StatefulWidget { - final DoctorList doctorList; + final DoctorList? doctorList; - RequestTypePage({Key key, this.doctorList}); + RequestTypePage({Key? key, this.doctorList}); @override _RequestTypePageState createState() => _RequestTypePageState(); @@ -50,8 +50,8 @@ class _RequestTypePageState extends State { child: InkWell( onTap: () { setState(() { - selected = model.askDoctorReqTypes[index].description; - parameterCode = model.askDoctorReqTypes[index].parameterCode; + selected = model.askDoctorReqTypes[index].description!; + parameterCode = model.askDoctorReqTypes[index].parameterCode!; }); }, child: Row( @@ -59,7 +59,7 @@ class _RequestTypePageState extends State { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: Text(model.askDoctorReqTypes[index].description), + child: Text(model.askDoctorReqTypes[index].description!), ), Radio( value: model.askDoctorReqTypes[index].description, @@ -67,8 +67,8 @@ class _RequestTypePageState extends State { activeColor: Colors.red[800], onChanged: (value) { setState(() { - selected = value; - parameterCode = model.askDoctorReqTypes[index].parameterCode; + selected = value!; + parameterCode = model.askDoctorReqTypes[index].parameterCode!; }); }, ), @@ -109,7 +109,7 @@ class _RequestTypePageState extends State { child: DefaultButton( TranslationBase.of(context).submit, () => { - model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) { + model.sendRequestLOV(doctorList: widget.doctorList!, requestType: parameterCode.toString(), remark: question).then((value) { if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) { Navigator.pop(context); AppToast.showSuccessToast(message: TranslationBase.of(context).RRTRequestSuccess); diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 5000e07d..ad98fe0e 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -38,20 +38,20 @@ class _AdvancePaymentPageState extends State { TextEditingController _fileTextController = TextEditingController(); TextEditingController _notesTextController = TextEditingController(); BeneficiaryType beneficiaryType = BeneficiaryType.NON; - HospitalsModel _selectedHospital; + late HospitalsModel _selectedHospital; String amount = ""; - String email; - PatientInfo _selectedPatientInfo; - AuthenticatedUser authenticatedUser; - GetAllSharedRecordsByStatusList selectedPatientFamily; + late String email; + late PatientInfo _selectedPatientInfo; + late AuthenticatedUser authenticatedUser; + late GetAllSharedRecordsByStatusList selectedPatientFamily; AdvanceModel advanceModel = AdvanceModel(); AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; + late AuthenticatedUser authUser; List imagesInfo =[]; - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override void initState() { @@ -122,8 +122,8 @@ class _AdvancePaymentPageState extends State { setState(() { if (type == BeneficiaryType.MyAccount) { - _fileTextController.text = model.user.patientID.toString(); - advanceModel.depositorName = model.user.firstName + " " + model.user.lastName; + _fileTextController.text = model.user!.patientID.toString(); + advanceModel.depositorName = model.user!.firstName! + " " + model.user!.lastName!; } else _fileTextController.text = ""; @@ -161,7 +161,7 @@ class _AdvancePaymentPageState extends State { GifLoaderDialogUtils.showMyDialog(context); model.getFamilyFiles().then((value) { GifLoaderDialogUtils.hideDialog(context); - confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList); + confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList!); }); }, child: Container( @@ -263,7 +263,7 @@ class _AdvancePaymentPageState extends State { if (model.user != null) NewTextFields( hintText: TranslationBase.of(context).depositorEmail, - initialValue: model.user.emailAddress, + initialValue: model.user!.emailAddress!, onChanged: (value) { email = value; }, @@ -297,8 +297,8 @@ class _AdvancePaymentPageState extends State { } if (beneficiaryType == BeneficiaryType.MyAccount) { - mobileNum = model.user.mobileNumber; - patientName = model.user.firstName; + mobileNum = model.user!.mobileNumber; + patientName = model.user!.firstName; } if (beneficiaryType == BeneficiaryType.OtherAccount) { @@ -309,7 +309,7 @@ class _AdvancePaymentPageState extends State { advanceModel.fileNumber = _fileTextController.text; advanceModel.hospitalsModel = _selectedHospital; advanceModel.note = _notesTextController.text; - advanceModel.email = email ?? model.user.emailAddress; + advanceModel.email = email ?? model.user!.emailAddress; advanceModel.amount = amount; advanceModel.mobileNumber = mobileNum; advanceModel.patientName = patientName; @@ -323,7 +323,7 @@ class _AdvancePaymentPageState extends State { context, FadePage( page: PaymentMethod( - onSelectedMethod: (String metohd, [String selectedInstallmentPlan]) { + onSelectedMethod: (String metohd, [String? selectedInstallmentPlan]) { setState(() {}); }, isShowInstallments: false, @@ -365,7 +365,7 @@ class _AdvancePaymentPageState extends State { void confirmSelectHospitalDialog(List hospitals) { List list = [ - for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name! + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), ]; showDialog( context: context, @@ -386,7 +386,7 @@ class _AdvancePaymentPageState extends State { void confirmSelectPatientDialog(List patientInfoList) { List list = [ - for (int i = 0; i < patientInfoList.length; i++) RadioSelectionDialogModel(patientInfoList[i].fullName, i), + for (int i = 0; i < patientInfoList.length; i++) RadioSelectionDialogModel(patientInfoList[i].fullName!, i), ]; showDialog( context: context, @@ -410,7 +410,7 @@ class _AdvancePaymentPageState extends State { if (getAllSharedRecordsByStatusList.isNotEmpty) { List list = [ for (int i = 0; i < getAllSharedRecordsByStatusList.length; i++) - if (getAllSharedRecordsByStatusList[i].status == 3) RadioSelectionDialogModel(getAllSharedRecordsByStatusList[i].patientName, i), + if (getAllSharedRecordsByStatusList[i].status == 3) RadioSelectionDialogModel(getAllSharedRecordsByStatusList[i].patientName!, i), ]; showDialog( context: context, @@ -447,14 +447,14 @@ class _AdvancePaymentPageState extends State { String getHospitalName() { if (_selectedHospital != null) - return _selectedHospital.name; + return _selectedHospital.name!; else return TranslationBase.of(context).selectHospital; } String getPatientName() { if (_selectedPatientInfo != null) - return _selectedPatientInfo.fullName; + return _selectedPatientInfo.fullName!; else return TranslationBase.of(context).selectPatientName; } @@ -470,7 +470,7 @@ class _AdvancePaymentPageState extends State { String getFamilyMembersName() { if (selectedPatientFamily != null) - return selectedPatientFamily.patientName; + return selectedPatientFamily.patientName!; else return TranslationBase.of(context).selectFamilyPatientName; } diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 0697ea75..1cfe1a74 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -31,11 +31,11 @@ import 'package:provider/provider.dart'; import 'new_text_Field.dart'; class ConfirmPaymentPage extends StatefulWidget { - final AdvanceModel advanceModel; - final PatientInfoAndMobileNumber patientInfoAndMobileNumber; - final String selectedPaymentMethod; - AuthenticatedUser authenticatedUser; - String installmentPlan; + final AdvanceModel? advanceModel; + final PatientInfoAndMobileNumber? patientInfoAndMobileNumber; + final String? selectedPaymentMethod; + AuthenticatedUser? authenticatedUser; + String? installmentPlan; ConfirmPaymentPage({this.advanceModel, this.patientInfoAndMobileNumber, this.selectedPaymentMethod, this.authenticatedUser, this.installmentPlan}); @@ -44,15 +44,15 @@ class ConfirmPaymentPage extends StatefulWidget { } class _ConfirmPaymentPageState extends State { - MyInAppBrowser browser; - ProjectViewModel projectViewModel; + late MyInAppBrowser browser; + late ProjectViewModel projectViewModel; AppSharedPreferences sharedPref = AppSharedPreferences(); String transID = ""; - String tamaraPaymentStatus; - String tamaraOrderID; + late String tamaraPaymentStatus; + late String tamaraOrderID; // Pay _payClient; @@ -71,12 +71,12 @@ class _ConfirmPaymentPageState extends State { GifLoaderDialogUtils.hideDialog(AppGlobal.context); Navigator.pop(context, true); AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); - appo.projectID = widget.patientInfoAndMobileNumber.projectID; + appo.projectID = widget.patientInfoAndMobileNumber!.projectID; // if (widget.selectedPaymentMethod == "ApplePay") { // startApplePay(); // } else { - projectViewModel.analytics.advancePayments.payment_otp_confirmation(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet'); - openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); + projectViewModel.analytics.advancePayments.payment_otp_confirmation(method: widget.selectedPaymentMethod!.toLowerCase(), type: 'wallet'); + openPayment(widget.selectedPaymentMethod!, widget.authenticatedUser!, double.parse(widget.advanceModel!.amount!), AppoitmentAllHistoryResultList()); // } }); } @@ -88,7 +88,7 @@ class _ConfirmPaymentPageState extends State { new SMSOTP( context, 1, - widget.patientInfoAndMobileNumber.mobileNumber, + widget.patientInfoAndMobileNumber!.mobileNumber, (value) { submit(model, value); }, @@ -134,14 +134,14 @@ class _ConfirmPaymentPageState extends State { width: MediaQuery.of(context).size.width * 0.30, child: widget.selectedPaymentMethod == "ApplePay" ? SvgPicture.asset( - getImagePath(widget.selectedPaymentMethod), + getImagePath(widget.selectedPaymentMethod!), ) - : Image.asset(getImagePath(widget.selectedPaymentMethod)), + : Image.asset(getImagePath(widget.selectedPaymentMethod!)), ), Text( - widget.advanceModel.hospitalsModel.projectOutSA - ? '${widget.advanceModel.amount} ' + TranslationBase.of(context).aed - : '${widget.advanceModel.amount} ' + TranslationBase.of(context).sar, + widget.advanceModel!.hospitalsModel!.projectOutSA! + ? '${widget.advanceModel!.amount} ' + TranslationBase.of(context).aed + : '${widget.advanceModel!.amount} ' + TranslationBase.of(context).sar, // '${widget.advanceModel.amount} ' + TranslationBase.of(context).sar, style: TextStyle( fontSize: 20, @@ -161,7 +161,7 @@ class _ConfirmPaymentPageState extends State { margin: EdgeInsets.all(3), child: NewTextFields( hintText: TranslationBase.of(context).fileNumber, - initialValue: widget.advanceModel.fileNumber, + initialValue: widget.advanceModel!.fileNumber!, isEnabled: false, ), ), @@ -171,7 +171,7 @@ class _ConfirmPaymentPageState extends State { margin: EdgeInsets.all(3), child: NewTextFields( hintText: TranslationBase.of(context).name, - initialValue: widget.patientInfoAndMobileNumber.firstName, + initialValue: widget.patientInfoAndMobileNumber!.firstName!, isEnabled: false, ), ), @@ -183,7 +183,7 @@ class _ConfirmPaymentPageState extends State { ), NewTextFields( hintText: TranslationBase.of(context).mobileNumber, - initialValue: widget.patientInfoAndMobileNumber.mobileNumber, + initialValue: widget.patientInfoAndMobileNumber!.mobileNumber!, isEnabled: false, ), SizedBox( @@ -191,7 +191,7 @@ class _ConfirmPaymentPageState extends State { ), NewTextFields( hintText: TranslationBase.of(context).depositorName, - initialValue: model.user.firstName + " " + model.user.middleName + " " + model.user.lastName, + initialValue: model.user!.firstName! + " " + model.user!.middleName! + " " + model.user!.lastName!, isEnabled: false, ), SizedBox( @@ -199,7 +199,7 @@ class _ConfirmPaymentPageState extends State { ), NewTextFields( hintText: TranslationBase.of(context).notes, - initialValue: widget.advanceModel.note, + initialValue: widget.advanceModel!.note!, isEnabled: false, ), ], @@ -215,16 +215,16 @@ class _ConfirmPaymentPageState extends State { child: DefaultButton( TranslationBase.of(context).confirm.toUpperCase(), () { - if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) { - openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); + if (widget.advanceModel!.fileNumber == projectViewModel.user!.patientID.toString()) { + openPayment(widget.selectedPaymentMethod!, widget.authenticatedUser!, double.parse(widget.advanceModel!.amount!), AppoitmentAllHistoryResultList()); } else { GifLoaderDialogUtils.showMyDialog(context); - model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { + model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel!.fileNumber!), projectID: widget.advanceModel!.hospitalsModel!.iD).then((value) { GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(model); }); } - projectViewModel.analytics.advancePayments.payment_confirm(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet'); + projectViewModel.analytics.advancePayments.payment_confirm(method: widget.selectedPaymentMethod!.toLowerCase(), type: 'wallet'); // startApplePay(); // if() @@ -271,29 +271,29 @@ class _ConfirmPaymentPageState extends State { AppleHeader appleHeader = new AppleHeader(); ApplePaymentMethod applePaymentMethod = new ApplePaymentMethod(); - applePayRequest.amount = widget.advanceModel.amount; + applePayRequest.amount = widget.advanceModel!.amount; applePayRequest.currency = "SAR"; applePayRequest.language = projectViewModel.isArabic ? "ar" : "en"; - applePayRequest.customername = projectViewModel.user.firstName; - applePayRequest.customerEmail = projectViewModel.user.emailAddress; + applePayRequest.customername = projectViewModel.user!.firstName; + applePayRequest.customerEmail = projectViewModel.user!.emailAddress; applePayRequest.orderdescription = "Advance Payment"; applePayRequest.liveServiceid = ""; applePayRequest.latitude = await this.sharedPref.getDouble(USER_LAT); applePayRequest.longitude = await this.sharedPref.getDouble(USER_LONG); applePayRequest.devicetoken = await sharedPref.getString(PUSH_TOKEN); - applePayRequest.clientrequestid = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); - applePayRequest.projectid = widget.advanceModel.hospitalsModel.iD.toString(); + applePayRequest.clientrequestid = Utils.getAdvancePaymentTransID(widget.advanceModel!.hospitalsModel!.iD, int.parse(widget.advanceModel!.fileNumber!)); + applePayRequest.projectid = widget.advanceModel!.hospitalsModel!.iD.toString(); applePayRequest.serviceid = "3"; - applePayRequest.patientid = projectViewModel.user.patientID.toString(); - applePayRequest.appleData = applePayResponse.token.data; - applePayRequest.appleSignature = applePayResponse.token.signature; + applePayRequest.patientid = projectViewModel.user!.patientID.toString(); + applePayRequest.appleData = applePayResponse.token!.data; + applePayRequest.appleSignature = applePayResponse.token!.signature; - appleHeader.appleEphemeralPublicKey = applePayResponse.token.header.ephemeralPublicKey; - appleHeader.appleTransactionId = applePayResponse.token.header.transactionId; - appleHeader.applePublicKeyHash = applePayResponse.token.header.publicKeyHash; - applePaymentMethod.appleType = getApplePayPaymentType(applePayResponse.paymentMethod.type); - applePaymentMethod.appleNetwork = applePayResponse.paymentMethod.network; - applePaymentMethod.appleDisplayName = applePayResponse.paymentMethod.displayName; + appleHeader.appleEphemeralPublicKey = applePayResponse.token!.header!.ephemeralPublicKey; + appleHeader.appleTransactionId = applePayResponse.token!.header!.transactionId; + appleHeader.applePublicKeyHash = applePayResponse.token!.header!.publicKeyHash; + applePaymentMethod.appleType = getApplePayPaymentType(applePayResponse.paymentMethod!.type); + applePaymentMethod.appleNetwork = applePayResponse.paymentMethod!.network; + applePaymentMethod.appleDisplayName = applePayResponse.paymentMethod!.displayName; applePayRequest.appleHeader = appleHeader; applePayRequest.applePaymentMethod = applePaymentMethod; @@ -355,18 +355,18 @@ class _ConfirmPaymentPageState extends State { openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); - transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); + transID = Utils.getAdvancePaymentTransID(widget.advanceModel!.hospitalsModel!.iD, int.parse(widget.advanceModel!.fileNumber!)); browser.openPaymentBrowser( amount, "Advance Payment", transID, - widget.advanceModel.hospitalsModel.iD.toString(), - widget.advanceModel.email, + widget.advanceModel!.hospitalsModel!.iD.toString(), + widget.advanceModel!.email!, paymentMethod, - widget.patientInfoAndMobileNumber.patientType, - widget.advanceModel.patientName, - widget.advanceModel.fileNumber, + widget.patientInfoAndMobileNumber!.patientType, + widget.advanceModel!.patientName!, + widget.advanceModel!.fileNumber!, authenticatedUser, browser, false, @@ -386,8 +386,8 @@ class _ConfirmPaymentPageState extends State { if (widget.selectedPaymentMethod == "TAMARA") { Uri uri = new Uri.dataFromString(url); - tamaraPaymentStatus = uri.queryParameters['paymentStatus']; - tamaraOrderID = uri.queryParameters['orderId']; + tamaraPaymentStatus = uri.queryParameters['paymentStatus']!; + tamaraOrderID = uri.queryParameters['orderId']!; print(tamaraPaymentStatus); print(tamaraOrderID); } @@ -413,7 +413,7 @@ class _ConfirmPaymentPageState extends State { print("onBrowserExit Called!!!!"); if (widget.selectedPaymentMethod == "TAMARA" && tamaraPaymentStatus != null && tamaraPaymentStatus == "approved") { var res = { - "Amount": double.parse(widget.advanceModel.amount), + "Amount": double.parse(widget.advanceModel!.amount!), "ErrorMessage": null, "Fort_id": tamaraOrderID, "Merchant_Reference": "5058637919318707883366", @@ -430,7 +430,7 @@ class _ConfirmPaymentPageState extends State { String txn_ref; String amount; String payment_method; - final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; + final currency = projectViewModel.user!.outSA == 0 ? "sar" : 'aed'; GifLoaderDialogUtils.showMyDialog(AppGlobal.context); DoctorsListService service = new DoctorsListService(); service.checkPaymentStatus(transID, false, AppGlobal.context).then((res) { @@ -441,18 +441,18 @@ class _ConfirmPaymentPageState extends State { payment_method = res['PaymentMethod']; createAdvancePayment(res, appo); projectViewModel.analytics.advancePayments.payment_success( - payment_type: 'wallet', payment_method: payment_method, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref, hospital: widget.advanceModel.hospitalsModel.name); + payment_type: 'wallet', payment_method: payment_method, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref, hospital: widget.advanceModel!.hospitalsModel!.name!); } else { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: res['Response_Message']); - amount = widget.advanceModel.amount; - payment_method = widget.selectedPaymentMethod; + amount = widget.advanceModel!.amount!; + payment_method = widget.selectedPaymentMethod!; projectViewModel.analytics.advancePayments.payment_fail( payment_type: 'wallet', payment_method: payment_method, txn_amount: "$amount", txn_currency: currency, - hospital: widget.advanceModel.hospitalsModel.name, + hospital: widget.advanceModel!.hospitalsModel!.name!, error_type: res['Response_Message']); } }).catchError((err) { @@ -465,11 +465,11 @@ class _ConfirmPaymentPageState extends State { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service.HIS_createAdvancePayment(appo, widget.advanceModel.hospitalsModel.iD.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], widget.patientInfoAndMobileNumber.patientType, - widget.advanceModel.patientName, widget.advanceModel.fileNumber, AppGlobal.context) + service.HIS_createAdvancePayment(appo, widget.advanceModel!.hospitalsModel!.iD.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], widget.patientInfoAndMobileNumber!.patientType, + widget.advanceModel!.patientName!, widget.advanceModel!.fileNumber, AppGlobal.context) .then((res) { addAdvancedNumberRequest( - Utils.isVidaPlusProject(projectViewModel, widget.advanceModel.hospitalsModel.iD) + Utils.isVidaPlusProject(projectViewModel, widget.advanceModel!.hospitalsModel!.iD) ? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() : res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, diff --git a/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart b/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart index 380f250c..ce69e8c0 100644 --- a/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart +++ b/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart @@ -15,13 +15,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ConfirmSMSDialog extends StatefulWidget { - final String phoneNumber; - final AdvanceModel advanceModel; - final PatientInfoAndMobileNumber patientInfoAndMobileNumber; - final String selectedPaymentMethod; + final String? phoneNumber; + final AdvanceModel? advanceModel; + final PatientInfoAndMobileNumber? patientInfoAndMobileNumber; + final String? selectedPaymentMethod; const ConfirmSMSDialog( - {Key key, + {Key? key, this.phoneNumber, this.advanceModel, this.selectedPaymentMethod, @@ -49,7 +49,7 @@ class _ConfirmSMSDialogState extends State { String timerText = (TIMER_MIN - 1).toString() + ':59'; int min = TIMER_MIN - 1; int sec = 59; - Timer _timer; + late Timer _timer; resendCode() { min = TIMER_MIN - 1; @@ -74,10 +74,10 @@ class _ConfirmSMSDialogState extends State { }); } - FocusNode focusD1; - FocusNode focusD2; - FocusNode focusD3; - FocusNode focusD4; + late FocusNode focusD1; + late FocusNode focusD2; + late FocusNode focusD3; + late FocusNode focusD4; @override void initState() { @@ -157,7 +157,7 @@ class _ConfirmSMSDialogState extends State { Form( key: verifyAccountForm, child: Container( - width: SizeConfig.realScreenWidth * 0.90, + width: SizeConfig.realScreenWidth! * 0.90, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -172,7 +172,7 @@ class _ConfirmSMSDialogState extends State { child: TextFormField( textInputAction: TextInputAction.next, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), focusNode: focusD1, //maxLength: 1, @@ -203,7 +203,7 @@ class _ConfirmSMSDialogState extends State { //maxLength: 1, textAlign: TextAlign.center, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), keyboardType: TextInputType.number, decoration: buildInputDecoration(context), @@ -230,7 +230,7 @@ class _ConfirmSMSDialogState extends State { //maxLength: 1, textAlign: TextAlign.center, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), keyboardType: TextInputType.number, decoration: buildInputDecoration(context), @@ -256,7 +256,7 @@ class _ConfirmSMSDialogState extends State { // maxLength: 1, textAlign: TextAlign.center, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), keyboardType: TextInputType.number, decoration: buildInputDecoration(context), @@ -329,7 +329,7 @@ class _ConfirmSMSDialogState extends State { } void submit(MyBalanceViewModel model) { - if (verifyAccountForm.currentState.validate()) { + if (verifyAccountForm.currentState!.validate()) { final activationCode = digit1.text + digit2.text + digit3.text + digit4.text; GifLoaderDialogUtils.showMyDialog(AppGlobal.context); @@ -346,7 +346,7 @@ class _ConfirmSMSDialogState extends State { if (value.isEmpty) { return ''; } - return null; + return "null"; } InputDecoration buildInputDecoration(BuildContext context) { diff --git a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart index d0f991ac..e7c766fd 100644 --- a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart @@ -9,12 +9,12 @@ import 'package:provider/provider.dart'; // todo 'sikander' remove this file when usage known class SelectCiteisDialog extends StatefulWidget { - final List hospitals; - final Function(CitiesModel) onValueSelected; - CitiesModel selectedHospital; + final List? hospitals; + final Function(CitiesModel)? onValueSelected; + CitiesModel? selectedHospital; SelectCiteisDialog( - {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); + {Key? key, this.hospitals, this.onValueSelected, this.selectedHospital}); @override _SelectCiteisDialogState createState() => _SelectCiteisDialogState(); @@ -25,7 +25,7 @@ class _SelectCiteisDialogState extends State { void initState() { super.initState(); - widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; + widget.selectedHospital = widget.selectedHospital ?? widget.hospitals![0]; } @override @@ -38,7 +38,7 @@ class _SelectCiteisDialogState extends State { children: [ Divider(), ...List.generate( - widget.hospitals.length, + widget.hospitals!.length, (index) => Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -52,17 +52,17 @@ class _SelectCiteisDialogState extends State { child: InkWell( onTap: () { setState(() { - widget.selectedHospital = widget.hospitals[index]; + widget.selectedHospital = widget.hospitals![index]; }); }, child: ListTile( // title: Text(widget.hospitals[index].description + // ' ${widget.hospitals[index].distanceInKilometers} KM'), title: Text(projectProvider.isArabic - ? widget.hospitals[index].descriptionN - : widget.hospitals[index].description), + ? widget.hospitals![index].descriptionN! + : widget.hospitals![index].description!), leading: Radio( - value: widget.hospitals[index], + value: widget.hospitals![index], groupValue: widget.selectedHospital, activeColor: Colors.red[800], onChanged: (value) { @@ -116,7 +116,7 @@ class _SelectCiteisDialogState extends State { flex: 1, child: InkWell( onTap: () { - widget.onValueSelected(widget.selectedHospital); + widget.onValueSelected!(widget.selectedHospital!); Navigator.pop(context); }, child: Padding( diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index db3b8226..459b7250 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -19,7 +19,7 @@ import 'advance_payment_page.dart'; class MyBalancePage extends StatelessWidget { List imagesInfo =[]; - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -106,7 +106,7 @@ class MyBalancePage extends StatelessWidget { ), ), Text( - projectViewModel.user.outSA == 1 ? TranslationBase.of(context).aed : TranslationBase.of(context).sar, + projectViewModel.user!.outSA == 1 ? TranslationBase.of(context).aed : TranslationBase.of(context).sar, style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, @@ -147,7 +147,7 @@ class MyBalancePage extends StatelessWidget { children: [ Expanded( child: Text( - balanceAmount.projectDescription, + balanceAmount!.projectDescription!, style: TextStyle( fontSize: 16, letterSpacing: -0.64, @@ -157,7 +157,7 @@ class MyBalancePage extends StatelessWidget { ), ), Text( - amount.toStringAsFixed(2) + " " + (projectViewModel.user.outSA == 1 ? TranslationBase.of(context).aed : TranslationBase.of(context).sar), + amount.toStringAsFixed(2) + " " + (projectViewModel.user!.outSA == 1 ? TranslationBase.of(context).aed : TranslationBase.of(context).sar), style: TextStyle( fontSize: 16, letterSpacing: -0.64, diff --git a/lib/pages/medical/balance/new_text_Field.dart b/lib/pages/medical/balance/new_text_Field.dart index a3c17e3e..b00e4274 100644 --- a/lib/pages/medical/balance/new_text_Field.dart +++ b/lib/pages/medical/balance/new_text_Field.dart @@ -4,8 +4,7 @@ import 'package:flutter/services.dart'; class NumberTextInputFormatter extends TextInputFormatter { @override - TextEditingValue formatEditUpdate( - TextEditingValue oldValue, TextEditingValue newValue) { + TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) { final int newTextLength = newValue.text.length; int selectionIndex = newValue.selection.end; int usedSubstringIndex = 0; @@ -27,8 +26,7 @@ class NumberTextInputFormatter extends TextInputFormatter { if (newValue.selection.end >= 10) selectionIndex++; } // Dump the rest. - if (newTextLength >= usedSubstringIndex) - newText.write(newValue.text.substring(usedSubstringIndex)); + if (newTextLength >= usedSubstringIndex) newText.write(newValue.text.substring(usedSubstringIndex)); return TextEditingValue( text: newText.toString(), selection: TextSelection.collapsed(offset: selectionIndex), @@ -40,77 +38,78 @@ final _mobileFormatter = NumberTextInputFormatter(); class NewTextFields extends StatefulWidget { NewTextFields( - {Key key, - this.type, - this.hintText, - this.suffixIcon, - this.autoFocus, - this.onChanged, - this.initialValue, - this.minLines, - this.maxLines, - this.inputFormatters, - this.padding, - this.focus = false, - this.maxLengthEnforced = true, - this.suffixIconColor, - this.inputAction, - this.onSubmit, - this.keepPadding = true, - this.textCapitalization = TextCapitalization.none, - this.controller, - this.keyboardType, - this.validator, - this.borderOnlyError = false, - this.onSaved, - this.onSuffixTap, - this.readOnly: false, - this.maxLength, - this.prefixIcon, - this.bare = false, - this.onTap, - this.fontSize = 14.0, - this.fontWeight = FontWeight.w600, - - this.hintColor, - this.isEnabled = true,this.counterText=""}) + {Key? key, + this.type, + this.hintText, + this.suffixIcon, + this.autoFocus, + this.onChanged, + this.initialValue, + this.minLines, + this.maxLines, + this.inputFormatters, + this.padding, + this.focus = false, + this.maxLengthEnforced = true, + this.suffixIconColor, + this.inputAction, + this.onSubmit, + this.keepPadding = true, + this.textCapitalization = TextCapitalization.none, + this.controller, + this.keyboardType, + this.validator, + this.borderOnlyError = false, + this.onSaved, + this.onSuffixTap, + this.readOnly = false, + this.maxLength, + this.prefixIcon, + this.bare = false, + this.onTap, + this.fontSize = 14.0, + this.fontWeight = FontWeight.w600, + this.hintColor, + this.isEnabled = true, + this.counterText = ""}) : super(key: key); - final String hintText; + final String? hintText; // final String initialValue; - final String type; - final bool autoFocus; - final IconData suffixIcon; - final Color suffixIconColor; - final Icon prefixIcon; - final VoidCallback onTap; - final TextEditingController controller; - final TextInputType keyboardType; - final FormFieldValidator validator; - final Function onSaved; - final Function onSuffixTap; - final Function onChanged; - final Function onSubmit; + final String? type; + final bool? autoFocus; + final IconData? suffixIcon; + final Color? suffixIconColor; + final Icon? prefixIcon; + final VoidCallback? onTap; + final TextEditingController? controller; + final TextInputType? keyboardType; + final FormFieldValidator? validator; + final Function(String?)? onSaved; + final Function? onSuffixTap; + final Function(String)? onChanged; + final Function(String)? onSubmit; final bool readOnly; - final int maxLength; - final int minLines; - final int maxLines; + final int? maxLength; + final int? minLines; + final int? maxLines; final bool maxLengthEnforced; final bool bare; final bool isEnabled; - final TextInputAction inputAction; + final TextInputAction? inputAction; final double fontSize; final FontWeight fontWeight; final bool keepPadding; final TextCapitalization textCapitalization; - final List inputFormatters; - final EdgeInsets padding; + final List? inputFormatters; + final EdgeInsets? padding; final bool focus; final bool borderOnlyError; - final Color hintColor; - final String initialValue; + final Color? hintColor; + final String? initialValue; final String counterText; + @override _NewTextFieldsState createState() => _NewTextFieldsState(); } @@ -155,9 +154,7 @@ class _NewTextFieldsState extends State { Widget build(BuildContext context) { return AnimatedContainer( duration: Duration(milliseconds: 300), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Container( margin: EdgeInsets.only(top: 8), child: TextFormField( @@ -168,10 +165,10 @@ class _NewTextFieldsState extends State { textCapitalization: widget.textCapitalization, onFieldSubmitted: widget.inputAction == TextInputAction.next ? (widget.onSubmit != null - ? widget.onSubmit - : (val) { - _focusNode.nextFocus(); - }) + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) : widget.onSubmit, textInputAction: widget.inputAction, minLines: widget.minLines ?? 1, @@ -187,35 +184,21 @@ class _NewTextFieldsState extends State { autofocus: widget.autoFocus ?? false, validator: widget.validator, onSaved: widget.onSaved, - style: Theme.of(context).textTheme.bodyText2.copyWith( - fontSize: widget.fontSize, fontWeight: widget.fontWeight), + style: Theme.of(context).textTheme.bodyText2!.copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone ? [ - FilteringTextInputFormatter.digitsOnly, - _mobileFormatter, - ] + FilteringTextInputFormatter.digitsOnly, + _mobileFormatter, + ] : widget.inputFormatters, decoration: InputDecoration( labelText: widget.hintText, counterText: widget.counterText, - labelStyle: - TextStyle(color: Theme.of(context).textTheme.bodyText1.color), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).errorColor.withOpacity(0.5), - width: 1.0), - borderRadius: BorderRadius.circular(12.0)), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).errorColor.withOpacity(0.5), - width: 1.0), - borderRadius: BorderRadius.circular(8.0)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.white, width: 1.0), - borderRadius: BorderRadius.circular(12)), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.white, width: 1.0), - borderRadius: BorderRadius.circular(12)), + labelStyle: TextStyle(color: Theme.of(context).textTheme.bodyText1!.color), + errorBorder: OutlineInputBorder(borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(0.5), width: 1.0), borderRadius: BorderRadius.circular(12.0)), + focusedErrorBorder: OutlineInputBorder(borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(0.5), width: 1.0), borderRadius: BorderRadius.circular(8.0)), + focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.white, width: 1.0), borderRadius: BorderRadius.circular(12)), + disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.white, width: 1.0), borderRadius: BorderRadius.circular(12)), enabledBorder: OutlineInputBorder( borderSide: BorderSide(color: Colors.white, width: 1.0), borderRadius: BorderRadius.circular(12), diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index efd3529a..c75d9582 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -63,7 +63,7 @@ class DoctorHomePage extends StatelessWidget { physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), itemBuilder: (context, _index) { - DoctorList _doctorList = model.patientDoctorAppointmentList[index].patientDoctorAppointmentList[_index]; + DoctorList _doctorList = model.patientDoctorAppointmentList[index].patientDoctorAppointmentList![_index]; DoctorList doctorList = DoctorList( projectID: _doctorList.projectID, setupID: _doctorList.setupID, @@ -81,11 +81,11 @@ class DoctorHomePage extends StatelessWidget { nationalityFlagURL: _doctorList.nationalityFlagURL); return DoctorView( doctor: doctorList, - isLiveCareAppointment: _doctorList.isLiveCareClinic, + isLiveCareAppointment: _doctorList.isLiveCareClinic!, ); }, separatorBuilder: (context, index) => SizedBox(height: 14), - itemCount: model.patientDoctorAppointmentList[index].patientDoctorAppointmentList.length), + itemCount: model.patientDoctorAppointmentList[index].patientDoctorAppointmentList!.length), ); }, itemCount: model.patientDoctorAppointmentList.length), diff --git a/lib/pages/medical/doctor/doctor_information_page.dart b/lib/pages/medical/doctor/doctor_information_page.dart index 7634cde2..262bd87c 100644 --- a/lib/pages/medical/doctor/doctor_information_page.dart +++ b/lib/pages/medical/doctor/doctor_information_page.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; class DoctorInformation extends StatefulWidget { final DoctorProfile doctorProfile; - const DoctorInformation({Key key, this.doctorProfile}) : super(key: key); + const DoctorInformation({Key? key, required this.doctorProfile}) : super(key: key); @override _DoctorInformationState createState() => _DoctorInformationState(); @@ -58,7 +58,7 @@ class _DoctorInformationState extends State { decoration: BoxDecoration(shape: BoxShape.circle, boxShadow: [ BoxShadow( - color: Colors.red[700], + color: Colors.red[700]!, blurRadius: 1.0, spreadRadius: 0.0, ) @@ -161,7 +161,7 @@ class _DoctorInformationState extends State { decoration: BoxDecoration(shape: BoxShape.circle, boxShadow: [ BoxShadow( - color: Colors.red[700], + color: Colors.red[700]!, blurRadius: 1.0, spreadRadius: 0.0, ) diff --git a/lib/pages/medical/doctor/doctor_profile_page.dart b/lib/pages/medical/doctor/doctor_profile_page.dart index 18e76002..5f9436c9 100644 --- a/lib/pages/medical/doctor/doctor_profile_page.dart +++ b/lib/pages/medical/doctor/doctor_profile_page.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; class DoctorProfilePage extends StatefulWidget { final PatientDoctorAppointment patientDoctorAppointment; - DoctorProfilePage({this.patientDoctorAppointment}); + DoctorProfilePage({required this.patientDoctorAppointment}); @override _DoctorProfilePageState createState() => @@ -17,8 +17,8 @@ class DoctorProfilePage extends StatefulWidget { class _DoctorProfilePageState extends State with TickerProviderStateMixin { - TabController _tabController; - final PatientDoctorAppointment patientDoctorAppointment; + late TabController _tabController; + late PatientDoctorAppointment patientDoctorAppointment; _DoctorProfilePageState(this.patientDoctorAppointment); @@ -155,6 +155,7 @@ class _DoctorProfilePageState extends State height: MediaQuery.of(context).size.height * 0.8, child: TabBarView( physics: BouncingScrollPhysics(), + children: [ DoctorInformation( doctorProfile: model.doctorProfile, diff --git a/lib/pages/medical/eye/ClassesPage.dart b/lib/pages/medical/eye/ClassesPage.dart index 573e5bf3..a3a82eb5 100644 --- a/lib/pages/medical/eye/ClassesPage.dart +++ b/lib/pages/medical/eye/ClassesPage.dart @@ -11,7 +11,7 @@ class ClassesPage extends StatelessWidget { final String projectName; final int projectID; - const ClassesPage({Key key, this.glassPerscription, this.appointmentNo, this.projectName, this.projectID}) : super(key: key); + const ClassesPage({Key? key, this.glassPerscription, this.appointmentNo, this.projectName, this.projectID}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/theme/theme_value.dart b/lib/theme/theme_value.dart index bcb460b7..86e06d22 100644 --- a/lib/theme/theme_value.dart +++ b/lib/theme/theme_value.dart @@ -30,7 +30,7 @@ defaultTheme({fontName}) { scaffoldBackgroundColor: Color(0xffF8F8F8), canvasColor: Colors.white, backgroundColor: Color.fromRGBO(255, 255, 255, 1), - highlightColor: Colors.grey[100].withOpacity(0.4), + highlightColor: Colors.grey[100]!.withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Color(0xff515A5D), toggleableActiveColor: secondaryColor, @@ -76,7 +76,7 @@ invertThemes({fontName}) { scaffoldBackgroundColor: Color(0xff000000), canvasColor: Colors.black, backgroundColor: Color.fromRGBO(255, 255, 255, 1), - highlightColor: Colors.grey[100].withOpacity(0.4), + highlightColor: Colors.grey[100]!.withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Color(0xff515A5D), toggleableActiveColor: secondaryColor, @@ -126,7 +126,7 @@ bwThemes({fontName}) { scaffoldBackgroundColor: Color(0xffffffe4), canvasColor: Colors.black, backgroundColor: Color(0xffffffe4), - highlightColor: Colors.grey[100].withOpacity(0.4), + highlightColor: Colors.grey[100]!.withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Color(0xfffffff4), toggleableActiveColor: secondaryColor, @@ -163,7 +163,7 @@ dimTheme({fontName}) { scaffoldBackgroundColor: Color(0xffEEEEEE), canvasColor: Colors.white, backgroundColor: Color.fromRGBO(255, 255, 255, 1), - highlightColor: Colors.grey[100].withOpacity(0.4), + highlightColor: Colors.grey[100]!.withOpacity(0.4), splashColor: Colors.transparent, primaryColor: Color(0xff40ACC9), bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), diff --git a/lib/uitl/CalendarUtils.dart b/lib/uitl/CalendarUtils.dart index 8f549d48..ed347b25 100644 --- a/lib/uitl/CalendarUtils.dart +++ b/lib/uitl/CalendarUtils.dart @@ -19,7 +19,7 @@ class CalendarUtils { _completer = Completer(); try { final calendarsResult = await deviceCalendarPlugin.retrieveCalendars(); - _completer?.complete(CalendarUtils._(calendarsResult?.data!)); + _completer?.complete(CalendarUtils._(calendarsResult.data!)); } on Exception catch (e) { _completer!.completeError(e); final Future sharedPrefsFuture = _completer!.future; @@ -30,15 +30,27 @@ class CalendarUtils { return _completer!.future; } - Future createOrUpdateEvents({List scheduleList, String title, String description, List scheduleDateTime, List daysOfWeek}) async { - List events =[]; - scheduleDateTime.forEach((element) { + Future createOrUpdateEvents({List? scheduleList, String? title, String? description, List? scheduleDateTime, List? daysOfWeek}) async { + List events = []; + Location _currentLocation; + if (DateTime.now().timeZoneName == "+04") + _currentLocation = getLocation('Asia/Dubai'); + else + _currentLocation = getLocation('Asia/Riyadh'); + + scheduleDateTime!.forEach((element) { RecurrenceRule recurrenceRule = RecurrenceRule( RecurrenceFrequency.Daily, daysOfWeek: daysOfWeek, endDate: element, ); - Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: element, end: element.add(Duration(minutes: 30)), title: title, description: description); + //added byAamir Tz Time + Event event = Event(writableCalendars!.id, + recurrenceRule: recurrenceRule, + start: TZDateTime.from(element, _currentLocation), + end: TZDateTime.from(element.add(Duration(minutes: 30)), _currentLocation), + title: title, + description: description); events.add(event); }); @@ -47,7 +59,7 @@ class CalendarUtils { }); } - Future createOrUpdateEvent({String title, String description, DateTime scheduleDateTime, String eventId}) async { + Future createOrUpdateEvent({String? title, String? description, DateTime? scheduleDateTime, String? eventId}) async { RecurrenceRule recurrenceRule = RecurrenceRule( RecurrenceFrequency.Daily, // daysOfWeek: daysOfWeek, @@ -60,17 +72,17 @@ class CalendarUtils { else _currentLocation = getLocation('Asia/Riyadh'); - TZDateTime scheduleDateTimeUTZ = TZDateTime.from(scheduleDateTime, _currentLocation); + TZDateTime scheduleDateTimeUTZ = TZDateTime.from(scheduleDateTime!, _currentLocation); // print("eventId: " + eventId); // print("writableCalendars-name: " + writableCalendars.name); // print("writableCalendars-Id: " + writableCalendars.id); // print("writableCalendarsToString: " + writableCalendars.toString()); - Event event = Event(writableCalendars.id, start: scheduleDateTimeUTZ, end: scheduleDateTimeUTZ.add(Duration(minutes: 30)), title: title, description: description); + Event event = Event(writableCalendars!.id, start: scheduleDateTimeUTZ, end: scheduleDateTimeUTZ.add(Duration(minutes: 30)), title: title, description: description); deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e) { print("catchError " + e.toString()); }).whenComplete(() { - print("whenComplete " + eventId); + print("whenComplete " + eventId!); }); } @@ -87,8 +99,8 @@ class CalendarUtils { Future createCalendar( String calendarName, { - Color calendarColor, - String localAccountName, + Color? calendarColor, + String? localAccountName, }) async { return await deviceCalendarPlugin.createCalendar(calendarName, calendarColor: calendarColor, localAccountName: localAccountName); } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index d677e196..9f6b4abf 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -137,7 +137,7 @@ class LocalNotification { ///Repeat notification every day at approximately 10:00:00 am Future showDailyAtTime() async { - var time = Time(10, 0, 0); + // var time = Time(10, 0, 0); // var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( @@ -152,7 +152,7 @@ class LocalNotification { ///Repeat notification weekly on Monday at approximately 10:00:00 am Future showWeeklyAtDayAndTime() async { - var time = Time(10, 0, 0); + // var time = Time(10, 0, 0); // var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( diff --git a/lib/uitl/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index 756008bc..2e4d5a71 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -4,16 +4,16 @@ import 'package:shared_preferences/shared_preferences.dart'; class AppSharedPreferences { Future _prefs = SharedPreferences.getInstance(); - Map _allData; + Map? _allData; // To Test Saved Data - Future> getAll() async{ + Future> getAll() async { final prefs = (await _prefs); _allData = {}; prefs.getKeys().forEach((key) { - _allData[key] = prefs.get(key); + _allData![key] = prefs.get(key); }); - return _allData; + return _allData!; } /// Save String [key] the key for save value [value] the value we need to save it @@ -75,7 +75,7 @@ class AppSharedPreferences { getStringWithDefaultValue(String key, String defaultVal) async { final SharedPreferences prefs = await _prefs; await prefs.reload(); - String value = prefs.getString(key); + String value = prefs.getString(key)!; return value == null ? defaultVal : value; } @@ -110,7 +110,7 @@ class AppSharedPreferences { /// Get Object [key] the key was saved Future getObject(String key) async { try { - final SharedPreferences prefs = await _prefs; + final SharedPreferences prefs = await _prefs; await prefs.reload(); var string = prefs.getString(key); if (string == null) { diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index 30864569..db186ddd 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -5,44 +5,44 @@ import 'package:fluttertoast/fluttertoast.dart'; class AppToast { static void showToast({ - @required String message, - Toast toastLength, - int timeInSeconds, - double fontSize, - ToastGravity toastGravity, - Color backgroundColor, - Color textColor, - int radius, - int elevation, - int imageSize, + required String message, + Toast? toastLength, + int? timeInSeconds, + double? fontSize, + ToastGravity? toastGravity, + Color? backgroundColor, + Color? textColor, + int? radius, + int? elevation, + int? imageSize, }) { Fluttertoast.showToast( - msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: backgroundColor, textColor: textColor, fontSize: fontSize); + msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds!, backgroundColor: backgroundColor, textColor: textColor, fontSize: fontSize); } static void showSuccessToast({ - @required String message, + required String message, Toast toastLength = Toast.LENGTH_LONG, - int timeInSeconds, + int? timeInSeconds, double fontSize = 16, ToastGravity toastGravity = ToastGravity.TOP, Color textColor = Colors.white, - int radius, - int elevation, + int? radius, + int? elevation, int imageSize = 32, }) { - Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.green, textColor: textColor, fontSize: fontSize); + Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds!, backgroundColor: Colors.green, textColor: textColor, fontSize: fontSize); } static void showErrorToast({ - @required String message, + required String message, Toast toastLength = Toast.LENGTH_LONG, int timeInSeconds = 2, double fontSize = 16, ToastGravity toastGravity = ToastGravity.TOP, Color textColor = Colors.white, int radius = 15, - int elevation, + int? elevation, int imageSize = 32, }) { Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.red, textColor: textColor, fontSize: fontSize); diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index d4ff7857..cffdd1fd 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -9,12 +10,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:huawei_location/location/fused_location_provider_client.dart'; -import 'package:huawei_location/location/location.dart'; -import 'package:huawei_location/location/location_callback.dart'; -import 'package:huawei_location/location/location_request.dart'; -import 'package:huawei_location/location/location_settings_request.dart'; -import 'package:huawei_location/permission/permission_handler.dart'; +import 'package:huawei_location/huawei_location.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; @@ -28,9 +24,9 @@ class LocationUtils { LocationUtils({required this.isShowConfirmDialog, required this.context, this.isHuawei = false}); - void getCurrentLocation({required Function(LatLng) callBack}) async { + void getCurrentLocation({Function(LatLng)? callBack}) async { if (Platform.isAndroid && isHuawei) { - _getHMSCurrentLocation(callBack); + _getHMSCurrentLocation(callBack!); } else { Geolocator.isLocationServiceEnabled().then((value) async { if (value) { @@ -44,7 +40,9 @@ class LocationUtils { if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) { if (Platform.isAndroid) { - Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () async { + Utils.showPermissionConsentDialog(context, TranslationBase + .of(context) + .locationPermissionDialog, () async { final hasPermission = await _handlePermission(); if (hasPermission) { Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 10)).then((value) { @@ -56,7 +54,9 @@ class LocationUtils { } }); } else { - if (await Permission.location.request().isGranted) { + if (await Permission.location + .request() + .isGranted) { getCurrentLocation(callBack: callBack); } else { setZeroLocation(); @@ -99,10 +99,12 @@ class LocationUtils { return true; } - late LocationCallback _locationCallback; + late LocationCallback _locationCallback; _getHMSCurrentLocation(Function(LatLng) callBack) async { - PermissionHandler permissionHandler = PermissionHandler(); + PermissionStatus permissionHandler = await Permission.location.request(); + + // print(statuses[Permission.location]); int _locationUpdateCbId = 0; doIt() { @@ -120,7 +122,17 @@ class LocationUtils { Location location = locationResult.lastLocation!; locationService.removeLocationUpdatesCb(_locationUpdateCbId); callBack(LatLng(location.latitude!, location.longitude!)); - setLocation(Position(latitude: location.latitude!, longitude: location.longitude!, altitude: location.altitude!,timestamp: null, accuracy: 1.0, heading: 0.0, speed: 0.0, speedAccuracy: 1)); + setLocation(Position( + latitude: location.latitude!, + longitude: location.longitude!, + altitude: location.altitude!, + timestamp: null, + accuracy: 1.0, + heading: 0.0, + speed: 0.0, + speedAccuracy: 1, + altitudeAccuracy: 0.0, + headingAccuracy: 0.0)); }, onLocationAvailability: (locationAvailability) { print("onLocationAvailability: $locationAvailability"); })); @@ -131,7 +143,7 @@ class LocationUtils { }); } - if (await permissionHandler.hasLocationPermission()) { + if (await permissionHandler.isGranted) { doIt(); } else { bool has = await requestPermissions(); @@ -144,10 +156,18 @@ class LocationUtils { showErrorLocationDialog(bool isPermissionError) { ConfirmDialog dialog = new ConfirmDialog( context: context, - confirmMessage: TranslationBase.of(context).locationDialogMessage, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {ConfirmDialog.closeAlertDialog(context), if (isPermissionError) Geolocator.openAppSettings() else Geolocator.openLocationSettings(), Navigator.of(context).canPop()}, + confirmMessage: TranslationBase + .of(context) + .locationDialogMessage, + okText: TranslationBase + .of(context) + .confirm, + cancelText: TranslationBase + .of(context) + .cancel_nocaps, + okFunction: () => + {ConfirmDialog.closeAlertDialog(context), if (isPermissionError) Geolocator.openAppSettings() else + Geolocator.openLocationSettings(), Navigator.of(context).canPop()}, cancelFunction: () => {}); return dialog.showAlertDialog(context); } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index b4763328..5eae4093 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -220,7 +220,7 @@ class Utils { } static List myMedicalList({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count}) { - List medical =[]; + List medical = []; medical.add(InkWell( onTap: () => projectViewModel!.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null, @@ -242,12 +242,14 @@ class Utils { left: 8, top: 4, child: badge_import.Badge( - toAnimate: false, - elevation: 0, + badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false), + badgeStyle: badge_import.BadgeStyle( + elevation: 0, + shape: badge_import.BadgeShape.circle, + badgeColor: secondaryColor!.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + ), position: badge_import.BadgePosition.topEnd(), - shape: badge_import.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, fontWeight: FontWeight.bold, fontSize: 12.0)), @@ -260,12 +262,14 @@ class Utils { right: 8, top: 4, child: badge_import.Badge( - toAnimate: false, - elevation: 0, position: badge_import.BadgePosition.topEnd(), - shape: badge_import.BadgeShape.circle, - badgeColor: secondaryColor!.withOpacity(1.0), - borderRadius: BorderRadius.circular(8), + badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false), + badgeStyle: badge_import.BadgeStyle( + elevation: 0, + shape: badge_import.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, fontWeight: FontWeight.bold, fontSize: 12.0)), @@ -597,7 +601,7 @@ class Utils { } static List myMedicalListHomePage({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count}) { - List medical =[]; + List medical = []; medical.add(InkWell( onTap: () => projectViewModel!.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null, @@ -615,12 +619,14 @@ class Utils { left: 8, top: 4, child: badge_import.Badge( - toAnimate: false, - elevation: 0, position: badge_import.BadgePosition.topEnd(), - shape: badge_import.BadgeShape.circle, - badgeColor: secondaryColor!.withOpacity(1.0), - borderRadius: BorderRadius.circular(8), + badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false), + badgeStyle: badge_import.BadgeStyle( + elevation: 0, + shape: badge_import.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, fontWeight: FontWeight.bold, fontSize: 12.0)), @@ -633,12 +639,14 @@ class Utils { right: 8, top: 4, child: badge_import.Badge( - toAnimate: false, - elevation: 0, + badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false), + badgeStyle: badge_import.BadgeStyle( + elevation: 0, + shape: badge_import.BadgeShape.circle, + badgeColor: secondaryColor!.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + ), position: badge_import.BadgePosition.topEnd(), - shape: badge_import.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, fontWeight: FontWeight.bold, fontSize: 12.0)), @@ -820,10 +828,9 @@ class Utils { return isVidaPlus; } - // static String generateSignature() { - // - // } - +// static String generateSignature() { +// +// } } Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), required Widget child}) { diff --git a/lib/widgets/app_map/google_huawei_map.dart b/lib/widgets/app_map/google_huawei_map.dart index d9641247..1ae54f79 100644 --- a/lib/widgets/app_map/google_huawei_map.dart +++ b/lib/widgets/app_map/google_huawei_map.dart @@ -7,10 +7,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart' as googlemap; // import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; -import 'package:huawei_map/components/callbacks.dart'; -import 'package:huawei_map/components/cameraPosition.dart' as cameraposition; -import 'package:huawei_map/components/cameraPosition.dart'; -import 'package:huawei_map/map.dart' as hmsMap; +import 'package:huawei_map/huawei_map.dart' as hmsMap; class AppMap extends StatefulWidget { late VoidCallback onCameraMove; @@ -25,13 +22,13 @@ class AppMap extends StatefulWidget { @override State createState() => _state = AppMapState(); - moveTo({ required CameraPosition cameraPostion}) { + moveTo({ required googlemap.CameraPosition cameraPostion}) { if (_state!.isHuawei) { - final cameraJson = cameraPostion?.toMap(); + final cameraJson = cameraPostion.toMap(); final camera = hmsMap.CameraPosition.fromMap(cameraJson); _state?._huaweiMapController.animateCamera(hmsMap.CameraUpdate.newCameraPosition(camera)); } else { - _state?.googleMapController.animateCamera(googlemap.CameraUpdate.newCameraPosition(cameraPostion! as googlemap.CameraPosition)); + _state?.googleMapController.animateCamera(googlemap.CameraUpdate.newCameraPosition(cameraPostion as googlemap.CameraPosition)); } } } diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index 8ad2aa18..922388c7 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -107,11 +107,17 @@ class BottomNavigationItem extends StatelessWidget { right: 18.0, bottom: 28.0, child: badge_import.Badge( - toAnimate: false, + badgeStyle: badge_import.BadgeStyle( + shape: badge_import.BadgeShape.circle, + badgeColor: secondaryColor!.withOpacity(1.0), + borderRadius: BorderRadius.circular(8) + ), + // toAnimate: false, + badgeAnimation: badge_import.BadgeAnimation.fade(toAnimate: false), position: badge_import.BadgePosition.topEnd(), - shape: badge_import.BadgeShape.circle, - badgeColor: secondaryColor!.withOpacity(1.0), - borderRadius: BorderRadius.circular(8), + // shape: badge_import.BadgeShape.circle, + // badgeColor: secondaryColor!.withOpacity(1.0), + // borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), child: Text(model.count.toString(), style: TextStyle(color: Colors.white, fontSize: 14.0)), diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index 9ac98acd..34be0f60 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -11,7 +11,7 @@ extension WithContainer on Widget { class DefaultButton extends StatelessWidget { final String text; - final VoidCallback onPress; + final VoidCallback? onPress; final Color textColor; final Color? color; final Color? disabledColor; diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 3fb690f2..d3e5b69d 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -75,7 +75,7 @@ class AppScaffold extends StatefulWidget { final int? dropdownIndexValue; List? dropDownList; final void Function(int?)? dropDownIndexChange; - VoidCallbackAction? onTap; + VoidCallbackAction()? onTap; final bool isMainPharmacyPages; final bool extendBody; final ValueChanged? changeCurrentTab; diff --git a/lib/widgets/pickupLocation/PickupLocationFromMap.dart b/lib/widgets/pickupLocation/PickupLocationFromMap.dart index fbfbb302..2f2276ae 100644 --- a/lib/widgets/pickupLocation/PickupLocationFromMap.dart +++ b/lib/widgets/pickupLocation/PickupLocationFromMap.dart @@ -13,10 +13,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:geocoding/geocoding.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart' as googleMap; +import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; -import 'package:huawei_map/components/cameraPosition.dart'; -import 'package:huawei_map/components/latLng.dart'; import 'package:provider/provider.dart'; class PickupLocationFromMap extends StatefulWidget { @@ -57,7 +56,8 @@ class _PickupLocationFromMapState extends State { } appMap = AppMap( - kGooglePlex.toMap(), + //changed by Aamir + kGooglePlex.toMap() as Map, onCameraMove: () { _updatePosition(kGooglePlex); }, @@ -180,7 +180,7 @@ class _PickupLocationFromMapState extends State { void _updatePosition(CameraPosition _position) { print(_position); - latitude = _position.target.lat; - longitude = _position.target.lng; + latitude = _position.target.latitude; + longitude = _position.target.longitude; } } diff --git a/pubspec.yaml b/pubspec.yaml index 27e3635d..75b516fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,13 +34,14 @@ dependencies: health: ^3.0.3 #chart - fl_chart: ^0.45.0 + fl_chart: 0.45.0 + #Camera Preview camera: ^0.10.1 # Permissions - permission_handler: ^10.2.0 + permission_handler: ^11.0.1 # Flutter Html View flutter_html: ^2.2.1 @@ -62,14 +63,14 @@ dependencies: # Progress bar flutter_progress_hud: ^2.0.2 - percent_indicator: ^3.4.0 + percent_indicator: ^4.2.3 # Icons font_awesome_flutter: any cupertino_icons: ^1.0.0 # Image Attachments - image_picker: ^0.8.5+3 + image_picker: ^1.0.4 #GIF image # flutter_gifimage: ^1.0.1 @@ -90,13 +91,13 @@ dependencies: google_maps_flutter: ^2.1.1 # Huawei - huawei_map: 6.5.0+301 + huawei_map: ^6.11.0+304 huawei_push: ^6.5.0+300 # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 # flutter_polyline_points: ^1.0.0 - location: ^4.3.0 + location: ^5.0.3 # Qr code Scanner # barcode_scan_fix: ^1.0.2 barcode_scan2: ^4.2.2 @@ -105,7 +106,7 @@ dependencies: flutter_rating_bar: ^4.0.1 # Calendar - syncfusion_flutter_calendar: ^19.3.55 + syncfusion_flutter_calendar: ^23.1.42 # SVG Images # flutter_svg: ^0.23.0+1 @@ -114,7 +115,7 @@ dependencies: manage_calendar_events: ^2.0.1 #InAppBrowser - flutter_inappwebview: 5.7.2+3 + flutter_inappwebview: ^5.8.0 #Circular progress bar for reverse timer circular_countdown_timer: ^0.2.0 @@ -147,19 +148,19 @@ dependencies: #Flutter WebRTC flutter_webrtc: ^0.9.7 - screen_brightness: ^0.1.2 + screen_brightness: ^0.2.2+1 #google maps places google_maps_place_picker_mb: ^3.0.0 # google_maps_place_picker: ^2.1.0-nullsafety.3 - map_launcher: ^2.5.0+1 + map_launcher: ^3.0.1 #countdown timer for Upcoming List flutter_countdown_timer: ^4.1.0 #Dependencies for video call implementation native_device_orientation: ^1.0.0 - wakelock: ^0.5.6 + wakelock: ^0.6.2 after_layout: ^1.1.0 # twilio_programmable_video: ^0.11.0+1 cached_network_image: ^3.1.0+1 @@ -177,11 +178,11 @@ dependencies: speech_to_text: ^6.1.1 # path: speech_to_text - in_app_update: ^3.0.0 + in_app_update: ^4.2.2 in_app_review: ^2.0.3 - badges: ^2.0.1 + badges: ^3.1.2 flutter_app_icon_badge: ^2.0.0 # syncfusion_flutter_sliders: ^19.3.55 # searchable_dropdown: ^1.1.3 @@ -189,13 +190,13 @@ dependencies: youtube_player_flutter: ^8.0.0 # Dep by Zohaib - shimmer: ^2.0.0 + shimmer: ^3.0.0 carousel_slider: ^4.0.0 # flutter_material_pickers: ^3.1.2 - flutter_staggered_grid_view: ^0.4.1 + flutter_staggered_grid_view: ^0.7.0 # flutter_hms_gms_availability: ^2.0.0 huawei_hmsavailability: ^6.6.0+300 - huawei_location: 6.0.0+302 + huawei_location: ^6.11.0+301 # Marker Animation # flutter_animarker: ^3.2.0 @@ -206,7 +207,7 @@ dependencies: # sms_retriever: ^1.0.0 sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.1.0 - google_api_availability: ^3.0.1 + google_api_availability: ^5.0.0 # open_file: ^3.2.1 open_filex: ^4.3.2 path_provider: ^2.0.8