showNotificationWithActions static method

Future<void> showNotificationWithActions({
  1. required String title,
  2. required String body,
  3. String? subtitle,
  4. required List<String> actions,
  5. bool silent = false,
  6. dynamic onActionClick(
    1. int
    )?,
  7. VoidCallback? onClick,
})

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');
    }
  }
}