From 8838eb4769f36cdcb29772cb1c7eb9d8a8994711 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 19 Aug 2024 12:33:41 +0300 Subject: [PATCH] Dr speciality translation fix --- .../Appointments/DoctorListResponse.dart | 4 ++ .../BookAppointment/widgets/DoctorView.dart | 58 +++++++++++++------ 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 8c6ad3f6..205909c9 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -41,6 +41,7 @@ class DoctorList { dynamic serviceID; String? setupID; List? speciality; + List? specialityN; dynamic workingHours; dynamic decimalDoctorRate; @@ -87,6 +88,7 @@ class DoctorList { this.serviceID, this.setupID, this.speciality, + this.specialityN, this.workingHours, this.decimalDoctorRate}); @@ -133,6 +135,7 @@ class DoctorList { serviceID = json['ServiceID']; setupID = json['SetupID']; if (json.containsKey('Speciality') && json['Speciality'] != null) speciality = json['Speciality'].cast(); + if (json.containsKey('SpecialityN') && json['SpecialityN'] != null) specialityN = json['SpecialityN'].cast(); workingHours = json['WorkingHours']; decimalDoctorRate = json['DecimalDoctorRate']; } @@ -180,6 +183,7 @@ class DoctorList { data['ServiceID'] = this.serviceID; data['SetupID'] = this.setupID; data['Speciality'] = this.speciality; + data['SpecialityN'] = this.specialityN; data['WorkingHours'] = this.workingHours; data['DecimalDoctorRate'] = this.decimalDoctorRate; return data; diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 42c5f052..3e27f9ba 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -36,7 +36,7 @@ class DoctorView extends StatefulWidget { DoctorView( {required this.doctor, - this.isLiveCareAppointment, + this.isLiveCareAppointment, this.isObGyneAppointment = false, this.isDoctorNameSearch = false, this.isContinueDentalPlan = false, @@ -50,7 +50,6 @@ class DoctorView extends StatefulWidget { } class _DoctorViewState extends State with AutomaticKeepAliveClientMixin { - late ProjectViewModel projectViewModel; @override @@ -99,10 +98,12 @@ class _DoctorViewState extends State with AutomaticKeepAliveClientMi style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), - widget.isShowDate ? Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.doctor.date)), - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), - ) : Container(), + widget.isShowDate + ? Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.doctor.date)), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ) + : Container(), ], ), if (widget.doctor.doctorTitle != null) SizedBox(height: 6), @@ -123,12 +124,20 @@ class _DoctorViewState extends State with AutomaticKeepAliveClientMi children: [ if (widget.doctor.clinicName != null) MyRichText(TranslationBase.of(context).clinic + ":", widget.doctor.clinicName!, context.read().isArabic), if (widget.doctor.projectName != null) MyRichText(TranslationBase.of(context).branch, widget.doctor.projectName!, context.read().isArabic), - if (widget.doctor.speciality != null && widget.doctor.speciality!.length > 0) - Text( - this.widget.doctor.speciality![0].trim(), - // getDoctorSpeciality(this.doctor.speciality).trim(), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), - ), + if (!projectViewModel.isArabic) + if (widget.doctor.speciality != null && widget.doctor.speciality!.length > 0) + Text( + this.widget.doctor.speciality![0].trim(), + // getDoctorSpeciality(this.doctor.speciality).trim(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), + ), + if (projectViewModel.isArabic) + if (widget.doctor.specialityN != null && widget.doctor.specialityN!.length > 0) + Text( + this.widget.doctor.specialityN![0].trim(), + // getDoctorSpeciality(this.doctor.speciality).trim(), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), + ), if (widget.doctor.nearestFreeSlot != null) Text( getDate(widget.doctor.nearestFreeSlot), @@ -147,9 +156,18 @@ class _DoctorViewState extends State with AutomaticKeepAliveClientMi itemSize: 20, ignoreGestures: true, ratingWidget: RatingWidget( - full: Icon(Icons.star, color: CustomColors.accentColor,), - half: Icon(Icons.star_half, color: CustomColors.accentColor,), - empty: Icon(Icons.star, color: CustomColors.accentColor,), + full: Icon( + Icons.star, + color: CustomColors.accentColor, + ), + half: Icon( + Icons.star_half, + color: CustomColors.accentColor, + ), + empty: Icon( + Icons.star, + color: CustomColors.accentColor, + ), ), tapOnlyMode: true, itemPadding: EdgeInsets.symmetric(horizontal: 4.0), @@ -267,8 +285,14 @@ class _DoctorViewState extends State with AutomaticKeepAliveClientMi } void next(BuildContext context) { - Navigator.push(context, - FadePage(page: ObGyneTimeSlots(projectID: widget.doctor.projectID!, selectedClinicID: widget.doctor.clinicID!, selectedDoctorID: widget.doctor.doctorID!, obGyneProcedureListResponse: widget.obGyneProcedureListResponse!))); + Navigator.push( + context, + FadePage( + page: ObGyneTimeSlots( + projectID: widget.doctor.projectID!, + selectedClinicID: widget.doctor.clinicID!, + selectedDoctorID: widget.doctor.doctorID!, + obGyneProcedureListResponse: widget.obGyneProcedureListResponse!))); } Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo, bool isContinueDentalPlan = false}) async {