[英]flutter_local_notifications plugin not showing the big image in notification
[英]Flutter local notification body not showing all notification text (flutter_local_notifications package)
我在我的 Flutter 應用程序中使用flutter_local_notifications: ^0.7.1+3
來推送日程通知。 這一切都很好,但我的通知正文中的問題是它只顯示一行文本,我無法擴展或拉伸通知以顯示所有通知正文文本。
這是我的嘗試:
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(''),
);
如果有人在這里接收 package awesome_notifications,請使用:
notificationLayout: NotificationLayout.BigText,
內部通知內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.