nova_alarm_plugin 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new58

nova_alarm_plugin :^0.1.0 #

设置闹钟定时器和日历提醒的插件.

使用日历提醒功能 #

Android部分 #

1 申请权限 #

NovaAlarmPlugin.requestCalendarPermission() #

    项目中注册
    <uses-permission android:name="android.permission.READ_CALENDAR" />
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />

2 插入日历提醒 #


 通过名称添加事件
 var now = new DateTime.now();
 var dateTime = new DateTime(now.year,now.month,now.day+3,now.hour,now.minute);
 var beginTime =  dateTime.millisecondsSinceEpoch;
    await NovaAlarmPlugin.insertCalenderEvent(beginTime, "提醒名", "提醒内容",3,repeatDay: true);  3代表提前提醒天数;
    repeateDay:bool  开启重复提醒  (repeateDay为true时,repeateValue有效)
    repeateValue: int   重复提醒频率   例如每天提醒一次   repeatevalue =1 

3 删除日历提醒 #

  通过名称删除事件(建议 删除后延时插入新的日历,否则可能导致日历添加失败)
  NovaAlarmPlugin.deleteCalendarEvent("提醒名");

IOS部分 #

(暂未添加IOS日历设置部分)

使用闹钟功能 #

Android部分 #

1,闹钟权限申请 #

  注册表添加设置闹钟权限
  <uses-permission android:name="android.permission.SET_ALARM" />
  <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />

2,设置闹钟 #

   由于平台差异性,Android调用原生闹钟只能设置当前时间戳和备注信息
  /// time 设置闹钟的时间戳   闹钟备注   一般闹钟生效后会自我销毁
  static Future<bool> setClock(String time,
      {String  content}) async {
    var kParams = {
      "time": time,
      "content": content,
      };
  }

3,取消闹钟 #

  跳转到闹钟界面  需要用户手动关闭未生效的闹钟
  static Future<bool> closeClock() async {
    return await _channel.invokeMethod('cancelAllClock', null);
  }

4,额外功能(唤醒前台service方便用户点击启动app)(前台服务) #

  //Android平台初始化定时器和前台Service
  static Future initClockService({String title,String content}) async {
    WidgetsFlutterBinding.ensureInitialized();
    if (Platform.isAndroid) {
      var params = {
        "title":title,
        "content":content
      };
      await _channel.invokeMethod('initClockService',params);
    }
  }

IOS部分 #

IOS使用的本地推送实现闹钟提醒 #


setClock 
requestClockPermission
isClockAvailable
closeClock
closeNotification

0.0.5 #

  • TODO: Describe initial release.

example/README.md

nova_alarm_plugin_example #

Demonstrates how to use the nova_alarm_plugin plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  nova_alarm_plugin: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:nova_alarm_plugin/nova_alarm_plugin.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Format lib/nova_alarm_plugin.dart.

Run flutter format to format lib/nova_alarm_plugin.dart.

Maintenance issues and suggestions

The description contains too many non-ASCII characters. (-20 points)

The site uses English as its primary language. The value of the description field in your package's pubspec.yaml field should primarily contain characters used in English.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test