我想在通知中添加一個按鈕,我能夠顯示它,但我找不到有關如何向按鈕按下添加操作的檔案
const androidNotification = AndroidNotificationDetails(
'Bla', 'Bla',
icon: 'ic_bg_service_small',
ongoing: true,
actions: [AndroidNotificationAction("stop", "Stop")]);
flutterLocalNotificationsPlugin.show(
888,
'MyService',
'bla',
const NotificationDetails(android: androidNotification),
);
uj5u.com熱心網友回復:
您需要使用此插件在通知中執行操作https://pub.dev/packages/awesome_notifications
void _showNotificationWithButton() {
AwesomeNotifications().createNotification(
content: NotificationContent(
id: 10,
channelKey: 'basic_channel',
title: 'Simple Notification',
body: 'Simple body'),
actionButtons: <NotificationActionButton>[
NotificationActionButton(key: 'yes', label: 'Yes'),
NotificationActionButton(key: 'no', label: 'No'),
],
);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/527888.html
標籤:扑
上一篇:VUE中nextTick
下一篇:Flutter-將地圖添加到地圖