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

flutter_alarm_clock 封面
套件詳情v0.1.2

flutter_alarm_clock

一個輕量級的 Flutter 套件,用於連接 Android 時鐘應用的意圖。

Android
近 30 天下載
171
喜歡數
79
Pub 分數
160

安裝套件

flutter pub add flutter_alarm_clock

套件介紹

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

一個輕量級的 Flutter 套件,可透過意圖實現與 Android 系統時鐘應用的整合。它允許 Flutter 應用程式觸發或與 Android 裝置上的原生鬧鐘功能進行互動,從而於應用中實現無縫的鬧鐘管理。專為 Android 設計,利用平台特定功能,無需複雜的原生程式碼。此套件非常適合需要直接存取裝置鬧鐘系統的生產力、健康或提醒類應用程式。

適用情境

  • 透過原生鬧鐘安排提醒
  • 在健康應用中整合警報功能
  • 從 Flutter 應用內部觸發警報
  • 建構帶有鬧鐘支援的任務或習慣追蹤應用
  • 啟用基於時間的通知

主要特色

  • 基於意圖的簡單整合
  • 輕量且依賴極少
  • 僅限 Android 的平台支援
  • 直接存取系統警示功能
  • 無需背景服務

適合對象

  • 開發面向 Android 的提醒類應用的開發者
  • 需要原生鬧鐘互動的應用
  • 與系統功能的輕量級整合
  • Flutter 專案僅針對 Android 設備
  • 尋求最小化設定的警報觸發器的使用者

使用建議

  • 僅限 Android 平台
  • 需要 Android 系統權限
  • 依賴於裝置特定時鐘應用的可用性
  • 在所有 Android 版本上可能無法一致運作
  • 無 iOS 支援

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Android Alarm Clock Plugin for Flutter

pub package

This plugin allows Flutter apps to operate with the default clock application when the platform is Android. Provides a lightweight wrapper around clock app intents. It uses Android intents to communicate with the default clock app.

Currently supported features

  • Create new Alarms
  • Create new Timers
  • Open default Clock app showing Alarms
  • Open default Clock app showing Timers

Usage

Create an Alarm

Create a new alarm. Function arguments:
'hour' specifies alarm hour
'minutes' specifies alarm minutes
'title' specifies alarm title - optional
'skipUi' specifies whether clock app should open or not - optional

// Creates an alarm at 23:59
FlutterAlarmClock.createAlarm(hour: 23, minutes: 59);
Create a Timer

Create a new timer. Function arguments:
'length' specifies timer length in seconds
'title' specifies timer title - optional
'skipUi' specifies whether clock app should open or not - optional

// Creates a timer for 42 seconds
FlutterAlarmClock.createTimer(length: 42);
Show Alarms

Opens default clock app showing alarms.

FlutterAlarmClock.showAlarms();
Show Timers

Opens default clock app showing timers.

FlutterAlarmClock.showTimers();

Feel free to add support for additional functionality.

Note that a similar method does not currently exist for iOS.

Platform Support

Android
✔️

Example App

Screenshot
screenshot
Code
import 'package:flutter/material.dart';
import 'package:flutter_alarm_clock/flutter_alarm_clock.dart';

void main() {
  runApp(const MyApp());
}

/// {@template myApp}
/// A main class for the Flutter alarm clock example application.
/// {@endtemplate}
class MyApp extends StatefulWidget {
  /// @{@macro myApp}
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter alarm clock example'),
        ),
        body: Center(
          child: Column(
            children: <Widget>[
              Container(
                margin: const EdgeInsets.all(25),
                child: TextButton(
                  child: const Text(
                    'Create alarm at 23:59',
                    style: TextStyle(fontSize: 20),
                  ),
                  onPressed: () {
                    FlutterAlarmClock.createAlarm(hour: 23, minutes: 59);
                  },
                ),
              ),
              Container(
                margin: const EdgeInsets.all(25),
                child: const TextButton(
                  onPressed: FlutterAlarmClock.showAlarms,
                  child: Text(
                    'Show alarms',
                    style: TextStyle(fontSize: 20),
                  ),
                ),
              ),
              Container(
                margin: const EdgeInsets.all(25),
                child: TextButton(
                  child: const Text(
                    'Create timer for 42 seconds',
                    style: TextStyle(fontSize: 20),
                  ),
                  onPressed: () {
                    FlutterAlarmClock.createTimer(length: 42);
                  },
                ),
              ),
              Container(
                margin: const EdgeInsets.all(25),
                child: const TextButton(
                  onPressed: FlutterAlarmClock.showTimers,
                  child: Text(
                    'Show Timers',
                    style: TextStyle(fontSize: 20),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。