|
|
|
|
@ -43,37 +43,36 @@ class CalenderUtilsNew {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _loadCalendars() async {
|
|
|
|
|
print("the get calenders is called");
|
|
|
|
|
CalendarPermissionStatus result = await DeviceCalendar.instance.hasPermissions();
|
|
|
|
|
if (result != CalendarPermissionStatus.granted) {
|
|
|
|
|
await DeviceCalendar.instance.requestPermissions();
|
|
|
|
|
result = await DeviceCalendar.instance.hasPermissions();
|
|
|
|
|
// if (result != CalendarPermissionStatus.granted) {
|
|
|
|
|
// print("the permission is not granted");
|
|
|
|
|
// showCommonBottomSheetWithoutHeight(
|
|
|
|
|
// title: LocaleKeys.notice.tr(context: GetIt
|
|
|
|
|
// .instance<NavigationService>()
|
|
|
|
|
// .navigatorKey
|
|
|
|
|
// .currentContext!),
|
|
|
|
|
// GetIt
|
|
|
|
|
// .instance<NavigationService>()
|
|
|
|
|
// .navigatorKey
|
|
|
|
|
// .currentContext!,
|
|
|
|
|
// child: Utils.getWarningWidget(
|
|
|
|
|
// loadingText: LocaleKeys.calendarPermissionAlert.tr(),
|
|
|
|
|
// isShowActionButtons: true,
|
|
|
|
|
// onCancelTap: () {
|
|
|
|
|
// GetIt.instance<NavigationService>().pop();
|
|
|
|
|
// },
|
|
|
|
|
// onConfirmTap: () async {
|
|
|
|
|
// GetIt.instance<NavigationService>().pop();
|
|
|
|
|
// openAppSettings();
|
|
|
|
|
// }),
|
|
|
|
|
// callBackFunc: () {},
|
|
|
|
|
// isFullScreen: false,
|
|
|
|
|
// isCloseButtonVisible: true,
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
if (result != CalendarPermissionStatus.granted) {
|
|
|
|
|
print("the permission is not granted");
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
title: LocaleKeys.notice.tr(context: GetIt
|
|
|
|
|
.instance<NavigationService>()
|
|
|
|
|
.navigatorKey
|
|
|
|
|
.currentContext!),
|
|
|
|
|
GetIt
|
|
|
|
|
.instance<NavigationService>()
|
|
|
|
|
.navigatorKey
|
|
|
|
|
.currentContext!,
|
|
|
|
|
child: Utils.getWarningWidget(
|
|
|
|
|
loadingText: LocaleKeys.calendarPermissionAlert.tr(),
|
|
|
|
|
isShowActionButtons: true,
|
|
|
|
|
onCancelTap: () {
|
|
|
|
|
GetIt.instance<NavigationService>().pop();
|
|
|
|
|
},
|
|
|
|
|
onConfirmTap: () async {
|
|
|
|
|
GetIt.instance<NavigationService>().pop();
|
|
|
|
|
openAppSettings();
|
|
|
|
|
}),
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var calenders = await calender.listCalendars();
|
|
|
|
|
calenders.forEach((calender) {
|
|
|
|
|
|