带有操作按钮的本地通知

问题描述 投票:0回答:1

我在 iOS 上从 flutter 本地通知下载并运行了示例,但在 iOS 上看不到任何操作按钮,我没有在 Android 上尝试。我需要能够暂停通知。

[Flutter 本地通知 Github][2]

https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications

我看到代码应该支持操作按钮,但我没有看到它们工作。

我是否缺少一些配置?我看到的代码是,长按操作时我看不到任何按钮

  final List<DarwinNotificationCategory> darwinNotificationCategories =
  <DarwinNotificationCategory>[
    DarwinNotificationCategory(
      darwinNotificationCategoryText,
      actions: <DarwinNotificationAction>[
        DarwinNotificationAction.text(
          'text_1',
          'Action 1',
          buttonTitle: 'Send',
          placeholder: 'Placeholder',
        ),
      ],
    ),
    DarwinNotificationCategory(
      darwinNotificationCategoryPlain,
      actions: <DarwinNotificationAction>[
        DarwinNotificationAction.plain('id_1', 'Action 1'),
        DarwinNotificationAction.plain(
          'id_2',
          'Action 2 (destructive)',
          options: <DarwinNotificationActionOption>{
            DarwinNotificationActionOption.destructive,
          },
        ),
        DarwinNotificationAction.plain(
          navigationActionId,
          'Action 3 (foreground)',
          options: <DarwinNotificationActionOption>{
            DarwinNotificationActionOption.foreground,
          },
        ),
        DarwinNotificationAction.plain(
          'id_4',
          'Action 4 (auth required)',
          options: <DarwinNotificationActionOption>{
            DarwinNotificationActionOption.authenticationRequired,
          },
        ),
      ],
      options: <DarwinNotificationCategoryOption>{
        DarwinNotificationCategoryOption.hiddenPreviewShowTitle,
      },
    )
  ];
flutter flutter-local-notification
1个回答
0
投票

awesome_notifications
支持带有ActionButtons的通知。您可以在这里获取软件包:软件包链接

© www.soinside.com 2019 - 2024. All rights reserved.