diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 29ed7736..7889c531 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -1,8 +1,10 @@ import 'dart:collection'; +import 'dart:convert'; import 'package:device_calendar/device_calendar.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/main.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; @@ -30,7 +32,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:provider/provider.dart'; - import 'widgets/AppointmentActions.dart'; class AppointmentDetails extends StatefulWidget { @@ -50,7 +51,7 @@ class _AppointmentDetailsState extends State with SingleTick static TabController? _tabController; AppSharedPreferences sharedPref = AppSharedPreferences(); - List doctorDetailsList =[]; + List doctorDetailsList = []; ToDoCountProviderModel? toDoProvider; ProjectViewModel? projectViewModel; @@ -306,10 +307,12 @@ class _AppointmentDetailsState extends State with SingleTick context, FadePage( page: BookConfirm( - doctor: getDoctorObject(), - isLiveCareAppointment: widget.appo.isLiveCareAppointment!, - selectedDate: DocAvailableAppointments.selectedDate!, - selectedTime: DocAvailableAppointments.selectedTime!, initialSlotDuration: 0,))); + doctor: getDoctorObject(), + isLiveCareAppointment: widget.appo.isLiveCareAppointment!, + selectedDate: DocAvailableAppointments.selectedDate!, + selectedTime: DocAvailableAppointments.selectedTime!, + initialSlotDuration: 0, + ))); } void getDoctorRatingsDetails() { @@ -357,41 +360,50 @@ class _AppointmentDetailsState extends State with SingleTick margin: EdgeInsets.only(bottom: 5.0), padding: EdgeInsets.all(10.0), child: Text(TranslationBase.of(context).doctorRating, style: TextStyle(fontSize: 22.0, color: Colors.black))), - Container(margin: EdgeInsets.only(top: 0.0), child: Text(this.widget.appo.actualDoctorRate!.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))), Container( - margin: EdgeInsets.only(top: 5.0), - alignment: Alignment.center, - child: - // RatingBar.readOnly( - // initialRating: this.widget.appo.actualDoctorRate.toDouble(), - // size: 35.0, - // filledColor: Colors.yellow[700], - // emptyColor: Colors.grey[500], - // isHalfAllowed: true, - // halfFilledIcon: Icons.star_half, - // filledIcon: Icons.star, - // emptyIcon: Icons.star, - // ), - RatingBar( - initialRating: this.widget.appo.actualDoctorRate!.toDouble(), - direction: Axis.horizontal, - allowHalfRating: true, - itemCount: 5, - 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,), - ), - tapOnlyMode: true, - unratedColor: Colors.grey[500], - itemPadding: EdgeInsets.symmetric(horizontal: 4.0), - onRatingUpdate: (rating) { - print(rating); - }, - ) - ), + margin: EdgeInsets.only(top: 0.0), child: Text(this.widget.appo.actualDoctorRate!.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: + // RatingBar.readOnly( + // initialRating: this.widget.appo.actualDoctorRate.toDouble(), + // size: 35.0, + // filledColor: Colors.yellow[700], + // emptyColor: Colors.grey[500], + // isHalfAllowed: true, + // halfFilledIcon: Icons.star_half, + // filledIcon: Icons.star, + // emptyIcon: Icons.star, + // ), + RatingBar( + initialRating: this.widget.appo.actualDoctorRate!.toDouble(), + direction: Axis.horizontal, + allowHalfRating: true, + itemCount: 5, + 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, + ), + ), + tapOnlyMode: true, + unratedColor: Colors.grey[500], + itemPadding: EdgeInsets.symmetric(horizontal: 4.0), + onRatingUpdate: (rating) { + print(rating); + }, + )), Container( margin: EdgeInsets.only(top: 10.0), child: Text(this.widget.appo.noOfPatientsRate.toString() + " " + TranslationBase.of(context).reviews, style: TextStyle(fontSize: 14.0, color: Colors.black))), @@ -510,10 +522,10 @@ class _AppointmentDetailsState extends State with SingleTick minWidth: MediaQuery.of(context).size.width, height: 40.0, child: CustomTextButton( - elevation: 0.0, - backgroundColor: Colors.white, - disabledForegroundColor: new Color(0xFFbcc2c4).withOpacity(0.38), - disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12), + elevation: 0.0, + backgroundColor: Colors.white, + disabledForegroundColor: new Color(0xFFbcc2c4).withOpacity(0.38), + disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12), onPressed: () { Navigator.of(context).pop(); }, @@ -612,15 +624,24 @@ class _AppointmentDetailsState extends State with SingleTick DateTime startEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate!); DateTime endEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate!); - RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate); - - await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id!, params).then((value) { - Result> events = value; - events.data!.forEach((element) { - if (element.title!.contains(widget.appo.doctorNameObj!)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element); + if (calendarUtils.calendars.length > 1) { + calendarUtils.calendars.forEach((calender) { + calendarUtils.retrieveEvents(calender.id!, params).then((value) { + Result> events = value; + events.data!.forEach((element) { + if (element.title!.contains(widget.appo.doctorNameObj!)) calendarUtils.deleteEvent(calender, element); + }); + }); }); - }); + } else { + await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id!, params).then((value) { + Result> events = value; + events.data!.forEach((element) { + if (element.title!.contains(widget.appo.doctorNameObj!)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element); + }); + }); + } } cancelAppointment() {