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

Loading…
Cancel
Save