Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ja2375/add_2_calendar

A really simple Flutter plugin to add events to each platform's default calendar..
https://github.com/ja2375/add_2_calendar

Last synced: 2 months ago
JSON representation

A really simple Flutter plugin to add events to each platform's default calendar..

Awesome Lists containing this project

README

        

# add_2_calendar

A really simple Flutter plugin to add events to each platform's default calendar.

## Installation

In your `pubspec.yaml` file within your Flutter Project:

```yaml
dependencies:
add_2_calendar: ^2.1.2
```
### Android integration
The plugin doesn't need any special permissions by default to add events to the calendar. However, events can also be added without launching the calendar application, for this it is needed to add calendar permissions to your `AndroidManifest.xml`
```xml

```

Starting from API 30 Android requires package visibility configuration in your AndroidManifest.xml. A element must be added to your manifest as a child of the root element. See the Android documentation for examples of other queries.

``` xml




```

### iOS integration

In order to make this plugin work on iOS 10+, be sure to add this to your `info.plist` file:

```xml
NSCalendarsUsageDescription
INSERT_REASON_HERE
```

`NSContactsUsageDescription` is required for the location autocomplete once Apple's UI is opened, so
it is highly recommended that you also add the key, the app might crash otherwise.

```xml
NSContactsUsageDescription
INSERT_REASON_HERE
```

## Use it

```dart
import 'package:add_2_calendar/add_2_calendar.dart';

final Event event = Event(
title: 'Event title',
description: 'Event description',
location: 'Event location',
startDate: DateTime(/* Some date here */),
endDate: DateTime(/* Some date here */),
iosParams: IOSParams(
reminder: Duration(/* Ex. hours:1 */), // on iOS, you can set alarm notification after your event.
url: 'https://www.example.com', // on iOS, you can set url to your event.
),
androidParams: AndroidParams(
emailInvites: [], // on Android, you can add invite emails to your event.
),
);
...
Add2Calendar.addEvent2Cal(event);
...
```
This will launch the default calendar application to confirm the event and add it to your calendar.

## Recurring events
You can add recurrency to your events by specifying a frequency. Optional parameters such as `interval`, `ocurrances` and `endDate` can also be added.

``` dart
Event(
...
recurrence: Recurrence(
frequency: Frequency.monthly,
interval: 2,
ocurrences: 6,
),
);
```

## iOS language support
By default the ios screen that appears to save the event will be displayed in English, to support diffrent languages, add to your info.plist the languages you are supporting.

```xml
CFBundleLocalizations

en
es
ja

```

Note: See [DateTime docs](https://api.flutter.dev/flutter/dart-core/DateTime-class.html) to know what valid date could be correct in above piece of code.

## Example

Please run the app in the `example/` folder to start playing!