我在下面的代码中添加了2个按钮到我的通知中 但我不知道如何找出哪个按钮被按下,并在此基础上做些什么
Future<void> zonedScheduleAlarmClockNotification({
required Duration duration,
required String title,
required String message,
required String type,
}) async {
print(duration);
final random = Random();
int id = random.nextInt(999999999);
await flutterLocalNotificationsPlugin.zonedSchedule(
id,
title,
message,
tz.TZDateTime.now(tz.local).add(duration),
NotificationDetails(
android: AndroidNotificationDetails(
'alarm_clock_channel',
'Alarm Clock Channel',
channelDescription: 'Alarm Clock Notification',
subText: type,
//silent: true,
color: Colors.amber,
colorized: true,
ticker: title,
playSound: true,
priority: Priority.high,
importance: Importance.high,
actions: <AndroidNotificationAction>[
const AndroidNotificationAction(
'id_2',
'Completed',
titleColor: Color.fromARGB(255, 255, 0, 0),
icon: DrawableResourceAndroidBitmap('secondary_icon'),
),
const AndroidNotificationAction(
's',
'Action 3',
icon: DrawableResourceAndroidBitmap('secondary_icon'),
showsUserInterface: true,
// By default, Android plugin will dismiss the notification when the
// user tapped on a action (this mimics the behavior on iOS).
cancelNotification: false,
),
],
),
),
androidScheduleMode: AndroidScheduleMode.alarmClock,
payload: title,
uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.absoluteTime,
);
}
我希望用户在他按下的每个按钮上执行应用程序内的任务 但我不知道如何找出用户点击了哪个按钮以及何时点击