Delete Event on Calender

dev_v3.13.6_voipcall
devamirsaleemahmad 2 years ago
parent f534ee6f58
commit 6671dea8d8

@ -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<AppointmentDetails> with SingleTick
static TabController? _tabController;
AppSharedPreferences sharedPref = AppSharedPreferences();
List<DoctorRateDetails> doctorDetailsList =[];
List<DoctorRateDetails> doctorDetailsList = [];
ToDoCountProviderModel? toDoProvider;
ProjectViewModel? projectViewModel;
@ -309,7 +310,9 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
doctor: getDoctorObject(),
isLiveCareAppointment: widget.appo.isLiveCareAppointment!,
selectedDate: DocAvailableAppointments.selectedDate!,
selectedTime: DocAvailableAppointments.selectedTime!, initialSlotDuration: 0,)));
selectedTime: DocAvailableAppointments.selectedTime!,
initialSlotDuration: 0,
)));
}
void getDoctorRatingsDetails() {
@ -357,7 +360,8 @@ class _AppointmentDetailsState extends State<AppointmentDetails> 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: 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,
@ -380,9 +384,18 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
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,
unratedColor: Colors.grey[500],
@ -390,8 +403,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
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))),
@ -612,9 +624,17 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
DateTime startEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate!);
DateTime endEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate!);
RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate);
if (calendarUtils.calendars.length > 1) {
calendarUtils.calendars.forEach((calender) {
calendarUtils.retrieveEvents(calender.id!, params).then((value) {
Result<UnmodifiableListView<Event>> 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<UnmodifiableListView<Event>> events = value;
events.data!.forEach((element) {
@ -622,6 +642,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
});
});
}
}
cancelAppointment() {
ConfirmDialog.closeAlertDialog(context);

Loading…
Cancel
Save