diff --git a/lib/config/config.dart b/lib/config/config.dart index 23c9f20a..f3f37cb4 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -28,7 +28,7 @@ var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'https://webservices.hmg.com/'; -// Pharmacy UAT URLs +// Pharmacy UAT URLsProductDetailService // var BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // var PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/main.dart b/lib/main.dart index 36e86ed9..a6008faa 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/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 2eb47131..522486f3 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1,6 +1,4 @@ -import 'dart:convert'; import 'dart:io'; - import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; @@ -28,10 +26,10 @@ class DoctorsListService extends BaseService { AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); - double lat; - double long; - String deviceToken; - String tokenID; + late double lat; + late double long; + late String deviceToken; + late String tokenID; List selectedBodyPartList = []; Future getDoctorsList(int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId, doctorName, isContinueDentalPlan = false}) async { @@ -92,8 +90,8 @@ class DoctorsListService extends BaseService { Future getDoctorsListByName(String docName, BuildContext context) async { Map request; - double lat; - double long; + late double lat; + late double long; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -257,7 +255,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context, [ProjectViewModel projectViewModel]) async { + Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context, [ProjectViewModel? projectViewModel]) async { Map request; var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); @@ -281,7 +279,7 @@ class DoctorsListService extends BaseService { }; if (clinicID == 253) { - List procedureID = projectViewModel.selectedBodyPartList.map((element) => element.id.toString()).toList(); + List procedureID = projectViewModel!.selectedBodyPartList.map((element) => element.id.toString()).toList(); request["GeneralProcedureList"] = procedureID; if (procedureID.length == 1 && procedureID[0] == "1") { request["ProcedureSlotDuration"] = 90; @@ -799,7 +797,7 @@ class DoctorsListService extends BaseService { "IsForLiveCare": appo.isLiveCareAppointment, "OriginalClinicID": appo.originalClinicID, "OriginalProjectID": appo.originalProjectID, - "StrAppointmentDate": DateUtil.getDateFormatted(appo.appointmentDate), + "StrAppointmentDate": DateUtil.getDateFormatted(appo.appointmentDate!), "VersionID": req.VersionID, "Channel": req.Channel, "LanguageID": languageID == 'ar' ? 1 : 2, @@ -1306,7 +1304,7 @@ class DoctorsListService extends BaseService { "ListPrescriptions": prescriptionReportEnhList, "PatientIditificationNum": authUser.patientIdentificationNo, "PatientMobileNumber": authUser.mobileNumber, - "PatientName": authUser.firstName + " " + authUser.lastName, + "PatientName": authUser.firstName! + " " + authUser.lastName!, "To": authUser.emailAddress, "SetupID": setupId, "VersionID": req.VersionID, @@ -1395,7 +1393,7 @@ class DoctorsListService extends BaseService { "AccountID": patientID, "PaymentAmount": payedAmount, "NationalityID": null, - "DepositorName": authUser.firstName + " " + authUser.lastName, + "DepositorName": authUser.firstName! + " " + authUser.lastName!, "CreatedBy": 3, "PaymentMethodName": paymentMethodName, "PaymentReference": paymentReference, @@ -1443,7 +1441,7 @@ class DoctorsListService extends BaseService { "ProjectId": projectID, "PatientId": authUser.patientID, "ClinicId": 10, - "DepositorName": authUser.firstName + " " + authUser.lastName, + "DepositorName": authUser.firstName! + " " + authUser.lastName!, "MemberId": authUser.patientID, "NationalityID": authUser.nationalityID, "PaymentAmount": payedAmount, @@ -1487,7 +1485,7 @@ class DoctorsListService extends BaseService { "PatientId": authUser.patientID, "ClinicId": 10, "FormId": 15, - "DepositorName": authUser.firstName + " " + authUser.lastName, + "DepositorName": authUser.firstName! + " " + authUser.lastName!, "MemberId": authUser.patientID, "NationalityID": authUser.nationalityID, "PaymentAmount": payedAmount, @@ -1604,14 +1602,14 @@ class DoctorsListService extends BaseService { "apple_signature": applePayRequest.appleSignature, "apple_header": { "apple_applicationData": "76a9a9cb2d9811e8de56d8e7713601bfa6acda3d488b1cf03b9b115bc3ff12b4", - "apple_ephemeralPublicKey": applePayRequest.appleHeader.appleEphemeralPublicKey, - "apple_publicKeyHash": applePayRequest.appleHeader.applePublicKeyHash, - "apple_transactionId": applePayRequest.appleHeader.appleTransactionId + "apple_ephemeralPublicKey": applePayRequest.appleHeader!.appleEphemeralPublicKey!, + "apple_publicKeyHash": applePayRequest.appleHeader!.applePublicKeyHash!, + "apple_transactionId": applePayRequest.appleHeader!.appleTransactionId }, "apple_paymentMethod": { - "apple_displayName": applePayRequest.applePaymentMethod.appleDisplayName, - "apple_network": applePayRequest.applePaymentMethod.appleNetwork, - "apple_type": applePayRequest.applePaymentMethod.appleType + "apple_displayName": applePayRequest.applePaymentMethod!.appleDisplayName, + "apple_network": applePayRequest.applePaymentMethod!.appleNetwork, + "apple_type": applePayRequest.applePaymentMethod!.appleType } }; dynamic localRes; @@ -1808,7 +1806,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel projectViewModel]) async { + Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel? projectViewModel]) async { Map requestFreeSlots; Map request; diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index d61e8ef7..e86ff18e 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -122,12 +122,12 @@ class AuthProvider with ChangeNotifier { var imei = await sharedPref.getString(PUSH_TOKEN); // if (!request.) { newRequest.iMEI = imei; //imei!=null ? imei : ''; - newRequest.firstName = request.firstName ?? "" + " " + request.lastName ?? ""; - newRequest.firstNameN = request.firstNameN ?? "" + " " + request.lastNameN ?? ""; + newRequest.firstName = request.firstName ?? "" + " " + request.lastName! ?? ""; + newRequest.firstNameN = request.firstNameN ?? "" + " " + request.lastNameN! ?? ""; newRequest.lastNameN = request.lastNameN ?? ""; newRequest.outSA = request.outSA == 1 ? true : false; newRequest.biometricEnabled = false; - newRequest.preferredLanguage = int.parse(request.preferredLanguage) ?? 1; + newRequest.preferredLanguage = int.parse(request.preferredLanguage!) ?? 1; newRequest.logInTypeID = lastLogin ?? 1; newRequest.patientID = request.patientID; newRequest.mobileNo = request.mobileNumber; @@ -373,14 +373,14 @@ class AuthProvider with ChangeNotifier { request['LogInTokenID'] = await sharedPref.getString(LOGIN_TOKEN_ID); var nhic = await sharedPref.getObject(NHIC_DATA); var requestN = RegisterUserRequest.fromJson(request); - requestN.patientOutSA = requestN.patientobject.patientOutSA; + requestN.patientOutSA = requestN.patientobject!.patientOutSA!; final DateFormat dateFormat = DateFormat('MM/dd/yyyy'); final DateFormat dateFormat2 = DateFormat('dd/MM/yyyy'); if(nhic !=null) { requestN.dob = nhic['IsHijri'] ? nhic['DateOfBirth'] : dateFormat2.format( dateFormat.parse(nhic['DateOfBirth'])); requestN.isHijri = nhic['IsHijri'] ? 1 : 0; - requestN.healthId = requestN.patientobject.eHealthIDField; + requestN.healthId = requestN.patientobject!.eHealthIDField!; } requestN.zipCode = requestN.patientOutSA == 1 ? '971' : '966'; @@ -407,7 +407,7 @@ class AuthProvider with ChangeNotifier { request.deviceToken = deviceToken; request.voipToken = ""; //this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false); request.deviceType = Platform.isIOS ? "1" : "2"; - request.patientMobileNumber = user.mobileNumber[0] == '0' ? user.mobileNumber : '0' + user.mobileNumber; + request.patientMobileNumber = user.mobileNumber![0] == '0' ? user.mobileNumber : '0' + user.mobileNumber!; request.nationalID = user.patientIdentificationNo; request.gender = user.gender; request.patientID = user.patientID; @@ -416,7 +416,7 @@ class AuthProvider with ChangeNotifier { request.mACAddress = '00:00:00:00:00:00'; request.latitude = lat; request.longitude = long; - request.languageID = int.parse(user.preferredLanguage); + request.languageID = int.parse(user.preferredLanguage!); request.patientTypeID = user.patientType; request.patientType = user.patientType; dynamic localRes; @@ -566,7 +566,7 @@ class AuthProvider with ChangeNotifier { await authenticatedUserObject.getUser(); Provider.of(AppGlobal.context, listen: false).isLogin = false; var model = Provider.of(AppGlobal.context, listen: false); - model.setState(0, false, null); + model.setState(0, false, ""); Navigator.of(AppGlobal.context).pushReplacementNamed(HOME); } } diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 8bf3a0ec..296d2b00 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -14,8 +14,8 @@ class ClinicListService extends BaseService { AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); - double lat; - double long; + late double lat; + late double long; Future getClinicsList(context) async { Map request; diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 901d3b42..a9443538 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -34,7 +34,7 @@ class FamilyFilesProvider with ChangeNotifier { bool isLogin = false; bool isLoading = true; dynamic authenticatedUser; - GetAllSharedRecordsByStatusResponse allSharedRecordsByStatusResponse; + GetAllSharedRecordsByStatusResponse? allSharedRecordsByStatusResponse; Future getSharedRecordByStatus() async { dynamic localRes; @@ -241,7 +241,7 @@ class FamilyFilesProvider with ChangeNotifier { request['PatientOutSA'] = currentUser.outSA; //currentUser.outSA; //? 1 : 0; request['LoginType'] = await sharedPref.getInt(LAST_LOGIN) ?? 1; - request['MobileNo'] = currentUser.mobileNumber[0].toString() == "0" ? currentUser.mobileNumber.toString() : '0' + currentUser.mobileNumber.toString(); + request['MobileNo'] = currentUser.mobileNumber![0].toString() == "0" ? currentUser.mobileNumber.toString() : '0' + currentUser.mobileNumber.toString(); request['PatientMobileNumber'] = currentUser.mobileNumber; //['MobileNumber']; request['SearchType'] = 2; // request['SuperUser'] = currentUser.patientID; //currentUser.PatientID; diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 2a18c79c..60d794ae 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -203,7 +203,7 @@ class LiveCareService extends BaseService { Future addNewCallForPatientER(int serviceID, String clientRequestID, bool isPharma, BuildContext context) async { Map request; - String deviceToken; + String? deviceToken; String voipToken = await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN); getDeviceToken().then((value) { print(value); @@ -219,7 +219,7 @@ class LiveCareService extends BaseService { "IsPharmacy": isPharma, "ErServiceID": serviceID, "ClientRequestID": clientRequestID, - "DeviceToken": deviceToken, + "DeviceToken": deviceToken!, "VoipToken": voipToken, "IsFlutter": true, "Latitude": await this.sharedPref.getDouble(USER_LAT), diff --git a/lib/services/my_invoice_service/my_invoice_services.dart b/lib/services/my_invoice_service/my_invoice_services.dart index 561f0da1..92463537 100644 --- a/lib/services/my_invoice_service/my_invoice_services.dart +++ b/lib/services/my_invoice_service/my_invoice_services.dart @@ -100,7 +100,7 @@ class MyInvoicesService extends BaseService { "PatientID": authUser.patientID, "License": true, "AppointmentNo": appoNo, - "To": authProvider.authenticatedUserObject.user.emailAddress, + "To": authProvider.authenticatedUserObject.user!.emailAddress, "IsRegistered": true, "ProjectID": projectID, "PatientTypeID": authUser.patientIdentificationType, diff --git a/lib/services/permission/permission_service.dart b/lib/services/permission/permission_service.dart index 4ce28251..eb41ecc0 100644 --- a/lib/services/permission/permission_service.dart +++ b/lib/services/permission/permission_service.dart @@ -8,7 +8,7 @@ import 'package:geolocator/geolocator.dart' as geo; class PermissionService extends BaseService { final LocalStorage storage = new LocalStorage("permission"); - geo.LocationPermission locationPermission; + geo.LocationPermission? locationPermission; AppGlobal appGlobal = new AppGlobal(); setVibrationPermission(flag) async { @@ -25,7 +25,7 @@ class PermissionService extends BaseService { vibrate(callback, context) async { if (callback == null) return null; if (isVibrationEnabled() == true) { - if (await Vibration.hasVibrator()) { + if (await Vibration.hasVibrator() !=null) { Vibration.vibrate(duration: 100); callback(); } diff --git a/lib/services/pharmacy_services/brands_service.dart b/lib/services/pharmacy_services/brands_service.dart index 6a010bd6..cf348a46 100644 --- a/lib/services/pharmacy_services/brands_service.dart +++ b/lib/services/pharmacy_services/brands_service.dart @@ -49,8 +49,8 @@ class BrandsService extends BaseService { }); } - Future searchProducts({String productName}) async { - RegExp exp = new RegExp(productName.toUpperCase()); + Future searchProducts({String? productName}) async { + RegExp exp = new RegExp(productName!.toUpperCase()); hasError = false; _searchList.clear(); await baseAppClient.getPharmacy( diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart index f02ce3db..562468c9 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -10,7 +10,7 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' class PharmacyAddressService extends BaseService { List addresses =[]; - CountryData country; + CountryData? country; int selectedAddressIndex = 0; Future> getAddresses() async { @@ -18,7 +18,7 @@ class PharmacyAddressService extends BaseService { var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); Map queryParams = {'fields': 'addresses'}; hasError = false; - Addresses selectedAddress; + Addresses? selectedAddress; try { var completer = Completer(); @@ -31,7 +31,7 @@ class PharmacyAddressService extends BaseService { int index = 0; response['customers'][0]['addresses'].forEach((item) { AddressInfo address = AddressInfo.fromJson(item); - if (selectedAddress != null && selectedAddress.id == item["id"]) { + if (selectedAddress! != null && selectedAddress!.id == item["id"]) { selectedAddressIndex = index; } addresses.add(address); diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index e4de60db..3d01d018 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -12,19 +12,19 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; class ProductDetailService extends BaseService { bool isLogin = false; - num _stockQuantity; + num? _stockQuantity; - num get stockQuantity => _stockQuantity; + num? get stockQuantity => _stockQuantity; - String _stockAvailability; - String _stockAvailabilityn; + String? _stockAvailability; + String? _stockAvailabilityn; - String get stockAvailability => _stockAvailability; - String get stockAvailabilityn => _stockAvailabilityn; + String? get stockAvailability => _stockAvailability; + String? get stockAvailabilityn => _stockAvailabilityn; - bool _isStockAvailable; + bool? _isStockAvailable; - bool get isStockAvailable => _isStockAvailable; + bool? get isStockAvailable => _isStockAvailable; List _productDetailList =[]; 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..b60c32a7 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! as List)); } on Exception catch (e) { _completer!.completeError(e); final Future sharedPrefsFuture = _completer!.future; @@ -30,15 +30,15 @@ class CalendarUtils { return _completer!.future; } - Future createOrUpdateEvents({List scheduleList, String title, String description, List scheduleDateTime, List daysOfWeek}) async { + Future createOrUpdateEvents({List? scheduleList, String? title, String? description, List? scheduleDateTime, List? daysOfWeek}) async { List events =[]; - scheduleDateTime.forEach((element) { + 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); + Event event = Event(writableCalendars!.id, recurrenceRule: recurrenceRule, start: element, end: element.add(Duration(minutes: 30)), title: title, description: description); events.add(event); }); @@ -47,7 +47,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 +60,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 +87,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/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index 756008bc..809210da 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -4,7 +4,7 @@ import 'package:shared_preferences/shared_preferences.dart'; class AppSharedPreferences { Future _prefs = SharedPreferences.getInstance(); - Map _allData; + late Map _allData; // To Test Saved Data Future> getAll() async{ @@ -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; } 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/utils.dart b/lib/uitl/utils.dart index b4763328..bf2678a7 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -387,7 +387,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(22) ? Navigator.push(context, FadePage(page: InsuranceCard())) : null, + onTap: () => projectViewModel.havePrivilege(22) ? Navigator.push(context, FadePage(page: InsuranceCard(appointmentNo: 0,))) : null, child: MedicalProfileItem( title: TranslationBase.of(context).insurance, imagePath: 'insurance_card.svg', @@ -408,7 +408,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval())) : null, + onTap: () => projectViewModel.havePrivilege(18) ? Navigator.push(context, FadePage(page: InsuranceApproval(appointmentNo: 0,))) : null, child: MedicalProfileItem( title: TranslationBase.of(context).insuranceApproval, imagePath: 'insurance_approval.svg', diff --git a/lib/widgets/others/bottom_bar.dart b/lib/widgets/others/bottom_bar.dart index d1742668..7fe974ff 100644 --- a/lib/widgets/others/bottom_bar.dart +++ b/lib/widgets/others/bottom_bar.dart @@ -349,7 +349,7 @@ class _SearchBot extends State { break; case '12': { - Navigator.push(context, FadePage(page: InsuranceApproval())); + Navigator.push(context, FadePage(page: InsuranceApproval(appointmentNo: 0,))); } break; case '13': diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 136ae538..7b2b136e 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -460,7 +460,7 @@ class _FloatingSearchButton extends State with TickerProvi break; case '12': { - Navigator.push(context, FadePage(page: InsuranceApproval())); + Navigator.push(context, FadePage(page: InsuranceApproval(appointmentNo: 0,))); } break; case '13':