|
|
@ -3,9 +3,12 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart'; |
|
|
|
import 'package:flutter_native_timezone/flutter_native_timezone.dart'; |
|
|
|
import 'package:get/get.dart'; |
|
|
|
import 'package:sqflite_pust_local_notification/models/task_model.dart'; |
|
|
|
import 'package:sqflite_pust_local_notification/ui/notified_screen.dart'; |
|
|
|
import 'package:timezone/data/latest.dart' as tz; |
|
|
|
import 'package:timezone/timezone.dart' as tz; |
|
|
|
|
|
|
|
import '../utils/assets_string.dart'; |
|
|
|
|
|
|
|
class NotifyHelper { |
|
|
|
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = |
|
|
|
FlutterLocalNotificationsPlugin(); // |
|
|
@ -43,6 +46,27 @@ class NotifyHelper { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
// displayNotification( |
|
|
|
// {required int id, required String title, required String body}) async { |
|
|
|
// print("doing test"); |
|
|
|
// var androidPlatformChannelSpecifics = new AndroidNotificationDetails( |
|
|
|
// 'your channel id', |
|
|
|
// 'your channel name', |
|
|
|
// channelDescription: '', |
|
|
|
// importance: Importance.max, |
|
|
|
// priority: Priority.high, |
|
|
|
// ); |
|
|
|
|
|
|
|
// var iOSPlatformChannelSpecifics = new IOSNotificationDetails(); |
|
|
|
// var platformChannelSpecifics = new NotificationDetails( |
|
|
|
// android: androidPlatformChannelSpecifics, |
|
|
|
// iOS: iOSPlatformChannelSpecifics); |
|
|
|
|
|
|
|
// await flutterLocalNotificationsPlugin.show( |
|
|
|
// id, title, body, platformChannelSpecifics, |
|
|
|
// payload: "${title}|" + "${body}|"); |
|
|
|
// } |
|
|
|
|
|
|
|
displayNotification({required String title, required String body}) async { |
|
|
|
print("doing test"); |
|
|
|
var androidPlatformChannelSpecifics = new AndroidNotificationDetails( |
|
|
@ -61,7 +85,7 @@ class NotifyHelper { |
|
|
|
title, |
|
|
|
body, |
|
|
|
platformChannelSpecifics, |
|
|
|
payload: 'Default_Sound', |
|
|
|
payload: title, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
@ -80,7 +104,8 @@ class NotifyHelper { |
|
|
|
androidAllowWhileIdle: true, |
|
|
|
uiLocalNotificationDateInterpretation: |
|
|
|
UILocalNotificationDateInterpretation.absoluteTime, |
|
|
|
matchDateTimeComponents: DateTimeComponents.time); |
|
|
|
matchDateTimeComponents: DateTimeComponents.time, |
|
|
|
payload: "${taskModel.title}|" + "${taskModel.note}|"); |
|
|
|
} |
|
|
|
|
|
|
|
tz.TZDateTime _convertTimeDeration(int hours, int minutes) { |
|
|
@ -113,8 +138,9 @@ class NotifyHelper { |
|
|
|
} else { |
|
|
|
print("Notification Done"); |
|
|
|
} |
|
|
|
Get.to(() => Container( |
|
|
|
color: Colors.white, |
|
|
|
)); |
|
|
|
if (payload == "Theme Change" || payload == "Add Task") { |
|
|
|
} else { |
|
|
|
Get.to(() => NotifiedScreen(lable: payload)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |