gpt4 book ai didi

Flutter 本地通知正文未显示所有通知文本(flutter_local_notifications 包)

转载 作者:行者123 更新时间:2023-12-03 02:43:55 25 4
gpt4 key购买 nike

我用了flutter_local_notifications: ^0.7.1+3在我的 Flutter 应用中推送日程通知。一切都很好,但我的通知正文中的问题是它只显示一行文本,我无法扩展或拉伸(stretch)通知以显示所有通知正文文本。

这是我的尝试:

class NotificationUtil {
final notifications = FlutterLocalNotificationsPlugin();
final int checkOutNotifyId = 0;

NotificationUtil(BuildContext context) {
final settingsAndroid = AndroidInitializationSettings('ic_notify_icon');
final settingsIOS = IOSInitializationSettings(
onDidReceiveLocalNotification: (id, title, body, payload) =>
onSelectNotification(context));
notifications.initialize(
InitializationSettings(settingsAndroid, settingsIOS),
onSelectNotification: (context) async => onSelectNotification);
}

Future<void> showCheckOutNotify([int maximumCheckoutHours]) async {
await notifications.periodicallyShow(
checkOutNotifyId,
AttendanceConstants.SCHEDULE_NOTIFICATION_TITLE,
AttendanceConstants.SCHEDULE_NOTIFICATION_BODY +
'$maximumCheckoutHours Hour/s of your attendance',
RepeatInterval.Hourly,
_ongoing);
}

NotificationDetails get _ongoing {
final androidChannelSpecifics = AndroidNotificationDetails(
'your channel id',
'your channel name',
'your channel description',
importance: Importance.Max,
priority: Priority.High,
ongoing: true,
);
final iOSChannelSpecifics = IOSNotificationDetails();
return NotificationDetails(androidChannelSpecifics, iOSChannelSpecifics);
}

最佳答案

在 [ AndroidNotificationDetails() ] 中添加 [ BigTextStyleInformation('') ]

NotificationDetails get _ongoing {
final androidChannelSpecifics = AndroidNotificationDetails(
'your channel id',
'your channel name',
'your channel description',
importance: Importance.Max,
priority: Priority.High,
ongoing: true,

styleInformation: BigTextStyleInformation(''),
);

关于Flutter 本地通知正文未显示所有通知文本(flutter_local_notifications 包),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57239754/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com