I am using the flutter_local_notifications package for push notifications. But in a notification tray, I want to show the complete message, no matter how many lines it takes. This is the code I have written
void showNotification(message) async {
var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
Platform.isAndroid ? 'com.headstrt.app' : 'com.headstrt.app',
'Flutter chat demo',
'your channel description',
playSound: true,
enableVibration: true,
importance: Importance.Max,
priority: Priority.High,
styleInformation: BigTextStyleInformation(''),
);
I have specified a style also but still, all lines are not being displayed.

In BigTextStyleInformation, you must specify the message value passed to the showNotification function.
my own code as an example;
Future<void> _demoNotification(Map<String, dynamic> icerik) async {
String longdata = icerik["notification"]["body"];
var bigTextStyleInformation = BigTextStyleInformation(longdata); //multi-line show style
AndroidNotificationDetails androidPlatformChannelSpecifics =
AndroidNotificationDetails(
'push_messages: 0',
'push_messages: push_messages',
'push_messages: A new Flutter project',
importance: Importance.max,
priority: Priority.high,
showWhen: false,
enableVibration: true,
styleInformation: bigTextStyleInformation);
NotificationDetails platformChannelSpecifics =
NotificationDetails(android: androidPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
1,
icerik["notification"]["title"],
icerik["notification"]["body"],
platformChannelSpecifics,
payload: icerik['data']['routing']);
}
It's actually not really up to you. In Android, the default for a single notification is on line. If you want to see the entire message you need to drag the notification down.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With