calander implementation inprogress

design_3.0_latest
WaseemAbbasi22 11 months ago
parent ec66c6fd17
commit ff7ab84650

@ -121,16 +121,14 @@ class ServiceRequestUtils {
var currentLocation = getLocation(await FlutterTimezone.getLocalTimezone());
final calendarsResult = await DeviceCalendarPlugin().retrieveCalendars();
calendarsResult.data?.forEach((element){
print('calander element are ${element.toJson()}');
});
if (calendarsResult.data?.isNotEmpty ?? false) {
setLocalLocation(currentLocation);
await Future.delayed(const Duration(seconds: 2));
TZDateTime startDate = TZDateTime.from(start, currentLocation);
TZDateTime endDate = TZDateTime.from(end, currentLocation);
final calendarId = calendarsResult.data!.first.id; // Use the first calendar
print('calander id i got is ${calendarId}');
var eventToCreate = Event(
calendarId,
eventId: requestId.toString(),
@ -139,11 +137,9 @@ class ServiceRequestUtils {
start: startDate,
end: endDate,
);
print('calander event to add is ${eventToCreate.toJson()}');
final response = await DeviceCalendarPlugin().createOrUpdateEvent(eventToCreate);
print("Response of adding calendar is ${response?.data}");
} else {
print("No calendars available on the device.");
// "No calendars available on the device.".showToast();
}

Loading…
Cancel
Save