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

GitHub 儲存庫mevljas/flutter_alarm_clock

flutter_alarm_clock

適用於 Flutter 的 Android 鬧鐘外掛程式。

flutter_alarm_clock 專案封面
星標
17
分支
10
最近推送(UTC)
2025年5月15日
專案狀態
未封存

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

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),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
Sebastjan Mevlja GitHub avatar
GitHub 作者

Sebastjan Mevlja ↗

Enthusiastic Software Engineer. Interested in developing Web and Mobile applications.

Telekom Slovenije, d. d.Slovenija官方網站 ↗
語言DartKotlin

此儲存庫發佈的套件

使用的依賴

依賴清單 3 項

  • flutter{"sdk":"flutter"}
  • flutter_test開發依賴{"sdk":"flutter"}
  • very_good_analysis開發依賴^5.0.0+1

如何選擇適合專案的儲存庫?

先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。

  1. 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
  2. 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
  3. 使用前在 GitHub 確認 README、授權條款與 Issues。

來源與維護

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗