diff --git a/lib/Constants.dart b/lib/Constants.dart index 598fa85e..3cb69afd 100644 --- a/lib/Constants.dart +++ b/lib/Constants.dart @@ -1,3 +1,5 @@ import 'package:flutter/material.dart'; -final Color? secondaryColor = Colors.red[800]; \ No newline at end of file +final Color? secondaryColor = Colors.red[800]; + +final Color? dividerColor = Colors.grey[600]; \ No newline at end of file diff --git a/lib/analytics/flows/appointments.dart b/lib/analytics/flows/appointments.dart index 92142761..d96421da 100644 --- a/lib/analytics/flows/appointments.dart +++ b/lib/analytics/flows/appointments.dart @@ -112,8 +112,8 @@ class Appointment { } // R024.1 - book_appointment_time_selection({required String appointment_type, required DateTime dateTime, required DoctorList doctor}) { - final day = DateUtil.getWeekDay(dateTime.weekday); + book_appointment_time_selection({required String appointment_type, required DateTime? dateTime, required DoctorList doctor}) { + final day = DateUtil.getWeekDay(dateTime!.weekday); final hour = DateFormat('HH').format(dateTime); logger('book_appointment_time_selection', parameters: { 'appointment_type': appointment_type, diff --git a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart index 91e09c0a..864dcaa7 100644 --- a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart @@ -153,7 +153,7 @@ class H2OViewModel extends BaseViewModel { Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async { setState(ViewState.BusyLocal); - insertUserActivityRequestModel.mobileNumber = user!.mobileNumber.substring(1); + insertUserActivityRequestModel.mobileNumber = user!.mobileNumber!.substring(1); insertUserActivityRequestModel.identificationNo = user!.patientIdentificationNo; await _h2OService.insertUserActivity(insertUserActivityRequestModel); diff --git a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart index 348c4ea5..5e25e3e8 100644 --- a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart +++ b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart @@ -47,8 +47,8 @@ class EReferralViewModel extends BaseViewModel { void getAllProjects() async { } - - void sendActivationCodeForEReferral(SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { +//Changed By Aamir into Future + Future sendActivationCodeForEReferral(SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { setState(ViewState.BusyLocal); await _eReferralService.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); if (_eReferralService.hasError) { @@ -69,8 +69,8 @@ class EReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } } - - void createEReferral( +//Changed by Aamir to Future + Future createEReferral( CreateEReferralRequestModel createEReferralRequestModel) async { setState(ViewState.BusyLocal); await _eReferralService.createEReferral(createEReferralRequestModel); diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index 1b0df143..2cc61db7 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -143,7 +143,7 @@ class MyBalanceViewModel extends BaseViewModel { } Future checkActivationCodeForAdvancePayment( - {required String activationCode, required String patientMobileNumber}) async { + {required String activationCode, String? patientMobileNumber}) async { setState(ViewState.Busy); await _myBalanceService.checkActivationCodeForAdvancePayment( activationCode: activationCode); diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart index ac514dc2..90a7e23d 100644 --- a/lib/models/SmartWatch/HealthData.dart +++ b/lib/models/SmartWatch/HealthData.dart @@ -1,9 +1,9 @@ class healthData { - int MedCategoryID; - int MedSubCategoryID; - String MachineDate; - double Value; - int TransactionsListID; + int? MedCategoryID; + int? MedSubCategoryID; + String? MachineDate; + double? Value; + int? TransactionsListID; healthData({ this.MedCategoryID, diff --git a/lib/models/SmartWatch/WeeklyHeartRateResModel.dart b/lib/models/SmartWatch/WeeklyHeartRateResModel.dart index 17dbb563..1c21c22d 100644 --- a/lib/models/SmartWatch/WeeklyHeartRateResModel.dart +++ b/lib/models/SmartWatch/WeeklyHeartRateResModel.dart @@ -1,8 +1,8 @@ class WeeklyHeartRateResModel { - num valueAvg; - String machineDate; - int medCategoryID; - int patientID; + num? valueAvg; + String? machineDate; + int? medCategoryID; + int? patientID; WeeklyHeartRateResModel( {this.valueAvg, this.machineDate, this.medCategoryID, this.patientID}); diff --git a/lib/models/SmartWatch/WeeklyStepsResModel.dart b/lib/models/SmartWatch/WeeklyStepsResModel.dart index ceae9d3b..e2af2dbd 100644 --- a/lib/models/SmartWatch/WeeklyStepsResModel.dart +++ b/lib/models/SmartWatch/WeeklyStepsResModel.dart @@ -1,14 +1,14 @@ class WeeklyStepsResModel { - int iD; - int patientID; - int medCategoryID; - int medSubCategoryID; - num value; - String machineDate; - bool patientOutSA; + int? iD; + int? patientID; + int? medCategoryID; + int? medSubCategoryID; + num? value; + String? machineDate; + bool? patientOutSA; dynamic notes; - bool isActive; - String createdOn; + bool? isActive; + String? createdOn; WeeklyStepsResModel({this.iD, this.patientID, this.medCategoryID, this.medSubCategoryID, this.value, this.machineDate, this.patientOutSA, this.notes, this.isActive, this.createdOn}); @@ -17,7 +17,7 @@ class WeeklyStepsResModel { patientID = json['PatientID']; medCategoryID = json['MedCategoryID']; medSubCategoryID = json['MedSubCategoryID']; - value = json['Value'] != null ? num.tryParse(json['Value']).toInt() : 0; + value = json['Value'] != null ? num.tryParse(json['Value'])!.toInt() : 0; machineDate = json['MachineDate']; patientOutSA = json['PatientOutSA']; notes = json['Notes']; diff --git a/lib/models/SmartWatch/YearlyHeartRateResModel.dart b/lib/models/SmartWatch/YearlyHeartRateResModel.dart index 1d045b19..2e751ee8 100644 --- a/lib/models/SmartWatch/YearlyHeartRateResModel.dart +++ b/lib/models/SmartWatch/YearlyHeartRateResModel.dart @@ -1,10 +1,10 @@ class YearlyHeartRateResModel { - num valueAvg; - int medCategoryID; - int month; - String monthName; - int patientID; - int year; + num? valueAvg; + int? medCategoryID; + int? month; + String? monthName; + int? patientID; + int? year; YearlyHeartRateResModel( {this.valueAvg, diff --git a/lib/models/SmartWatch/YearlyStepsResModel.dart b/lib/models/SmartWatch/YearlyStepsResModel.dart index c98fff27..13392105 100644 --- a/lib/models/SmartWatch/YearlyStepsResModel.dart +++ b/lib/models/SmartWatch/YearlyStepsResModel.dart @@ -1,10 +1,10 @@ class YearlyStepsResModel { - num valueSum; - int medCategoryID; - int month; - String monthName; - int patientID; - int year; + num? valueSum; + int? medCategoryID; + int? month; + String? monthName; + int? patientID; + int? year; YearlyStepsResModel( {this.valueSum, @@ -21,7 +21,7 @@ class YearlyStepsResModel { monthName = json['MonthName']; patientID = json['PatientID']; year = json['Year']; - valueSum = valueSum != null ? valueSum.toInt() : valueSum; + valueSum = valueSum != null ? valueSum!.toInt() : valueSum; } Map toJson() { diff --git a/lib/models/apple_pay_request.dart b/lib/models/apple_pay_request.dart index 4cb6a9e8..f4880544 100644 --- a/lib/models/apple_pay_request.dart +++ b/lib/models/apple_pay_request.dart @@ -1,22 +1,22 @@ class ApplePayRequest { - String currency; - String language; - String customername; + String? currency; + String? language; + String? customername; dynamic customerEmail; - String orderdescription; - String liveServiceid; + String? orderdescription; + String? liveServiceid; dynamic longitude; dynamic latitude; - String devicetoken; - String clientrequestid; - String projectid; - String serviceid; - String patientid; - String amount; - String appleData; - String appleSignature; - AppleHeader appleHeader; - ApplePaymentMethod applePaymentMethod; + String? devicetoken; + String? clientrequestid; + String? projectid; + String? serviceid; + String? patientid; + String? amount; + String? appleData; + String? appleSignature; + AppleHeader? appleHeader; + ApplePaymentMethod? applePaymentMethod; ApplePayRequest( {this.currency, @@ -78,20 +78,20 @@ class ApplePayRequest { data['apple_data'] = this.appleData; data['apple_signature'] = this.appleSignature; if (this.appleHeader != null) { - data['apple_header'] = this.appleHeader.toJson(); + data['apple_header'] = this.appleHeader!.toJson(); } if (this.applePaymentMethod != null) { - data['apple_paymentMethod'] = this.applePaymentMethod.toJson(); + data['apple_paymentMethod'] = this.applePaymentMethod!.toJson(); } return data; } } class AppleHeader { - String appleApplicationData; - String appleEphemeralPublicKey; - String applePublicKeyHash; - String appleTransactionId; + String? appleApplicationData; + String? appleEphemeralPublicKey; + String? applePublicKeyHash; + String? appleTransactionId; AppleHeader({this.appleApplicationData, this.appleEphemeralPublicKey, this.applePublicKeyHash, this.appleTransactionId}); @@ -113,9 +113,9 @@ class AppleHeader { } class ApplePaymentMethod { - String appleDisplayName; - String appleNetwork; - String appleType; + String? appleDisplayName; + String? appleNetwork; + String? appleType; ApplePaymentMethod({this.appleDisplayName, this.appleNetwork, this.appleType}); diff --git a/lib/models/apple_pay_response.dart b/lib/models/apple_pay_response.dart index f53b3d50..7628873e 100644 --- a/lib/models/apple_pay_response.dart +++ b/lib/models/apple_pay_response.dart @@ -1,11 +1,11 @@ import 'dart:convert'; class ApplePayResponse { - PaymentMethod paymentMethod; + PaymentMethod? paymentMethod; dynamic billingContact; dynamic shippingMethod; dynamic shippingContact; - Token token; + Token? token; ApplePayResponse( {this.paymentMethod, @@ -27,13 +27,13 @@ class ApplePayResponse { Map toJson() { final Map data = new Map(); if (this.paymentMethod != null) { - data['paymentMethod'] = this.paymentMethod.toJson(); + data['paymentMethod'] = this.paymentMethod!.toJson(); } data['billingContact'] = this.billingContact; data['shippingMethod'] = this.shippingMethod; data['shippingContact'] = this.shippingContact; if (this.token != null) { - data['token'] = this.token.toJson(); + data['token'] = this.token!.toJson(); } return data; } @@ -62,10 +62,10 @@ class PaymentMethod { } class Token { - String version; - String data; - String signature; - Header header; + String? version; + String? data; + String? signature; + Header? header; Token({this.version, this.data, this.signature, this.header}); @@ -83,16 +83,16 @@ class Token { data['data'] = this.data; data['signature'] = this.signature; if (this.header != null) { - data['header'] = this.header.toJson(); + data['header'] = this.header!.toJson(); } return data; } } class Header { - String ephemeralPublicKey; - String publicKeyHash; - String transactionId; + String? ephemeralPublicKey; + String? publicKeyHash; + String? transactionId; Header({this.ephemeralPublicKey, this.publicKeyHash, this.transactionId}); diff --git a/lib/models/gradient_color.dart b/lib/models/gradient_color.dart index d2a32e8d..b2114b97 100644 --- a/lib/models/gradient_color.dart +++ b/lib/models/gradient_color.dart @@ -10,26 +10,26 @@ class GradientColor { List bannerColor = [ new GradientColor(Color(0xFFF2B353E), Color(0xFFF71787E)), new GradientColor(Color(0xFFFD02127), Color(0xFFFEE6161)), - new GradientColor(Colors.blue[700], Colors.blue[400]), - new GradientColor(Colors.yellow[700], Colors.yellow), - new GradientColor(Colors.orange[800], Colors.orange), - new GradientColor(Colors.green[800], Colors.green[500]), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), - new GradientColor(Colors.brown[700], Colors.brown), + new GradientColor(Colors.blue[700]!, Colors.blue[400]!), + new GradientColor(Colors.yellow[700]!, Colors.yellow), + new GradientColor(Colors.orange[800]!, Colors.orange), + new GradientColor(Colors.green[800]!, Colors.green[500]!), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), + new GradientColor(Colors.brown[700]!, Colors.brown), ]; diff --git a/lib/models/header_model.dart b/lib/models/header_model.dart index 1f4d14fc..6d176d4f 100644 --- a/lib/models/header_model.dart +++ b/lib/models/header_model.dart @@ -15,5 +15,5 @@ class HeaderModel { String email; HeaderModel(this.doctorName, this.doctorId, this.doctorImageURL, this.speciality, this.invoiceNo, this.projectName, this.date, this.time, this.nationalityFlagURL, this.doctorRate, - this.actualDoctorRate, this.totalReviews, this.email, {this.decimalDoctorRate = null}); + this.actualDoctorRate, this.totalReviews, this.email, {this.decimalDoctorRate = ""}); } diff --git a/lib/models/mobile_number.dart b/lib/models/mobile_number.dart index 72a6bfc4..f973aad9 100644 --- a/lib/models/mobile_number.dart +++ b/lib/models/mobile_number.dart @@ -16,10 +16,10 @@ // } class Countries { - String name; - String nameAr; - String code; - String countryCode; + String? name; + String? nameAr; + String? code; + String? countryCode; Countries({this.name, this.nameAr, this.code, this.countryCode}); diff --git a/lib/models/pharmacy/Wishlist.dart b/lib/models/pharmacy/Wishlist.dart index 86e095ec..0e1eb1b1 100644 --- a/lib/models/pharmacy/Wishlist.dart +++ b/lib/models/pharmacy/Wishlist.dart @@ -35,7 +35,7 @@ class Wishlist { dynamic languageId; dynamic id; - List productAttributes; + List? productAttributes; dynamic customerEnteredPrice; dynamic quantity; dynamic discountAmountInclTax; @@ -53,7 +53,7 @@ class Wishlist { dynamic productId; dynamic product; dynamic customerId; - Customer customer; + Customer? customer; factory Wishlist.fromJson(Map json) => Wishlist( languageId: json["language_id"], @@ -82,7 +82,7 @@ class Wishlist { Map toJson() => { "language_id": languageId, "id": id, - "product_attributes": List.from(productAttributes.map((x) => x)), + "product_attributes": List.from(productAttributes!.map((x) => x)), "customer_entered_price": customerEnteredPrice, "quantity": quantity, "discount_amount_incl_tax": discountAmountInclTax, @@ -100,7 +100,7 @@ class Wishlist { "product_id": productId, "product": product.toJson(), "customer_id": customerId, - "customer": customer.toJson(), + "customer": customer!.toJson(), }; } @@ -130,28 +130,28 @@ class Customer { this.roleIds, }); - Address billingAddress; - Address shippingAddress; - List
addresses; - String id; - String username; - String email; + Address? billingAddress; + Address? shippingAddress; + List
? addresses; + String? id; + String? username; + String? email; dynamic firstName; dynamic lastName; dynamic languageId; dynamic adminComment; - bool isTaxExempt; - bool hasShoppingCartItems; - bool active; - bool deleted; - bool isSystemAccount; + bool? isTaxExempt; + bool? hasShoppingCartItems; + bool? active; + bool? deleted; + bool? isSystemAccount; dynamic systemName; - String lastIpAddress; - DateTime createdOnUtc; - DateTime lastLoginDateUtc; - DateTime lastActivityDateUtc; + String? lastIpAddress; + DateTime? createdOnUtc; + DateTime? lastLoginDateUtc; + DateTime? lastActivityDateUtc; dynamic registeredInStoreId; - List roleIds; + List? roleIds; factory Customer.fromJson(Map json) => Customer( billingAddress: Address.fromJson(json["billing_address"]), @@ -179,9 +179,9 @@ class Customer { ); Map toJson() => { - "billing_address": billingAddress.toJson(), - "shipping_address": shippingAddress.toJson(), - "addresses": List.from(addresses.map((x) => x.toJson())), + "billing_address": billingAddress!.toJson(), + "shipping_address": shippingAddress!.toJson(), + "addresses": List.from(addresses!.map((x) => x.toJson())), "id": id, "username": username, "email": email, @@ -196,11 +196,11 @@ class Customer { "is_system_account": isSystemAccount, "system_name": systemName, "last_ip_address": lastIpAddress, - "created_on_utc": createdOnUtc.toIso8601String(), - "last_login_date_utc": lastLoginDateUtc.toIso8601String(), - "last_activity_date_utc": lastActivityDateUtc.toIso8601String(), + "created_on_utc": createdOnUtc!.toIso8601String(), + "last_login_date_utc": lastLoginDateUtc!.toIso8601String(), + "last_activity_date_utc": lastActivityDateUtc!.toIso8601String(), "registered_in_store_id": registeredInStoreId, - "role_ids": List.from(roleIds.map((x) => x)), + "role_ids": List.from(roleIds!.map((x) => x)), }; } @@ -226,35 +226,35 @@ class Address { this.latLong, }); - String id; - FirstName firstName; - LastName lastName; - Email email; + String? id; + FirstName? firstName; + LastName? lastName; + Email? email; dynamic company; dynamic countryId; - Country country; + Country? country; dynamic stateProvinceId; - City city; - String address1; - String address2; - String zipPostalCode; - String phoneNumber; + City? city; + String? address1; + String? address2; + String? zipPostalCode; + String? phoneNumber; dynamic faxNumber; - String customerAttributes; - DateTime createdOnUtc; + String? customerAttributes; + DateTime? createdOnUtc; dynamic province; - String latLong; + String? latLong; factory Address.fromJson(Map json) => Address( id: json["id"], - firstName: firstNameValues.map[json["first_name"]], - lastName: lastNameValues.map[json["last_name"]], - email: emailValues.map[json["email"]], + firstName: firstNameValues.map![json["first_name"]], + lastName: lastNameValues.map![json["last_name"]], + email: emailValues.map![json["email"]], company: json["company"], countryId: json["country_id"], - country: countryValues.map[json["country"]], + country: countryValues.map![json["country"]], stateProvinceId: json["state_province_id"], - city: cityValues.map[json["city"]], + city: cityValues.map![json["city"]], address1: json["address1"], address2: json["address2"], zipPostalCode: json["zip_postal_code"], @@ -282,7 +282,7 @@ class Address { "phone_number": phoneNumber, "fax_number": faxNumber, "customer_attributes": customerAttributes, - "created_on_utc": createdOnUtc.toIso8601String(), + "created_on_utc": createdOnUtc!.toIso8601String(), "province": province, "lat_long": latLong, }; @@ -437,117 +437,117 @@ class Product { this.seName, }); - String id; - bool visibleIndividually; - String name; - String namen; - List localizedNames; - String shortDescription; - String shortDescriptionn; - String fullDescription; - String fullDescriptionn; - bool markasNew; - bool showOnHomePage; + String? id; + bool? visibleIndividually; + String? name; + String? namen; + List? localizedNames; + String? shortDescription; + String? shortDescriptionn; + String? fullDescription; + String? fullDescriptionn; + bool? markasNew; + bool? showOnHomePage; // dynamic metaKeywords; // dynamic metaDescription; // dynamic metaTitle; - bool allowCustomerReviews; + bool? allowCustomerReviews; dynamic approvedRatingSum; dynamic notApprovedRatingSum; dynamic approvedTotalReviews; dynamic notApprovedTotalReviews; - String sku; - bool isRx; - bool prescriptionRequired; + String? sku; + bool? isRx; + bool? prescriptionRequired; dynamic rxMessage; dynamic rxMessagen; // dynamic manufacturerPartNumber; // dynamic gtin; - bool isGiftCard; - bool requireOtherProducts; - bool automaticallyAddRequiredProducts; - bool isDownload; - bool unlimitedDownloads; + bool? isGiftCard; + bool? requireOtherProducts; + bool? automaticallyAddRequiredProducts; + bool? isDownload; + bool? unlimitedDownloads; dynamic maxNumberOfDownloads; // dynamic downloadExpirationDays; - bool hasSampleDownload; - bool hasUserAgreement; - bool isRecurring; + bool? hasSampleDownload; + bool? hasUserAgreement; + bool? isRecurring; dynamic recurringCycleLength; dynamic recurringTotalCycles; - bool isRental; + bool? isRental; dynamic rentalPriceLength; - bool isShipEnabled; - bool isFreeShipping; - bool shipSeparately; + bool? isShipEnabled; + bool? isFreeShipping; + bool? shipSeparately; dynamic additionalShippingCharge; - bool isTaxExempt; - bool isTelecommunicationsOrBroadcastingOrElectronicServices; - bool useMultipleWarehouses; + bool? isTaxExempt; + bool? isTelecommunicationsOrBroadcastingOrElectronicServices; + bool? useMultipleWarehouses; dynamic manageInventoryMethodId; dynamic stockQuantity; - String stockAvailability; - String stockAvailabilityn; - bool displayStockAvailability; - bool displayStockQuantity; + String? stockAvailability; + String? stockAvailabilityn; + bool? displayStockAvailability; + bool? displayStockQuantity; dynamic minStockQuantity; dynamic notifyAdminForQuantityBelow; - bool allowBackInStockSubscriptions; + bool? allowBackInStockSubscriptions; dynamic orderMinimumQuantity; dynamic orderMaximumQuantity; // dynamic allowedQuantities; - bool allowAddingOnlyExistingAttributeCombinations; - bool disableBuyButton; - bool disableWishlistButton; - bool availableForPreOrder; + bool? allowAddingOnlyExistingAttributeCombinations; + bool? disableBuyButton; + bool? disableWishlistButton; + bool? availableForPreOrder; dynamic preOrderAvailabilityStartDateTimeUtc; - bool callForPrice; - double price; + bool? callForPrice; + double? price; dynamic oldPrice; - double productCost; + double? productCost; dynamic specialPrice; dynamic specialPriceStartDateTimeUtc; dynamic specialPriceEndDateTimeUtc; - bool customerEntersPrice; + bool? customerEntersPrice; dynamic minimumCustomerEnteredPrice; dynamic maximumCustomerEnteredPrice; - bool basepriceEnabled; + bool? basepriceEnabled; dynamic basepriceAmount; dynamic basepriceBaseAmount; - bool hasTierPrices; - bool hasDiscountsApplied; + bool? hasTierPrices; + bool? hasDiscountsApplied; dynamic discountName; dynamic discountNamen; dynamic discountDescription; dynamic discountDescriptionn; dynamic discountPercentage; - String currency; - String currencyn; - double weight; + String? currency; + String? currencyn; + double? weight; dynamic length; dynamic width; dynamic height; dynamic availableStartDateTimeUtc; dynamic availableEndDateTimeUtc; dynamic displayOrder; - bool published; - bool deleted; - DateTime createdOnUtc; - DateTime updatedOnUtc; - String productType; + bool? published; + bool? deleted; + DateTime? createdOnUtc; + DateTime? updatedOnUtc; + String? productType; dynamic parentGroupedProductId; - List roleIds; - List discountIds; - List storeIds; - List manufacturerIds; - List reviews; - List images; - List attributes; - List specifications; - List associatedProductIds; - List tags; + List? roleIds; + List? discountIds; + List? storeIds; + List? manufacturerIds; + List? reviews; + List? images; + List? attributes; + List? specifications; + List? associatedProductIds; + List? tags; dynamic vendorId; - String seName; + String? seName; factory Product.fromJson(Map json) => Product( id: json["id"], @@ -668,7 +668,7 @@ class Product { "visible_individually": visibleIndividually, "name": name, "namen": namen, - "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "localized_names": List.from(localizedNames!.map((x) => x.toJson())), "short_description": shortDescription, "short_descriptionn": shortDescriptionn, "full_description": fullDescription, @@ -759,20 +759,20 @@ class Product { "display_order": displayOrder, "published": published, "deleted": deleted, - "created_on_utc": createdOnUtc.toIso8601String(), - "updated_on_utc": updatedOnUtc.toIso8601String(), + "created_on_utc": createdOnUtc!.toIso8601String(), + "updated_on_utc": updatedOnUtc!.toIso8601String(), "product_type": productType, "parent_grouped_product_id": parentGroupedProductId, - "role_ids": List.from(roleIds.map((x) => x)), - "discount_ids": List.from(discountIds.map((x) => x)), - "store_ids": List.from(storeIds.map((x) => x)), - "manufacturer_ids": List.from(manufacturerIds.map((x) => x)), - "reviews": List.from(reviews.map((x) => x)), - "images": List.from(images.map((x) => x.toJson())), - "attributes": List.from(attributes.map((x) => x)), - "specifications": List.from(specifications.map((x) => x.toJson())), - "associated_product_ids": List.from(associatedProductIds.map((x) => x)), - "tags": List.from(tags.map((x) => x)), + "role_ids": List.from(roleIds!.map((x) => x)), + "discount_ids": List.from(discountIds!.map((x) => x)), + "store_ids": List.from(storeIds!.map((x) => x)), + "manufacturer_ids": List.from(manufacturerIds!.map((x) => x)), + "reviews": List.from(reviews!.map((x) => x)), + "images": List.from(images!.map((x) => x.toJson())), + "attributes": List.from(attributes!.map((x) => x)), + "specifications": List.from(specifications!.map((x) => x.toJson())), + "associated_product_ids": List.from(associatedProductIds!.map((x) => x)), + "tags": List.from(tags!.map((x) => x)), "vendor_id": vendorId, "se_name": seName, }; @@ -789,9 +789,9 @@ class Image { dynamic id; dynamic position; - String src; - String thumb; - String attachment; + String? src; + String? thumb; + String? attachment; factory Image.fromJson(Map json) => Image( id: json["id"], @@ -817,7 +817,7 @@ class LocalizedName { }); dynamic languageId; - String localizedName; + String? localizedName; factory LocalizedName.fromJson(Map json) => LocalizedName( languageId: json["language_id"], @@ -842,10 +842,10 @@ class Specification { dynamic id; dynamic displayOrder; - String defaultValue; - String defaultValuen; - String name; - String nameN; + String? defaultValue; + String? defaultValuen; + String? name; + String? nameN; factory Specification.fromJson(Map json) => Specification( id: json["id"], @@ -867,15 +867,15 @@ class Specification { } class EnumValues { - Map map; - Map reverseMap; + Map? map; + Map? reverseMap; EnumValues(this.map); Map get reverse { if (reverseMap == null) { - reverseMap = map.map((k, v) => new MapEntry(v, k)); + reverseMap = map!.map((k, v) => new MapEntry(v, k)); } - return reverseMap; + return reverseMap!; } } diff --git a/lib/models/pharmacy/addToCartModel.dart b/lib/models/pharmacy/addToCartModel.dart index bdc2fcd9..d9fac131 100644 --- a/lib/models/pharmacy/addToCartModel.dart +++ b/lib/models/pharmacy/addToCartModel.dart @@ -44,7 +44,7 @@ class ShoppingCart { "subtotal_with_vat": subtotalWithVat, "subtotal_vat_amount": subtotalVatAmount, "subtotal_vat_rate": subtotalVatRate, - "shopping_carts": List.from(shoppingCarts.map((x) => x.toJson())), + "shopping_carts": List.from(shoppingCarts!.map((x) => x.toJson())), }; } @@ -287,14 +287,14 @@ class Address { factory Address.fromJson(Map json) => Address( id: json["id"], - firstName: firstNameValues.map[json["first_name"]], - lastName: lastNameValues.map[json["last_name"]], - email: emailValues.map[json["email"]], + firstName: firstNameValues.map![json["first_name"]], + lastName: lastNameValues.map![json["last_name"]], + email: emailValues.map![json["email"]], company: json["company"], countryId: json["country_id"], - country: countryValues.map[json["country"]], + country: countryValues.map![json["country"]], stateProvinceId: json["state_province_id"], - city: cityValues.map[json["city"]], + city: cityValues.map![json["city"]], address1: json["address1"], address2: json["address2"], zipPostalCode: json["zip_postal_code"], diff --git a/lib/models/pharmacy/brandModel.dart b/lib/models/pharmacy/brandModel.dart index 2855d492..c1a64c2f 100644 --- a/lib/models/pharmacy/brandModel.dart +++ b/lib/models/pharmacy/brandModel.dart @@ -30,24 +30,24 @@ class Brand { this.image, }); - String id; - String name; - String namen; - List localizedNames; - String description; - int manufacturerTemplateId; - String metaKeywords; + String? id; + String? name; + String? namen; + List? localizedNames; + String? description; + int? manufacturerTemplateId; + String? metaKeywords; dynamic metaDescription; dynamic metaTitle; - int pageSize; - String pageSizeOptions; + int? pageSize; + String? pageSizeOptions; dynamic priceRanges; - bool published; - bool deleted; - int displayOrder; - DateTime createdOnUtc; - DateTime updatedOnUtc; - Image image; + bool? published; + bool? deleted; + int? displayOrder; + DateTime? createdOnUtc; + DateTime? updatedOnUtc; + Image? image; factory Brand.fromJson(Map json) => Brand( id: json["id"], @@ -74,7 +74,7 @@ class Brand { "id": id, "name": name, "namen": namen, - "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "localized_names": List.from(localizedNames!.map((x) => x.toJson())), "description": description == null ? null : description, "manufacturer_template_id": manufacturerTemplateId, "meta_keywords": metaKeywords, @@ -86,9 +86,9 @@ class Brand { "published": published, "deleted": deleted, "display_order": displayOrder, - "created_on_utc": createdOnUtc.toIso8601String(), - "updated_on_utc": updatedOnUtc.toIso8601String(), - "image": image == null ? null : image.toJson(), + "created_on_utc": createdOnUtc!.toIso8601String(), + "updated_on_utc": updatedOnUtc!.toIso8601String(), + "image": image == null ? null : image!.toJson(), }; } @@ -99,7 +99,7 @@ class Image { this.attachment, }); - String src; + String? src; dynamic thumb; dynamic attachment; @@ -122,8 +122,8 @@ class LocalizedName { this.localizedName, }); - int languageId; - String localizedName; + int? languageId; + String? localizedName; factory LocalizedName.fromJson(Map json) => LocalizedName( languageId: json["language_id"], diff --git a/lib/models/pharmacy/locationModel.dart b/lib/models/pharmacy/locationModel.dart index 02d67a09..ee80ecde 100644 --- a/lib/models/pharmacy/locationModel.dart +++ b/lib/models/pharmacy/locationModel.dart @@ -36,33 +36,33 @@ class LocationModel { this.sortOrder, }); - ExpiryDate expiryDate; - double sellingPrice; - int quantity; - int itemId; - int locationId; - int projectId; - String setupId; - String locationDescription; + ExpiryDate? expiryDate; + double? sellingPrice; + int? quantity; + int? itemId; + int? locationId; + int? projectId; + String? setupId; + String? locationDescription; dynamic locationDescriptionN; - ItemDescription itemDescription; + ItemDescription? itemDescription; dynamic itemDescriptionN; - Alias alias; - int locationTypeId; - int barcode; + Alias? alias; + int? locationTypeId; + int? barcode; dynamic companybarcode; - int cityId; - String cityName; - int distanceInKilometers; - String latitude; - int locationType; - String longitude; - String phoneNumber; - String projectImageUrl; - int sortOrder; + int? cityId; + String? cityName; + int? distanceInKilometers; + String? latitude; + int? locationType; + String? longitude; + String? phoneNumber; + String? projectImageUrl; + int? sortOrder; factory LocationModel.fromJson(Map json) => LocationModel( - expiryDate: expiryDateValues.map[json["ExpiryDate"]], + expiryDate: expiryDateValues.map![json["ExpiryDate"]], sellingPrice: json["SellingPrice"].toDouble(), quantity: json["Quantity"], itemId: json["ItemID"], @@ -71,9 +71,9 @@ class LocationModel { setupId: json["SetupID"], locationDescription: json["LocationDescription"], locationDescriptionN: json["LocationDescriptionN"], - itemDescription: itemDescriptionValues.map[json["ItemDescription"]], + itemDescription: itemDescriptionValues.map![json["ItemDescription"]], itemDescriptionN: json["ItemDescriptionN"], - alias: aliasValues.map[json["Alias"]], + alias: aliasValues.map![json["Alias"]], locationTypeId: json["LocationTypeID"], barcode: json["Barcode"], companybarcode: json["Companybarcode"], @@ -145,15 +145,15 @@ final itemDescriptionValues = EnumValues({ }); class EnumValues { - Map map; - Map reverseMap; + Map? map; + Map? reverseMap; EnumValues(this.map); Map get reverse { if (reverseMap == null) { - reverseMap = map.map((k, v) => new MapEntry(v, k)); + reverseMap = map!.map((k, v) => new MapEntry(v, k)); } - return reverseMap; + return reverseMap!; } } diff --git a/lib/models/pharmacy/productDetailModel.dart b/lib/models/pharmacy/productDetailModel.dart index 724f1190..0d09130f 100644 --- a/lib/models/pharmacy/productDetailModel.dart +++ b/lib/models/pharmacy/productDetailModel.dart @@ -9,14 +9,14 @@ class ProductDetail { this.reviews, }); - List reviews; + List? reviews; factory ProductDetail.fromJson(Map json) => ProductDetail( reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), ); Map toJson() => { - "reviews": List.from(reviews.map((x) => x.toJson())), + "reviews": List.from(reviews!.map((x) => x.toJson())), }; } @@ -40,21 +40,21 @@ class Review { this.product, }); - int id; - int position; - int reviewId; - int customerId; - int productId; - int storeId; - bool isApproved; - String title; - String reviewText; + int? id; + int? position; + int? reviewId; + int? customerId; + int? productId; + int? storeId; + bool? isApproved; + String? title; + String? reviewText; dynamic replyText; - int rating; - int helpfulYesTotal; - int helpfulNoTotal; - DateTime createdOnUtc; - Customer customer; + int? rating; + int? helpfulYesTotal; + int? helpfulNoTotal; + DateTime? createdOnUtc; + Customer? customer; dynamic product; factory Review.fromJson(Map json) => Review( @@ -90,8 +90,8 @@ class Review { "rating": rating, "helpful_yes_total": helpfulYesTotal, "helpful_no_total": helpfulNoTotal, - "created_on_utc": createdOnUtc.toIso8601String(), - "customer": customer.toJson(), + "created_on_utc": createdOnUtc!.toIso8601String(), + "customer": customer!.toJson(), "product": product, }; } @@ -131,18 +131,18 @@ class Customer { dynamic fileNumber; dynamic iqamaNumber; - int isOutSa; - int patientType; + int? isOutSa; + int? patientType; dynamic gender; - DateTime birthDate; + DateTime? birthDate; dynamic phone; dynamic countryCode; dynamic yahalaAccountno; dynamic billingAddress; dynamic shippingAddress; - String id; - Email username; - Email email; + String? id; + Email? username; + Email? email; dynamic firstName; dynamic lastName; dynamic languageId; @@ -172,8 +172,8 @@ class Customer { billingAddress: json["billing_address"], shippingAddress: json["shipping_address"], id: json["id"], - username: emailValues.map[json["username"]], - email: emailValues.map[json["email"]], + username: emailValues.map![json["username"]], + email: emailValues.map![json["email"]], firstName: json["first_name"], lastName: json["last_name"], languageId: json["language_id"], @@ -197,7 +197,7 @@ class Customer { "is_out_sa": isOutSa, "patient_type": patientType, "gender": gender, - "birth_date": birthDate.toIso8601String(), + "birth_date": birthDate!.toIso8601String(), "phone": phone, "country_code": countryCode, "yahala_accountno": yahalaAccountno, @@ -229,15 +229,15 @@ enum Email { STEVE_GATES_NOP_COMMERCE_COM } final emailValues = EnumValues({"steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM}); class EnumValues { - Map map; - Map reverseMap; + Map? map; + Map? reverseMap; EnumValues(this.map); Map get reverse { if (reverseMap == null) { - reverseMap = map.map((k, v) => new MapEntry(v, k)); + reverseMap = map!.map((k, v) => new MapEntry(v, k)); } - return reverseMap; + return reverseMap!; } } diff --git a/lib/models/pharmacy/products.dart b/lib/models/pharmacy/products.dart index b4833c64..b792399d 100644 --- a/lib/models/pharmacy/products.dart +++ b/lib/models/pharmacy/products.dart @@ -15,17 +15,17 @@ class Products { }); dynamic messageStatus; - List products; + List? products; factory Products.fromJson(Map json) => Products( - messageStatus: json["MessageStatus"], - products: List.from(json["products"].map((x) => Product.fromJson(x))), - ); + messageStatus: json["MessageStatus"], + products: List.from(json["products"].map((x) => Product.fromJson(x))), + ); Map toJson() => { - "MessageStatus": messageStatus, - "products": List.from(products.map((x) => x.toJson())), - }; + "MessageStatus": messageStatus, + "products": List.from(products!.map((x) => x.toJson())), + }; } class Product { @@ -143,345 +143,345 @@ class Product { this.seName, }); - String id; - bool visibleIndividually; - String name; - String namen; - List localizedNames; - String shortDescription; - String shortDescriptionn; - String fullDescription; - String fullDescriptionn; - bool markasNew; - bool showOnHomePage; - String metaKeywords; - String metaDescription; - String metaTitle; - bool allowCustomerReviews; - int approvedRatingSum; - int notApprovedRatingSum; - int approvedTotalReviews; - int notApprovedTotalReviews; - String sku; - bool isRx; - bool prescriptionRequired; - String rxMessage; - String rxMessagen; + String? id; + bool? visibleIndividually; + String? name; + String? namen; + List? localizedNames; + String? shortDescription; + String? shortDescriptionn; + String? fullDescription; + String? fullDescriptionn; + bool? markasNew; + bool? showOnHomePage; + String? metaKeywords; + String? metaDescription; + String? metaTitle; + bool? allowCustomerReviews; + int? approvedRatingSum; + int? notApprovedRatingSum; + int? approvedTotalReviews; + int? notApprovedTotalReviews; + String? sku; + bool? isRx; + bool? prescriptionRequired; + String? rxMessage; + String? rxMessagen; dynamic manufacturerPartNumber; dynamic gtin; - bool isGiftCard; - bool requireOtherProducts; - bool automaticallyAddRequiredProducts; - bool isDownload; - bool unlimitedDownloads; - int maxNumberOfDownloads; + bool? isGiftCard; + bool? requireOtherProducts; + bool? automaticallyAddRequiredProducts; + bool? isDownload; + bool? unlimitedDownloads; + int? maxNumberOfDownloads; dynamic downloadExpirationDays; - bool hasSampleDownload; - bool hasUserAgreement; - bool isRecurring; - int recurringCycleLength; - int recurringTotalCycles; - bool isRental; - int rentalPriceLength; - bool isShipEnabled; - bool isFreeShipping; - bool shipSeparately; - int additionalShippingCharge; - bool isTaxExempt; - bool isTelecommunicationsOrBroadcastingOrElectronicServices; - bool useMultipleWarehouses; - int manageInventoryMethodId; - int stockQuantity; - String stockAvailability; - String stockAvailabilityn; - bool displayStockAvailability; - bool displayStockQuantity; - int minStockQuantity; - int notifyAdminForQuantityBelow; - bool allowBackInStockSubscriptions; - int orderMinimumQuantity; - int orderMaximumQuantity; + bool? hasSampleDownload; + bool? hasUserAgreement; + bool? isRecurring; + int? recurringCycleLength; + int? recurringTotalCycles; + bool? isRental; + int? rentalPriceLength; + bool? isShipEnabled; + bool? isFreeShipping; + bool? shipSeparately; + int? additionalShippingCharge; + bool? isTaxExempt; + bool? isTelecommunicationsOrBroadcastingOrElectronicServices; + bool? useMultipleWarehouses; + int? manageInventoryMethodId; + int? stockQuantity; + String? stockAvailability; + String? stockAvailabilityn; + bool? displayStockAvailability; + bool? displayStockQuantity; + int? minStockQuantity; + int? notifyAdminForQuantityBelow; + bool? allowBackInStockSubscriptions; + int? orderMinimumQuantity; + int? orderMaximumQuantity; dynamic allowedQuantities; - bool allowAddingOnlyExistingAttributeCombinations; - bool disableBuyButton; - bool disableWishlistButton; - bool availableForPreOrder; + bool? allowAddingOnlyExistingAttributeCombinations; + bool? disableBuyButton; + bool? disableWishlistButton; + bool? availableForPreOrder; dynamic preOrderAvailabilityStartDateTimeUtc; - bool callForPrice; - double price; - int oldPrice; - double productCost; + bool? callForPrice; + double? price; + int? oldPrice; + double? productCost; dynamic specialPrice; dynamic specialPriceStartDateTimeUtc; dynamic specialPriceEndDateTimeUtc; - bool customerEntersPrice; - int minimumCustomerEnteredPrice; - int maximumCustomerEnteredPrice; - bool basepriceEnabled; - int basepriceAmount; - int basepriceBaseAmount; - bool hasTierPrices; - bool hasDiscountsApplied; - String discountName; - String discountNamen; - String discountDescription; - String discountDescriptionn; - String discountPercentage; - String currency; - String currencyn; - double weight; - int length; - int width; - int height; + bool? customerEntersPrice; + int? minimumCustomerEnteredPrice; + int? maximumCustomerEnteredPrice; + bool? basepriceEnabled; + int? basepriceAmount; + int? basepriceBaseAmount; + bool? hasTierPrices; + bool? hasDiscountsApplied; + String? discountName; + String? discountNamen; + String? discountDescription; + String? discountDescriptionn; + String? discountPercentage; + String? currency; + String? currencyn; + double? weight; + int? length; + int? width; + int? height; dynamic availableStartDateTimeUtc; dynamic availableEndDateTimeUtc; - int displayOrder; - bool published; - bool deleted; - DateTime createdOnUtc; - DateTime updatedOnUtc; - String productType; - int parentGroupedProductId; - List roleIds; - List discountIds; - List storeIds; - List manufacturerIds; - List reviews; - List images; - List attributes; - List specifications; - List associatedProductIds; - List tags; - int vendorId; - String seName; + int? displayOrder; + bool? published; + bool? deleted; + DateTime? createdOnUtc; + DateTime? updatedOnUtc; + String? productType; + int? parentGroupedProductId; + List? roleIds; + List? discountIds; + List? storeIds; + List? manufacturerIds; + List? reviews; + List? images; + List? attributes; + List? specifications; + List? associatedProductIds; + List? tags; + int? vendorId; + String? seName; factory Product.fromJson(Map json) => Product( - id: json["id"], - visibleIndividually: json["visible_individually"], - name: json["name"], - namen: json["namen"], - localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), - shortDescription: json["short_description"] == null ? null : json["short_description"], - shortDescriptionn: json["short_descriptionn"] == null ? null : json["short_descriptionn"], - fullDescription: json["full_description"], - fullDescriptionn: json["full_descriptionn"], - markasNew: json["markas_new"], - showOnHomePage: json["show_on_home_page"], - metaKeywords: json["meta_keywords"] == null ? null : json["meta_keywords"], - metaDescription: json["meta_description"] == null ? null : json["meta_description"], - metaTitle: json["meta_title"] == null ? null : json["meta_title"], - allowCustomerReviews: json["allow_customer_reviews"], - approvedRatingSum: json["approved_rating_sum"], - notApprovedRatingSum: json["not_approved_rating_sum"], - approvedTotalReviews: json["approved_total_reviews"], - notApprovedTotalReviews: json["not_approved_total_reviews"], - sku: json["sku"], - isRx: json["is_rx"], - prescriptionRequired: json["prescription_required"], - rxMessage: json["rx_message"] == null ? null : json["rx_message"], - rxMessagen: json["rx_messagen"] == null ? null : json["rx_messagen"], - manufacturerPartNumber: json["manufacturer_part_number"], - gtin: json["gtin"], - isGiftCard: json["is_gift_card"], - requireOtherProducts: json["require_other_products"], - automaticallyAddRequiredProducts: json["automatically_add_required_products"], - isDownload: json["is_download"], - unlimitedDownloads: json["unlimited_downloads"], - maxNumberOfDownloads: json["max_number_of_downloads"], - downloadExpirationDays: json["download_expiration_days"], - hasSampleDownload: json["has_sample_download"], - hasUserAgreement: json["has_user_agreement"], - isRecurring: json["is_recurring"], - recurringCycleLength: json["recurring_cycle_length"], - recurringTotalCycles: json["recurring_total_cycles"], - isRental: json["is_rental"], - rentalPriceLength: json["rental_price_length"], - isShipEnabled: json["is_ship_enabled"], - isFreeShipping: json["is_free_shipping"], - shipSeparately: json["ship_separately"], - additionalShippingCharge: json["additional_shipping_charge"], - isTaxExempt: json["is_tax_exempt"], - isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"], - useMultipleWarehouses: json["use_multiple_warehouses"], - manageInventoryMethodId: json["manage_inventory_method_id"], - stockQuantity: json["stock_quantity"], - stockAvailability: json["stock_availability"], - stockAvailabilityn: json["stock_availabilityn"], - displayStockAvailability: json["display_stock_availability"], - displayStockQuantity: json["display_stock_quantity"], - minStockQuantity: json["min_stock_quantity"], - notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"], - allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], - orderMinimumQuantity: json["order_minimum_quantity"], - orderMaximumQuantity: json["order_maximum_quantity"], - allowedQuantities: json["allowed_quantities"], - allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"], - disableBuyButton: json["disable_buy_button"], - disableWishlistButton: json["disable_wishlist_button"], - availableForPreOrder: json["available_for_pre_order"], - preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"], - callForPrice: json["call_for_price"], - price: json["price"].toDouble(), - oldPrice: json["old_price"], - productCost: json["product_cost"].toDouble(), - specialPrice: json["special_price"], - specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], - specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], - customerEntersPrice: json["customer_enters_price"], - minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], - maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], - basepriceEnabled: json["baseprice_enabled"], - basepriceAmount: json["baseprice_amount"], - basepriceBaseAmount: json["baseprice_base_amount"], - hasTierPrices: json["has_tier_prices"], - hasDiscountsApplied: json["has_discounts_applied"], - discountName: json["discount_name"] == null ? null : json["discount_name"], - discountNamen: json["discount_namen"] == null ? null : json["discount_namen"], - discountDescription: json["discount_description"] == null ? null : json["discount_description"], - discountDescriptionn: json["discount_Descriptionn"] == null ? null : json["discount_Descriptionn"], - discountPercentage: json["discount_percentage"] == null ? null : json["discount_percentage"], - currency: json["currency"], - currencyn: json["currencyn"], - weight: json["weight"].toDouble(), - length: json["length"], - width: json["width"], - height: json["height"], - availableStartDateTimeUtc: json["available_start_date_time_utc"], - availableEndDateTimeUtc: json["available_end_date_time_utc"], - displayOrder: json["display_order"], - published: json["published"], - deleted: json["deleted"], - createdOnUtc: DateTime.parse(json["created_on_utc"]), - updatedOnUtc: DateTime.parse(json["updated_on_utc"]), - productType: json["product_type"], - parentGroupedProductId: json["parent_grouped_product_id"], - roleIds: List.from(json["role_ids"].map((x) => x)), - discountIds: List.from(json["discount_ids"].map((x) => x)), - storeIds: List.from(json["store_ids"].map((x) => x)), - manufacturerIds: List.from(json["manufacturer_ids"].map((x) => x)), - reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), - images: List.from(json["images"].map((x) => Image.fromJson(x))), - attributes: List.from(json["attributes"].map((x) => x)), - specifications: List.from(json["specifications"].map((x) => Specification.fromJson(x))), - associatedProductIds: List.from(json["associated_product_ids"].map((x) => x)), - tags: List.from(json["tags"].map((x) => x)), - vendorId: json["vendor_id"], - seName: json["se_name"], - ); + id: json["id"], + visibleIndividually: json["visible_individually"], + name: json["name"], + namen: json["namen"], + localizedNames: List.from(json["localized_names"].map((x) => LocalizedName.fromJson(x))), + shortDescription: json["short_description"] == null ? null : json["short_description"], + shortDescriptionn: json["short_descriptionn"] == null ? null : json["short_descriptionn"], + fullDescription: json["full_description"], + fullDescriptionn: json["full_descriptionn"], + markasNew: json["markas_new"], + showOnHomePage: json["show_on_home_page"], + metaKeywords: json["meta_keywords"] == null ? null : json["meta_keywords"], + metaDescription: json["meta_description"] == null ? null : json["meta_description"], + metaTitle: json["meta_title"] == null ? null : json["meta_title"], + allowCustomerReviews: json["allow_customer_reviews"], + approvedRatingSum: json["approved_rating_sum"], + notApprovedRatingSum: json["not_approved_rating_sum"], + approvedTotalReviews: json["approved_total_reviews"], + notApprovedTotalReviews: json["not_approved_total_reviews"], + sku: json["sku"], + isRx: json["is_rx"], + prescriptionRequired: json["prescription_required"], + rxMessage: json["rx_message"] == null ? null : json["rx_message"], + rxMessagen: json["rx_messagen"] == null ? null : json["rx_messagen"], + manufacturerPartNumber: json["manufacturer_part_number"], + gtin: json["gtin"], + isGiftCard: json["is_gift_card"], + requireOtherProducts: json["require_other_products"], + automaticallyAddRequiredProducts: json["automatically_add_required_products"], + isDownload: json["is_download"], + unlimitedDownloads: json["unlimited_downloads"], + maxNumberOfDownloads: json["max_number_of_downloads"], + downloadExpirationDays: json["download_expiration_days"], + hasSampleDownload: json["has_sample_download"], + hasUserAgreement: json["has_user_agreement"], + isRecurring: json["is_recurring"], + recurringCycleLength: json["recurring_cycle_length"], + recurringTotalCycles: json["recurring_total_cycles"], + isRental: json["is_rental"], + rentalPriceLength: json["rental_price_length"], + isShipEnabled: json["is_ship_enabled"], + isFreeShipping: json["is_free_shipping"], + shipSeparately: json["ship_separately"], + additionalShippingCharge: json["additional_shipping_charge"], + isTaxExempt: json["is_tax_exempt"], + isTelecommunicationsOrBroadcastingOrElectronicServices: json["is_telecommunications_or_broadcasting_or_electronic_services"], + useMultipleWarehouses: json["use_multiple_warehouses"], + manageInventoryMethodId: json["manage_inventory_method_id"], + stockQuantity: json["stock_quantity"], + stockAvailability: json["stock_availability"], + stockAvailabilityn: json["stock_availabilityn"], + displayStockAvailability: json["display_stock_availability"], + displayStockQuantity: json["display_stock_quantity"], + minStockQuantity: json["min_stock_quantity"], + notifyAdminForQuantityBelow: json["notify_admin_for_quantity_below"], + allowBackInStockSubscriptions: json["allow_back_in_stock_subscriptions"], + orderMinimumQuantity: json["order_minimum_quantity"], + orderMaximumQuantity: json["order_maximum_quantity"], + allowedQuantities: json["allowed_quantities"], + allowAddingOnlyExistingAttributeCombinations: json["allow_adding_only_existing_attribute_combinations"], + disableBuyButton: json["disable_buy_button"], + disableWishlistButton: json["disable_wishlist_button"], + availableForPreOrder: json["available_for_pre_order"], + preOrderAvailabilityStartDateTimeUtc: json["pre_order_availability_start_date_time_utc"], + callForPrice: json["call_for_price"], + price: json["price"].toDouble(), + oldPrice: json["old_price"], + productCost: json["product_cost"].toDouble(), + specialPrice: json["special_price"], + specialPriceStartDateTimeUtc: json["special_price_start_date_time_utc"], + specialPriceEndDateTimeUtc: json["special_price_end_date_time_utc"], + customerEntersPrice: json["customer_enters_price"], + minimumCustomerEnteredPrice: json["minimum_customer_entered_price"], + maximumCustomerEnteredPrice: json["maximum_customer_entered_price"], + basepriceEnabled: json["baseprice_enabled"], + basepriceAmount: json["baseprice_amount"], + basepriceBaseAmount: json["baseprice_base_amount"], + hasTierPrices: json["has_tier_prices"], + hasDiscountsApplied: json["has_discounts_applied"], + discountName: json["discount_name"] == null ? null : json["discount_name"], + discountNamen: json["discount_namen"] == null ? null : json["discount_namen"], + discountDescription: json["discount_description"] == null ? null : json["discount_description"], + discountDescriptionn: json["discount_Descriptionn"] == null ? null : json["discount_Descriptionn"], + discountPercentage: json["discount_percentage"] == null ? null : json["discount_percentage"], + currency: json["currency"], + currencyn: json["currencyn"], + weight: json["weight"].toDouble(), + length: json["length"], + width: json["width"], + height: json["height"], + availableStartDateTimeUtc: json["available_start_date_time_utc"], + availableEndDateTimeUtc: json["available_end_date_time_utc"], + displayOrder: json["display_order"], + published: json["published"], + deleted: json["deleted"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + updatedOnUtc: DateTime.parse(json["updated_on_utc"]), + productType: json["product_type"], + parentGroupedProductId: json["parent_grouped_product_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + discountIds: List.from(json["discount_ids"].map((x) => x)), + storeIds: List.from(json["store_ids"].map((x) => x)), + manufacturerIds: List.from(json["manufacturer_ids"].map((x) => x)), + reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))), + images: List.from(json["images"].map((x) => Image.fromJson(x))), + attributes: List.from(json["attributes"].map((x) => x)), + specifications: List.from(json["specifications"].map((x) => Specification.fromJson(x))), + associatedProductIds: List.from(json["associated_product_ids"].map((x) => x)), + tags: List.from(json["tags"].map((x) => x)), + vendorId: json["vendor_id"], + seName: json["se_name"], + ); Map toJson() => { - "id": id, - "visible_individually": visibleIndividually, - "name": name, - "namen": namen, - "localized_names": List.from(localizedNames.map((x) => x.toJson())), - "short_description": shortDescription == null ? null : shortDescription, - "short_descriptionn": shortDescriptionn == null ? null : shortDescriptionn, - "full_description": fullDescription, - "full_descriptionn": fullDescriptionn, - "markas_new": markasNew, - "show_on_home_page": showOnHomePage, - "meta_keywords": metaKeywords == null ? null : metaKeywords, - "meta_description": metaDescription == null ? null : metaDescription, - "meta_title": metaTitle == null ? null : metaTitle, - "allow_customer_reviews": allowCustomerReviews, - "approved_rating_sum": approvedRatingSum, - "not_approved_rating_sum": notApprovedRatingSum, - "approved_total_reviews": approvedTotalReviews, - "not_approved_total_reviews": notApprovedTotalReviews, - "sku": sku, - "is_rx": isRx, - "prescription_required": prescriptionRequired, - "rx_message": rxMessage == null ? null : rxMessage, - "rx_messagen": rxMessagen == null ? null : rxMessagen, - "manufacturer_part_number": manufacturerPartNumber, - "gtin": gtin, - "is_gift_card": isGiftCard, - "require_other_products": requireOtherProducts, - "automatically_add_required_products": automaticallyAddRequiredProducts, - "is_download": isDownload, - "unlimited_downloads": unlimitedDownloads, - "max_number_of_downloads": maxNumberOfDownloads, - "download_expiration_days": downloadExpirationDays, - "has_sample_download": hasSampleDownload, - "has_user_agreement": hasUserAgreement, - "is_recurring": isRecurring, - "recurring_cycle_length": recurringCycleLength, - "recurring_total_cycles": recurringTotalCycles, - "is_rental": isRental, - "rental_price_length": rentalPriceLength, - "is_ship_enabled": isShipEnabled, - "is_free_shipping": isFreeShipping, - "ship_separately": shipSeparately, - "additional_shipping_charge": additionalShippingCharge, - "is_tax_exempt": isTaxExempt, - "is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices, - "use_multiple_warehouses": useMultipleWarehouses, - "manage_inventory_method_id": manageInventoryMethodId, - "stock_quantity": stockQuantity, - "stock_availability": stockAvailability, - "stock_availabilityn": stockAvailabilityn, - "display_stock_availability": displayStockAvailability, - "display_stock_quantity": displayStockQuantity, - "min_stock_quantity": minStockQuantity, - "notify_admin_for_quantity_below": notifyAdminForQuantityBelow, - "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, - "order_minimum_quantity": orderMinimumQuantity, - "order_maximum_quantity": orderMaximumQuantity, - "allowed_quantities": allowedQuantities, - "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, - "disable_buy_button": disableBuyButton, - "disable_wishlist_button": disableWishlistButton, - "available_for_pre_order": availableForPreOrder, - "pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc, - "call_for_price": callForPrice, - "price": price, - "old_price": oldPrice, - "product_cost": productCost, - "special_price": specialPrice, - "special_price_start_date_time_utc": specialPriceStartDateTimeUtc, - "special_price_end_date_time_utc": specialPriceEndDateTimeUtc, - "customer_enters_price": customerEntersPrice, - "minimum_customer_entered_price": minimumCustomerEnteredPrice, - "maximum_customer_entered_price": maximumCustomerEnteredPrice, - "baseprice_enabled": basepriceEnabled, - "baseprice_amount": basepriceAmount, - "baseprice_base_amount": basepriceBaseAmount, - "has_tier_prices": hasTierPrices, - "has_discounts_applied": hasDiscountsApplied, - "discount_name": discountName == null ? null : discountName, - "discount_namen": discountNamen == null ? null : discountNamen, - "discount_description": discountDescription == null ? null : discountDescription, - "discount_Descriptionn": discountDescriptionn == null ? null : discountDescriptionn, - "discount_percentage": discountPercentage == null ? null : discountPercentage, - "currency": currency, - "currencyn": currencyn, - "weight": weight, - "length": length, - "width": width, - "height": height, - "available_start_date_time_utc": availableStartDateTimeUtc, - "available_end_date_time_utc": availableEndDateTimeUtc, - "display_order": displayOrder, - "published": published, - "deleted": deleted, - "created_on_utc": createdOnUtc.toIso8601String(), - "updated_on_utc": updatedOnUtc.toIso8601String(), - "product_type": productType, - "parent_grouped_product_id": parentGroupedProductId, - "role_ids": List.from(roleIds.map((x) => x)), - "discount_ids": List.from(discountIds.map((x) => x)), - "store_ids": List.from(storeIds.map((x) => x)), - "manufacturer_ids": List.from(manufacturerIds.map((x) => x)), - "reviews": List.from(reviews.map((x) => x.toJson())), - "images": List.from(images.map((x) => x.toJson())), - "attributes": List.from(attributes.map((x) => x)), - "specifications": List.from(specifications.map((x) => x.toJson())), - "associated_product_ids": List.from(associatedProductIds.map((x) => x)), - "tags": List.from(tags.map((x) => x)), - "vendor_id": vendorId, - "se_name": seName, - }; + "id": id, + "visible_individually": visibleIndividually, + "name": name, + "namen": namen, + "localized_names": List.from(localizedNames!.map((x) => x.toJson())), + "short_description": shortDescription == null ? null : shortDescription, + "short_descriptionn": shortDescriptionn == null ? null : shortDescriptionn, + "full_description": fullDescription, + "full_descriptionn": fullDescriptionn, + "markas_new": markasNew, + "show_on_home_page": showOnHomePage, + "meta_keywords": metaKeywords == null ? null : metaKeywords, + "meta_description": metaDescription == null ? null : metaDescription, + "meta_title": metaTitle == null ? null : metaTitle, + "allow_customer_reviews": allowCustomerReviews, + "approved_rating_sum": approvedRatingSum, + "not_approved_rating_sum": notApprovedRatingSum, + "approved_total_reviews": approvedTotalReviews, + "not_approved_total_reviews": notApprovedTotalReviews, + "sku": sku, + "is_rx": isRx, + "prescription_required": prescriptionRequired, + "rx_message": rxMessage == null ? null : rxMessage, + "rx_messagen": rxMessagen == null ? null : rxMessagen, + "manufacturer_part_number": manufacturerPartNumber, + "gtin": gtin, + "is_gift_card": isGiftCard, + "require_other_products": requireOtherProducts, + "automatically_add_required_products": automaticallyAddRequiredProducts, + "is_download": isDownload, + "unlimited_downloads": unlimitedDownloads, + "max_number_of_downloads": maxNumberOfDownloads, + "download_expiration_days": downloadExpirationDays, + "has_sample_download": hasSampleDownload, + "has_user_agreement": hasUserAgreement, + "is_recurring": isRecurring, + "recurring_cycle_length": recurringCycleLength, + "recurring_total_cycles": recurringTotalCycles, + "is_rental": isRental, + "rental_price_length": rentalPriceLength, + "is_ship_enabled": isShipEnabled, + "is_free_shipping": isFreeShipping, + "ship_separately": shipSeparately, + "additional_shipping_charge": additionalShippingCharge, + "is_tax_exempt": isTaxExempt, + "is_telecommunications_or_broadcasting_or_electronic_services": isTelecommunicationsOrBroadcastingOrElectronicServices, + "use_multiple_warehouses": useMultipleWarehouses, + "manage_inventory_method_id": manageInventoryMethodId, + "stock_quantity": stockQuantity, + "stock_availability": stockAvailability, + "stock_availabilityn": stockAvailabilityn, + "display_stock_availability": displayStockAvailability, + "display_stock_quantity": displayStockQuantity, + "min_stock_quantity": minStockQuantity, + "notify_admin_for_quantity_below": notifyAdminForQuantityBelow, + "allow_back_in_stock_subscriptions": allowBackInStockSubscriptions, + "order_minimum_quantity": orderMinimumQuantity, + "order_maximum_quantity": orderMaximumQuantity, + "allowed_quantities": allowedQuantities, + "allow_adding_only_existing_attribute_combinations": allowAddingOnlyExistingAttributeCombinations, + "disable_buy_button": disableBuyButton, + "disable_wishlist_button": disableWishlistButton, + "available_for_pre_order": availableForPreOrder, + "pre_order_availability_start_date_time_utc": preOrderAvailabilityStartDateTimeUtc, + "call_for_price": callForPrice, + "price": price, + "old_price": oldPrice, + "product_cost": productCost, + "special_price": specialPrice, + "special_price_start_date_time_utc": specialPriceStartDateTimeUtc, + "special_price_end_date_time_utc": specialPriceEndDateTimeUtc, + "customer_enters_price": customerEntersPrice, + "minimum_customer_entered_price": minimumCustomerEnteredPrice, + "maximum_customer_entered_price": maximumCustomerEnteredPrice, + "baseprice_enabled": basepriceEnabled, + "baseprice_amount": basepriceAmount, + "baseprice_base_amount": basepriceBaseAmount, + "has_tier_prices": hasTierPrices, + "has_discounts_applied": hasDiscountsApplied, + "discount_name": discountName == null ? null : discountName, + "discount_namen": discountNamen == null ? null : discountNamen, + "discount_description": discountDescription == null ? null : discountDescription, + "discount_Descriptionn": discountDescriptionn == null ? null : discountDescriptionn, + "discount_percentage": discountPercentage == null ? null : discountPercentage, + "currency": currency, + "currencyn": currencyn, + "weight": weight, + "length": length, + "width": width, + "height": height, + "available_start_date_time_utc": availableStartDateTimeUtc, + "available_end_date_time_utc": availableEndDateTimeUtc, + "display_order": displayOrder, + "published": published, + "deleted": deleted, + "created_on_utc": createdOnUtc!.toIso8601String(), + "updated_on_utc": updatedOnUtc!.toIso8601String(), + "product_type": productType, + "parent_grouped_product_id": parentGroupedProductId, + "role_ids": List.from(roleIds!.map((x) => x)), + "discount_ids": List.from(discountIds!.map((x) => x)), + "store_ids": List.from(storeIds!.map((x) => x)), + "manufacturer_ids": List.from(manufacturerIds!.map((x) => x)), + "reviews": List.from(reviews!.map((x) => x.toJson())), + "images": List.from(images!.map((x) => x.toJson())), + "attributes": List.from(attributes!.map((x) => x)), + "specifications": List.from(specifications!.map((x) => x.toJson())), + "associated_product_ids": List.from(associatedProductIds!.map((x) => x)), + "tags": List.from(tags!.map((x) => x)), + "vendor_id": vendorId, + "se_name": seName, + }; } class Image { @@ -493,27 +493,27 @@ class Image { this.attachment, }); - int id; - int position; - String src; - String thumb; - String attachment; + int? id; + int? position; + String? src; + String? thumb; + String? attachment; factory Image.fromJson(Map json) => Image( - id: json["id"], - position: json["position"], - src: json["src"], - thumb: json["thumb"], - attachment: json["attachment"], - ); + id: json["id"], + position: json["position"], + src: json["src"], + thumb: json["thumb"], + attachment: json["attachment"], + ); Map toJson() => { - "id": id, - "position": position, - "src": src, - "thumb": thumb, - "attachment": attachment, - }; + "id": id, + "position": position, + "src": src, + "thumb": thumb, + "attachment": attachment, + }; } class LocalizedName { @@ -522,18 +522,18 @@ class LocalizedName { this.localizedName, }); - int languageId; - String localizedName; + int? languageId; + String? localizedName; factory LocalizedName.fromJson(Map json) => LocalizedName( - languageId: json["language_id"], - localizedName: json["localized_name"], - ); + languageId: json["language_id"], + localizedName: json["localized_name"], + ); Map toJson() => { - "language_id": languageId, - "localized_name": localizedName, - }; + "language_id": languageId, + "localized_name": localizedName, + }; } class Review { @@ -556,60 +556,60 @@ class Review { this.product, }); - int id; - int position; - int reviewId; - int customerId; - int productId; - int storeId; - bool isApproved; - String title; - String reviewText; + int? id; + int? position; + int? reviewId; + int? customerId; + int? productId; + int? storeId; + bool? isApproved; + String? title; + String? reviewText; dynamic replyText; - int rating; - int helpfulYesTotal; - int helpfulNoTotal; - DateTime createdOnUtc; - Customer customer; + int? rating; + int? helpfulYesTotal; + int? helpfulNoTotal; + DateTime? createdOnUtc; + Customer? customer; dynamic product; factory Review.fromJson(Map json) => Review( - id: json["id"], - position: json["position"], - reviewId: json["review_id"], - customerId: json["customer_id"], - productId: json["product_id"], - storeId: json["store_id"], - isApproved: json["is_approved"], - title: json["title"], - reviewText: json["review_text"], - replyText: json["reply_text"], - rating: json["rating"], - helpfulYesTotal: json["helpful_yes_total"], - helpfulNoTotal: json["helpful_no_total"], - createdOnUtc: DateTime.parse(json["created_on_utc"]), - customer: Customer.fromJson(json["customer"]), - product: json["product"], - ); + id: json["id"], + position: json["position"], + reviewId: json["review_id"], + customerId: json["customer_id"], + productId: json["product_id"], + storeId: json["store_id"], + isApproved: json["is_approved"], + title: json["title"], + reviewText: json["review_text"], + replyText: json["reply_text"], + rating: json["rating"], + helpfulYesTotal: json["helpful_yes_total"], + helpfulNoTotal: json["helpful_no_total"], + createdOnUtc: DateTime.parse(json["created_on_utc"]), + customer: Customer.fromJson(json["customer"]), + product: json["product"], + ); Map toJson() => { - "id": id, - "position": position, - "review_id": reviewId, - "customer_id": customerId, - "product_id": productId, - "store_id": storeId, - "is_approved": isApproved, - "title": title, - "review_text": reviewText, - "reply_text": replyText, - "rating": rating, - "helpful_yes_total": helpfulYesTotal, - "helpful_no_total": helpfulNoTotal, - "created_on_utc": createdOnUtc.toIso8601String(), - "customer": customer.toJson(), - "product": product, - }; + "id": id, + "position": position, + "review_id": reviewId, + "customer_id": customerId, + "product_id": productId, + "store_id": storeId, + "is_approved": isApproved, + "title": title, + "review_text": reviewText, + "reply_text": replyText, + "rating": rating, + "helpful_yes_total": helpfulYesTotal, + "helpful_no_total": helpfulNoTotal, + "created_on_utc": createdOnUtc!.toIso8601String(), + "customer": customer!.toJson(), + "product": product, + }; } class Customer { @@ -649,19 +649,19 @@ class Customer { dynamic fileNumber; dynamic iqamaNumber; - int isOutSa; - int patientType; + int? isOutSa; + int? patientType; dynamic gender; - DateTime birthDate; + DateTime? birthDate; dynamic phone; dynamic countryCode; dynamic yahalaAccountno; dynamic billingAddress; dynamic shippingAddress; - List addresses; - String id; - Username username; - Email email; + List? addresses; + String? id; + Username? username; + Email? email; dynamic firstName; dynamic lastName; dynamic languageId; @@ -677,90 +677,84 @@ class Customer { dynamic lastLoginDateUtc; dynamic lastActivityDateUtc; dynamic registeredInStoreId; - List roleIds; + List? roleIds; factory Customer.fromJson(Map json) => Customer( - fileNumber: json["file_number"], - iqamaNumber: json["iqama_number"], - isOutSa: json["is_out_sa"], - patientType: json["patient_type"], - gender: json["gender"], - birthDate: DateTime.parse(json["birth_date"]), - phone: json["phone"], - countryCode: json["country_code"], - yahalaAccountno: json["yahala_accountno"], - billingAddress: json["billing_address"], - shippingAddress: json["shipping_address"], - addresses: List.from(json["addresses"].map((x) => x)), - id: json["id"], - username: usernameValues.map[json["username"]], - email: emailValues.map[json["email"]], - firstName: json["first_name"], - lastName: json["last_name"], - languageId: json["language_id"], - adminComment: json["admin_comment"], - isTaxExempt: json["is_tax_exempt"], - hasShoppingCartItems: json["has_shopping_cart_items"], - active: json["active"], - deleted: json["deleted"], - isSystemAccount: json["is_system_account"], - systemName: json["system_name"], - lastIpAddress: json["last_ip_address"], - createdOnUtc: json["created_on_utc"], - lastLoginDateUtc: json["last_login_date_utc"], - lastActivityDateUtc: json["last_activity_date_utc"], - registeredInStoreId: json["registered_in_store_id"], - roleIds: List.from(json["role_ids"].map((x) => x)), - ); + fileNumber: json["file_number"], + iqamaNumber: json["iqama_number"], + isOutSa: json["is_out_sa"], + patientType: json["patient_type"], + gender: json["gender"], + birthDate: DateTime.parse(json["birth_date"]), + phone: json["phone"], + countryCode: json["country_code"], + yahalaAccountno: json["yahala_accountno"], + billingAddress: json["billing_address"], + shippingAddress: json["shipping_address"], + addresses: List.from(json["addresses"].map((x) => x)), + id: json["id"], + username: usernameValues.map![json["username"]], + email: emailValues.map![json["email"]], + firstName: json["first_name"], + lastName: json["last_name"], + languageId: json["language_id"], + adminComment: json["admin_comment"], + isTaxExempt: json["is_tax_exempt"], + hasShoppingCartItems: json["has_shopping_cart_items"], + active: json["active"], + deleted: json["deleted"], + isSystemAccount: json["is_system_account"], + systemName: json["system_name"], + lastIpAddress: json["last_ip_address"], + createdOnUtc: json["created_on_utc"], + lastLoginDateUtc: json["last_login_date_utc"], + lastActivityDateUtc: json["last_activity_date_utc"], + registeredInStoreId: json["registered_in_store_id"], + roleIds: List.from(json["role_ids"].map((x) => x)), + ); Map toJson() => { - "file_number": fileNumber, - "iqama_number": iqamaNumber, - "is_out_sa": isOutSa, - "patient_type": patientType, - "gender": gender, - "birth_date": birthDate.toIso8601String(), - "phone": phone, - "country_code": countryCode, - "yahala_accountno": yahalaAccountno, - "billing_address": billingAddress, - "shipping_address": shippingAddress, - "addresses": List.from(addresses.map((x) => x)), - "id": id, - "username": usernameValues.reverse[username], - "email": emailValues.reverse[email], - "first_name": firstName, - "last_name": lastName, - "language_id": languageId, - "admin_comment": adminComment, - "is_tax_exempt": isTaxExempt, - "has_shopping_cart_items": hasShoppingCartItems, - "active": active, - "deleted": deleted, - "is_system_account": isSystemAccount, - "system_name": systemName, - "last_ip_address": lastIpAddress, - "created_on_utc": createdOnUtc, - "last_login_date_utc": lastLoginDateUtc, - "last_activity_date_utc": lastActivityDateUtc, - "registered_in_store_id": registeredInStoreId, - "role_ids": List.from(roleIds.map((x) => x)), - }; + "file_number": fileNumber, + "iqama_number": iqamaNumber, + "is_out_sa": isOutSa, + "patient_type": patientType, + "gender": gender, + "birth_date": birthDate!.toIso8601String(), + "phone": phone, + "country_code": countryCode, + "yahala_accountno": yahalaAccountno, + "billing_address": billingAddress, + "shipping_address": shippingAddress, + "addresses": List.from(addresses!.map((x) => x)), + "id": id, + "username": usernameValues.reverse[username], + "email": emailValues.reverse[email], + "first_name": firstName, + "last_name": lastName, + "language_id": languageId, + "admin_comment": adminComment, + "is_tax_exempt": isTaxExempt, + "has_shopping_cart_items": hasShoppingCartItems, + "active": active, + "deleted": deleted, + "is_system_account": isSystemAccount, + "system_name": systemName, + "last_ip_address": lastIpAddress, + "created_on_utc": createdOnUtc, + "last_login_date_utc": lastLoginDateUtc, + "last_activity_date_utc": lastActivityDateUtc, + "registered_in_store_id": registeredInStoreId, + "role_ids": List.from(roleIds!.map((x) => x)), + }; } enum Email { MEMO17299_GMAIL_COM, STEVE_GATES_NOP_COMMERCE_COM } -final emailValues = EnumValues({ - "Memo17299@gmail.com": Email.MEMO17299_GMAIL_COM, - "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM -}); +final emailValues = EnumValues({"Memo17299@gmail.com": Email.MEMO17299_GMAIL_COM, "steve_gates@nopCommerce.com": Email.STEVE_GATES_NOP_COMMERCE_COM}); enum Username { AMAL_26, STEVE_GATES_NOP_COMMERCE_COM } -final usernameValues = EnumValues({ - "amal_26": Username.AMAL_26, - "steve_gates@nopCommerce.com": Username.STEVE_GATES_NOP_COMMERCE_COM -}); +final usernameValues = EnumValues({"amal_26": Username.AMAL_26, "steve_gates@nopCommerce.com": Username.STEVE_GATES_NOP_COMMERCE_COM}); class Specification { Specification({ @@ -772,30 +766,30 @@ class Specification { this.nameN, }); - int id; - int displayOrder; - String defaultValue; - String defaultValuen; - Name name; - NameN nameN; + int? id; + int? displayOrder; + String? defaultValue; + String? defaultValuen; + Name? name; + NameN? nameN; factory Specification.fromJson(Map json) => Specification( - id: json["id"], - displayOrder: json["display_order"], - defaultValue: json["default_value"], - defaultValuen: json["default_valuen"], - name: nameValues.map[json["name"]], - nameN: nameNValues.map[json["nameN"]], - ); + id: json["id"], + displayOrder: json["display_order"], + defaultValue: json["default_value"], + defaultValuen: json["default_valuen"], + name: nameValues.map![json["name"]], + nameN: nameNValues.map![json["nameN"]], + ); Map toJson() => { - "id": id, - "display_order": displayOrder, - "default_value": defaultValue, - "default_valuen": defaultValuen, - "name": nameValues.reverse[name], - "nameN": nameNValues.reverse[nameN], - }; + "id": id, + "display_order": displayOrder, + "default_value": defaultValue, + "default_valuen": defaultValuen, + "name": nameValues.reverse[name], + "nameN": nameNValues.reverse[nameN], + }; } enum Name { PRIMARY_UNIT_OF_MEASURE, BRAND, MANUFACTURER_COUNTRY_NAME, STORAGE, COMPOSITION, SPF } @@ -811,25 +805,19 @@ final nameValues = EnumValues({ enum NameN { EMPTY, NAME_N, PURPLE, FLUFFY, TENTACLED, SPF } -final nameNValues = EnumValues({ - "وحدة القياس الأولية": NameN.EMPTY, - "تخزين": NameN.FLUFFY, - "علامة تجارية": NameN.NAME_N, - "اسم البلد المصنع": NameN.PURPLE, - "SPF": NameN.SPF, - "المكونات": NameN.TENTACLED -}); +final nameNValues = + EnumValues({"وحدة القياس الأولية": NameN.EMPTY, "تخزين": NameN.FLUFFY, "علامة تجارية": NameN.NAME_N, "اسم البلد المصنع": NameN.PURPLE, "SPF": NameN.SPF, "المكونات": NameN.TENTACLED}); class EnumValues { - Map map; - Map reverseMap; + Map? map; + Map? reverseMap; EnumValues(this.map); Map get reverse { if (reverseMap == null) { - reverseMap = map.map((k, v) => new MapEntry(v, k)); + reverseMap = map!.map((k, v) => new MapEntry(v, k)); } - return reverseMap; + return reverseMap!; } } diff --git a/lib/models/pharmacy/reviewModel.dart b/lib/models/pharmacy/reviewModel.dart index da30212c..dacf6c6f 100644 --- a/lib/models/pharmacy/reviewModel.dart +++ b/lib/models/pharmacy/reviewModel.dart @@ -123,117 +123,117 @@ class Product { this.seName, }); - String id; - bool visibleIndividually; - String name; - String namen; - List localizedNames; - String shortDescription; - String shortDescriptionn; - String fullDescription; - String fullDescriptionn; - bool markasNew; - bool showOnHomePage; - String metaKeywords; - String metaDescription; - String metaTitle; - bool allowCustomerReviews; + String? id; + bool? visibleIndividually; + String? name; + String? namen; + List? localizedNames; + String? shortDescription; + String? shortDescriptionn; + String? fullDescription; + String? fullDescriptionn; + bool? markasNew; + bool? showOnHomePage; + String? metaKeywords; + String? metaDescription; + String? metaTitle; + bool? allowCustomerReviews; dynamic approvedRatingSum; dynamic notApprovedRatingSum; dynamic approvedTotalReviews; dynamic notApprovedTotalReviews; - String sku; - bool isRx; - bool prescriptionRequired; + String? sku; + bool? isRx; + bool? prescriptionRequired; dynamic rxMessage; dynamic rxMessagen; dynamic manufacturerPartNumber; dynamic gtin; - bool isGiftCard; - bool requireOtherProducts; - bool automaticallyAddRequiredProducts; - bool isDownload; - bool unlimitedDownloads; + bool? isGiftCard; + bool? requireOtherProducts; + bool? automaticallyAddRequiredProducts; + bool? isDownload; + bool? unlimitedDownloads; dynamic maxNumberOfDownloads; dynamic downloadExpirationDays; - bool hasSampleDownload; - bool hasUserAgreement; - bool isRecurring; + bool? hasSampleDownload; + bool? hasUserAgreement; + bool? isRecurring; dynamic recurringCycleLength; dynamic recurringTotalCycles; - bool isRental; + bool? isRental; dynamic rentalPriceLength; - bool isShipEnabled; - bool isFreeShipping; - bool shipSeparately; + bool? isShipEnabled; + bool? isFreeShipping; + bool? shipSeparately; dynamic additionalShippingCharge; - bool isTaxExempt; - bool isTelecommunicationsOrBroadcastingOrElectronicServices; - bool useMultipleWarehouses; + bool? isTaxExempt; + bool? isTelecommunicationsOrBroadcastingOrElectronicServices; + bool? useMultipleWarehouses; dynamic manageInventoryMethodId; dynamic stockQuantity; - String stockAvailability; - String stockAvailabilityn; - bool displayStockAvailability; - bool displayStockQuantity; + String? stockAvailability; + String? stockAvailabilityn; + bool? displayStockAvailability; + bool? displayStockQuantity; dynamic minStockQuantity; dynamic notifyAdminForQuantityBelow; - bool allowBackInStockSubscriptions; + bool? allowBackInStockSubscriptions; dynamic orderMinimumQuantity; dynamic orderMaximumQuantity; dynamic allowedQuantities; - bool allowAddingOnlyExistingAttributeCombinations; - bool disableBuyButton; - bool disableWishlistButton; - bool availableForPreOrder; + bool? allowAddingOnlyExistingAttributeCombinations; + bool? disableBuyButton; + bool? disableWishlistButton; + bool? availableForPreOrder; dynamic preOrderAvailabilityStartDateTimeUtc; - bool callForPrice; + bool? callForPrice; dynamic price; dynamic oldPrice; dynamic productCost; dynamic specialPrice; dynamic specialPriceStartDateTimeUtc; dynamic specialPriceEndDateTimeUtc; - bool customerEntersPrice; + bool? customerEntersPrice; dynamic minimumCustomerEnteredPrice; dynamic maximumCustomerEnteredPrice; - bool basepriceEnabled; + bool? basepriceEnabled; dynamic basepriceAmount; dynamic basepriceBaseAmount; - bool hasTierPrices; - bool hasDiscountsApplied; + bool? hasTierPrices; + bool? hasDiscountsApplied; dynamic discountName; dynamic discountNamen; dynamic discountDescription; dynamic discountDescriptionn; dynamic discountPercentage; - String currency; - String currencyn; - double weight; + String? currency; + String? currencyn; + double? weight; dynamic length; dynamic width; dynamic height; dynamic availableStartDateTimeUtc; dynamic availableEndDateTimeUtc; dynamic displayOrder; - bool published; - bool deleted; - DateTime createdOnUtc; - DateTime updatedOnUtc; - String productType; + bool? published; + bool? deleted; + DateTime? createdOnUtc; + DateTime? updatedOnUtc; + String? productType; dynamic parentGroupedProductId; - List roleIds; - List discountIds; - List storeIds; - List manufacturerIds; - List reviews; - List images; - List attributes; - List specifications; - List associatedProductIds; - List tags; + List? roleIds; + List? discountIds; + List? storeIds; + List? manufacturerIds; + List? reviews; + List? images; + List? attributes; + List? specifications; + List? associatedProductIds; + List? tags; dynamic vendorId; - String seName; + String? seName; factory Product.fromJson(Map json) => Product( id: json["id"], @@ -354,7 +354,7 @@ class Product { "visible_individually": visibleIndividually, "name": name, "namen": namen, - "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "localized_names": List.from(localizedNames!.map((x) => x.toJson())), "short_description": shortDescription, "short_descriptionn": shortDescriptionn, "full_description": fullDescription, @@ -445,20 +445,20 @@ class Product { "display_order": displayOrder, "published": published, "deleted": deleted, - "created_on_utc": createdOnUtc.toIso8601String(), - "updated_on_utc": updatedOnUtc.toIso8601String(), + "created_on_utc": createdOnUtc!.toIso8601String(), + "updated_on_utc": updatedOnUtc!.toIso8601String(), "product_type": productType, "parent_grouped_product_id": parentGroupedProductId, - "role_ids": List.from(roleIds.map((x) => x)), - "discount_ids": List.from(discountIds.map((x) => x)), - "store_ids": List.from(storeIds.map((x) => x)), - "manufacturer_ids": List.from(manufacturerIds.map((x) => x)), - "reviews": List.from(reviews.map((x) => x.toJson())), - "images": List.from(images.map((x) => x.toJson())), - "attributes": List.from(attributes.map((x) => x)), - "specifications": List.from(specifications.map((x) => x.toJson())), - "associated_product_ids": List.from(associatedProductIds.map((x) => x)), - "tags": List.from(tags.map((x) => x)), + "role_ids": List.from(roleIds!.map((x) => x)), + "discount_ids": List.from(discountIds!.map((x) => x)), + "store_ids": List.from(storeIds!.map((x) => x)), + "manufacturer_ids": List.from(manufacturerIds!.map((x) => x)), + "reviews": List.from(reviews!.map((x) => x.toJson())), + "images": List.from(images!.map((x) => x.toJson())), + "attributes": List.from(attributes!.map((x) => x)), + "specifications": List.from(specifications!.map((x) => x.toJson())), + "associated_product_ids": List.from(associatedProductIds!.map((x) => x)), + "tags": List.from(tags!.map((x) => x)), "vendor_id": vendorId, "se_name": seName, }; @@ -490,16 +490,16 @@ class Review { dynamic customerId; dynamic productId; dynamic storeId; - bool isApproved; - String title; - ReviewText reviewText; + bool? isApproved; + String? title; + ReviewText? reviewText; dynamic replyText; dynamic rating; dynamic helpfulYesTotal; dynamic helpfulNoTotal; - DateTime createdOnUtc; - Customer customer; - Product product; + DateTime? createdOnUtc; + Customer? customer; + Product? product; factory Review.fromJson(Map json) => Review( id: json["id"], @@ -510,7 +510,7 @@ class Review { storeId: json["store_id"], isApproved: json["is_approved"], title: json["title"], - reviewText: reviewTextValues.map[json["review_text"]], + reviewText: reviewTextValues.map![json["review_text"]], replyText: json["reply_text"], rating: json["rating"], helpfulYesTotal: json["helpful_yes_total"], @@ -534,9 +534,9 @@ class Review { "rating": rating, "helpful_yes_total": helpfulYesTotal, "helpful_no_total": helpfulNoTotal, - "created_on_utc": createdOnUtc.toIso8601String(), - "customer": customer.toJson(), - "product": product == null ? null : product.toJson(), + "created_on_utc": createdOnUtc!.toIso8601String(), + "customer": customer!.toJson(), + "product": product == null ? null : product!.toJson(), }; } @@ -551,9 +551,9 @@ class Image { dynamic id; dynamic position; - String src; - String thumb; - String attachment; + String? src; + String? thumb; + String? attachment; factory Image.fromJson(Map json) => Image( id: json["id"], @@ -579,7 +579,7 @@ class LocalizedName { }); dynamic languageId; - String localizedName; + String? localizedName; factory LocalizedName.fromJson(Map json) => LocalizedName( languageId: json["language_id"], @@ -604,10 +604,10 @@ class Specification { dynamic id; dynamic displayOrder; - String defaultValue; - String defaultValuen; - String name; - String nameN; + String? defaultValue; + String? defaultValuen; + String? name; + String? nameN; factory Specification.fromJson(Map json) => Specification( id: json["id"], @@ -668,16 +668,16 @@ class Customer { dynamic isOutSa; dynamic patientType; dynamic gender; - DateTime birthDate; + DateTime? birthDate; dynamic phone; dynamic countryCode; dynamic yahalaAccountno; dynamic billingAddress; dynamic shippingAddress; - List addresses; - String id; - Username username; - Email email; + List? addresses; + String? id; + Username? username; + Email? email; dynamic firstName; dynamic lastName; dynamic languageId; @@ -693,7 +693,7 @@ class Customer { dynamic lastLoginDateUtc; dynamic lastActivityDateUtc; dynamic registeredInStoreId; - List roleIds; + List? roleIds; factory Customer.fromJson(Map json) => Customer( fileNumber: json["file_number"], @@ -709,8 +709,8 @@ class Customer { shippingAddress: json["shipping_address"], addresses: List.from(json["addresses"].map((x) => x)), id: json["id"], - username: usernameValues.map[json["username"]], - email: emailValues.map[json["email"]], + username: usernameValues.map![json["username"]], + email: emailValues.map![json["email"]], firstName: json["first_name"], lastName: json["last_name"], languageId: json["language_id"], @@ -735,13 +735,13 @@ class Customer { "is_out_sa": isOutSa, "patient_type": patientType, "gender": gender, - "birth_date": birthDate.toIso8601String(), + "birth_date": birthDate!.toIso8601String(), "phone": phone, "country_code": countryCode, "yahala_accountno": yahalaAccountno, "billing_address": billingAddress, "shipping_address": shippingAddress, - "addresses": List.from(addresses.map((x) => x)), + "addresses": List.from(addresses!.map((x) => x)), "id": id, "username": usernameValues.reverse[username], "email": emailValues.reverse[email], @@ -760,7 +760,7 @@ class Customer { "last_login_date_utc": lastLoginDateUtc, "last_activity_date_utc": lastActivityDateUtc, "registered_in_store_id": registeredInStoreId, - "role_ids": List.from(roleIds.map((x) => x)), + "role_ids": List.from(roleIds!.map((x) => x)), }; } @@ -789,15 +789,15 @@ final reviewTextValues = EnumValues({ }); class EnumValues { - Map map; - Map reverseMap; + Map? map; + Map? reverseMap; EnumValues(this.map); Map get reverse { if (reverseMap == null) { - reverseMap = map.map((k, v) => new MapEntry(v, k)); + reverseMap = map!.map((k, v) => new MapEntry(v, k)); } - return reverseMap; + return reverseMap!; } } diff --git a/lib/models/pharmacy/specification.dart b/lib/models/pharmacy/specification.dart index 6ef69191..9fd50f01 100644 --- a/lib/models/pharmacy/specification.dart +++ b/lib/models/pharmacy/specification.dart @@ -13,14 +13,14 @@ class SpecificationModel { this.specification, }); - List specification; + List? specification; factory SpecificationModel.fromJson(Map json) => SpecificationModel( specification: List.from(json["specification"].map((x) => Specification.fromJson(x))), ); Map toJson() => { - "specification": List.from(specification.map((x) => x.toJson())), + "specification": List.from(specification!.map((x) => x.toJson())), }; } @@ -34,12 +34,12 @@ class Specification { this.nameN, }); - int id; - int displayOrder; - String defaultValue; - String defaultValuen; - String name; - String nameN; + int? id; + int? displayOrder; + String? defaultValue; + String? defaultValuen; + String? name; + String? nameN; factory Specification.fromJson(Map json) => Specification( id: json["id"], diff --git a/lib/models/pharmacy/topBrandsModel.dart b/lib/models/pharmacy/topBrandsModel.dart index 0cd833b7..57ac2fed 100644 --- a/lib/models/pharmacy/topBrandsModel.dart +++ b/lib/models/pharmacy/topBrandsModel.dart @@ -30,24 +30,24 @@ class TopBrand { this.image, }); - String id; - String name; - String namen; - List localizedNames; - String description; - int manufacturerTemplateId; - String metaKeywords; + String? id; + String? name; + String? namen; + List? localizedNames; + String? description; + int? manufacturerTemplateId; + String? metaKeywords; dynamic metaDescription; dynamic metaTitle; - int pageSize; - String pageSizeOptions; + int? pageSize; + String? pageSizeOptions; dynamic priceRanges; - bool published; - bool deleted; - int displayOrder; - DateTime createdOnUtc; - DateTime updatedOnUtc; - Image image; + bool? published; + bool? deleted; + int? displayOrder; + DateTime? createdOnUtc; + DateTime? updatedOnUtc; + Image? image; factory TopBrand.fromJson(Map json) => TopBrand( id: json["id"], @@ -74,7 +74,7 @@ class TopBrand { "id": id, "name": name, "namen": namen, - "localized_names": List.from(localizedNames.map((x) => x.toJson())), + "localized_names": List.from(localizedNames!.map((x) => x.toJson())), "description": description == null ? null : description, "manufacturer_template_id": manufacturerTemplateId, "meta_keywords": metaKeywords, @@ -86,9 +86,9 @@ class TopBrand { "published": published, "deleted": deleted, "display_order": displayOrder, - "created_on_utc": createdOnUtc.toIso8601String(), - "updated_on_utc": updatedOnUtc.toIso8601String(), - "image": image == null ? null : image.toJson(), + "created_on_utc": createdOnUtc!.toIso8601String(), + "updated_on_utc": updatedOnUtc!.toIso8601String(), + "image": image == null ? null : image!.toJson(), }; } @@ -99,7 +99,7 @@ class Image { this.attachment, }); - String src; + String? src; dynamic thumb; dynamic attachment; @@ -122,8 +122,8 @@ class LocalizedName { this.localizedName, }); - int languageId; - String localizedName; + int? languageId; + String? localizedName; factory LocalizedName.fromJson(Map json) => LocalizedName( languageId: json["language_id"], diff --git a/lib/models/rrt/RRTProcedureList.dart b/lib/models/rrt/RRTProcedureList.dart index 12b74ecf..ff68b047 100644 --- a/lib/models/rrt/RRTProcedureList.dart +++ b/lib/models/rrt/RRTProcedureList.dart @@ -1,5 +1,5 @@ class RRTProcedureList { - List vidaProcedureList; + List? vidaProcedureList; RRTProcedureList({this.vidaProcedureList}); @@ -7,7 +7,7 @@ class RRTProcedureList { if (json['Vida_ProcedureList'] != null) { vidaProcedureList = []; json['Vida_ProcedureList'].forEach((v) { - vidaProcedureList.add(new VidaProcedureList.fromJson(v)); + vidaProcedureList!.add(new VidaProcedureList.fromJson(v)); }); } } @@ -15,26 +15,20 @@ class RRTProcedureList { Map toJson() { final Map data = new Map(); if (this.vidaProcedureList != null) { - data['Vida_ProcedureList'] = - this.vidaProcedureList.map((v) => v.toJson()).toList(); + data['Vida_ProcedureList'] = this.vidaProcedureList!.map((v) => v.toJson()).toList(); } return data; } } class VidaProcedureList { - num patientShare; - num patientShareWithTax; - num patientTaxAmount; - String procedureID; - String procedureName; + num? patientShare; + num? patientShareWithTax; + num? patientTaxAmount; + String? procedureID; + String? procedureName; - VidaProcedureList( - {this.patientShare, - this.patientShareWithTax, - this.patientTaxAmount, - this.procedureID, - this.procedureName}); + VidaProcedureList({this.patientShare, this.patientShareWithTax, this.patientTaxAmount, this.procedureID, this.procedureName}); VidaProcedureList.fromJson(Map json) { patientShare = json['PatientShare']; diff --git a/lib/models/rrt/RRTRequestModel.dart b/lib/models/rrt/RRTRequestModel.dart index f4322fde..dfb5b1b2 100644 --- a/lib/models/rrt/RRTRequestModel.dart +++ b/lib/models/rrt/RRTRequestModel.dart @@ -1,14 +1,14 @@ class RRTRequestModel { - num patientId; - int patientOutSa; - bool isOutPatient; - int nearestProjectId; - num longitude; - num latitude; - String additionalDetails; - String nationality; - num paymentAmount; - List procedures; + num? patientId; + int? patientOutSa; + bool? isOutPatient; + int? nearestProjectId; + num? longitude; + num? latitude; + String? additionalDetails; + String? nationality; + num? paymentAmount; + List? procedures; RRTRequestModel( {this.patientId, @@ -35,7 +35,7 @@ class RRTRequestModel { if (json['procedures'] != null) { procedures = []; json['procedures'].forEach((v) { - procedures.add(new Procedures.fromJson(v)); + procedures!.add(new Procedures.fromJson(v)); }); } } @@ -52,14 +52,14 @@ class RRTRequestModel { data['nationality'] = this.nationality; data['paymentAmount'] = this.paymentAmount; if (this.procedures != null) { - data['procedures'] = this.procedures.map((v) => v.toJson()).toList(); + data['procedures'] = this.procedures!.map((v) => v.toJson()).toList(); } return data; } } class Procedures { - String serviceID; + String? serviceID; Procedures({this.serviceID}); diff --git a/lib/models/rrt/service_price.dart b/lib/models/rrt/service_price.dart index 998671f7..abb57be6 100644 --- a/lib/models/rrt/service_price.dart +++ b/lib/models/rrt/service_price.dart @@ -1,5 +1,5 @@ class ServicePrice { - String currency; + String? currency; dynamic maxPrice; dynamic maxTotalPrice; dynamic maxVAT; diff --git a/lib/models/tamara_request_model.dart b/lib/models/tamara_request_model.dart index d75fe4b0..4fe24426 100644 --- a/lib/models/tamara_request_model.dart +++ b/lib/models/tamara_request_model.dart @@ -1,31 +1,31 @@ class TamaraRequestModel { - String merchantReference; - String merchantIdentifier; - String clientRequestID; - num amount; - String currency; - String language; - String commandType; - String signature; - String customerEmail; - String orderDescription; - bool isInstallment; - num projectID; - String accessCode; - String sHARequestPhase; - String sHAResponsePhase; - String customerName; - String fileNumber; - bool patientOutSA; - String deviceToken; - String longitude; - String latitude; - String appointmentNo; + String? merchantReference; + String? merchantIdentifier; + String? clientRequestID; + num? amount; + String? currency; + String? language; + String? commandType; + String? signature; + String? customerEmail; + String? orderDescription; + bool? isInstallment; + num? projectID; + String? accessCode; + String? sHARequestPhase; + String? sHAResponsePhase; + String? customerName; + String? fileNumber; + bool? patientOutSA; + String? deviceToken; + String? longitude; + String? latitude; + String? appointmentNo; var serviceID; var liveServiceID; - String doctorID; + String? doctorID; var appointmentDate; - bool isSchedule; + bool? isSchedule; TamaraRequestModel( {this.merchantReference, diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart index e2685e29..4ea8c4ee 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_cancel_order_dialog.dart @@ -5,10 +5,10 @@ import 'package:flutter/material.dart'; // ignore: must_be_immutable class ConfirmCancelOrderDialog extends StatefulWidget { - final CMCViewModel model; + final CMCViewModel model; final Function onTap; - ConfirmCancelOrderDialog({Key key, this.model, this.onTap}); + ConfirmCancelOrderDialog({Key? key, required this.model, required this.onTap}); @override _ConfirmCancelOrderDialogState createState() => _ConfirmCancelOrderDialogState(); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart index 6d47c0cf..536af3cd 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart @@ -4,7 +4,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:flutter/material.dart'; -Future showCMCConfirmDialog(BuildContext context, String requestId, {Function onClick}) async { +Future showCMCConfirmDialog(BuildContext context, String requestId, {required Function onClick}) async { return showDialog( context: context, barrierDismissible: false, // user must tap button! @@ -28,7 +28,7 @@ class ConfirmDialog extends StatelessWidget { String requestId; Function onClick; - ConfirmDialog(this.requestId, {this.onClick}); + ConfirmDialog(this.requestId, {required this.onClick}); @override Widget build(BuildContext context) { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart index f45d2942..7cd1eaea 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart @@ -24,7 +24,7 @@ import 'package:flutter/material.dart'; // import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; import 'package:geocoding/geocoding.dart'; import 'package:geolocator/geolocator.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart' as gmaps; import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; import 'package:provider/provider.dart'; @@ -35,7 +35,7 @@ class CMCLocationPage extends StatefulWidget { final double longitude; final dynamic model; - const CMCLocationPage({Key key, this.onPick, this.latitude, 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(); @@ -45,17 +45,17 @@ class _CMCLocationPageState extends State { double latitude = 0; double longitude = 0; bool showCurrentLocation = false; - Function onPick; + late Function onPick; bool isHuawei = false; - Placemark selectedPlace; - AppMap appMap; - static CameraPosition _kGooglePlex = CameraPosition( - target: LatLng(37.42796133580664, -122.085749655962), + late Placemark selectedPlace; + late AppMap appMap; + static gmaps.CameraPosition _kGooglePlex = gmaps.CameraPosition( + target: gmaps.LatLng(37.42796133580664, -122.085749655962), zoom: 14.4746, ); - LatLng currentPostion; + late gmaps.LatLng currentPostion; AppSharedPreferences sharedPref = AppSharedPreferences(); - HmsApiAvailability hmsApiAvailability; + late HmsApiAvailability hmsApiAvailability; @override void initState() { @@ -63,12 +63,14 @@ class _CMCLocationPageState extends State { checkIsHuawei(); appMap = AppMap( - _kGooglePlex.toMap(), - onCameraMove: (camera) { - _updatePosition(camera); + _kGooglePlex.toMap() as Map, + // changed by Aamir + onCameraMove: (cam) { + _updatePosition(cam as gmaps.CameraPosition); + // changed by Aamir Huawei & Google Issue may Be }, onMapCreated: () { - currentPostion = LatLng(widget.latitude, widget.longitude); + currentPostion = gmaps.LatLng(widget.latitude, widget.longitude); latitude = widget.latitude; longitude = widget.longitude; _getUserLocation(); @@ -91,7 +93,7 @@ class _CMCLocationPageState extends State { } checkIsHuawei() async { - await hmsApiAvailability.isHMSAvailable().then((value) { + await hmsApiAvailability!.isHMSAvailable().then((value) { isHuawei = value == 0 ? true : false; }); print(isHuawei); @@ -148,13 +150,13 @@ class _CMCLocationPageState extends State { createdOnUtc: "", id: "0", faxNumber: "", - phoneNumber: projectViewModel.user.mobileNumber, + phoneNumber: projectViewModel.user!.mobileNumber, province: selectedPlace.administrativeArea, countryId: 69, latLong: latitude.toStringAsFixed(6) + "," + longitude.toStringAsFixed(6), country: selectedPlace.country, zipPostalCode: selectedPlace.postalCode, - email: projectViewModel.user.emailAddress) + email: projectViewModel.user!.emailAddress) ]), ); await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); @@ -206,28 +208,28 @@ class _CMCLocationPageState extends State { customer: Customer( addresses: [ Addresses( - address1: selectedPlace.formattedAddress, + address1: selectedPlace!.formattedAddress, address2: selectedPlace.formattedAddress, customerAttributes: "", city: "", createdOnUtc: "", id: "0", - latLong: selectedPlace.geometry.location.lat.toString() + "," + selectedPlace.geometry.location.lng.toString(), + latLong: selectedPlace.geometry!.location.lat.toString() + "," + selectedPlace.geometry!.location.lng.toString(), email: "", ) ], ), ); - selectedPlace.addressComponents.forEach((e) { + selectedPlace.addressComponents!.forEach((e) { if (e.types.contains("country")) { - addNewAddressRequestModel.customer.addresses[0].country = e.longName; + addNewAddressRequestModel.customer!.addresses![0].country = e.longName; } if (e.types.contains("postal_code")) { - addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; + addNewAddressRequestModel.customer!.addresses![0].zipPostalCode = e.longName; } if (e.types.contains("locality")) { - addNewAddressRequestModel.customer.addresses[0].city = e.longName; + addNewAddressRequestModel.customer!.addresses![0].city = e.longName; } }); @@ -247,7 +249,7 @@ class _CMCLocationPageState extends State { ), ); }, - initialPosition: LatLng(latitude, longitude), + initialPosition: gmaps.LatLng(latitude, longitude), useCurrentLocation: showCurrentLocation, ), ), @@ -260,29 +262,29 @@ class _CMCLocationPageState extends State { var long = await this.sharedPref.getDouble(USER_LONG); latitude = lat; longitude = long; - currentPostion = LatLng(lat, long); + currentPostion = gmaps.LatLng(lat, long); setMap(); } else { if (await PermissionService.isLocationEnabled()) { Geolocator.getLastKnownPosition().then((value) { - latitude = value.latitude; + latitude = value!.latitude; longitude = value.longitude; - currentPostion = LatLng(latitude, longitude); + currentPostion = gmaps.LatLng(latitude, longitude); setMap(); }); } else { if (Platform.isAndroid) { Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () { Geolocator.getLastKnownPosition().then((value) { - latitude = value.latitude; + latitude = value!.latitude; longitude = value.longitude; - currentPostion = LatLng(latitude, longitude); + currentPostion = gmaps.LatLng(latitude, longitude); setMap(); }); }); } else { Geolocator.getLastKnownPosition().then((value) { - latitude = value.latitude; + latitude = value!.latitude; longitude = value.longitude; setMap(); }); @@ -293,7 +295,7 @@ class _CMCLocationPageState extends State { setMap() { setState(() { - _kGooglePlex = CameraPosition( + _kGooglePlex = gmaps.CameraPosition( target: currentPostion, zoom: 14.4746, ); @@ -301,7 +303,7 @@ class _CMCLocationPageState extends State { }); } - void _updatePosition(CameraPosition _position) { + void _updatePosition(gmaps.CameraPosition _position) { print(_position); latitude = _position.target.latitude; longitude = _position.target.longitude; diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index d67f8a8e..c8467c6b 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -18,7 +18,7 @@ import 'package:provider/provider.dart'; import 'new_cmc_step_one_page.dart'; class NewCMCPage extends StatefulWidget { - NewCMCPage({this.model}); + NewCMCPage({required this.model}); final CMCViewModel model; @@ -27,15 +27,15 @@ class NewCMCPage extends StatefulWidget { } class _NewCMCPageState extends State with TickerProviderStateMixin { - PageController _controller; + late PageController _controller; int _currentIndex = 1; - double _latitude; - double _longitude; + late double _latitude; + late double _longitude; - CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel; + late CMCInsertPresOrderRequestModel cMCInsertPresOrderRequestModel; - BuildContext _context; + late BuildContext _context; @override void initState() { @@ -51,10 +51,11 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { totalPrice: widget.model.cmcAllServicesList[0].priceTotal, vAT: widget.model.cmcAllServicesList[0].priceVAT); cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel(patientERCMCInsertServicesList: [patientERCMCInsertServicesList]); + } else { + cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel(patientERCMCInsertServicesList: []); + //changed By Aamir } - cMCInsertPresOrderRequestModel = new CMCInsertPresOrderRequestModel(patientERCMCInsertServicesList: patientERCMCInsertServicesList != null ? [patientERCMCInsertServicesList] : []); - _controller = new PageController(); // _getCurrentLocation(); @@ -62,7 +63,7 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { _getCurrentLocation() async { await Geolocator.getLastKnownPosition().then((value) { - _latitude = value.latitude; + _latitude = value!.latitude; _longitude = value.longitude; }).catchError((e) { _longitude = 0; @@ -107,9 +108,9 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { )); } - int status = widget.model.pendingOrder != null ? widget.model.pendingOrder.statusId : 0; - String _statusDisp = widget.model.pendingOrder != null ? widget.model.pendingOrder.statusText : ""; - Color _color; + int status = widget.model.pendingOrder != null ? widget.model.pendingOrder!.statusId! : 0; + String _statusDisp = widget.model.pendingOrder != null ? widget.model.pendingOrder!.statusText! : ""; + late Color _color; if (status == 1) { //pending _color = Color(0xffCC9B14); @@ -165,7 +166,7 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { ), SizedBox(height: 6), Text( - '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD}', + '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder!.iD}', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), Row( @@ -177,7 +178,7 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { ), Expanded( child: Text( - widget.model.pendingOrder.projectName != null ? widget.model.pendingOrder.projectName.trim().toString() : "", + widget.model.pendingOrder!.projectName != null ? widget.model.pendingOrder!.projectName!.trim().toString() : "", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), @@ -192,7 +193,7 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { ), Expanded( child: Text( - widget.model.pendingOrder.serviceText.trim().toString(), + widget.model.pendingOrder!.serviceText!.trim().toString(), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), @@ -206,14 +207,14 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder!.created!)!), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), SizedBox(height: 12), - if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) + if (widget.model.pendingOrder!.statusId == 1 || widget.model.pendingOrder!.statusId == 2) InkWell( onTap: () { - showConfirmMessage(widget.model, widget.model.pendingOrder); + showConfirmMessage(widget.model, widget.model.pendingOrder!); }, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index 0b6f49dd..b55d6846 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -25,7 +25,8 @@ class NewCMCStepOnePage extends StatefulWidget { final double latitude; final double longitude; - const NewCMCStepOnePage({Key key, this.cMCInsertPresOrderRequestModel, this.model, this.changePageViewIndex, this.latitude, this.longitude}) : super(key: key); + const NewCMCStepOnePage({Key? key, required this.cMCInsertPresOrderRequestModel, required this.model, required this.changePageViewIndex, required this.latitude, required this.longitude}) + : super(key: key); @override _NewCMCStepOnePageState createState() => _NewCMCStepOnePageState(); @@ -61,7 +62,7 @@ class _NewCMCStepOnePageState extends State { return Row( children: [ Radio( - value: num.tryParse(widget.model.cmcAllServicesList[index].serviceID), + value: num.tryParse(widget.model.cmcAllServicesList[index].serviceID!), activeColor: Colors.red[800], onChanged: (newValue) async { selectedItem = index; @@ -79,8 +80,8 @@ class _NewCMCStepOnePageState extends State { // CMCGetItemsRequestModel cMCGetItemsRequestModel = new CMCGetItemsRequestModel(checkupType: newValue); // await widget.model.getCheckupItems(cMCGetItemsRequestModel: cMCGetItemsRequestModel); }, - groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length > 0 - ? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList[0].serviceID) + groupValue: widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList!.length > 0 + ? int.parse(widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList![0].serviceID!) : 1), Expanded( child: Padding( @@ -91,7 +92,7 @@ class _NewCMCStepOnePageState extends State { bottom: 20, ), child: Text( - projectViewModel.isArabic ? widget.model.cmcAllServicesList[index].textN : widget.model.cmcAllServicesList[index].text, + projectViewModel.isArabic ? widget.model.cmcAllServicesList[index].textN! : widget.model.cmcAllServicesList[index].text!, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -146,7 +147,7 @@ class _NewCMCStepOnePageState extends State { child: DefaultButton( TranslationBase.of(context).next, () async { - if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList.length != 0 || widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList == null) { + if (widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList!.length != 0 || widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList == null) { // int index = widget.model.cmcAllServicesList.length; PatientERCMCInsertServicesList patientERCMCInsertServicesList = new PatientERCMCInsertServicesList( price: widget.model.cmcAllServicesList[selectedItem].price, @@ -158,8 +159,8 @@ class _NewCMCStepOnePageState extends State { vAT: widget.model.cmcAllServicesList[selectedItem].priceVAT, ); - widget.cMCInsertPresOrderRequestModel.patientID = projectViewModel.user.patientID; - widget.cMCInsertPresOrderRequestModel.patientOutSA = projectViewModel.user.outSA; + widget.cMCInsertPresOrderRequestModel.patientID = projectViewModel.user!.patientID; + widget.cMCInsertPresOrderRequestModel.patientOutSA = projectViewModel.user!.outSA; widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; navigateTo( diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart index ec020f49..de4733c2 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart @@ -27,7 +27,7 @@ class NewCMCStepThreePage extends StatefulWidget { final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel; final CMCViewModel model; - NewCMCStepThreePage({Key key, this.model, this.cmcInsertPresOrderRequestModel}); + NewCMCStepThreePage({Key? key, required this.model, required this.cmcInsertPresOrderRequestModel}); @override _NewCMCStepThreePageState createState() => _NewCMCStepThreePageState(); @@ -36,9 +36,9 @@ class NewCMCStepThreePage extends StatefulWidget { class _NewCMCStepThreePageState extends State { Completer _controller = Completer(); - String projectDropdownValue; - List projectsList = []; - HospitalsModel selectedHospital; + String? projectDropdownValue; + late List projectsList = []; + late HospitalsModel selectedHospital; final GlobalKey projectDropdownKey = GlobalKey(); bool isLocationSelected = false; @@ -57,10 +57,10 @@ class _NewCMCStepThreePageState extends State { markerId: MarkerId( widget.cmcInsertPresOrderRequestModel.latitude.hashCode.toString(), ), - position: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, widget.cmcInsertPresOrderRequestModel.longitude)), + position: LatLng(widget.cmcInsertPresOrderRequestModel.latitude!, widget.cmcInsertPresOrderRequestModel.longitude!)), ); _kGooglePlex = CameraPosition( - target: LatLng(widget.cmcInsertPresOrderRequestModel.latitude, widget.cmcInsertPresOrderRequestModel.longitude), + target: LatLng(widget.cmcInsertPresOrderRequestModel.latitude!, widget.cmcInsertPresOrderRequestModel.longitude!), zoom: 14.4746, ); } @@ -148,12 +148,12 @@ class _NewCMCStepThreePageState extends State { items: projectsList.map((item) { return new DropdownMenuItem( value: item, - child: new Text(item.name), + child: new Text(item.name!), ); }).toList(), onChanged: (newValue) async { setState(() { - selectedHospital = newValue; + selectedHospital = newValue!; projectDropdownValue = newValue.mainProjectID.toString(); isLocationSelected = true; widget.cmcInsertPresOrderRequestModel.projectID = newValue.mainProjectID; @@ -259,15 +259,15 @@ class _NewCMCStepThreePageState extends State { ), ), ...List.generate( - widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList.length, + widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList!.length, (index) => Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( projectViewModel.isArabic - ? widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList[index].selectedServiceNameAR - : widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList[index].selectedServiceName, + ? widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList![index].selectedServiceNameAR! + : widget.cmcInsertPresOrderRequestModel.patientERCMCInsertServicesList![index].selectedServiceName!, style: TextStyle( fontSize: 12, fontWeight: FontWeight.bold, @@ -353,7 +353,7 @@ class _NewCMCStepThreePageState extends State { getDirections() { if (isLocationSelected) { - MapsLauncher.launchCoordinates(double.parse(selectedHospital.latitude), double.parse(selectedHospital.longitude), selectedHospital.name); + MapsLauncher.launchCoordinates(double.parse(selectedHospital.latitude!), double.parse(selectedHospital.longitude!), selectedHospital.name); } else { Utils.showErrorToast("Please select address from the dropdown menu to get directions"); } 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 e846d31c..70a6433a 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 @@ -19,7 +19,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart' as gmaps; import 'package:google_maps_place_picker_mb/google_maps_place_picker.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -33,7 +33,7 @@ class NewCMCStepTowPage extends StatefulWidget { final CMCInsertPresOrderRequestModel cmcInsertPresOrderRequestModel; final CMCViewModel model; - const NewCMCStepTowPage({Key key, this.onPick, this.latitude, this.longitude, this.cmcInsertPresOrderRequestModel, this.model}) : super(key: key); + const NewCMCStepTowPage({Key? key, required this.onPick, required this.latitude, required this.longitude, required this.cmcInsertPresOrderRequestModel, required this.model}) : super(key: key); @override _NewCMCStepTowPageState createState() => _NewCMCStepTowPageState(); @@ -42,16 +42,16 @@ class NewCMCStepTowPage extends StatefulWidget { class _NewCMCStepTowPageState extends State { double latitude = 0; double longitude = 0; - AddressInfo _selectedAddress; + late AddressInfo _selectedAddress; bool showCurrentLocation = false; AppSharedPreferences sharedPref = AppSharedPreferences(); - static CameraPosition cameraPosition = CameraPosition( - target: LatLng(37.42796133580664, -122.085749655962), + static gmaps.CameraPosition cameraPosition = gmaps.CameraPosition( + target: gmaps.LatLng(37.42796133580664, -122.085749655962), zoom: 14.4746, ); - LatLng currentPostion; + late gmaps.LatLng currentPostion; void _getUserLocation() async { if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { @@ -59,31 +59,31 @@ class _NewCMCStepTowPageState extends State { var long = await this.sharedPref.getDouble(USER_LONG); latitude = lat; longitude = long; - currentPostion = LatLng(lat, long); + currentPostion = gmaps.LatLng(lat, long); setMap(); } else { if (await PermissionService.isLocationEnabled()) { Geolocator.getLastKnownPosition().then((value) { - latitude = value.latitude; + latitude = value!.latitude; longitude = value.longitude; - currentPostion = LatLng(latitude, longitude); + currentPostion = gmaps.LatLng(latitude, longitude); setMap(); }); } else { if (Platform.isAndroid) { Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () { Geolocator.getLastKnownPosition().then((value) { - latitude = value.latitude; + latitude = value!.latitude; longitude = value.longitude; - currentPostion = LatLng(latitude, longitude); + currentPostion = gmaps.LatLng(latitude, longitude); setMap(); }); }); } else { Geolocator.getLastKnownPosition().then((value) { - latitude = value.latitude; + latitude = value!.latitude; longitude = value.longitude; - currentPostion = LatLng(latitude, longitude); + currentPostion = gmaps.LatLng(latitude, longitude); setMap(); }); } @@ -95,10 +95,12 @@ class _NewCMCStepTowPageState extends State { void initState() { super.initState(); appMap = AppMap( - cameraPosition.toMap(), + cameraPosition.toMap() as Map, + // Changed by Aamir onCameraMove: (camera) { setState(() {}); - _updatePosition(camera); + // Changed by Aamir + _updatePosition(camera as gmaps.CameraPosition); }, onMapCreated: () { print("_getUserLocation"); @@ -109,7 +111,7 @@ class _NewCMCStepTowPageState extends State { setMap() { setState(() { - cameraPosition = CameraPosition( + cameraPosition = gmaps.CameraPosition( target: currentPostion, zoom: 14.4746, ); @@ -126,7 +128,7 @@ class _NewCMCStepTowPageState extends State { return permissionResults; } - setLatitudeAndLongitude({bool isSetState = false, String latLong}) async { + setLatitudeAndLongitude({bool isSetState = false, String? latLong}) async { print("latLong " + latLong.toString()); if (latLong == null) { if (widget.model.addressesList.isEmpty) { @@ -139,18 +141,18 @@ class _NewCMCStepTowPageState extends State { } if (!showCurrentLocation) { - List latLongArr = latLong.split(','); + List latLongArr = latLong!.split(','); latitude = double.parse(latLongArr[0]); longitude = double.parse(latLongArr[1]); print("sssss1 " + latitude.toString()); print("sssss2 " + longitude.toString()); - currentPostion = LatLng(latitude, longitude); + currentPostion = gmaps.LatLng(latitude, longitude); setMap(); } } - AppMap appMap; + late AppMap appMap; @override Widget build(BuildContext context) { @@ -283,7 +285,7 @@ class _NewCMCStepTowPageState extends State { ); } - void _updatePosition(CameraPosition _position) { + void _updatePosition(gmaps.CameraPosition _position) { latitude = _position.target.latitude; longitude = _position.target.longitude; } @@ -308,7 +310,7 @@ class _NewCMCStepTowPageState extends State { String getAddressName() { if (_selectedAddress != null) - return _selectedAddress.address1; + return _selectedAddress.address1!; else return TranslationBase.of(context).selectAddress; } diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart index 42212c40..162c67a2 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart @@ -20,7 +20,7 @@ class CMCPage extends StatefulWidget { } class _CMCPageState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; @override void initState() { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index 9ff4e067..10a15d8d 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -23,7 +23,7 @@ import 'Dialog/confirm_cancel_order_dialog.dart'; class OrdersLogDetailsPage extends StatelessWidget { final CMCViewModel model; - const OrdersLogDetailsPage({Key key, this.model}) : super(key: key); + const OrdersLogDetailsPage({Key ?key, required this.model}) : super(key: key); @override Widget build(BuildContext context) { @@ -62,9 +62,9 @@ class OrdersLogDetailsPage extends StatelessWidget { itemBuilder: (context, index) { GetCMCAllOrdersResponseModel order = model.cmcAllPresOrders.reversed.toList()[index]; - int status = order.statusId; - String _statusDisp = order.statusText; - Color _color; + int status = order.statusId!; + String _statusDisp = order.statusText!; + late Color _color; if (status == 1) { //pending _color = Color(0xffCC9B14); @@ -133,7 +133,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Expanded( child: Text( // !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), - order.projectName != null ? order.projectName.trim().toString() : "", + order.projectName != null ? order.projectName!.trim().toString() : "", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), @@ -147,7 +147,7 @@ class OrdersLogDetailsPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created!)!), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), SizedBox(height: 12), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart index 5d1d5210..543f320b 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart @@ -16,7 +16,7 @@ class StartIndexForNewEReferral extends StatefulWidget { } class _StartIndexForNewEReferralState extends State with TickerProviderStateMixin { - PageController _controller; + late PageController _controller; int _currentIndex = 0; int pageSelected = 2; @@ -120,7 +120,7 @@ class _StartIndexForNewEReferralState extends State w ); } - Widget showProgress({String title, String status, Color color, bool isNeedBorder = true}) { + Widget showProgress({required String title, required String status, required Color color, bool isNeedBorder = true}) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index 363b46e2..e6c7fb72 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -28,7 +28,7 @@ class NewEReferralStepOnePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; - const NewEReferralStepOnePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); + const NewEReferralStepOnePage({Key? key, required this.createEReferralRequestModel, required this.changePageViewIndex}) : super(key: key); @override _NewEReferralStepOnePageState createState() => _NewEReferralStepOnePageState(); @@ -38,19 +38,19 @@ class _NewEReferralStepOnePageState extends State { TextEditingController _nameTextController = TextEditingController(); TextEditingController _requesterRelationTextController = TextEditingController(); - GetAllRelationshipTypeResponseModel _selectedRelation; - String email; - AuthenticatedUser authenticatedUser; - GetAllSharedRecordsByStatusList selectedPatientFamily; + late GetAllRelationshipTypeResponseModel _selectedRelation; + String? email; + late AuthenticatedUser authenticatedUser; + late GetAllSharedRecordsByStatusList selectedPatientFamily; AdvanceModel advanceModel = AdvanceModel(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; String mobileNo = ""; // todo create a model for Country // todo use country from the json dynamic _selectedCountry = {"name": "Saudi Arabia", "name_ar": "المملكة العربية السعودية", "code": "966", "countryCode": "SA", "pattern": "5xxxxxxxx", "maxLength": 9}; AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; + late AuthenticatedUser authUser; @override void initState() { @@ -251,7 +251,7 @@ class _NewEReferralStepOnePageState extends State { } Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, - {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + {VoidCallback? suffixTap, bool isEnable = true, bool hasSelection = false, int? lines, bool isInputTypeNum = false}) { return Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), alignment: Alignment.center, @@ -340,9 +340,9 @@ class _NewEReferralStepOnePageState extends State { String getRelationName() { if (_selectedRelation != null) { if (projectViewModel.isArabic) { - return _selectedRelation.textAr; + return _selectedRelation.textAr!; } - return _selectedRelation.textEn; + return _selectedRelation.textEn!; } else return ""; } @@ -359,7 +359,7 @@ class _NewEReferralStepOnePageState extends State { } class MobileNumberTextFiled extends StatelessWidget { - const MobileNumberTextFiled({Key key, this.controller, this.code, this.onChange}) : super(key: key); + const MobileNumberTextFiled({Key? key, required this.controller, required this.code, required this.onChange}) : super(key: key); final TextEditingController controller; final String code; @@ -389,7 +389,7 @@ class MobileNumberTextFiled extends StatelessWidget { margin: EdgeInsets.all(5), child: TextField( controller: controller, - onChanged: onChange, + onChanged: onChange(), keyboardType: TextInputType.phone, decoration: InputDecoration(border: InputBorder.none, hintText: '5xxxxxxxx'), ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart index 7bacad65..9d08ec32 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart @@ -29,7 +29,7 @@ class NewEReferralStepThreePage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; - const NewEReferralStepThreePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); + const NewEReferralStepThreePage({Key? key, required this.createEReferralRequestModel, required this.changePageViewIndex}) : super(key: key); @override _NewEReferralStepThreePageState createState() => _NewEReferralStepThreePageState(); @@ -38,9 +38,9 @@ class NewEReferralStepThreePage extends StatefulWidget { class _NewEReferralStepThreePageState extends State { TextEditingController _nameTextController = TextEditingController(); TextEditingController _mobileTextController = TextEditingController(); - GetAllCitiesResponseModel _selectedCity; + late GetAllCitiesResponseModel _selectedCity; - GetAllSharedRecordsByStatusList selectedPatientFamily; + late GetAllSharedRecordsByStatusList selectedPatientFamily; List medicalReportImages = []; List insuredPatientImages = []; @@ -48,10 +48,10 @@ class _NewEReferralStepThreePageState extends State { bool isPatientInsured = false; AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; + late AuthenticatedUser authUser; final GlobalKey projectDropdownKey = GlobalKey(); - String projectDropdownValue; + String? projectDropdownValue; @override void initState() { @@ -211,12 +211,12 @@ class _NewEReferralStepThreePageState extends State { items: projectsList.map((item) { return new DropdownMenuItem( value: item.mainProjectID.toString() + "," + item.name.toString(), - child: new Text(item.name), + child: new Text(item.name!), ); }).toList(), onChanged: (newValue) { setState(() { - projectDropdownValue = newValue; + projectDropdownValue = newValue!; print(projectDropdownValue); }); }, @@ -247,9 +247,9 @@ class _NewEReferralStepThreePageState extends State { Checkbox( value: isPatientInsured, activeColor: CustomColors.accentColor, - onChanged: (bool newValue) { + onChanged: (bool? newValue) { setState(() { - isPatientInsured = newValue; + isPatientInsured = newValue!; }); }), Padding( @@ -372,8 +372,8 @@ class _NewEReferralStepThreePageState extends State { this.widget.createEReferralRequestModel.insuranceCardAttachment = insuredPatientImages.length != 0 ? insuredPatientImages[0] : null; this.widget.createEReferralRequestModel.isInsuredPatient = isPatientInsured; // ToDo make the preferred Branch info dynamic - this.widget.createEReferralRequestModel.preferredBranchCode = projectDropdownValue != null && projectDropdownValue.isNotEmpty ? num.tryParse(projectDropdownValue.split(",")[0]) : 0; - this.widget.createEReferralRequestModel.preferredBranchName = projectDropdownValue != null && projectDropdownValue.isNotEmpty ? projectDropdownValue.split(",")[1] : ""; + this.widget.createEReferralRequestModel.preferredBranchCode = projectDropdownValue != null && projectDropdownValue!.isNotEmpty ? int.tryParse(projectDropdownValue!.split(",")[0]) : 0; + this.widget.createEReferralRequestModel.preferredBranchName = projectDropdownValue != null && projectDropdownValue!.isNotEmpty ? projectDropdownValue!.split(",")[1] : ""; // this.widget.createEReferralRequestModel.otherRelationship = ""; await model.createEReferral(this.widget.createEReferralRequestModel); if (model.state == ViewState.ErrorLocal) { @@ -472,7 +472,7 @@ class _NewEReferralStepThreePageState extends State { String getRelationName() { if (_selectedCity != null) - return _selectedCity.description; + return _selectedCity.description!; else return "Select Relationship" /*TranslationBase.of(context).selectHospital*/; } diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart index a953705e..2ea76b65 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -25,7 +25,7 @@ class NewEReferralStepTowPage extends StatefulWidget { final CreateEReferralRequestModel createEReferralRequestModel; final Function changePageViewIndex; - const NewEReferralStepTowPage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); + const NewEReferralStepTowPage({Key? key, required this.createEReferralRequestModel, required this.changePageViewIndex}) : super(key: key); @override _NewEReferralStepTowPageState createState() => _NewEReferralStepTowPageState(); @@ -35,15 +35,15 @@ class _NewEReferralStepTowPageState extends State { TextEditingController _patientNameTextController = TextEditingController(); TextEditingController _patientIdentificationTextController = TextEditingController(); String mobileNo = ""; - GetAllCitiesResponseModel _selectedCity; + late GetAllCitiesResponseModel _selectedCity; - GetAllSharedRecordsByStatusList selectedPatientFamily; + late GetAllSharedRecordsByStatusList selectedPatientFamily; // todo create a model for Country // todo use country from the json dynamic _selectedCountry = {"name": "Saudi Arabia", "name_ar": "المملكة العربية السعودية", "code": "966", "countryCode": "SA", "pattern": "5xxxxxxxx", "maxLength": 9}; AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; + late AuthenticatedUser authUser; @override void initState() { @@ -195,7 +195,7 @@ class _NewEReferralStepTowPageState extends State { } Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, - {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + {VoidCallback? suffixTap, bool isEnable = true, bool hasSelection = false, int? lines, bool isInputTypeNum = false}) { return Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), alignment: Alignment.center, @@ -298,7 +298,7 @@ class _NewEReferralStepTowPageState extends State { String getRelationName() { if (_selectedCity != null) - return _selectedCity.description; + return _selectedCity.description!; else return TranslationBase.of(context).selectCity /*TranslationBase.of(context).selectHospital*/; } @@ -312,7 +312,7 @@ class _NewEReferralStepTowPageState extends State { } class MobileNumberTextFiled extends StatelessWidget { - const MobileNumberTextFiled({Key key, this.controller, this.code}) : super(key: key); + const MobileNumberTextFiled({Key? key, required this.controller, required this.code}) : super(key: key); final TextEditingController controller; final String code; diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart index 52338edd..e07f01bf 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart @@ -10,7 +10,7 @@ class SelectCityDialog extends StatefulWidget { final Function(GetAllCitiesResponseModel) onValueSelected; GetAllCitiesResponseModel selectedCity; - SelectCityDialog({Key key, this.cities, this.onValueSelected, this.selectedCity}); + SelectCityDialog({Key? key, required this.cities, required this.onValueSelected, required this.selectedCity}); @override _SelectCityDialogState createState() => _SelectCityDialogState(); @@ -51,14 +51,14 @@ class _SelectCityDialogState extends State { }); }, child: ListTile( - title: Text(widget.cities[index].description), + title: Text(widget.cities[index].description!), leading: Radio( value: widget.cities[index], groupValue: widget.selectedCity, activeColor: Colors.red[800], onChanged: (value) { setState(() { - widget.selectedCity = value; + widget.selectedCity = value!; }); }, ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart index 8046346f..e1db9d5c 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart @@ -11,7 +11,7 @@ class SelectCountryDialog extends StatefulWidget { dynamic selectedCountry; SelectCountryDialog( - {Key key, /*this.relationTypes,*/ this.onValueSelected, this.selectedCountry}); + {Key? key, /*this.relationTypes,*/ required this.onValueSelected, this.selectedCountry}); @override _SelectCountryDialogState createState() => _SelectCountryDialogState(); diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart index e8d4bb7d..d5323f4c 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart @@ -11,7 +11,7 @@ class SelectRelationTypeDialog extends StatefulWidget { GetAllRelationshipTypeResponseModel selectedRelation; SelectRelationTypeDialog( - {Key key, this.relationTypes, this.onValueSelected, this.selectedRelation}); + {Key? key, required this.relationTypes, required this.onValueSelected, required this.selectedRelation}); @override _SelectRelationTypeDialogState createState() => _SelectRelationTypeDialogState(); @@ -50,14 +50,14 @@ class _SelectRelationTypeDialogState extends State { }); }, child: ListTile( - title: Text(widget.relationTypes[index].text), + title: Text(widget.relationTypes[index].text!), leading: Radio( value: widget.relationTypes[index], groupValue: widget.selectedRelation, activeColor: Colors.red[800], onChanged: (value) { setState(() { - widget.selectedRelation = value; + widget.selectedRelation = value!; }); }, ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart index f7915c68..b9eefe08 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart @@ -20,9 +20,9 @@ class EReferralConfirmSMSDialog extends StatefulWidget { // final String selectedPaymentMethod; const EReferralConfirmSMSDialog( - {Key key, - this.phoneNumber, - this.onSucces + {Key? key, + required this.phoneNumber, + required this.onSucces // this.advanceModel, // this.selectedPaymentMethod, // this.patientInfoAndMobileNumber @@ -50,7 +50,7 @@ class _EReferralConfirmSMSDialogState 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; @@ -75,10 +75,10 @@ class _EReferralConfirmSMSDialogState 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() { @@ -158,7 +158,7 @@ class _EReferralConfirmSMSDialogState extends State { Form( key: verifyAccountForm, child: Container( - width: SizeConfig.realScreenWidth * 0.90, + width: SizeConfig.realScreenWidth! * 0.90, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -173,7 +173,7 @@ class _EReferralConfirmSMSDialogState extends State { child: TextFormField( textInputAction: TextInputAction.next, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), focusNode: focusD1, maxLength: 1, @@ -204,7 +204,7 @@ class _EReferralConfirmSMSDialogState extends State { maxLength: 1, textAlign: TextAlign.center, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), keyboardType: TextInputType.number, decoration: buildInputDecoration(context), @@ -231,7 +231,7 @@ class _EReferralConfirmSMSDialogState extends State { maxLength: 1, textAlign: TextAlign.center, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), keyboardType: TextInputType.number, decoration: buildInputDecoration(context), @@ -257,7 +257,7 @@ class _EReferralConfirmSMSDialogState extends State { maxLength: 1, textAlign: TextAlign.center, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), keyboardType: TextInputType.number, decoration: buildInputDecoration(context), @@ -330,7 +330,7 @@ class _EReferralConfirmSMSDialogState extends State { } void submit(EReferralViewModel model) async { - if (verifyAccountForm.currentState.validate()) { + if (verifyAccountForm.currentState!.validate()) { final activationCode = digit1.text + digit2.text + digit3.text + digit4.text; // ToDo call service @@ -346,7 +346,7 @@ class _EReferralConfirmSMSDialogState extends State { } } - String validateCodeDigit(value) { + String? validateCodeDigit(value) { if (value.isEmpty) { return ''; } diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart index 78d3bca3..f216c5ea 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart @@ -20,7 +20,7 @@ class EReferralPage extends StatefulWidget { class _EReferralPageState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; @override void initState() { diff --git a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart index 1baab531..d92ff50b 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -10,7 +11,7 @@ import 'package:provider/provider.dart'; class ReferralDetails extends StatefulWidget { final SearchEReferralResponseModel referral; - const ReferralDetails({Key key, @required this.referral}) : super(key: key); + const ReferralDetails({Key? key, required this.referral}) : super(key: key); @override _ReferralDetailsState createState() => _ReferralDetailsState(); @@ -55,7 +56,7 @@ class _ReferralDetailsState extends State { ], ), ), - mDivider(Colors.grey[600]), + mDivider(dividerColor!), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), @@ -70,7 +71,7 @@ class _ReferralDetailsState extends State { ], ), ), - mDivider(Colors.grey[600]), + mDivider(dividerColor!), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), @@ -85,7 +86,7 @@ class _ReferralDetailsState extends State { ], ), ), - mDivider(Colors.grey[600]), + mDivider(dividerColor!), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), @@ -95,12 +96,12 @@ class _ReferralDetailsState extends State { child: _getNormalText(TranslationBase.of(context).referralDate), ), Expanded( - child: _getNormalText(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(widget.referral.referralDate)), isBold: true), + child: _getNormalText(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(widget.referral.referralDate!)), isBold: true), ) ], ), ), - mDivider(Colors.grey[600]), + mDivider(dividerColor!), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart index b2277560..106dc6e0 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -25,7 +25,7 @@ import 'package:provider/provider.dart'; import 'dialogs/select_country_ingo_Dialog.dart'; class SearchForReferralsPage extends StatefulWidget { - SearchForReferralsPage({Key key}); + SearchForReferralsPage({Key? key}); @override _SearchForReferralsPageState createState() => _SearchForReferralsPageState(); @@ -50,14 +50,14 @@ class _SearchForReferralsPageState extends State { Future.delayed(new Duration(milliseconds: 300)).then((value) async { GifLoaderDialogUtils.showMyDialog(context); SearchEReferralRequestModel searchEReferralRequestModel = new SearchEReferralRequestModel( - patientMobileNumber: (projectViewModel.user.outSA == 0 ? "966" : "971") + projectViewModel.user.mobileNumber.substring(1, projectViewModel.user.mobileNumber.length), + patientMobileNumber: (projectViewModel.user!.outSA == 0 ? "966" : "971") + projectViewModel.user!.mobileNumber!.substring(1, projectViewModel.user!.mobileNumber!.length), ); if (selectedCriteria.value == 1) { searchEReferralRequestModel.identificationNo = _searchTextController.text; searchEReferralRequestModel.referralNumber = 0; } else { searchEReferralRequestModel.referralNumber = int.parse(_searchTextController.text); - searchEReferralRequestModel.identificationNo = projectViewModel.user.patientIdentificationNo; + searchEReferralRequestModel.identificationNo = projectViewModel.user!.patientIdentificationNo; } await model.getEReferrals(searchEReferralRequestModel); GifLoaderDialogUtils.hideDialog(context); @@ -85,7 +85,7 @@ class _SearchForReferralsPageState extends State { ]; List list = []; for (int i = 0; i < searchCriteria.length; i++) { - list.add(RadioSelectionDialogModel(projectViewModel.isArabic ? searchCriteria[i].nameAr : searchCriteria[i].name, searchCriteria[i].value)); + list.add(RadioSelectionDialogModel(projectViewModel.isArabic ? searchCriteria[i].nameAr! : searchCriteria[i].name!, searchCriteria[i].value!)); } showDialog( context: context, @@ -168,14 +168,14 @@ class _SearchForReferralsPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(projectViewModel.isArabic ? model.allReferral[index].statusAr : model.allReferral[index].status, + Text(projectViewModel.isArabic ? model.allReferral[index].statusAr! : model.allReferral[index].status!, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)), Container( margin: EdgeInsets.only(top: 5.0), - child: MyRichText(TranslationBase.of(context).patientName + ": ", model.allReferral[index].patientName, projectViewModel.isArabic)), - MyRichText(TranslationBase.of(context).hospital + ": ", model.allReferral[index].preferredBranchName, projectViewModel.isArabic), + child: MyRichText(TranslationBase.of(context).patientName + ": ", model.allReferral[index].patientName!, projectViewModel.isArabic)), + MyRichText(TranslationBase.of(context).hospital + ": ", model.allReferral[index].preferredBranchName!, projectViewModel.isArabic), MyRichText(TranslationBase.of(context).referralDate + ": ", - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(model.allReferral[index].referralDate)), projectViewModel.isArabic), + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(model.allReferral[index].referralDate!)), projectViewModel.isArabic), ], ), Icon(projectViewModel.isArabic ? Icons.arrow_back_ios_outlined : Icons.arrow_forward_outlined), @@ -248,7 +248,7 @@ class _SearchForReferralsPageState extends State { } Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, - {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + {VoidCallback? suffixTap, bool isEnable = true, bool hasSelection = false, int? lines, bool isInputTypeNum = false}) { return InkWell( onTap: hasSelection ? () {} : null, child: Row( @@ -309,6 +309,6 @@ class _SearchForReferralsPageState extends State { } String getSearchCriteriaName(ProjectViewModel projectViewModel) { - return projectViewModel.isArabic ? selectedCriteria.nameAr : selectedCriteria.name; + return projectViewModel.isArabic ? selectedCriteria.nameAr! : selectedCriteria.name!; } } diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index ffb974e1..6ed4a47b 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -50,7 +50,7 @@ class AllHabibMedicalService extends StatefulWidget { //TODO final Function goToMyProfile; - AllHabibMedicalService({Key key, this.goToMyProfile}); + AllHabibMedicalService({Key? key, required this.goToMyProfile}); @override _AllHabibMedicalServiceState createState() => _AllHabibMedicalServiceState(); @@ -61,7 +61,7 @@ class _AllHabibMedicalServiceState extends State { AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); PharmacyModuleViewModel pharmacyModuleViewModel = locator(); - LocationUtils locationUtils; + late LocationUtils locationUtils; var weather = '--'; WeatherService _weatherService = WeatherService(); List hmgServices = []; @@ -70,7 +70,7 @@ class _AllHabibMedicalServiceState extends State { void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance.addPostFrameCallback((_) => {Geolocator.getLastKnownPosition().then((value) => setLocation(value))}); + WidgetsBinding.instance.addPostFrameCallback((_) => {Geolocator.getLastKnownPosition().then((value) => setLocation(value!))}); }); super.initState(); } diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart index 779c230e..f23d175d 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart @@ -30,7 +30,7 @@ class AllHabibMedicalSevicePage2 extends StatefulWidget { class _AllHabibMedicalSevicePage2State extends State { List hmgServices = []; - LocationUtils locationUtils; + late LocationUtils locationUtils; var weather = '--'; AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser = new AuthenticatedUser(); @@ -46,17 +46,17 @@ class _AllHabibMedicalSevicePage2State extends State locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); WidgetsBinding.instance.addPostFrameCallback((_) async => { if (await PermissionService.isLocationEnabled()) - {Geolocator.getLastKnownPosition().then((value) => setLocation(value))} + {Geolocator.getLastKnownPosition().then((value) => setLocation(value!))} else { if (Platform.isAndroid) { Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () { - Geolocator.getLastKnownPosition().then((value) => setLocation(value)); + Geolocator.getLastKnownPosition().then((value) => setLocation(value!)); }) } else - {Geolocator.getLastKnownPosition().then((value) => setLocation(value))} + {Geolocator.getLastKnownPosition().then((value) => setLocation(value!))} } }); }); diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart index 3b708c46..37aa7e91 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrders.dart @@ -18,8 +18,8 @@ class AnicllaryOrders extends StatefulWidget { } class _AnicllaryOrdersState extends State with SingleTickerProviderStateMixin { - TabController _tabController; - ProjectViewModel projectViewModel; + TabController? _tabController; + late ProjectViewModel projectViewModel; void initState() { super.initState(); @@ -28,7 +28,7 @@ class _AnicllaryOrdersState extends State with SingleTickerProv void dispose() { super.dispose(); - _tabController.dispose(); + _tabController!.dispose(); } @override @@ -73,7 +73,7 @@ class _AnicllaryOrdersState extends State with SingleTickerProv ), mWidth(3), Text( - projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + projectViewModel.user!.firstName! + " " + projectViewModel.user!.lastName!, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -95,7 +95,7 @@ class _AnicllaryOrdersState extends State with SingleTickerProv ), mWidth(3), Text( - projectViewModel.user.patientID.toString(), + projectViewModel!.user!.patientID.toString(), style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -117,7 +117,7 @@ class _AnicllaryOrdersState extends State with SingleTickerProv ), mWidth(3), Text( - projectViewModel.user.patientIdentificationNo, + projectViewModel!.user!.patientIdentificationNo!, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -146,18 +146,18 @@ class _AnicllaryOrdersState extends State with SingleTickerProv reverse: true, itemBuilder: (context, index) { return DoctorCard( - onTap: () => ancillaryOrdersDetails(model.ancillaryLists[0].ancillaryOrderList[index], model.ancillaryLists[0].projectID), + onTap: () => ancillaryOrdersDetails(model.ancillaryLists[0].ancillaryOrderList![index], model.ancillaryLists[0].projectID), isInOutPatient: true, - name: TranslationBase.of(context).dr.toString() + " " + (model.ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""), - billNo: model.ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(), + name: TranslationBase.of(context).dr.toString() + " " + (model.ancillaryLists[0].ancillaryOrderList![index].doctorName ?? ""), + billNo: model.ancillaryLists[0].ancillaryOrderList![index].orderNo.toString(), profileUrl: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", subName: model.ancillaryLists[0].projectName, isLiveCareAppointment: false, - date: DateUtil.convertStringToDate(model.ancillaryLists[0].ancillaryOrderList[index].orderDate), + date: DateUtil.convertStringToDate(model.ancillaryLists[0].ancillaryOrderList![index].orderDate!), isSortByClinic: true, ); }, - itemCount: model.ancillaryLists[0].ancillaryOrderList.length, + itemCount: model.ancillaryLists[0].ancillaryOrderList!.length, separatorBuilder: (context, index) => SizedBox(height: 14), ), ]); diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index b1b457f5..e7b89b42 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -37,18 +37,18 @@ class AnicllaryOrdersDetails extends StatefulWidget { } class _AnicllaryOrdersState extends State with SingleTickerProviderStateMixin { - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; bool _agreeTerms = false; - String selectedPaymentMethod; - MyInAppBrowser browser; + String selectedPaymentMethod = ""; + late MyInAppBrowser browser; String transID = ""; - BuildContext localContext; - String selectedInstallmentPlan; + late BuildContext localContext; + String? selectedInstallmentPlan; List selectedProcList = []; - String tamaraPaymentStatus; - String tamaraOrderID; + String? tamaraPaymentStatus; + String? tamaraOrderID; void initState() { super.initState(); @@ -207,7 +207,7 @@ class _AnicllaryOrdersState extends State with SingleTic ), mWidth(3), Text( - projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + projectViewModel.user!.firstName! + " " + projectViewModel.user!.lastName!, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -229,7 +229,7 @@ class _AnicllaryOrdersState extends State with SingleTic ), mWidth(3), Text( - projectViewModel.user.patientID.toString(), + projectViewModel.user!.patientID.toString(), style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -251,7 +251,7 @@ class _AnicllaryOrdersState extends State with SingleTic ), mWidth(3), Text( - projectViewModel.user.patientIdentificationNo, + projectViewModel.user!.patientIdentificationNo!, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -296,7 +296,7 @@ class _AnicllaryOrdersState extends State with SingleTic ), mWidth(3), Text( - model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList[0].orderNo.toString(), + model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList![0].orderNo.toString(), style: TextStyle( fontWeight: FontWeight.w600, fontSize: 12, @@ -366,8 +366,8 @@ class _AnicllaryOrdersState extends State with SingleTic ); } - Widget getAncillaryDetails(model) { - Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); + Widget getAncillaryDetails(AnciallryOrdersViewModel model) { + Map newMap = groupBy(model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList!, (obj) => obj.procedureCategoryName); return Padding(padding: EdgeInsets.only(top: 0, bottom: 200), child: getHeaderDetails(newMap)); } @@ -406,7 +406,7 @@ class _AnicllaryOrdersState extends State with SingleTic padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), decoration: BoxDecoration( color: isProcedureDisabled(value[index]) ? Colors.grey[300] : Colors.white, - border: Border.all(color: isProcedureDisabled(value[index]) ? Colors.grey[300] : Colors.white, width: 1), + border: Border.all(color: isProcedureDisabled(value[index]) ? Colors.grey[300]! : Colors.white, width: 1), borderRadius: BorderRadius.only( bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), @@ -493,31 +493,31 @@ class _AnicllaryOrdersState extends State with SingleTic showDraggableDialog( context, PaymentMethod( - onSelectedMethod: (String method, [String selectedInstallmentPlan]) { + onSelectedMethod: (String method, [String? selectedInstallmentPlan]) { selectedPaymentMethod = method; - this.selectedInstallmentPlan = selectedInstallmentPlan; - openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), null, model, selectedInstallmentPlan); + this.selectedInstallmentPlan = selectedInstallmentPlan!; + openPayment(selectedPaymentMethod, projectViewModel.user!, double.parse(getTotalValue()), AppoitmentAllHistoryResultList(), model, selectedInstallmentPlan); }, patientShare: double.parse(getTotalValue()), isFromAdvancePayment: !projectViewModel.havePrivilege(94), )); } - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, AnciallryOrdersViewModel model, [String selectedInstallmentPlan]) { + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, AnciallryOrdersViewModel model, [String? selectedInstallmentPlan]) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); - transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user.patientID); + transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user!.patientID!); browser.openPaymentBrowser( amount, "Ancillary Orders Payment", transID, widget.projectID.toString(), - projectViewModel.user.emailAddress, + projectViewModel.user!.emailAddress!, paymentMethod, - projectViewModel.user.patientType, - projectViewModel.user.firstName + " " + projectViewModel.user.lastName, - projectViewModel.user.patientID, + projectViewModel.user!.patientType, + projectViewModel.user!.firstName! + " " + projectViewModel.user!.lastName!, + projectViewModel.user!.patientID, authenticatedUser, browser, false, @@ -580,10 +580,10 @@ class _AnicllaryOrdersState extends State with SingleTic service.getTamaraPaymentStatus(orderID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res["status"].toString().toLowerCase() == "success") { - updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID, num.parse(this.selectedInstallmentPlan), appo); + updateTamaraRequestStatus("success", "14", orderID, tamaraOrderID!, int.parse(this.selectedInstallmentPlan!), appo); } else { - updateTamaraRequestStatus( - "Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", num.parse(this.selectedInstallmentPlan), appo); + updateTamaraRequestStatus("Failed", "00", Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), tamaraOrderID != null ? tamaraOrderID! : "", + int.parse(this.selectedInstallmentPlan!), appo); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); @@ -598,7 +598,7 @@ class _AnicllaryOrdersState extends State with SingleTic DoctorsListService service = new DoctorsListService(); service.updateTamaraRequestStatus(responseMessage, status, clientRequestID, tamaraOrderID, selectedInstallments).then((res) { GifLoaderDialogUtils.hideDialog(context); - if (tamaraPaymentStatus.toLowerCase() == "approved") { + if (tamaraPaymentStatus!.toLowerCase() == "approved") { createAdvancePayment(res, appo); // addAdvancedNumberRequestTamara("Tamara-Advance-0000", tamaraOrderID, appo.appointmentNo.toString(), appo); } @@ -637,8 +637,8 @@ class _AnicllaryOrdersState extends State with SingleTic // selectedProcList.forEach((element) { // ancillaryOrdersProcedureList.add(new AncillaryOrdersProcedureList(procedureID: num.parse(element.procedureID), procedureDescription: element.procedureName)); // }); - service.HIS_createAdvancePayment(appo, widget.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], projectViewModel.user.patientType, - projectViewModel.user.firstName + " " + projectViewModel.user.lastName, projectViewModel.user.patientID, localContext, + service.HIS_createAdvancePayment(appo, widget.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], projectViewModel.user!.patientType, + projectViewModel.user!.firstName! + " " + projectViewModel.user!.lastName!, projectViewModel.user!.patientID!, localContext, isAncillaryOrder: true) .then((res) { addAdvancedNumberRequest( @@ -714,7 +714,7 @@ class _AnicllaryOrdersState extends State with SingleTic addToSelectedProcedures(AnciallryOrdersViewModel model) { if (model.ancillaryListsDetails.isNotEmpty) { selectedProcList.clear(); - model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList.forEach((element) { + model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList!.forEach((element) { if (!isProcedureDisabled(element)) { selectedProcList.add(element); } @@ -756,9 +756,9 @@ class _AnicllaryOrdersState extends State with SingleTic } bool isProcedureDisabled(AncillaryOrderProcDetailsList ancillaryOrderProcDetailsList) { - if ((ancillaryOrderProcDetailsList.isApprovalRequired && !ancillaryOrderProcDetailsList.isApprovalCreated) || - (ancillaryOrderProcDetailsList.isApprovalCreated && ancillaryOrderProcDetailsList.approvalNo == 0) || - (ancillaryOrderProcDetailsList.isApprovalRequired && ancillaryOrderProcDetailsList.isApprovalCreated && ancillaryOrderProcDetailsList.approvalNo == 0)) { + if ((ancillaryOrderProcDetailsList.isApprovalRequired! && !ancillaryOrderProcDetailsList.isApprovalCreated!) || + (ancillaryOrderProcDetailsList.isApprovalCreated! && ancillaryOrderProcDetailsList.approvalNo == 0) || + (ancillaryOrderProcDetailsList.isApprovalRequired! && ancillaryOrderProcDetailsList.isApprovalCreated! && ancillaryOrderProcDetailsList.approvalNo == 0)) { return true; } else { return false; diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/setting_page_radio_button_list_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/setting_page_radio_button_list_dialog.dart index 6e6cf726..61e171c3 100644 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/setting_page_radio_button_list_dialog.dart +++ b/lib/pages/AlHabibMedicalService/h2o/Dialog/setting_page_radio_button_list_dialog.dart @@ -6,7 +6,7 @@ class CommonRadioButtonDialog extends StatefulWidget { final String title; final int selectedIndex; final Function(int) onSelect; - CommonRadioButtonDialog({Key key, this.title = "", this.selectedIndex = 0, this.list, this.onSelect}) : super(key: key); + CommonRadioButtonDialog({Key? key, this.title = "", this.selectedIndex = 0, required this.list, required this.onSelect}) : super(key: key); @override _CommonRadioButtonDialogState createState() { @@ -58,7 +58,7 @@ class _CommonRadioButtonDialogState extends State { dense: true, activeColor: Colors.black54, groupValue: _selectedIndex, - onChanged: (_index) => setState(() => _selectedIndex = _index), + onChanged: (_index) => setState(() => _selectedIndex = _index!), title: Text( widget.list[index], style: TextStyle(fontWeight: FontWeight.w500), diff --git a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart index 3c545336..ee7f03c3 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart @@ -22,7 +22,7 @@ class H2oSetting extends StatefulWidget { final UserDetailModel userDetailModel; final H2OViewModel viewModel; - H2oSetting({Key key, this.userDetailModel, this.viewModel}) : super(key: key); + H2oSetting({Key? key, required this.userDetailModel, required this.viewModel}) : super(key: key); @override _H2oSettingState createState() { @@ -51,7 +51,7 @@ class _H2oSettingState extends State { DateTime _dobDate = DateTime.now(); DateTime _tempDate = DateTime.now(); - UserDetailModel _userDetailModel; + late UserDetailModel _userDetailModel; @override void initState() { @@ -61,16 +61,16 @@ class _H2oSettingState extends State { _weightValue = _userDetailModel?.weight ?? 50; _heightController.text = _heightValue.toStringAsFixed(0); _weightController.text = _weightValue.toStringAsFixed(0); - _nameController.text = _userDetailModel.firstName; + _nameController.text = _userDetailModel.firstName!; _isWeightKG = _userDetailModel?.isWeightInKG ?? true; _isHeightCM = _userDetailModel?.isHeightInCM ?? true; _isGenderMale = (_userDetailModel?.gender ?? "M") == "M" ? true : false; - _dobDate = DateUtil.convertStringToDate(_userDetailModel.dOB); + _dobDate = DateUtil.convertStringToDate(_userDetailModel.dOB!); _selectedActiveLevel = _userDetailModel.activityID ?? 1; readPrefs(); } - SharedPreferences prefs; + late SharedPreferences prefs; void readPrefs() async { prefs = await SharedPreferences.getInstance(); @@ -81,11 +81,8 @@ class _H2oSettingState extends State { @override void didChangeDependencies() { - // TODO: implement didChangeDependencies super.didChangeDependencies(); - _activityLevelListEng = [TranslationBase.of(context).notActive, TranslationBase.of(context).lightActive, TranslationBase.of(context).modActive, TranslationBase.of(context).active]; - _remindedTimeListEng = ["1 ${TranslationBase.of(context).time}", "2 ${TranslationBase.of(context).times}", "3 ${TranslationBase.of(context).times}", "4 ${TranslationBase.of(context).times}"]; } @@ -142,7 +139,7 @@ class _H2oSettingState extends State { _commonRadioButtonsRow(TranslationBase.of(context).mililitre, TranslationBase.of(context).litre, _isUnitML, (value) { if (_isUnitML != value) { setState(() { - _isUnitML = value; + _isUnitML = value!; }); } }), @@ -161,7 +158,7 @@ class _H2oSettingState extends State { _commonRadioButtonsRow(TranslationBase.of(context).male, TranslationBase.of(context).female, _isGenderMale, (value) { if (_isGenderMale != value) { setState(() { - _isGenderMale = value; + _isGenderMale = value!; }); } }), @@ -328,7 +325,7 @@ class _H2oSettingState 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 InkWell( onTap: hasSelection ? () {} : null, child: Row( @@ -400,7 +397,7 @@ class _H2oSettingState extends State { ); } - Widget _commonRadioButtonsRow(String rightText, String leftText, bool checkParam, Function(bool) callBack) { + Widget _commonRadioButtonsRow(String rightText, String leftText, bool checkParam, Function(bool?) callBack) { return Row( children: [ Row( @@ -509,7 +506,7 @@ class _H2oSettingState extends State { Expanded( flex: 1, child: PopupMenuButton( - child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}), onSelected: (value) { onUnitTap(value); }, @@ -554,13 +551,13 @@ class _H2oSettingState extends State { final CalendarPlugin _myPlugin = CalendarPlugin(); void _addReminderToCalender(int _selectedRemindedTime) async { - bool _calendarPermission = await _myPlugin.hasPermissions(); - if (_calendarPermission) { + bool? _calendarPermission = await _myPlugin.hasPermissions(); + if (_calendarPermission!) { } else { await _myPlugin.requestPermissions(); } _myPlugin.hasPermissions().then((value) { - if (!value) { + if (!value!) { _myPlugin.requestPermissions(); } else { _myPlugin.getCalendars().then((value) => {}); @@ -574,8 +571,8 @@ class CommonDropDownView extends StatelessWidget { final String title; final String value; final VoidCallback callback; - final IconData iconData; - CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + final IconData? iconData; + CommonDropDownView(this.title, this.value, this.callback, {Key? key, this.iconData}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index d216cd21..981f80b1 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -27,7 +27,7 @@ class H2OPage extends StatefulWidget { } class _H2OPageState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; @override void initState() { diff --git a/lib/pages/AlHabibMedicalService/h2o/month_page.dart b/lib/pages/AlHabibMedicalService/h2o/month_page.dart index 642f4826..49440106 100644 --- a/lib/pages/AlHabibMedicalService/h2o/month_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/month_page.dart @@ -49,7 +49,7 @@ class MonthPage extends StatelessWidget { style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64), ), SizedBox(height: 24), - CustomLineChart(model.userProgressForMonthDataSeries, projectViewModel.isArabic), + CustomLineChart(model.userProgressForMonthDataSeries!, projectViewModel.isArabic), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index 7b10078b..55a12105 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -16,7 +16,7 @@ import 'package:wave/config.dart'; import 'package:wave/wave.dart'; class TodayPage extends StatefulWidget { - TodayPage({Key key}) : super(key: key); + TodayPage({Key? key}) : super(key: key); @override _TodayPageState createState() { @@ -60,7 +60,7 @@ class _TodayPageState extends State { builder: (context, data) { String unit; if (data.connectionState == ConnectionState.done) { - isUnitML = data.data; + isUnitML = data.data!; } if (isUnitML) { unit = TranslationBase.of(context).ml; @@ -348,7 +348,7 @@ class _TodayPageState extends State { InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: amount); await model.insertUserActivity(insertUserActivityRequestModel); GifLoaderDialogUtils.hideDialog(context); - FocusManager.instance.primaryFocus.unfocus(); + FocusManager.instance.primaryFocus!.unfocus(); }, ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/week_page.dart b/lib/pages/AlHabibMedicalService/h2o/week_page.dart index 83529afd..447f8da7 100644 --- a/lib/pages/AlHabibMedicalService/h2o/week_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/week_page.dart @@ -48,7 +48,7 @@ class WeekPage extends StatelessWidget { style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64), ), SizedBox(height: 24), - CustomLineChart(model.userProgressForWeekDataSeries, projectViewModel.isArabic), + CustomLineChart(model.userProgressForWeekDataSeries!, projectViewModel.isArabic), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_buttom_navigation_bar.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_buttom_navigation_bar.dart index 3b2e166e..9309fa9b 100644 --- a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_buttom_navigation_bar.dart +++ b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_buttom_navigation_bar.dart @@ -9,7 +9,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; import 'package:flutter/material.dart'; class H20BottomNavigationBar extends StatelessWidget { - H20BottomNavigationBar({Key key}) : super(key: key); + H20BottomNavigationBar({Key? key}) : super(key: key); PageController pageController = PageController(keepPage: true); int currentTab = 0; diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index bbd73d64..f799a161 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -24,10 +24,10 @@ class HealthWeatherIndicator extends StatefulWidget { class _HospitalsPageState extends State { var data; AppSharedPreferences sharedPref = AppSharedPreferences(); - LocationUtils locationUtils; + late LocationUtils locationUtils; var weather = '--'; - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override void initState() { @@ -125,7 +125,7 @@ class _HospitalsPageState extends State { Padding( padding: EdgeInsets.all(15), child: AppText( - projectViewModel.isArabic ? mode.weatherIndicatorData[0].cityNameN : mode.weatherIndicatorData[0].cityName, + projectViewModel.isArabic ? mode.weatherIndicatorData[0].cityNameN! : mode.weatherIndicatorData[0].cityName!, fontSize: 24, fontWeight: FontWeight.bold, )), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart index 01378b04..a402d6c7 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart @@ -66,8 +66,8 @@ class _BariatricsPageState extends State { title: Texts("${item.diseases}"), activeColor: Colors.blue.shade700, value: item.diseasesID, - groupValue: _selectedDisease != null ? _selectedDisease.diseasesID : -1, - selected: _selectedDisease != null ? item.diseasesID == _selectedDisease.diseasesID : false, + groupValue: _selectedDisease != null ? _selectedDisease!.diseasesID : -1, + selected: _selectedDisease != null ? item.diseasesID == _selectedDisease!.diseasesID : false, onChanged: (val) { setState(() { _selectedDisease = item; @@ -91,7 +91,7 @@ class _BariatricsPageState extends State { margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: BorderedButton( TranslationBase.of(context).continues, - fontSize: SizeConfig.textMultiplier * 2.1, + fontSize: SizeConfig.textMultiplier! * 2.1, textColor: Colors.white, vPadding: 8, hPadding: 8, @@ -114,7 +114,7 @@ class _BariatricsPageState extends State { margin: EdgeInsets.only(bottom: 16.0, left: 16, right: 16), child: BorderedButton( TranslationBase.of(context).skip, - fontSize: SizeConfig.textMultiplier * 2.1, + fontSize: SizeConfig.textMultiplier! * 2.1, textColor: Colors.blue, vPadding: 8, hPadding: 8, @@ -165,7 +165,7 @@ class _BariatricsPageState 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)); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart index 955dd646..cb91f85d 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart @@ -21,9 +21,9 @@ class BMICalculator extends StatefulWidget { class _BMICalculatorState extends State { TextEditingController textController = new TextEditingController(); - String textResult; - String msg; - double bmiResult; + String? textResult; + String? msg; + double? bmiResult; TextEditingController _heightController = TextEditingController(); TextEditingController _weightController = TextEditingController(); @@ -51,29 +51,29 @@ class _BMICalculatorState extends State { bmiResult = _weightValue / pow(_heightValue / 100, 2); - return bmiResult; + return bmiResult!; } void showTextResult(BuildContext context) { - if (bmiResult >= 30) { + if (bmiResult! >= 30) { textResult = TranslationBase.of(context).obese; - } else if (bmiResult < 30 && bmiResult >= 25) { + } else if (bmiResult! < 30 && bmiResult! >= 25) { textResult = TranslationBase.of(context).overWeight; - } else if (bmiResult < 25 && bmiResult >= 18.5) { + } else if (bmiResult! < 25 && bmiResult! >= 18.5) { textResult = TranslationBase.of(context).healthy; - } else if (bmiResult < 18.5) { + } else if (bmiResult! < 18.5) { textResult = TranslationBase.of(context).underWeight; } } void showMsg(BuildContext context) { - if (bmiResult >= 30) { + if (bmiResult! >= 30) { msg = TranslationBase.of(context).bmiCalcMsgObese; - } else if (bmiResult < 30 && bmiResult >= 25) { + } else if (bmiResult! < 30 && bmiResult! >= 25) { msg = TranslationBase.of(context).bmiCalcMsgOverweight; - } else if (bmiResult < 25 && bmiResult >= 18.5) { + } else if (bmiResult! < 25 && bmiResult! >= 18.5) { msg = TranslationBase.of(context).bmiCalcMsgHealthy; - } else if (bmiResult < 18.5) { + } else if (bmiResult! < 18.5) { msg = TranslationBase.of(context).bmiCalcMsgUnderWeight; } } @@ -184,9 +184,9 @@ class _BMICalculatorState extends State { context, FadePage( page: ResultPage( - finalResult: bmiResult, - textResult: textResult, - msg: msg, + finalResult: bmiResult!, + textResult: textResult!, + msg: msg!, ), ), ); @@ -267,7 +267,7 @@ class _BMICalculatorState extends State { Expanded( flex: 1, child: PopupMenuButton( - child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}), onSelected: (value) { onUnitTap(value); }, @@ -283,9 +283,9 @@ class CommonDropDownView extends StatelessWidget { final String title; final String value; final VoidCallback callback; - final IconData iconData; + final IconData? iconData; - CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + CommonDropDownView(this.title, this.value, this.callback, {Key? key, this.iconData}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart index d01a6935..0c3c399b 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart @@ -21,16 +21,16 @@ class ResultPage extends StatefulWidget { final String textResult; final String msg; - ResultPage({this.finalResult, this.textResult, this.msg}); + ResultPage({required this.finalResult, required this.textResult, required this.msg}); @override _ResultPageState createState() => _ResultPageState(); } class _ResultPageState extends State { - Color inductorColor; + Color? inductorColor; - double percent; + double? percent; Color colorInductor() { if (widget.finalResult >= 30) { @@ -42,7 +42,7 @@ class _ResultPageState extends State { } else if (widget.finalResult < 18.5) { inductorColor = Color(0xff1BE0EE); } - return inductorColor; + return inductorColor!; } double percentInductor() { @@ -55,7 +55,7 @@ class _ResultPageState extends State { } else if (widget.finalResult < 18.5) { percent = 0.25; } - return percent; + return percent!; } @override @@ -163,7 +163,7 @@ class _ResultPageState 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)); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart index 3c215366..0291f762 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -42,14 +42,14 @@ class _BmrCalculatorState extends State { double _heightValue = 150; double _weightValue = 40; - List _heightPopupList =[]; - List _weightPopupList =[]; + List _heightPopupList = []; + List _weightPopupList = []; // int age = 0; // int height = 0; // int weight = 0; double bmrResult = 0; - String dropdownValue = null; + String dropdownValue = ''; double calories = 0; void updateColor(int type) { @@ -357,7 +357,8 @@ class _BmrCalculatorState extends State { height: 18, child: DropdownButtonHideUnderline( child: DropdownButton( - value: dropdownValue, key: clinicDropdownKey, + value: dropdownValue, + key: clinicDropdownKey, icon: Icon(Icons.arrow_downward), iconSize: 0, elevation: 16, @@ -367,9 +368,9 @@ class _BmrCalculatorState extends State { height: 2, color: Colors.black54, ), - onChanged: (String newValue) { + onChanged: (String? newValue) { setState(() { - dropdownValue = newValue; + dropdownValue = newValue!; }); }, items: [ @@ -436,27 +437,28 @@ class _BmrCalculatorState extends State { } void openDropdown(GlobalKey key) { - GestureDetector detector; + GestureDetector? detector; + void searchForGestureDetector(BuildContext element) { element.visitChildElements((element) { if (element.widget != null && element.widget is GestureDetector) { - detector = element.widget; - return false; + detector = element.widget as GestureDetector?; + //return false; } else { searchForGestureDetector(element); } - return true; + //return true; }); } - searchForGestureDetector(key.currentContext); + searchForGestureDetector(key.currentContext!); assert(detector != null); - detector.onTap(); + detector!.onTap!(); } - 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, @@ -605,7 +607,7 @@ class _BmrCalculatorState extends State { Expanded( flex: 1, child: PopupMenuButton( - child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}), onSelected: (value) { onUnitTap(value); }, @@ -621,9 +623,9 @@ class CommonDropDownView extends StatelessWidget { final String title; final String value; final VoidCallback callback; - final IconData iconData; + final IconData? iconData; - CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + CommonDropDownView(this.title, this.value, this.callback, {Key? key, this.iconData}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart index ef098492..5343ff5b 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart @@ -17,7 +17,7 @@ class BmrResultPage extends StatelessWidget { final double bmrResult; final double calories; - BmrResultPage({this.bmrResult, this.calories}); + BmrResultPage({required this.bmrResult, required this.calories}); @override Widget build(BuildContext context) { @@ -148,7 +148,7 @@ class BmrResultPage extends StatelessWidget { .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: "0", patientDoctorAppointment: element)); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart index 4fb1c118..da558d39 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -61,15 +61,15 @@ class _BodyFatState extends State { // int heightCm = 0; // int heightFt = 0; // int hip = 5; - double heightInches; - double minRange; - double maxRange; - double overWeightBy; + double? heightInches; + double? minRange; + double? maxRange; + double? overWeightBy; // int waist = 5; double bodyFat = 0; double fat = 0; - String dropdownValue; + String? dropdownValue; double calories = 0; String textResult = ''; @@ -479,7 +479,7 @@ class _BodyFatState 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, @@ -628,7 +628,7 @@ class _BodyFatState extends State { Expanded( flex: 1, child: PopupMenuButton( - child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}), onSelected: (value) { onUnitTap(value); }, @@ -644,9 +644,9 @@ class CommonDropDownView extends StatelessWidget { final String title; final String value; final VoidCallback callback; - final IconData iconData; + final IconData? iconData; - CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + CommonDropDownView(this.title, this.value, this.callback, {Key? key, this.iconData}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart index d51861f4..94e7796c 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart @@ -18,9 +18,9 @@ class FatResult extends StatelessWidget { final double fat; final String textResult; - FatResult({this.bodyFat, this.fat, this.textResult = ''}); + FatResult({required this.bodyFat, required this.fat, this.textResult = ''}); - Color inductorColor; + Color? inductorColor; Color colorInductor() { if (bodyFat >= 17) { @@ -32,7 +32,7 @@ class FatResult extends StatelessWidget { } else if (bodyFat > 45) { inductorColor = Color(0xff1BE0EE); } - return inductorColor; + return inductorColor!; } @override @@ -84,18 +84,13 @@ class FatResult extends StatelessWidget { ), mHeight(20), Text( - textResult, style: TextStyle( - fontSize: 14, - letterSpacing: -0.56, - fontWeight: FontWeight.w600, - color: CustomColors.textColor - ), + textResult, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, fontWeight: FontWeight.w600, color: CustomColors.textColor), ), ], ).withBorderedContainer, ), mFlex(1), - Container( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), color: Colors.white, @@ -107,7 +102,6 @@ class FatResult extends StatelessWidget { }, ), ), - ], ), ); @@ -118,7 +112,7 @@ class FatResult extends StatelessWidget { BariatricsService service = new BariatricsService(); List doctorsList = []; - List _patientDoctorAppointmentListHospital =[]; + List _patientDoctorAppointmentListHospital = []; service.getCalculationDoctors(calculationID: 5).then((res) { GifLoaderDialogUtils.hideDialog(context); @@ -150,7 +144,7 @@ class FatResult extends StatelessWidget { .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: "0", patientDoctorAppointment: element)); } @@ -165,18 +159,19 @@ class FatResult extends StatelessWidget { }); } } + extension BorderedContainer on Widget { Widget get withBorderedContainer => Container( - padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: this, - ); -} \ No newline at end of file + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart index 502da608..f3f4589c 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -37,14 +37,14 @@ class _CalorieCalculatorState extends State { TextEditingController _heightController = new TextEditingController(); TextEditingController _weightController = TextEditingController(); - List _heightPopupList =[]; - List _weightPopupList =[]; + List _heightPopupList = []; + List _weightPopupList = []; // int age = 0; // int height = 0; // int weight = 0; - double calories; - String dropdownValue; + double? calories; + String dropdownValue = ''; void updateColor(int type) { //MG/DLT card @@ -261,7 +261,6 @@ class _CalorieCalculatorState extends State { SizedBox( height: 12.0, ), - InkWell( onTap: () { // dropdownKey.currentState; @@ -300,16 +299,16 @@ class _CalorieCalculatorState extends State { height: 2, color: Colors.black54, ), - onChanged: (String newValue) { + onChanged: (String? newValue) { setState(() { - dropdownValue = newValue; + dropdownValue = newValue!; }); }, items: [ TranslationBase.of(context).almostInactive, - TranslationBase.of(context).lightActive, - TranslationBase.of(context).lightActive1, - TranslationBase.of(context).superActive, + TranslationBase.of(context).lightActive, + TranslationBase.of(context).lightActive1, + TranslationBase.of(context).superActive, ].map>((String value) { return DropdownMenuItem( value: value, @@ -350,7 +349,7 @@ class _CalorieCalculatorState extends State { context, FadePage( page: CalorieResultPage( - calorie: calories, + calorie: calories!, )), ); } @@ -363,28 +362,51 @@ class _CalorieCalculatorState extends State { ); } + // void openDropdown(GlobalKey key) { + // GestureDetector detector; + // void searchForGestureDetector(BuildContext element) { + // element.visitChildElements((element) { + // if (element.widget != null && element.widget is GestureDetector) { + // detector = element.widget; + // return false; + // } else { + // searchForGestureDetector(element); + // } + // + // return true; + // }); + // } + // + // searchForGestureDetector(key.currentContext); + // assert(detector != null); + // + // detector.onTap(); + // } + // + void openDropdown(GlobalKey key) { - GestureDetector detector; + GestureDetector? detector; + void searchForGestureDetector(BuildContext element) { element.visitChildElements((element) { if (element.widget != null && element.widget is GestureDetector) { - detector = element.widget; - return false; + detector = element.widget as GestureDetector?; + //return false; } else { searchForGestureDetector(element); } - return true; + //return true; }); } - searchForGestureDetector(key.currentContext); + searchForGestureDetector(key.currentContext!); assert(detector != null); - detector.onTap(); + detector!.onTap!(); } - 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, @@ -533,7 +555,7 @@ class _CalorieCalculatorState extends State { Expanded( flex: 1, child: PopupMenuButton( - child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}), onSelected: (value) { onUnitTap(value); }, @@ -549,9 +571,9 @@ class CommonDropDownView extends StatelessWidget { final String title; final String value; final VoidCallback callback; - final IconData iconData; + final IconData? iconData; - CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + CommonDropDownView(this.title, this.value, this.callback, {Key? key, this.iconData}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart index 52d56ac7..e3f37d02 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart @@ -16,7 +16,7 @@ import 'package:percent_indicator/circular_percent_indicator.dart'; class CalorieResultPage extends StatelessWidget { final double calorie; - CalorieResultPage({this.calorie}); + CalorieResultPage({required this.calorie}); @override Widget build(BuildContext context) { @@ -147,7 +147,7 @@ class CalorieResultPage extends StatelessWidget { .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: "0", patientDoctorAppointment: element)); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index 9f2c6842..168b1164 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -19,23 +19,23 @@ class Carbs extends StatefulWidget { class _CarbsState extends State { TextEditingController textController = new TextEditingController(); final GlobalKey clinicDropdownKey = GlobalKey(); - int calories; - String dropdownValue; + int? calories; + late String dropdownValue; bool _visible = false; - int meals; - int protein; - int carbs; + int? meals; + int? protein; + int? carbs; - int fat; - double pCal; - double cCal; - double fCal; - double pCalGram; - double cCalGram; - double fCalGram; - double pCalMeal; - double cCalMeal; - double fCalMeal; + int? fat; + double? pCal; + double? cCal; + double? fCal; + double? pCalGram; + double? cCalGram; + double? fCalGram; + double? pCalMeal; + double? cCalMeal; + double? fCalMeal; void calculateDietRatios() { if (dropdownValue == TranslationBase.of(context).dietVeryLow) { @@ -67,17 +67,17 @@ class _CarbsState extends State { } void calculate() { - pCal = (protein / 100.0) * int.parse(textController.text).ceil(); - cCal = (carbs / 100.0) * int.parse(textController.text); + pCal = (protein! / 100.0) * int.parse(textController.text).ceil(); + cCal = (carbs! / 100.0) * int.parse(textController.text); - fCal = (fat / 100) * int.parse(textController.text); + fCal = (fat! / 100) * int.parse(textController.text); - pCalGram = pCal / 4.0; - cCalGram = cCal / 4.0; - fCalGram = fCal / 9.0; - pCalMeal = pCalGram / meals.ceil(); - cCalMeal = cCalGram / meals.ceil(); - fCalMeal = fCalGram / meals.ceil(); + pCalGram = pCal! / 4.0; + cCalGram = cCal! / 4.0; + fCalGram = fCal! / 9.0; + pCalMeal = pCalGram! / meals!.ceil(); + cCalMeal = cCalGram! / meals!.ceil(); + fCalMeal = fCalGram! / meals!.ceil(); } @override @@ -171,7 +171,8 @@ class _CarbsState extends State { height: 18, child: DropdownButtonHideUnderline( child: DropdownButton( - value: dropdownValue, key: clinicDropdownKey, + value: dropdownValue, + key: clinicDropdownKey, icon: Icon(Icons.arrow_downward), iconSize: 0, elevation: 16, @@ -181,9 +182,9 @@ class _CarbsState extends State { height: 2, color: Colors.black54, ), - onChanged: (String newValue) { + onChanged: (String? newValue) { setState(() { - dropdownValue = newValue; + dropdownValue = newValue!; calculateDietRatios(); }); }, @@ -196,7 +197,8 @@ class _CarbsState extends State { ].map>((String value) { return DropdownMenuItem( value: value, - child: Text(value, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), + child: Text(value, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 11, letterSpacing: -0.44, fontWeight: FontWeight.w600)), ); }).toList(), ), @@ -235,15 +237,15 @@ class _CarbsState extends State { context, FadePage( page: CarbsResult( - cCal: cCal, - pCal: pCal, - fCal: fCal, - pCalGram: pCalGram, - pCalMeal: pCalMeal, - fCalGram: fCalGram, - fCalMeal: fCalMeal, - cCalGram: cCalGram, - cCalMeal: cCalMeal, + cCal: cCal!, + pCal: pCal!, + fCal: fCal!, + pCalGram: pCalGram!, + pCalMeal: pCalMeal!, + fCalGram: fCalGram!, + fCalMeal: fCalMeal!, + cCalGram: cCalGram!, + cCalMeal: cCalMeal!, )), ); } @@ -256,29 +258,52 @@ class _CarbsState extends State { ); } + void openDropdown(GlobalKey key) { - GestureDetector detector; + GestureDetector? detector; + void searchForGestureDetector(BuildContext element) { element.visitChildElements((element) { if (element.widget != null && element.widget is GestureDetector) { - detector = element.widget; - return false; + detector = element.widget as GestureDetector?; + //return false; } else { searchForGestureDetector(element); } - return true; + //return true; }); } - searchForGestureDetector(key.currentContext); + searchForGestureDetector(key.currentContext!); assert(detector != null); - detector.onTap(); + detector!.onTap!(); } + + // void openDropdown(GlobalKey key) { + // GestureDetector detector; + // void searchForGestureDetector(BuildContext element) { + // element.visitChildElements((element) { + // if (element.widget != null && element.widget is GestureDetector) { + // detector = element.widget; + // return false; + // } else { + // searchForGestureDetector(element); + // } + // + // return true; + // }); + // } + // + // searchForGestureDetector(key.currentContext); + // assert(detector != null); + // + // detector.onTap(); + // } } -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/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart index 88727a2b..99ab9ecb 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart @@ -27,7 +27,7 @@ class CarbsResult extends StatelessWidget { double cCalMeal; double fCalMeal; - CarbsResult({this.pCal, this.cCal, this.fCal, this.pCalGram, this.cCalGram, this.fCalGram, this.fCalMeal, this.cCalMeal, this.pCalMeal}); + CarbsResult({required this.pCal, required this.cCal, required this.fCal, required this.pCalGram, required this.cCalGram, required this.fCalGram, required this.fCalMeal, required this.cCalMeal, required this.pCalMeal}); @override Widget build(BuildContext context) { @@ -170,7 +170,7 @@ class CarbsResult extends StatelessWidget { .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: "0", patientDoctorAppointment: element)); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart index 7da0ae06..e1364e73 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due_result_page.dart @@ -103,7 +103,7 @@ class DeliveryDueResult extends StatelessWidget { ); } - Widget showItem(String title, String value, {Color titleColor}) { + Widget showItem(String title, String value, {Color? titleColor}) { return Container( width: double.infinity, child: Column( @@ -170,7 +170,7 @@ class DeliveryDueResult extends StatelessWidget { .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: "0", patientDoctorAppointment: element)); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart b/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart index ba906ca4..9791b588 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart @@ -6,11 +6,12 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:rating_bar/rating_bar.dart'; +import 'package:flutter_rating_bar/flutter_rating_bar.dart'; class DoctorList extends StatelessWidget { DiseasesByClinic diseaseByClinic; - DoctorList({Key key, this.diseaseByClinic}) : super(key: key); + + DoctorList({Key? key, required this.diseaseByClinic}) : super(key: key); @override Widget build(BuildContext context) { @@ -56,8 +57,7 @@ class DoctorList extends StatelessWidget { flex: 1, child: ClipRRect( borderRadius: BorderRadius.circular(100.0), - child: Image.network(doctor.doctorImageURL, - fit: BoxFit.fill, height: 60.0, width: 60.0), + child: Image.network(doctor.doctorImageURL!, fit: BoxFit.fill, height: 60.0, width: 60.0), ), ), Expanded( @@ -69,32 +69,51 @@ class DoctorList extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ if (doctor.doctorTitle != null) - Text(doctor.doctorTitle + " " + doctor.name, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)), + Text(doctor.doctorTitle! + " " + doctor.name!, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)), Container( margin: EdgeInsets.only(top: 3.0), - child: Text(doctor.clinicName != null ? doctor.clinicName : "", style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), + child: Text(doctor.clinicName != null ? doctor.clinicName! : "", style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), ), Container( margin: EdgeInsets.only(top: 3.0), - child: Text(doctor.projectName, style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), + child: Text(doctor.projectName!, style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, children: [ - RatingBar.readOnly( - initialRating: doctor.actualDoctorRate.toDouble(), - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + // RatingBar.readOnly( + // initialRating: doctor.actualDoctorRate.toDouble(), + // size: 20.0, + // filledColor: Colors.yellow[700], + // emptyColor: Colors.grey[500], + // isHalfAllowed: true, + // halfFilledIcon: Icons.star_half, + // filledIcon: Icons.star, + // emptyIcon: Icons.star, + // ), + + // Changed By Aamir + RatingBar( + initialRating: 3, + direction: Axis.horizontal, + allowHalfRating: true, + itemCount: 5, + itemSize: 20, + ignoreGestures: true, + ratingWidget: RatingWidget( + full: Icon(Icons.star), + half: Icon(Icons.star_half), + empty: Icon(Icons.star), + ), + tapOnlyMode: true, + itemPadding: EdgeInsets.symmetric(horizontal: 4.0), + onRatingUpdate: (rating) { + print(rating); + }, ), Container( - child: Image.network(doctor.nationalityFlagURL, - width: 25.0, height: 25.0), + child: Image.network(doctor.nationalityFlagURL!, width: 25.0, height: 25.0), ), ], ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart index ec4689b0..910bb4a1 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -27,17 +27,17 @@ class _IdealBodyState extends State { // int age = 0; // int height = 0; - double heightInches; - double minRange; - double maxRange; - double overWeightBy; + double? heightInches; + double? minRange; + double? maxRange; + double? overWeightBy; int weight = 0; double idealWeight = 0; - String dropdownValue = null; + late String dropdownValue; double calories = 0; String textResult = ''; - double maxIdealWeight; - double heightFeet; + double? maxIdealWeight; + double? heightFeet; final GlobalKey clinicDropdownKey = GlobalKey(); bool _isHeightCM = true; @@ -48,8 +48,8 @@ class _IdealBodyState extends State { TextEditingController _heightController = new TextEditingController(); TextEditingController _weightController = TextEditingController(); - List _heightPopupList =[]; - List _weightPopupList =[]; + List _heightPopupList = []; + List _weightPopupList = []; void calculateIdealWeight() { var height = int.parse(_heightController.text); @@ -219,9 +219,9 @@ class _IdealBodyState extends State { height: 2, color: Colors.black54, ), - onChanged: (String newValue) { + onChanged: (String? newValue) { setState(() { - dropdownValue = newValue; + dropdownValue = newValue!; }); }, items: [ @@ -267,9 +267,9 @@ class _IdealBodyState extends State { FadePage( page: IdealBodyResult( idealBodyWeight: idealWeight, - minRange: minRange, - mixRange: maxRange, - overWeightBy: overWeightBy, + minRange: minRange!, + mixRange: maxRange!, + overWeightBy: overWeightBy!, textResult: textResult, )), ); @@ -283,28 +283,51 @@ class _IdealBodyState extends State { ); } + void openDropdown(GlobalKey key) { - GestureDetector detector; + GestureDetector? detector; + void searchForGestureDetector(BuildContext element) { element.visitChildElements((element) { if (element.widget != null && element.widget is GestureDetector) { - detector = element.widget; - return false; + detector = element.widget as GestureDetector?; + //return false; } else { searchForGestureDetector(element); } - return true; + //return true; }); } - searchForGestureDetector(key.currentContext); + searchForGestureDetector(key.currentContext!); assert(detector != null); - detector.onTap(); + detector!.onTap!(); } + + // void openDropdown(GlobalKey key) { + // GestureDetector detector; + // void searchForGestureDetector(BuildContext element) { + // element.visitChildElements((element) { + // if (element.widget != null && element.widget is GestureDetector) { + // detector = element.widget; + // return false; + // } else { + // searchForGestureDetector(element); + // } + // + // return true; + // }); + // } + // + // searchForGestureDetector(key.currentContext); + // assert(detector != null); + // + // detector.onTap(); + // } - 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, @@ -453,7 +476,7 @@ class _IdealBodyState extends State { Expanded( flex: 1, child: PopupMenuButton( - child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}), onSelected: (value) { onUnitTap(value); }, @@ -469,9 +492,9 @@ class CommonDropDownView extends StatelessWidget { final String title; final String value; final VoidCallback callback; - final IconData iconData; + final IconData? iconData; - CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + CommonDropDownView(this.title, this.value, this.callback, {Key? key, this.iconData}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart index 53a6f8a2..40dae7c9 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart @@ -18,7 +18,7 @@ class IdealBodyResult extends StatelessWidget { final double overWeightBy; final String textResult; - IdealBodyResult({this.idealBodyWeight, this.minRange, this.mixRange, this.overWeightBy, this.textResult}); + IdealBodyResult({required this.idealBodyWeight, required this.minRange, required this.mixRange, required this.overWeightBy, required this.textResult}); @override Widget build(BuildContext context) { @@ -247,7 +247,7 @@ class IdealBodyResult extends StatelessWidget { .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: "0", patientDoctorAppointment: element)); } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart index 69894df3..a92b7e06 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -25,7 +24,7 @@ class _OvulationPeriodState extends State { // int cycleLength = 0; // int lutealPhaseLength = 0; - String selectedDate; + late String selectedDate; var dateFrom = DateTime.now(); var babyAgeWeeks; var babyAgeDays; @@ -34,7 +33,7 @@ class _OvulationPeriodState extends State { var deliveryDue = DateTime.now(); var dt = DateTime.now(); var newFormat = DateFormat("yy-MM-dd"); - String updatedDt; + String? updatedDt; TextEditingController cycleLengthController = new TextEditingController(); TextEditingController lutelLengthController = new TextEditingController(); @@ -57,8 +56,11 @@ class _OvulationPeriodState extends State { deliveryDue = selectedDateTime.add(Duration(days: 280)); // babyAge = Jiffy([DateTime.now()]).diff(Jiffy([date]), Units.WEEK); - babyAgeWeeks = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]).diff(Jiffy([selectedDateTime.year, selectedDateTime.month, dateTo.day]), Units.WEEK); - babyAgeDays = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day]).diff(Jiffy([selectedDateTime.year, selectedDateTime.month, dateTo.day]), Units.DAY); + + babyAgeWeeks = + Jiffy.parseFromList([DateTime.now().year, DateTime.now().month, DateTime.now().day]).diff(Jiffy.parseFromList([selectedDateTime.year, selectedDateTime.month, dateTo.day]), unit: Unit.week); + babyAgeDays = + Jiffy.parseFromList([DateTime.now().year, DateTime.now().month, DateTime.now().day]).diff(Jiffy.parseFromList([selectedDateTime.year, selectedDateTime.month, dateTo.day]), unit: Unit.day); }); } @@ -163,7 +165,7 @@ class _OvulationPeriodState 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/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart index 15dcce58..300e96fa 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_result_page.dart @@ -88,10 +88,10 @@ class OvulationResult extends StatelessWidget { mDivider(CustomColors.devider), mHeight(12), showItem(TranslationBase.of(context).babyAge, babyAge <= 0 ? TranslationBase.of(context).babyAgeAvail : babyAge.toString() + TranslationBase.of(context).week), - mHeight(12), mDivider(CustomColors.devider), - mHeight(12), showItem(TranslationBase.of(context).deliveryDue, DateFormat.yMMMEd().format(deliveryDue)), + mHeight(12), + showItem(TranslationBase.of(context).deliveryDue, DateFormat.yMMMEd().format(deliveryDue)), ], ).withBorderedContainer, ), @@ -113,7 +113,7 @@ class OvulationResult extends StatelessWidget { ); } - Widget showItem(String title, String value, {Color titleColor}) { + Widget showItem(String title, String value, {Color? titleColor}) { return Container( width: double.infinity, child: Column( @@ -147,7 +147,7 @@ class OvulationResult extends StatelessWidget { BariatricsService service = new BariatricsService(); List doctorsList = []; - List _patientDoctorAppointmentListHospital =[]; + List _patientDoctorAppointmentListHospital = []; service.getCalculationDoctors(calculationID: 6).then((res) { GifLoaderDialogUtils.hideDialog(context); @@ -180,7 +180,7 @@ class OvulationResult extends StatelessWidget { .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: "0", patientDoctorAppointment: element)); } diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index af93afa4..cb0885b3 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -52,10 +52,10 @@ class _BloodCholesterolState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); TextEditingController resultTextController = new TextEditingController(); - String finalValue; + late String finalValue; double inputValue = 0.0; - String unit; + late String unit; double conversionConst = 38.67; @override @@ -213,7 +213,7 @@ class _BloodCholesterolState 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/AlHabibMedicalService/health_converter/blood_sugar.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart index 4604c3df..4bb22754 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart @@ -16,7 +16,7 @@ class BloodSugar extends StatefulWidget { _BloodSugarState createState() => _BloodSugarState(); } -Color color; +Color? color; class _BloodSugarState extends State { Color cardMGColor = inactiveCardColor; @@ -64,10 +64,10 @@ class _BloodSugarState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); TextEditingController resultTextController = new TextEditingController(); - String finalValue; + late String finalValue; double inputValue = 0; - String unit; + late String unit; @override void initState() { @@ -230,7 +230,7 @@ class _BloodSugarState 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/AlHabibMedicalService/health_converter/triglycerides.dart b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart index e441d935..67e12964 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart @@ -17,7 +17,7 @@ class Triglycerides extends StatefulWidget { class _TriglyceridesState extends State { Color cardMGColor = inactiveCardColor; Color cardMMOLColor = inactiveCardColor; - int type; + late int type; void updateColor(type) { //MG/DLT card @@ -54,10 +54,10 @@ class _TriglyceridesState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); TextEditingController resultTextController = new TextEditingController(); - String finalValue; + late String finalValue; double inputValue = 0.0; - String unit; + late String unit; double conversionConst = 88.57; @override @@ -219,7 +219,7 @@ class _TriglyceridesState 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/AlHabibMedicalService/my_web_view.dart b/lib/pages/AlHabibMedicalService/my_web_view.dart index 4b03c7dd..fe116bfa 100644 --- a/lib/pages/AlHabibMedicalService/my_web_view.dart +++ b/lib/pages/AlHabibMedicalService/my_web_view.dart @@ -12,8 +12,8 @@ class MyWebView extends StatelessWidget { Completer(); MyWebView({ - @required this.title, - @required this.selectedUrl, + required this.title, + required this.selectedUrl, }); @override diff --git a/lib/pages/AlHabibMedicalService/parking_page.dart b/lib/pages/AlHabibMedicalService/parking_page.dart index ac63011c..9f2216b5 100644 --- a/lib/pages/AlHabibMedicalService/parking_page.dart +++ b/lib/pages/AlHabibMedicalService/parking_page.dart @@ -66,11 +66,11 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ - Texts(model.qrParkingModel.parkingDescriptionN), + Texts(model.qrParkingModel!.parkingDescriptionN), Divider( height: 3, ), - Texts(model.qrParkingModel.rowDescriptionN) + Texts(model.qrParkingModel!.rowDescriptionN) ], ), ), @@ -89,7 +89,7 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).showMyPark), - Texts(projectViewModel.isArabic ? model.qrParkingModel.floorDescriptionN : model.qrParkingModel.floorDescription), + Texts(projectViewModel.isArabic ? model.qrParkingModel!.floorDescriptionN : model.qrParkingModel!.floorDescription), ], ), ), @@ -105,7 +105,7 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).gate), - Texts(projectViewModel.isArabic ? model.qrParkingModel.gateDescriptionN : model.qrParkingModel.gateDescription), + Texts(projectViewModel.isArabic ? model.qrParkingModel!.gateDescriptionN : model.qrParkingModel!.gateDescription), ], ), ), @@ -121,7 +121,7 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).building), - Texts(projectViewModel.isArabic ? model.qrParkingModel.buildingDescriptionN : model.qrParkingModel.buildingDescription), + Texts(projectViewModel.isArabic ? model.qrParkingModel!.buildingDescriptionN : model.qrParkingModel!.buildingDescription), ], ), ), @@ -137,7 +137,7 @@ class ParkingPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts(TranslationBase.of(context).branch), - Texts(projectViewModel.isArabic ? model.qrParkingModel.branchDescriptionN : model.qrParkingModel.branchDescription), + Texts(projectViewModel.isArabic ? model.qrParkingModel!.branchDescriptionN : model.qrParkingModel!.branchDescription), ], ), ), @@ -173,8 +173,8 @@ class ParkingPage extends StatelessWidget { TranslationBase.of(context).showMyPark, () => { MapsLauncher.launchCoordinates( - model.qrParkingModel.latitude, - model.qrParkingModel.longitude, + model.qrParkingModel!.latitude!, + model.qrParkingModel!.longitude!, ), }), ), diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart index f118b793..1fb64dde 100644 --- a/lib/pages/AlHabibMedicalService/​ health_calculators.dart +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -21,7 +21,7 @@ class HealthCalculators extends StatefulWidget { } class _HealthCalculatorsState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + late TabController _tabController; void initState() { super.initState(); diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 417b13ea..cc654ea6 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -21,7 +21,9 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } + enum Gender { Male, Female, NON } + enum Blood { Oplus, Ominus, Aplus, Aminus, Bplus, Bminus, ABplus, ABminus, NON } class BloodDonationPage extends StatefulWidget { @@ -32,7 +34,7 @@ class BloodDonationPage extends StatefulWidget { class _BloodDonationPageState extends State { BeneficiaryType beneficiaryType = BeneficiaryType.NON; - CitiesModel _selectedHospital; + late CitiesModel _selectedHospital; int _selectedHospitalIndex = 0; int _selectedGenderIndex = 1; @@ -40,14 +42,14 @@ class _BloodDonationPageState extends State { String _selectedBloodType = "O+"; String amount = ""; - String email; + String? email; List_BloodGroupDetailsModel bloodDetails = List_BloodGroupDetailsModel(bloodGroup: "A-"); AppSharedPreferences sharedPref = AppSharedPreferences(); var checkedValue = false; - List imagesInfo =[]; + List imagesInfo = []; - ProjectViewModel projectProvider; + late ProjectViewModel projectProvider; @override void initState() { @@ -62,7 +64,7 @@ class _BloodDonationPageState extends State { int cityID = 1; model.CitiesModelList.forEach((element) { if (element.description == model.bloodModelList[0].city) { - cityID = element.iD; + cityID = element.iD!; } }); return cityID; @@ -78,11 +80,11 @@ class _BloodDonationPageState extends State { if (model.bloodModelList.length > 0) { CitiesModel citiesModel = new CitiesModel(); citiesModel.iD = getSelectedCityID(model); - _selectedHospitalIndex = (citiesModel.iD - 1); + _selectedHospitalIndex = (citiesModel.iD! - 1); citiesModel.description = model.CitiesModelList[_selectedHospitalIndex].description; citiesModel.descriptionN = model.CitiesModelList[_selectedHospitalIndex].descriptionN; _selectedHospital = citiesModel; - _selectedBloodType = model.bloodModelList[0].bloodGroup; + _selectedBloodType = model.bloodModelList[0].bloodGroup!; _selectedBloodTypeIndex = getBloodIndex(_selectedBloodType); } else { _selectedHospital = model.CitiesModelList[0]; @@ -134,33 +136,32 @@ class _BloodDonationPageState extends State { ), SizedBox(height: 12), if (projectProvider.isLogin && model.state != ViewState.Busy) - CommonDropDownView( - TranslationBase.of(context).city, - model.CitiesModelList.isNotEmpty - ? projectProvider.isArabic - ? model.CitiesModelList[_selectedHospitalIndex].descriptionN - : model.CitiesModelList[_selectedHospitalIndex].description - : "", () { - List list = [ - for (int i = 0; i < model.CitiesModelList.length; i++) - RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), - ]; + TranslationBase.of(context).city, + model.CitiesModelList.isNotEmpty + ? projectProvider.isArabic + ? model.CitiesModelList[_selectedHospitalIndex].descriptionN! + : model.CitiesModelList[_selectedHospitalIndex].description! + : "", () { + List list = [ + for (int i = 0; i < model.CitiesModelList.length; i++) + RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN! : model.CitiesModelList[i].description!, i), + ]; - showDialog( - context: context, - builder: (cxt) => RadioSelectionDialog( - listData: list, - selectedIndex: _selectedHospitalIndex, - isScrollable: true, - onValueSelected: (index) { - _selectedHospitalIndex = index; - _selectedHospital = model.CitiesModelList[index]; - setState(() {}); - }, - ), - ); - }).withBorderedContainer, + showDialog( + context: context, + builder: (cxt) => RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = model.CitiesModelList[index]; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, SizedBox(height: 12), CommonDropDownView(TranslationBase.of(context).gender, _selectedGenderIndex == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female, () { List list = [ @@ -230,9 +231,9 @@ class _BloodDonationPageState extends State { Row( children: [ Checkbox( - onChanged: (bool value) { + onChanged: (bool? value) { setState(() { - checkedValue = value; + checkedValue = value!; }); }, value: checkedValue, @@ -372,7 +373,7 @@ class _BloodDonationPageState extends State { String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { if (_selectedHospital != null) - return projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; + return projectProvider.isArabic ? _selectedHospital.descriptionN! : _selectedHospital.description!; else return TranslationBase.of(context).selectCity; } diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index 700d5471..20cfd88f 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -1,3 +1,5 @@ +import 'dart:js'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; @@ -27,15 +29,15 @@ import 'dialogs/ConfirmSMSDialog.dart'; import 'new_text_Field.dart'; class ConfirmPaymentPage extends StatelessWidget { - final AdvanceModel advanceModel; + late AdvanceModel advanceModel; final PatientInfoAndMobileNumber patientInfoAndMobileNumber; final String selectedPaymentMethod; - MyInAppBrowser browser; + late MyInAppBrowser browser; AuthenticatedUser authenticatedUser; AppSharedPreferences sharedPref = AppSharedPreferences(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; - ConfirmPaymentPage({this.advanceModel, this.patientInfoAndMobileNumber, this.selectedPaymentMethod, this.authenticatedUser}); + ConfirmPaymentPage({required this.advanceModel, required this.patientInfoAndMobileNumber, required this.selectedPaymentMethod, required this.authenticatedUser}); @override Widget build(BuildContext context) { @@ -45,7 +47,7 @@ class ConfirmPaymentPage extends StatelessWidget { context: context, barrierDismissible: false, builder: (cxt) => ConfirmSMSDialog( - phoneNumber: patientInfoAndMobileNumber.mobileNumber, + phoneNumber: patientInfoAndMobileNumber.mobileNumber!, ), ).then((value) { print("dialog dismissed"); @@ -53,7 +55,7 @@ class ConfirmPaymentPage extends StatelessWidget { if (value != null && value) { AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.projectID = patientInfoAndMobileNumber.projectID; - openPayment(selectedPaymentMethod, authenticatedUser, double.parse(advanceModel.amount), appo); + openPayment(selectedPaymentMethod, authenticatedUser, double.parse(advanceModel.amount!), appo, context); } }); } @@ -88,7 +90,7 @@ class ConfirmPaymentPage extends StatelessWidget { child: selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(selectedPaymentMethod)) : Image.asset(getImagePath(selectedPaymentMethod)), ), Texts( - advanceModel.hospitalsModel.projectOutSA ? '${advanceModel.amount} AED' : '${advanceModel.amount} SAR', + advanceModel.hospitalsModel!.projectOutSA! ? '${advanceModel.amount} AED' : '${advanceModel.amount} SAR', fontSize: 26, bold: true, ) @@ -104,7 +106,7 @@ class ConfirmPaymentPage extends StatelessWidget { margin: EdgeInsets.all(3), child: NewTextFields( hintText: TranslationBase.of(context).fileNumber, - initialValue: advanceModel.fileNumber, + initialValue: advanceModel.fileNumber!, isEnabled: false, ), ), @@ -114,7 +116,7 @@ class ConfirmPaymentPage extends StatelessWidget { margin: EdgeInsets.all(3), child: NewTextFields( hintText: TranslationBase.of(context).name, - initialValue: patientInfoAndMobileNumber.firstName, + initialValue: patientInfoAndMobileNumber.firstName!, isEnabled: false, ), ), @@ -126,7 +128,7 @@ class ConfirmPaymentPage extends StatelessWidget { ), NewTextFields( hintText: TranslationBase.of(context).mobileNumber, - initialValue: patientInfoAndMobileNumber.mobileNumber, + initialValue: patientInfoAndMobileNumber.mobileNumber!, isEnabled: false, ), SizedBox( @@ -134,7 +136,7 @@ class ConfirmPaymentPage extends StatelessWidget { ), NewTextFields( hintText: TranslationBase.of(context).depositorName, - initialValue: advanceModel.depositorName, + initialValue: advanceModel.depositorName!, isEnabled: false, ), SizedBox( @@ -142,7 +144,7 @@ class ConfirmPaymentPage extends StatelessWidget { ), NewTextFields( hintText: TranslationBase.of(context).notes, - initialValue: advanceModel.note, + initialValue: advanceModel.note!, isEnabled: false, ), ], @@ -159,7 +161,7 @@ class ConfirmPaymentPage extends StatelessWidget { disabled: model.state == ViewState.Busy, onTap: () { GifLoaderDialogUtils.showMyDialog(context); - model.sendActivationCodeForAdvancePayment(patientID: int.parse(advanceModel.fileNumber), projectID: advanceModel.hospitalsModel.iD).then((value) { + model.sendActivationCodeForAdvancePayment(patientID: int.parse(advanceModel.fileNumber!), projectID: advanceModel.hospitalsModel!.iD).then((value) { GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(); }); @@ -195,11 +197,26 @@ class ConfirmPaymentPage extends StatelessWidget { return 'assets/images/new-design/mada.png'; } - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo) { + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, BuildContext context) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); - browser.openPaymentBrowser(amount, "Advance Payment", Utils.getAdvancePaymentTransID(authenticatedUser.projectID, authenticatedUser.patientID), appo.projectID.toString(), - authenticatedUser.emailAddress, paymentMethod, authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "3", "", null); + browser.openPaymentBrowser( + amount, + "Advance Payment", + Utils.getAdvancePaymentTransID(authenticatedUser.projectID!, authenticatedUser.patientID!), + appo.projectID.toString(), + authenticatedUser.emailAddress!, + paymentMethod, + authenticatedUser.patientType, + authenticatedUser.firstName!, + authenticatedUser.patientID, + authenticatedUser, + browser, + false, + "3", + "", + context, + ); } onBrowserLoadStart(String url) { @@ -231,7 +248,7 @@ class ConfirmPaymentPage extends StatelessWidget { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(AppGlobal.context); - service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, AppGlobal.context).then((res) { + service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), false, AppGlobal.context).then((res) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); print("Printing Payment Status Reponse!!!!"); print(res); @@ -255,7 +272,7 @@ class ConfirmPaymentPage extends StatelessWidget { service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], AppGlobal.context).then((res) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); addAdvancedNumberRequest( - Utils.isVidaPlusProject(projectViewModel, appo.projectID) + Utils.isVidaPlusProject(projectViewModel, appo.projectID!) ? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString() : res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, diff --git a/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart b/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart index 5cfb2372..2be812d6 100644 --- a/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart +++ b/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart @@ -18,17 +18,11 @@ import 'package:provider/provider.dart'; class ConfirmSMSDialog extends StatefulWidget { final String phoneNumber; - final AdvanceModel advanceModel; - final PatientInfoAndMobileNumber patientInfoAndMobileNumber; - final String selectedPaymentMethod; + final AdvanceModel? advanceModel; + final PatientInfoAndMobileNumber? patientInfoAndMobileNumber; + final String? selectedPaymentMethod; - const ConfirmSMSDialog( - {Key key, - this.phoneNumber, - this.advanceModel, - this.selectedPaymentMethod, - this.patientInfoAndMobileNumber}) - : super(key: key); + const ConfirmSMSDialog({Key? key, required this.phoneNumber, this.advanceModel, this.selectedPaymentMethod, this.patientInfoAndMobileNumber}) : super(key: key); @override _ConfirmSMSDialogState createState() => _ConfirmSMSDialogState(); @@ -51,7 +45,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; @@ -76,10 +70,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() { @@ -125,8 +119,7 @@ class _ConfirmSMSDialogState extends State { child: InkWell( onTap: () => Navigator.pop(context), child: Container( - decoration: BoxDecoration( - shape: BoxShape.circle, color: Colors.white), + decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.white), child: Icon( Icons.clear, color: Colors.grey[900], @@ -150,8 +143,7 @@ class _ConfirmSMSDialogState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).pleaseEnterTheVerificationCode + - '[${widget.phoneNumber}]', + TranslationBase.of(context).pleaseEnterTheVerificationCode + '[${widget.phoneNumber}]', textAlign: TextAlign.center, ), ), @@ -161,7 +153,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: [ @@ -176,7 +168,7 @@ class _ConfirmSMSDialogState extends State { child: TextFormField( textInputAction: TextInputAction.next, style: TextStyle( - fontSize: SizeConfig.textMultiplier * 3, + fontSize: SizeConfig.textMultiplier! * 3, ), focusNode: focusD1, maxLength: 1, @@ -207,7 +199,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), @@ -234,7 +226,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), @@ -247,8 +239,7 @@ class _ConfirmSMSDialogState extends State { }, onChanged: (val) { if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD4); + FocusScope.of(context).requestFocus(focusD4); } }, )), @@ -260,7 +251,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), @@ -274,8 +265,7 @@ class _ConfirmSMSDialogState extends State { }, onChanged: (val) { if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD4); + FocusScope.of(context).requestFocus(focusD4); submit(model); } }), @@ -285,8 +275,7 @@ class _ConfirmSMSDialogState extends State { SizedBox( height: 8, ), - if (model.state == ViewState.ErrorLocal || - model.state == ViewState.Error) + if (model.state == ViewState.ErrorLocal || model.state == ViewState.Error) Container( margin: EdgeInsets.only(left: 8, right: 8), width: double.maxFinite, @@ -301,9 +290,7 @@ class _ConfirmSMSDialogState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context) - .theVerificationCodeExpiresIn + - ' $timerText', + TranslationBase.of(context).theVerificationCodeExpiresIn + ' $timerText', textAlign: TextAlign.center, ), ), @@ -314,8 +301,7 @@ class _ConfirmSMSDialogState extends State { padding: EdgeInsets.all(12), child: SecondaryButton( textColor: Colors.white, - label: - TranslationBase.of(context).submit.toUpperCase(), + label: TranslationBase.of(context).submit.toUpperCase(), onTap: () { submit(model); }, @@ -333,13 +319,10 @@ class _ConfirmSMSDialogState extends State { } void submit(MyBalanceViewModel model) { - if (verifyAccountForm.currentState.validate()) { + if (verifyAccountForm.currentState!.validate()) { GifLoaderDialogUtils.showMyDialog(context); - final activationCode = - digit1.text + digit2.text + digit3.text + digit4.text; - model - .checkActivationCodeForAdvancePayment(activationCode: activationCode) - .then((value) { + final activationCode = digit1.text + digit2.text + digit3.text + digit4.text; + model.checkActivationCodeForAdvancePayment(activationCode: activationCode).then((value) { GifLoaderDialogUtils.hideDialog(context); Navigator.pop(context, true); }); @@ -350,7 +333,7 @@ class _ConfirmSMSDialogState extends State { if (value.isEmpty) { return ''; } - return null; + return 'null'; } InputDecoration buildInputDecoration(BuildContext context) { diff --git a/lib/pages/Blood/dialogs/SelectBeneficiaryDialog.dart b/lib/pages/Blood/dialogs/SelectBeneficiaryDialog.dart index eae22f36..c4780f8b 100644 --- a/lib/pages/Blood/dialogs/SelectBeneficiaryDialog.dart +++ b/lib/pages/Blood/dialogs/SelectBeneficiaryDialog.dart @@ -7,15 +7,15 @@ import 'package:flutter/material.dart'; //import '../advance_payment_page.dart'; class SelectBeneficiaryDialog extends StatefulWidget { - final BeneficiaryType beneficiaryType; - final Function(BeneficiaryType) onValueSelected; + final BeneficiaryType? beneficiaryType; + final Function(BeneficiaryType)? onValueSelected; SelectBeneficiaryDialog( - {Key key, this.beneficiaryType, this.onValueSelected}); + {Key? key, this.beneficiaryType, this.onValueSelected}); @override _SelectBeneficiaryDialogState createState() => - _SelectBeneficiaryDialogState(this.beneficiaryType); + _SelectBeneficiaryDialogState(this.beneficiaryType!); } class _SelectBeneficiaryDialogState extends State { @@ -47,9 +47,9 @@ class _SelectBeneficiaryDialogState extends State { value: BeneficiaryType.MyAccount, groupValue: beneficiaryType, activeColor: Colors.red[800], - onChanged: (BeneficiaryType value) { + onChanged: (BeneficiaryType? value) { setState(() { - beneficiaryType = value; + beneficiaryType = value!; }); }, ), @@ -77,9 +77,9 @@ class _SelectBeneficiaryDialogState extends State { value: BeneficiaryType.MyFamilyFiles, groupValue: beneficiaryType, activeColor: Colors.red[800], - onChanged: (BeneficiaryType value) { + onChanged: (BeneficiaryType? value) { setState(() { - beneficiaryType = value; + beneficiaryType = value!; }); }, ), @@ -107,9 +107,9 @@ class _SelectBeneficiaryDialogState extends State { value: BeneficiaryType.OtherAccount, groupValue: beneficiaryType, activeColor: Colors.red[800], - onChanged: (BeneficiaryType value) { + onChanged: (BeneficiaryType? value) { setState(() { - beneficiaryType = value; + beneficiaryType = value!; }); }, ), @@ -152,7 +152,7 @@ class _SelectBeneficiaryDialogState extends State { flex: 1, child: InkWell( onTap: () { - widget.onValueSelected(beneficiaryType); + widget.onValueSelected!(beneficiaryType); Navigator.pop(context); }, child: Padding( diff --git a/lib/pages/Blood/dialogs/SelectGenderDialog.dart b/lib/pages/Blood/dialogs/SelectGenderDialog.dart index a097ae8e..d1c8a8b2 100644 --- a/lib/pages/Blood/dialogs/SelectGenderDialog.dart +++ b/lib/pages/Blood/dialogs/SelectGenderDialog.dart @@ -8,7 +8,7 @@ class SelectGenderDialog extends StatefulWidget { final Gender beneficiaryType; final Function(Gender) onValueSelected; - SelectGenderDialog({Key key, this.beneficiaryType, this.onValueSelected}); + SelectGenderDialog({Key? key, required this.beneficiaryType, required this.onValueSelected}); @override _SelectGenderDialogState createState() => @@ -43,9 +43,9 @@ class _SelectGenderDialogState extends State { value: Gender.Male, groupValue: beneficiaryType, activeColor: Colors.red[800], - onChanged: (Gender value) { + onChanged: (Gender? value) { setState(() { - beneficiaryType = value; + beneficiaryType = value!; }); }, ), @@ -73,9 +73,9 @@ class _SelectGenderDialogState extends State { value: Gender.Female, groupValue: beneficiaryType, activeColor: Colors.red[800], - onChanged: (Gender value) { + onChanged: (Gender? value) { setState(() { - beneficiaryType = value; + beneficiaryType = value!; }); }, ), diff --git a/lib/pages/Blood/dialogs/SelectHospitalDialog.dart b/lib/pages/Blood/dialogs/SelectHospitalDialog.dart index c7554c20..40fbb036 100644 --- a/lib/pages/Blood/dialogs/SelectHospitalDialog.dart +++ b/lib/pages/Blood/dialogs/SelectHospitalDialog.dart @@ -7,10 +7,10 @@ import 'package:flutter/material.dart'; class SelectHospitalDialog extends StatefulWidget { final List hospitals; final Function(HospitalsModel) onValueSelected; - HospitalsModel selectedHospital; + HospitalsModel? selectedHospital; SelectHospitalDialog( - {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); + {Key? key, required this.hospitals, required this.onValueSelected, this.selectedHospital}); @override _SelectHospitalDialogState createState() => _SelectHospitalDialogState(); @@ -49,7 +49,7 @@ class _SelectHospitalDialogState extends State { }); }, child: ListTile( - title: Text(widget.hospitals[index].name), + title: Text(widget.hospitals[index].name!), leading: Radio( value: widget.hospitals[index], groupValue: widget.selectedHospital, @@ -105,7 +105,7 @@ class _SelectHospitalDialogState 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/Blood/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart index bb9afd6c..09495348 100644 --- a/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart +++ b/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart @@ -7,9 +7,9 @@ import 'package:flutter/material.dart'; class SelectPatientFamilyDialog extends StatefulWidget { final List getAllSharedRecordsByStatusList; final Function(GetAllSharedRecordsByStatusList) onValueSelected; - GetAllSharedRecordsByStatusList selectedPatientFamily; + GetAllSharedRecordsByStatusList? selectedPatientFamily; - SelectPatientFamilyDialog({Key key, this.getAllSharedRecordsByStatusList, this.onValueSelected,this.selectedPatientFamily}); + SelectPatientFamilyDialog({Key? key, required this.getAllSharedRecordsByStatusList, required this.onValueSelected,this.selectedPatientFamily}); @override _SelectPatientFamilyDialogState createState() => _SelectPatientFamilyDialogState(); @@ -49,7 +49,7 @@ class _SelectPatientFamilyDialogState extends State { }); }, child: ListTile( - title: Text(widget.getAllSharedRecordsByStatusList[index].patientName), + title: Text(widget.getAllSharedRecordsByStatusList[index].patientName!), leading: Radio( value: widget.getAllSharedRecordsByStatusList[index], groupValue: widget.selectedPatientFamily, @@ -105,7 +105,7 @@ class _SelectPatientFamilyDialogState extends State { flex: 1, child: InkWell( onTap: () { - widget.onValueSelected(widget.selectedPatientFamily); + widget.onValueSelected(widget.selectedPatientFamily!); Navigator.pop(context); }, child: Padding( diff --git a/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart b/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart index 150d408e..f2368c0d 100644 --- a/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart +++ b/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart @@ -9,7 +9,7 @@ class SelectPatientInfoDialog extends StatefulWidget { final Function(PatientInfo) onValueSelected; PatientInfo selectedPatientInfo; - SelectPatientInfoDialog({Key key, this.patientInfoList, this.onValueSelected,this.selectedPatientInfo}); + SelectPatientInfoDialog({Key? key, required this.patientInfoList, required this.onValueSelected,required this.selectedPatientInfo}); @override _SelectPatientInfoDialogState createState() => _SelectPatientInfoDialogState(); @@ -49,14 +49,14 @@ class _SelectPatientInfoDialogState extends State { }); }, child: ListTile( - title: Text(widget.patientInfoList[index].fullName), + title: Text(widget.patientInfoList[index].fullName!), leading: Radio( value: widget.patientInfoList[index], groupValue: widget.selectedPatientInfo, activeColor: Colors.red[800], onChanged: (value) { setState(() { - widget.selectedPatientInfo = value; + widget.selectedPatientInfo = value!; }); }, ), diff --git a/lib/pages/Blood/new_text_Field.dart b/lib/pages/Blood/new_text_Field.dart index f6273f57..e6431f1f 100644 --- a/lib/pages/Blood/new_text_Field.dart +++ b/lib/pages/Blood/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,74 +38,76 @@ 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 = 16.0, - this.fontWeight = FontWeight.w700, - this.hintColor,this.isEnabled=true}) + {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 = 16.0, + this.fontWeight = FontWeight.w700, + this.hintColor, + this.isEnabled = true}) : 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 bool readOnly; - final int maxLength; - final int minLines; - final int maxLines; - final bool maxLengthEnforced; - final bool bare; - final bool isEnabled; - final TextInputAction inputAction; - final double fontSize; - final FontWeight fontWeight; - final bool keepPadding; + 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 bool? maxLengthEnforced; + final bool? bare; + final bool? isEnabled; + final TextInputAction? inputAction; + final double? fontSize; + final FontWeight? fontWeight; + final bool? keepPadding; final TextCapitalization textCapitalization; - final List inputFormatters; - final EdgeInsets padding; - final bool focus; - final bool borderOnlyError; - final Color hintColor; - final String initialValue; + final List? inputFormatters; + final EdgeInsets? padding; + final bool? focus; + final bool? borderOnlyError; + final Color? hintColor; + final String? initialValue; + @override _NewTextFieldsState createState() => _NewTextFieldsState(); } @@ -129,7 +129,7 @@ class _NewTextFieldsState extends State { @override void didUpdateWidget(NewTextFields oldWidget) { - if (widget.focus) _focusNode.requestFocus(); + if (widget.focus!) _focusNode.requestFocus(); super.didUpdateWidget(oldWidget); } @@ -139,9 +139,8 @@ class _NewTextFieldsState extends State { super.dispose(); } - bool _determineReadOnly() { - if (widget.readOnly != null && widget.readOnly) { + if (widget.readOnly != null && widget.readOnly!) { _focusNode.unfocus(); return true; } else { @@ -153,12 +152,9 @@ 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( enabled: widget.isEnabled, initialValue: widget.initialValue, @@ -167,10 +163,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,44 +183,22 @@ class _NewTextFieldsState extends State { 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, labelStyle: TextStyle(color: Colors.black), - 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)), + 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), + borderSide: BorderSide(color: Colors.white, width: 1.0), borderRadius: BorderRadius.circular(12), ), ), diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 04f6d1b0..6ad979fc 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -23,23 +23,23 @@ class DocAvailableAppointments extends StatefulWidget { DoctorList doctor; static bool areSlotsAvailable = false; static bool areAppointmentsAvailable = false; - static DateTime selectedAppoDateTime; - static String selectedDate; - static String selectedTime; + static DateTime? selectedAppoDateTime; + static String? selectedDate; + static String? selectedTime; bool isLiveCareAppointment; final dynamic doctorSchedule; - static int initialSlotDuration; + static int? initialSlotDuration; - DocAvailableAppointments({@required this.doctor, this.doctorSchedule, @required this.isLiveCareAppointment}); + DocAvailableAppointments({required this.doctor, this.doctorSchedule, required this.isLiveCareAppointment}); @override _DocAvailableAppointmentsState createState() => _DocAvailableAppointmentsState(); } class _DocAvailableAppointmentsState extends State with TickerProviderStateMixin { - Map _events; - AnimationController _animationController; - CalendarController _calendarController; + late Map _events; + late AnimationController _animationController; + late CalendarController _calendarController; AppSharedPreferences sharedPref = new AppSharedPreferences(); @@ -54,10 +54,11 @@ class _DocAvailableAppointmentsState extends State wit dynamic freeSlotsResponse; - ScrollController _scrollController; + late ScrollController _scrollController; var language; - bool isLiveCareSchedule; + bool isLiveCareSchedule = false; + // String selectedLogSlots =''; @override @@ -118,7 +119,7 @@ class _DocAvailableAppointmentsState extends State wit }); } - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { @@ -183,7 +184,7 @@ class _DocAvailableAppointmentsState extends State wit monthViewSettings: const MonthViewSettings(appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, showTrailingAndLeadingDates: false, appointmentDisplayCount: 1), onTap: (CalendarTapDetails details) { _calendarController.selectedDate = details.date; - _onDaySelected(details.date); + _onDaySelected(details.date!); }, ), ), @@ -214,19 +215,12 @@ class _DocAvailableAppointmentsState extends State wit DocAvailableAppointments.areSlotsAvailable = true; selectedButtonIndex = 0; // selectedLogSlots = dayEvents[selectedButtonIndex].toString(); - List> timeList =[]; - for(var i =0; i timeSlot={ - "isoTime":dayEvents[i].isoTime, - "start":dayEvents[i].start.toString(), - "end":dayEvents[i].end.toString(), - "vidaDate":dayEvents[i].vidaDate - }; - timeList.add(timeSlot); + List> timeList = []; + for (var i = 0; i < dayEvents.length; i++) { + Map timeSlot = {"isoTime": dayEvents[i].isoTime, "start": dayEvents[i].start.toString(), "end": dayEvents[i].end.toString(), "vidaDate": dayEvents[i].vidaDate}; + timeList.add(timeSlot); } - - AppSharedPreferences sharedPref = new AppSharedPreferences(); sharedPref.setString('selectedLogSlots', json.encode(timeList)); DocAvailableAppointments.selectedTime = dayEvents[selectedButtonIndex].isoTime; @@ -244,30 +238,60 @@ class _DocAvailableAppointmentsState extends State wit for (var i = 0; i < freeSlotsResponse.length; i++) { date = (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(freeSlotsResponse[i]) - : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[i], widget.doctor.projectID); + : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[i], int.parse(widget.doctor.projectID.toString())); slotsList.add(FreeSlot(date, ['slot'])); docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: freeSlotsResponse[i])); } _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { - DocAvailableAppointments.selectedDate = dateFormatter.format((isLiveCareSchedule != null && isLiveCareSchedule) - ? DateUtil.convertStringToDate(freeSlotsResponse[0]) - : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID)); + DocAvailableAppointments.selectedDate = dateFormatter.format( + (isLiveCareSchedule != null && isLiveCareSchedule) + ? DateUtil.convertStringToDate(freeSlotsResponse[0]) + : DateUtil.convertStringToDateSaudiTimezone( + freeSlotsResponse[0], + int.parse( + widget.doctor.projectID.toString(), + ), + ), + ); DocAvailableAppointments.selectedAppoDateTime = (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(freeSlotsResponse[0]) - : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID); + : DateUtil.convertStringToDateSaudiTimezone( + freeSlotsResponse[0], + int.parse( + widget.doctor.projectID.toString(), + ), + ); selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted( (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(freeSlotsResponse[0]) - : DateUtil.convertStringToDateSaudiTimezone(freeSlotsResponse[0], widget.doctor.projectID), + : DateUtil.convertStringToDateSaudiTimezone( + freeSlotsResponse[0], + int.parse( + widget.doctor.projectID.toString(), + ), + ), language); selectedDateJSON = freeSlotsResponse[0]; }); openTimeSlotsPickerForDate( - (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(selectedDateJSON) : DateUtil.convertStringToDateSaudiTimezone(selectedDateJSON, widget.doctor.projectID), + (isLiveCareSchedule != null && isLiveCareSchedule) + ? DateUtil.convertStringToDate(selectedDateJSON) + : DateUtil.convertStringToDateSaudiTimezone( + selectedDateJSON, + int.parse( + widget.doctor.projectID.toString(), + ), + ), docFreeSlots); - _calendarController.selectedDate = - (isLiveCareSchedule != null && isLiveCareSchedule) ? DateUtil.convertStringToDate(selectedDateJSON) : DateUtil.convertStringToDateSaudiTimezone(selectedDateJSON, widget.doctor.projectID); + _calendarController.selectedDate = (isLiveCareSchedule != null && isLiveCareSchedule) + ? DateUtil.convertStringToDate(selectedDateJSON) + : DateUtil.convertStringToDateSaudiTimezone( + selectedDateJSON, + int.parse( + widget.doctor.projectID.toString(), + ), + ); _calendarController.displayDate = _calendarController.selectedDate; return _eventsParsed; } @@ -292,7 +316,7 @@ class _DocAvailableAppointmentsState extends State wit }); projectViewModel.analytics.appointment.book_appointment_time_selection(appointment_type: 'regular', dateTime: timeslot.end, doctor: widget.doctor); }, - child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, color: Color(0xFF60686b))), + child: Text(dayEvents[index].isoTime!, style: TextStyle(fontSize: 12.0, color: Color(0xFF60686b))), ); } @@ -312,7 +336,7 @@ class _DocAvailableAppointmentsState extends State wit print(DocAvailableAppointments.selectedTime); }); }, - child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, color: Colors.white)), + child: Text(dayEvents[index].isoTime!, style: TextStyle(fontSize: 12.0, color: Colors.white)), ); } @@ -320,7 +344,20 @@ class _DocAvailableAppointmentsState extends State wit print(DocAvailableAppointments.initialSlotDuration); GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, context, projectViewModel).then((res) { + service + .getDoctorFreeSlots( + int.parse( + docObject.doctorID.toString(), + ), + int.parse( + docObject.clinicID.toString(), + ), + int.parse( + docObject.projectID.toString(), + ), + context, + projectViewModel) + .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { @@ -332,7 +369,12 @@ class _DocAvailableAppointmentsState extends State wit _events.clear(), _events = value, if (widget.doctorSchedule != null) - {_onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date'])), _calendarController.selectedDate = DateUtil.convertStringToDate(widget.doctorSchedule['Date'])} + { + _onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date'])), + _calendarController.selectedDate = DateUtil.convertStringToDate( + widget.doctorSchedule['Date'], + ) + } }); }); } else { @@ -353,7 +395,15 @@ class _DocAvailableAppointmentsState extends State wit getDoctorScheduledFreeSlots(context, DoctorList docObject) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorScheduledFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, context).then((res) { + service + .getDoctorScheduledFreeSlots( + int.parse(docObject.doctorID.toString()), + int.parse(docObject.clinicID.toString()), + int.parse(docObject.projectID.toString()), + docObject.serviceID, + context, + ) + .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['PatientER_DoctorFreeSlots'].length != 0) { @@ -390,37 +440,38 @@ class MeetingDataSource extends CalendarDataSource { @override DateTime getStartTime(int index) { - return _getMeetingData(index).from; + return _getMeetingData(index)!.from; } @override DateTime getEndTime(int index) { - return _getMeetingData(index).to; + return _getMeetingData(index)!.to; } @override String getSubject(int index) { - return _getMeetingData(index).eventName; + return _getMeetingData(index)!.eventName; } @override Color getColor(int index) { - return _getMeetingData(index).background; + return _getMeetingData(index)!.background; } @override bool isAllDay(int index) { - return _getMeetingData(index).isAllDay; + return _getMeetingData(index)!.isAllDay; } - Meeting _getMeetingData(int index) { - final dynamic meeting = appointments[index]; - Meeting meetingData; + Meeting? _getMeetingData(int index) { + final dynamic meeting = appointments?[index]; + Meeting? meetingData; if (meeting is Meeting) { meetingData = meeting; } return meetingData; } + } class Meeting { diff --git a/lib/pages/BookAppointment/components/DocInfo.dart b/lib/pages/BookAppointment/components/DocInfo.dart index 59925b06..eda3a1e4 100644 --- a/lib/pages/BookAppointment/components/DocInfo.dart +++ b/lib/pages/BookAppointment/components/DocInfo.dart @@ -1,12 +1,13 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; class DoctorInformation extends StatelessWidget { DoctorProfileList docProfileList; - DoctorInformation({@required this.docProfileList}); + DoctorInformation({required this.docProfileList}); @override Widget build(BuildContext context) { @@ -46,7 +47,7 @@ class DoctorInformation extends StatelessWidget { ), mWidth(2), Text( - docProfileList.genderDescription, + docProfileList.genderDescription!, style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -69,7 +70,7 @@ class DoctorInformation extends StatelessWidget { ), mWidth(2), Text( - docProfileList.nationalityName, + docProfileList.nationalityName!, style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -104,7 +105,7 @@ class DoctorInformation extends StatelessWidget { ), mHeight(10), Text( - docProfileList.doctorProfileInfo != null ? docProfileList.doctorProfileInfo : "", + docProfileList.doctorProfileInfo != null ? docProfileList.doctorProfileInfo! : "", style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -121,4 +122,9 @@ class DoctorInformation extends StatelessWidget { ), ); } + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties.add(DiagnosticsProperty('docProfileList', docProfileList)); + } } diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index 77a94d62..ae4b7b91 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -20,7 +20,7 @@ import 'package:provider/provider.dart'; class LaserClinic extends StatefulWidget { HospitalsModel selectedHospital; - LaserClinic({this.selectedHospital}); + LaserClinic({required this.selectedHospital}); @override _LaserClinicState createState() { @@ -32,11 +32,11 @@ class _LaserClinicState extends State with SingleTickerProviderStat List _laserCategoryList = [1, 2, 11]; List _selectedBodyPartList = []; bool _isFullBody = false; - LaserBodyPart fullBody; + late LaserBodyPart fullBody; int _selectedCategoryIndex = 0; List laserBodyPartsList = []; - TabController _tabController; + late TabController _tabController; int _duration = 0; List maleLaserCategory = []; @@ -49,8 +49,8 @@ class _LaserClinicState extends State with SingleTickerProviderStat _tabController.addListener(() { if (_tabController.indexIsChanging) { } else { - _selectedBodyPartList = List(); - laserBodyPartsList = List(); + _selectedBodyPartList = []; + laserBodyPartsList = []; _selectedCategoryIndex = 0; setState(() {}); if (_tabController.index == 0) { @@ -73,7 +73,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['Laser_GetBodyPartsByCategoryList'].length != 0) { - List _tempList = List(); + List _tempList = []; res['Laser_GetBodyPartsByCategoryList'].forEach((v) { _tempList.add(LaserBodyPart.fromJson(v)); }); @@ -96,7 +96,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat bool lastIndexIsFirst = false; bool isLastIndexIsBack = false; - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; bool get isMale => _tabController.index == 0; @@ -231,7 +231,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat .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)); @@ -267,7 +267,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat int getDuration() { int duration = 0; if (_isFullBody) { - _duration = int.parse(fullBody.timeDuration); + _duration = int.parse(fullBody.timeDuration!); projectViewModel.laserSelectionDuration = duration; return _duration; } @@ -276,7 +276,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat var upperLowerArmsList = _selectedBodyPartList.where((element) => element.mappingCode == "40" || element.mappingCode == "41")?.toList() ?? []; if (_selectedBodyPartList.length > 0) { - duration = _selectedBodyPartList.fold(0, (previousValue, element) => previousValue + int.parse(element.timeDuration)); + duration = _selectedBodyPartList.fold(0, (previousValue, element) => previousValue + int.parse(element.timeDuration!)); } if (lowerUpperLegsList.length == 2) { duration -= 30; @@ -365,7 +365,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat value: _isFullBody, onChanged: (value) { setState(() { - if (value) { + if (value!) { _selectedBodyPartList.clear(); _selectedBodyPartList.add(fullBody); } else { @@ -380,7 +380,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat ), SizedBox(width: 12), Text( - projectViewModel.isArabic ? fullBody.bodyPartN : fullBody.bodyPart, + projectViewModel.isArabic ? fullBody.bodyPartN! : fullBody.bodyPart!, style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.6, height: 21 / 14), ), ], @@ -412,7 +412,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat _selectedBodyPartList.removeWhere((element) => element.id == laserBodyPartsList[index].id); // _selectedBodyPartList.remove(laserBodyPartsList[index]); } else { - if (_duration + int.parse(laserBodyPartsList[index].timeDuration) > 90) { + if (_duration + int.parse(laserBodyPartsList[index].timeDuration!) > 90) { AppToast.showToast(message: TranslationBase.of(context).laserMaxLimitReach); return; } @@ -440,7 +440,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat border: Border.all(color: _isSelected ? Color(0xffD02127) : Color(0xffEAEAEA), width: 2), ), child: LaserBodyParts() - .getCategoryImage(isMale, (isMale ? maleLaserCategory : femaleLaserCategory)[_selectedCategoryIndex].laserCategoryID, laserBodyPartsList[index].mappingCode), + .getCategoryImage(isMale, (isMale ? maleLaserCategory : femaleLaserCategory)[_selectedCategoryIndex].laserCategoryID, laserBodyPartsList[index].mappingCode!), ), if (_isSelected) Container( @@ -459,7 +459,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat SizedBox(height: 6), Expanded( child: Text( - projectViewModel.isArabic ? laserBodyPartsList[index].bodyPartN : laserBodyPartsList[index].bodyPart, + projectViewModel.isArabic ? laserBodyPartsList[index].bodyPartN! : laserBodyPartsList[index].bodyPart!, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 467ce2a7..4c73a626 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -32,7 +32,7 @@ import 'LiveCareBookAppointment.dart'; class SearchByClinic extends StatefulWidget { final List clnicIds; - SearchByClinic({this.clnicIds}); + SearchByClinic({required this.clnicIds}); @override _SearchByClinicState createState() => _SearchByClinicState(); @@ -40,9 +40,10 @@ class SearchByClinic extends StatefulWidget { class _SearchByClinicState extends State { bool nearestAppo = false; - String dropdownValue; + late String dropdownValue; + String dropdownTitle = ""; - String projectDropdownValue; + late String projectDropdownValue; // var event = RobotProvider(); List clinicsList = []; @@ -51,8 +52,8 @@ class _SearchByClinicState extends State { bool isLoaded = false; bool isProjectLoaded = false; - ListClinicCentralized selectedClinic; - HospitalsModel selectedHospital; + late ListClinicCentralized selectedClinic; + late HospitalsModel selectedHospital; AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); @@ -60,11 +61,11 @@ class _SearchByClinicState extends State { final GlobalKey clinicDropdownKey = GlobalKey(); final GlobalKey projectDropdownKey = GlobalKey(); TextEditingController ageController = new TextEditingController(); - ProjectViewModel projectViewModel; + late ProjectViewModel projectViewModel; - String radioValue = null; + late String radioValue; - LocationUtils locationUtils; + late LocationUtils locationUtils; @override void initState() { @@ -78,7 +79,7 @@ class _SearchByClinicState extends State { projectViewModel = Provider.of(context); if (projectViewModel.isLogin) { if (radioValue == null) { - if (projectViewModel.user.gender == 1) { + if (projectViewModel.user!.gender == 1) { radioValue = TranslationBase.of(context).male; } else { radioValue = TranslationBase.of(context).female; @@ -88,7 +89,7 @@ class _SearchByClinicState extends State { radioValue = TranslationBase.of(context).female; } if (ageController.text.isEmpty) { - ageController.text = projectViewModel.isLogin ? projectViewModel.user.age.toString() : ""; + ageController.text = projectViewModel.isLogin ? projectViewModel.user!.age.toString() : ""; ageController.selection = TextSelection.fromPosition(TextPosition(offset: ageController.text.length)); } @@ -143,7 +144,7 @@ class _SearchByClinicState extends State { groupValue: radioValue, onChanged: (v) { setState(() { - radioValue = v; + radioValue = v!; }); }, ), @@ -165,7 +166,7 @@ class _SearchByClinicState extends State { groupValue: radioValue, onChanged: (v) { setState(() { - radioValue = v; + radioValue = v!; }); }, ), @@ -197,9 +198,9 @@ class _SearchByClinicState extends State { Checkbox( activeColor: CustomColors.accentColor, value: nearestAppo, - onChanged: (bool value) { + onChanged: (bool? value) { setState(() { - nearestAppo = value; + nearestAppo = value!; if (nearestAppo) getProjectsList(); else @@ -228,7 +229,7 @@ class _SearchByClinicState extends State { } else {} }); }, - title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)))); + title: Text(result.clinicDescription!, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)))); }).toList()) : InkWell( onTap: () { @@ -236,7 +237,7 @@ class _SearchByClinicState extends State { selectedClinic = clincs; Navigator.pop(context); setState(() { - dropdownTitle = clincs.clinicDescription; + dropdownTitle = clincs.clinicDescription!; dropdownValue = clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString(); if (dropdownValue == "253-false-0-0") { @@ -325,12 +326,12 @@ class _SearchByClinicState extends State { items: projectsList.map((item) { return new DropdownMenuItem( value: item, - child: new Text(item.name), + child: new Text(item.name!), ); }).toList(), onChanged: (newValue) async { setState(() { - selectedHospital = newValue; + selectedHospital = newValue!; projectDropdownValue = newValue.mainProjectID.toString(); if (dropdownValue.split("-")[0] == "253") { Navigator.push(context, FadePage(page: LaserClinic(selectedHospital: selectedHospital))); @@ -356,7 +357,7 @@ class _SearchByClinicState 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, @@ -438,27 +439,50 @@ class _SearchByClinicState extends State { ); } +//Changed By Aamir void openDropdown(GlobalKey key) { - GestureDetector detector; + GestureDetector? detector; + void searchForGestureDetector(BuildContext element) { element.visitChildElements((element) { if (element.widget != null && element.widget is GestureDetector) { - detector = element.widget; - return false; + detector = element.widget as GestureDetector?; + //return false; } else { searchForGestureDetector(element); } - return true; + //return true; }); } - searchForGestureDetector(key.currentContext); + searchForGestureDetector(key.currentContext!); assert(detector != null); - detector.onTap(); + detector!.onTap!(); } + // void openDropdown(GlobalKey key) { + // GestureDetector detector; + // void searchForGestureDetector(BuildContext element) { + // element.visitChildElements((element) { + // if (element.widget != null && element.widget is GestureDetector) { + // detector = element.widget; + // return false; + // } else { + // searchForGestureDetector(element); + // } + // + // return true; + // }); + // } + // + // searchForGestureDetector(key.currentContext); + // assert(detector != null); + // + // detector.onTap(); + // } + bool isDentalSelectedAndSupported() { if (dropdownValue != null) return dropdownValue != "" && (dropdownValue.split("-")[0] == "17" || dropdownValue.split("-")[0] == "253") && isMobileAppDentalAllow; @@ -535,7 +559,7 @@ class _SearchByClinicState extends State { searchInfo.date = DateTime.now(); if (projectViewModel.isLogin) { - if (projectViewModel.user.age > 12) { + if (projectViewModel.user!.age! > 12) { navigateToDentalComplaints(context, searchInfo); } else { callDoctorsSearchAPI(17); @@ -557,7 +581,7 @@ class _SearchByClinicState extends State { ), ).then((value) { setState(() { - if (value == "false") dropdownValue = null; + if (value == "false") dropdownValue = "null"; }); if (value == "livecare") { Navigator.push(context, FadePage(page: LiveCareHome())); @@ -578,7 +602,7 @@ class _SearchByClinicState extends State { List arrDistance = []; List result; int numAll; - List _patientDoctorAppointmentListHospital =[]; + List _patientDoctorAppointmentListHospital = []; DoctorsListService service = new DoctorsListService(); service.getDoctorsList(clinicID, projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, nearestAppo, context).then((res) { @@ -598,7 +622,7 @@ class _SearchByClinicState 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)); @@ -630,7 +654,7 @@ class _SearchByClinicState extends State { ), ).then((value) { setState(() { - dropdownValue = null; + dropdownValue = "null"; }); }); } @@ -643,7 +667,7 @@ class _SearchByClinicState extends State { ), ).then((value) { setState(() { - dropdownValue = null; + dropdownValue = "null"; }); }); } @@ -653,7 +677,7 @@ class _SearchByClinicState extends State { Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) .then((value) { setState(() { - dropdownValue = null; + dropdownValue = "null"; dropdownTitle = ""; }); getProjectsList(); diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index a280bf40..5c0cc81d 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -19,8 +19,8 @@ class SearchByDoctor extends StatefulWidget { class _SearchByDoctorState extends State { TextEditingController doctorNameController = new TextEditingController(); - bool _isButtonDisabled; - ProjectViewModel projectViewModel; + late bool _isButtonDisabled; + late ProjectViewModel projectViewModel; @override void initState() { @@ -109,7 +109,7 @@ class _SearchByDoctorState extends State { List doctorByHospital = _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).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)); @@ -156,7 +156,7 @@ class _SearchByDoctorState extends State { Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, isDoctorNameSearch: true, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } - 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/BookAppointment/dialog/clinic_list_dialog.dart b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart index 96bf9492..c68db13a 100644 --- a/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart +++ b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart @@ -3,9 +3,8 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:progress_hud_v2/generated/i18n.dart'; -showClickListDialog(BuildContext context, List clinicsList, {Function(ListClinicCentralized) onSelection}) { +showClickListDialog(BuildContext context, List clinicsList, {Function(ListClinicCentralized)? onSelection}) { showDialog( context: context, builder: (BuildContext context) { @@ -19,7 +18,7 @@ showClickListDialog(BuildContext context, List clinicsLis height: MediaQuery.of(context).size.height - 80, child: ClickListDialog( clinicsList: clinicsList, - onSelection: onSelection, + onSelection: onSelection!, ), ), ); @@ -28,8 +27,8 @@ showClickListDialog(BuildContext context, List clinicsLis } class ClickListDialog extends StatefulWidget { - List clinicsList; - Function(ListClinicCentralized) onSelection; + List? clinicsList; + Function(ListClinicCentralized)? onSelection; ClickListDialog({this.clinicsList, this.onSelection}); @@ -50,8 +49,8 @@ class _ClickListDialogState extends State { addAllData() { tempClinicsList.clear(); - for (int i = 0; i < widget.clinicsList.length; i++) { - tempClinicsList.add(widget.clinicsList[i]); + for (int i = 0; i < widget.clinicsList!.length; i++) { + tempClinicsList.add(widget.clinicsList![i]); } setState(() {}); } @@ -68,9 +67,9 @@ class _ClickListDialogState extends State { onChanged: (v) { if (v.length > 0) { tempClinicsList.clear(); - for (int i = 0; i < widget.clinicsList.length; i++) { - if (widget.clinicsList[i].clinicDescription.toLowerCase().contains(v.toLowerCase())) { - tempClinicsList.add(widget.clinicsList[i]); + for (int i = 0; i < widget.clinicsList!.length; i++) { + if (widget.clinicsList![i].clinicDescription!.toLowerCase().contains(v.toLowerCase())) { + tempClinicsList.add(widget.clinicsList![i]); } } } else { @@ -93,15 +92,15 @@ class _ClickListDialogState extends State { itemBuilder: (context, index) { return InkWell( onTap: () { - widget.onSelection(tempClinicsList[index]); + widget.onSelection!(tempClinicsList[index]); }, child: Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: Text(tempClinicsList[index].clinicDescription.trim())), - tempClinicsList[index].isLiveCareClinicAndOnline + Expanded(child: Text(tempClinicsList[index].clinicDescription!.trim())), + tempClinicsList[index].isLiveCareClinicAndOnline! ? SvgPicture.asset( 'assets/images/new-design/video_icon_green_right.svg', height: 12, diff --git a/lib/pages/appUpdatePage/app_update_page.dart b/lib/pages/appUpdatePage/app_update_page.dart index 4bc790a5..1692d096 100644 --- a/lib/pages/appUpdatePage/app_update_page.dart +++ b/lib/pages/appUpdatePage/app_update_page.dart @@ -11,7 +11,7 @@ import 'package:url_launcher/url_launcher.dart'; class AppUpdatePage extends StatefulWidget { final String appUpdateText; - AppUpdatePage({@required this.appUpdateText}); + AppUpdatePage({required this.appUpdateText}); @override _AppUpdatePageState createState() => _AppUpdatePageState(); @@ -58,7 +58,7 @@ class _AppUpdatePageState extends State { minWidth: MediaQuery.of(context).size.width, height: 45.0, child: CustomTextButton( - backgroundColor: Colors.red[800], + backgroundColor: Colors.red[800]!, disabledForegroundColor: Color(0xFFbcc2c4).withOpacity(0.38), disabledBackgroundColor: Color(0xFFbcc2c4).withOpacity(0.12), elevation: 0, diff --git a/lib/pages/base/base_view.dart b/lib/pages/base/base_view.dart index ba274bdd..cede7732 100644 --- a/lib/pages/base/base_view.dart +++ b/lib/pages/base/base_view.dart @@ -11,13 +11,13 @@ import '../../locator.dart'; AppSharedPreferences sharedPref = AppSharedPreferences(); class BaseView extends StatefulWidget { - final Widget Function(BuildContext context, T model, Widget child) builder; - final Function(T) onModelReady; + final Widget Function(BuildContext context, T model, Widget? child) builder; + final Function(T)? onModelReady; final bool allowAny; BaseView({ - this.builder, - this.onModelReady, + required this.builder, + this.onModelReady, this.allowAny = false, }); @@ -27,17 +27,15 @@ class BaseView extends StatefulWidget { class _BaseViewState extends State> { T model = locator(); - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); bool isLogin = false; @override void initState() { if (widget.allowAny && widget.onModelReady != null) { - widget.onModelReady(model); - } else if (widget.onModelReady != null && - Provider.of(context, listen: false).isLogin) { - widget.onModelReady(model); + widget.onModelReady!(model); + } else if (widget.onModelReady != null && Provider.of(context, listen: false).isLogin) { + widget.onModelReady!(model); } super.initState(); } @@ -57,8 +55,11 @@ class _BaseViewState extends State> { @override void dispose() { + if (model != null) { - model = null; + //changed by Aamir + //May be cause a problem after update + model = locator(); } super.dispose(); } diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index f7283d1c..86373cc9 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -11,15 +11,15 @@ extension WithContainer on Widget { class DefaultButton extends StatelessWidget { final String text; - final VoidCallback onPress; - final Color textColor; - final Color color; - final Color disabledColor; - final IconData iconData; - final String svgIcon; - final double fontSize; + final VoidCallback? onPress; + final Color? textColor; + final Color? color; + final Color? disabledColor; + final IconData? iconData; + final String? svgIcon; + final double? fontSize; final bool isTextExpanded; - final int count; + final int? count; DefaultButton(this.text, this.onPress, {this.color, this.isTextExpanded = true, this.svgIcon, this.disabledColor, this.count = 0, this.textColor = Colors.white, this.iconData, this.fontSize}); @@ -34,7 +34,7 @@ class DefaultButton extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ if (iconData != null) Icon(iconData, color: textColor), - if (svgIcon != null) SvgPicture.asset(svgIcon, color: textColor), + if (svgIcon != null) SvgPicture.asset(svgIcon!, color: textColor), if (!isTextExpanded) Padding( padding: EdgeInsets.only(left: (iconData ?? svgIcon) != null ? 6 : 0), @@ -52,7 +52,7 @@ class DefaultButton extends StatelessWidget { style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), ), ), - if (count > 0) + if (count! > 0) Align( alignment: Alignment.topCenter, child: Container( diff --git a/lib/widgets/errors/app_embedded_error.dart b/lib/widgets/errors/app_embedded_error.dart index b2355a01..54f61d3d 100644 --- a/lib/widgets/errors/app_embedded_error.dart +++ b/lib/widgets/errors/app_embedded_error.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; /// [error] the message we show to the user class AppEmbeddedError extends StatelessWidget { const AppEmbeddedError({ - required Key key, + Key? key, required this.error, }) : super(key: key);