showNotificationWithActions static method
Show a desktop notification with action buttons
Implementation
static Future<void> showNotificationWithActions({
required String title,
required String body,
String? subtitle,
required List<String> actions,
bool silent = false,
Function(int)? onActionClick,
VoidCallback? onClick,
}) async {
if (!_isDesktopPlatform()) {
if (kDebugMode) {
print('NotificationMasterDesktop: Not a desktop platform');
}
return;
}
if (!_isInitialized) {
if (kDebugMode) {
print(
'NotificationMasterDesktop: Not initialized. Call initialize() first.',
);
}
return;
}
try {
// Implementation with local_notifier
// List<LocalNotificationAction> notificationActions = actions
// .map((action) => LocalNotificationAction(text: action))
// .toList();
//
// LocalNotification notification = LocalNotification(
// title: title,
// subtitle: subtitle,
// body: body,
// silent: silent,
// actions: notificationActions,
// );
//
// if (onClick != null) {
// notification.onClick = onClick;
// }
//
// if (onActionClick != null) {
// notification.onClickAction = onActionClick;
// }
//
// await notification.show();
if (kDebugMode) {
print(
'NotificationMasterDesktop: Notification with actions shown - $title',
);
}
} catch (e) {
if (kDebugMode) {
print('NotificationMasterDesktop: Failed to show notification: $e');
}
}
}