Flutter本地通知主体未显示所有通知文本(flutter_local_notifications程序包) [英] Flutter local notification body not showing all notification text (flutter_local_notifications package)
本文介绍了Flutter本地通知主体未显示所有通知文本(flutter_local_notifications程序包)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Flutter应用中使用了 flutter_local_notifications:^ 0.7.1 + 3
来推送计划通知。一切都很好,但是我的通知主体中的问题是它只显示一行文本,而我无法展开或拉伸通知以显示所有通知主体文本。
I used flutter_local_notifications: ^0.7.1+3
in my Flutter app to push schedule notifications. All is well in this but the problem in my notification body is that it shows just one line of text, and I can't expand or stretch notification to show all the notification body text.
这是我的尝试:
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);
}
推荐答案
add [BigTextStyleInformation('' )中的[AndroidNotificationDetails()]
add [ BigTextStyleInformation('') ] in [ AndroidNotificationDetails() ]
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程序包)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文