搜尋套件、儲存庫與 APP 分類

套件詳情v3.1.1

add_2_calendar

一個非常簡單的 Flutter 插件,用於將事件新增至各平台的預設日曆。

AndroidiOS
近 30 天下載
15.9萬
喜歡數
364
Pub 分數
160

安裝套件

flutter pub add add_2_calendar

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個輕量級的Flutter外掛,可於Android與iOS的預設日曆中新增日曆事件。它提供簡單的API,可輕鬆建立與排程事件,設定簡單,非常適合需要日曆整合的應用程式。該外掛會自動處理平台特定的差異,確保在各裝置上行為一致。它支援基本的事件細節,如標題、日期、時間與描述。

適用情境

  • 安排預約
  • 將提醒加入日曆
  • 在生產力應用中整合事件建立
  • 在應用內部啟用事件共享
  • 支援會議邀請

主要特色

  • 跨平台相容性
  • 簡單事件建立 API
  • 自動平台處理
  • 支援事件標題、日期、時間和描述
  • 所需設定最少

適合對象

  • 開發整合日曆應用程式的開發者
  • 需要快速新增事件的應用程式
  • 針對 Android 和 iOS 的專案
  • 希望獲得簡單日曆存取權限的團隊

使用建議

  • 需要使用者權限才能存取日曆
  • 僅限基本事件屬性
  • 不支援重複事件
  • 取決於裝置的預設日曆應用程式
  • 可能需要在 Android 上授予額外權限

原始 README

以下為關聯原始碼儲存庫的 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:

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

<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_CALENDAR" />

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.

<queries>
  <intent>
    <action android:name="android.intent.action.INSERT" />
    <data android:mimeType="vnd.android.cursor.item/event" />
  </intent>
</queries>
iOS integration

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

<key>NSCalendarsUsageDescription</key>
<string>INSERT_REASON_HERE</string>

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.

<key>NSContactsUsageDescription</key>
<string>INSERT_REASON_HERE</string>

Use it

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.

 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.

<key>CFBundleLocalizations</key>
	<array>
		<string>en</string>
		<string>es</string>
		<string>ja</string>
	</array>

Note: See DateTime docs 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!

所屬分類

原始碼儲存庫

使用此套件的專案