Omo*_*o4i 7 localnotification dart flutter
我已经可以显示本地通知,但是在通知下方是否可以显示按钮?
(请参阅所附图片中的“延后”和“关闭”按钮)。

如果您使用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
)
]
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
506 次 |
| 最近记录: |