From 29c2fd067ee10942b2ddbc3ee8c070d62a98d434 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" <> Date: Wed, 15 May 2024 10:55:13 +0300 Subject: [PATCH] Null fixes after merge from 3.13 --- ...et_dental_instructions_response_model.dart | 26 +++++++++---------- .../medical/dental_instructions_page.dart | 8 +++--- .../medical/medical_profile_page_new.dart | 10 +++---- lib/uitl/utils.dart | 10 +++---- .../dialogs/radio_selection_dialog.dart | 4 +-- lib/widgets/drawer/app_drawer_widget.dart | 4 +-- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/models/get_dental_instructions_response_model.dart b/lib/models/get_dental_instructions_response_model.dart index 6f2f8621..97ed424c 100644 --- a/lib/models/get_dental_instructions_response_model.dart +++ b/lib/models/get_dental_instructions_response_model.dart @@ -1,7 +1,7 @@ class GetDentalInstructionsResponseModel { - List data; + List? data; dynamic message; - int status; + int? status; GetDentalInstructionsResponseModel({this.data, this.message, this.status}); @@ -9,7 +9,7 @@ class GetDentalInstructionsResponseModel { if (json['Data'] != null) { data = []; json['Data'].forEach((v) { - data.add(new Data.fromJson(v)); + data!.add(new Data.fromJson(v)); }); } message = json['message']; @@ -19,7 +19,7 @@ class GetDentalInstructionsResponseModel { Map toJson() { final Map data = new Map(); if (this.data != null) { - data['Data'] = this.data.map((v) => v.toJson()).toList(); + data['Data'] = this.data!.map((v) => v.toJson()).toList(); } data['message'] = this.message; data['status'] = this.status; @@ -28,15 +28,15 @@ class GetDentalInstructionsResponseModel { } class Data { - String createdOn; - String mobileNo; - int patientId; - int procedureId; - int projectId; - String setupId; - String smsContent; - int sourceReferenceNo; - String sourceType; + String? createdOn; + String? mobileNo; + int? patientId; + int? procedureId; + int? projectId; + String? setupId; + String? smsContent; + int? sourceReferenceNo; + String? sourceType; Data( {this.createdOn, diff --git a/lib/pages/medical/dental_instructions_page.dart b/lib/pages/medical/dental_instructions_page.dart index a704d620..133165d7 100644 --- a/lib/pages/medical/dental_instructions_page.dart +++ b/lib/pages/medical/dental_instructions_page.dart @@ -16,7 +16,7 @@ class DentalInstructionsPage extends StatefulWidget { } class _DentalInstructionsPageState extends State { - GetDentalInstructionsResponseModel getDentalInstructionsResponseModel; + GetDentalInstructionsResponseModel? getDentalInstructionsResponseModel; @override void initState() { @@ -41,15 +41,15 @@ class _DentalInstructionsPageState extends State { padding: const EdgeInsets.all(16.0), child: Column( children: [ - getDentalInstructionsResponseModel != null && getDentalInstructionsResponseModel.data.isNotEmpty + getDentalInstructionsResponseModel != null && getDentalInstructionsResponseModel!.data!.isNotEmpty ? ListView.builder( - itemCount: getDentalInstructionsResponseModel.data.length, + itemCount: getDentalInstructionsResponseModel!.data!.length, shrinkWrap: true, itemBuilder: (context, index) { return Padding( padding: EdgeInsets.only(top: 16.0, bottom: 16.0), child: Text( - getDentalInstructionsResponseModel.data[index].smsContent, + getDentalInstructionsResponseModel!.data![index].smsContent!, style: TextStyle( fontSize: 14.0, letterSpacing: -0.56, diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index 376c924a..55b6a4c6 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -33,14 +33,14 @@ class _MedicalProfilePageState extends State { ProjectViewModel? projectViewModel; List projectsList = []; - HospitalsModel _selectedHospital; + HospitalsModel? _selectedHospital; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); var appoCountProvider = Provider.of(context); List myMedicalList = - Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin, onWeCareClick: openWeCareProjectSelection); + Utils.myMedicalList(projectViewModel: projectViewModel!, context: context, count: appoCountProvider.count, isLogin: projectViewModel!.isLogin, onWeCareClick: openWeCareProjectSelection); return BaseView( onModelReady: (model) => model.getAppointmentHistory(isForTimeLine: true), builder: (_, model, widget1) => AppScaffold( @@ -113,7 +113,7 @@ class _MedicalProfilePageState extends State { openWeCareProjectSelection() { int _selectedHospitalIndex = -1; - int languageID = projectViewModel.isArabic ? 1 : 2; + int languageID = projectViewModel!.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); ClinicListService service = new ClinicListService(); List projectsListLocal = []; @@ -127,7 +127,7 @@ class _MedicalProfilePageState extends State { }); GifLoaderDialogUtils.hideDialog(context); List list = [ - for (int i = 0; i < projectsList.length; i++) RadioSelectionDialogModel(projectsList[i].name + ' ${projectsList[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + for (int i = 0; i < projectsList.length; i++) RadioSelectionDialogModel(projectsList[i].name! + ' ${projectsList[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), ]; showDialog( context: context, @@ -139,7 +139,7 @@ class _MedicalProfilePageState extends State { onValueSelected: (index) { _selectedHospitalIndex = index; _selectedHospital = projectsList[index]; - openWeCareURL(_selectedHospital.iD); + openWeCareURL(_selectedHospital!.iD); // setState(() {}); }, ), diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 55431476..8d4eaf50 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -222,11 +222,11 @@ class Utils { return RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email); } - static List myMedicalList({ProjectViewModel projectViewModel, BuildContext context, bool isLogin, count, Function onWeCareClick}) { + static List myMedicalList({ProjectViewModel? projectViewModel, BuildContext? context, bool? isLogin, count, Function? onWeCareClick}) { List medical = []; medical.add(InkWell( - onTap: () => projectViewModel!.havePrivilege(5) ? Navigator.push(context!, FadePage(page: MyAppointments())) : null, + onTap: () => projectViewModel.havePrivilege(5) ? Navigator.push(context, FadePage(page: MyAppointments())) : null, child: isLogin! ? Stack(children: [ Container( @@ -235,12 +235,12 @@ class Utils { child: MedicalProfileItem( title: TranslationBase.of(context!).myAppointments, imagePath: 'appointment_list.svg', - subTitle: TranslationBase.of(context!).myAppointmentsList, + subTitle: TranslationBase.of(context).myAppointmentsList, hasBadge: true, isEnable: projectViewModel!.havePrivilege(5)), ), projectViewModel.isArabic - ? !projectViewModel.user!.isFamily + ? !projectViewModel.user.isFamily ? Positioned( left: 8, top: 4, @@ -384,7 +384,7 @@ class Utils { )); medical.add(InkWell( - onTap: () => onWeCareClick(), + onTap: () => onWeCareClick!(), child: MedicalProfileItem( title: TranslationBase.of(context).wecare, imagePath: 'assets/images/new-design/virtual_tour_icon.png', diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index 2a4178b7..7776425b 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -17,7 +17,7 @@ class RadioSelectionDialog extends StatefulWidget { final bool? isShowSearch; final String? buttonText; - const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false, this.isShowSearch = false, this.buttonText = ""}) : super(key: key); + const RadioSelectionDialog({Key? key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false, this.isShowSearch = false, this.buttonText = ""}) : super(key: key); @override State createState() => new RadioSelectionDialogState(); @@ -165,7 +165,7 @@ class RadioSelectionDialogState extends State { children: [ Expanded( child: DefaultButton( - widget.buttonText.isNotEmpty ? widget.buttonText : TranslationBase.of(context).save, + widget.buttonText!.isNotEmpty ? widget.buttonText! : TranslationBase.of(context).save, () { Navigator.pop(context); widget.onValueSelected!(selectedIndex); diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index f75517bd..84fdb2bf 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -156,8 +156,8 @@ class _AppDrawerState extends State { ), ), mHeight(20.0), - (user != null && projectProvider.isLogin) - ? Image.network("https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${user.patientID.toString()}", fit: BoxFit.fill, height: 73.5, width: 73.5) + (user != null && projectProvider!.isLogin) + ? Image.network("https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${user!.patientID.toString()}", fit: BoxFit.fill, height: 73.5, width: 73.5) : Container(), ], ),