feat:增加日程模块
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
// String formatDate(DateTime date) {
|
||||
// return '${date.month}月${date.day}日';
|
||||
// }
|
||||
//
|
||||
// String formatTime(DateTime datetime) {
|
||||
// return '${datetime.year}-${datetime.month}-${datetime.day} ${datetime.hour}:${datetime.minute}:${datetime.second}';
|
||||
// }
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
String formatDate(DateTime date) {
|
||||
return DateFormat('yyyy-MM-dd').format(date);
|
||||
}
|
||||
|
||||
String formatTime(DateTime datetime) {
|
||||
return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ class NotifyService {
|
||||
required String body,
|
||||
required DateTime scheduledTime,
|
||||
}) async {
|
||||
print("scheduleNotification: $id");
|
||||
await _notifications.zonedSchedule(
|
||||
id,
|
||||
title,
|
||||
@@ -110,8 +109,11 @@ class NotifyService {
|
||||
|
||||
// 取消特定通知
|
||||
Future<void> cancelNotification(int id) async {
|
||||
print("cancelNotification: $id");
|
||||
await _notifications.cancel(id);
|
||||
try {
|
||||
await _notifications.cancel(id);
|
||||
} catch(e) {
|
||||
print('取消通知失败: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 取消所有通知
|
||||
|
||||
Reference in New Issue
Block a user