我已经可以显示本地通知,但是在通知下方是否可以显示按钮?
(请参阅所附图片中的“延后”和“关闭”按钮)。
答案 0 :(得分:1)
如果您使用的是local_notifications,则可以添加actions
:
handleCustomActionClick(String payload) {
if(payload == "secondAction") {
LocalNotifications.removeNotification(0);
}
}
int id = await LocalNotifications.createNotification(
title: "Multiple Actions",
content: 'With custom callbacks',
id: 0,
onNotificationClick: new NotificationAction(
actionText: "Some action",
callback: onNotificationClick,
payload: "Some payload",
launchesApp: false
),
actions: [
new NotificationAction(
actionText: "First",
callback: handleCustomActionClick,
payload: "firstAction",
launchesApp: true
),
new NotificationAction(
actionText: "Second",
callback: handleCustomActionClick,
payload: "secondAction",
launchesApp: false
)
]
);