2

I have a problem that only the first line in the notification body appears, how can I make the notification expanded with large content?

This is the code, using the flutter_local_notifications package:

void showNotification(int id, String title, String content, DateTime time) async {
  final AndroidNotificationDetails android = AndroidNotificationDetails(
      'ch_ID', 'Ch_Name', 'ch_Description', 
      priority: Priority.High, importance: Importance.Max);
  final IOSNotificationDetails ios = IOSNotificationDetails();
  final NotificationDetails platform = NotificationDetails(android, ios);

  await flutterLocalNotificationsPlugin.schedule(
      id,
      '$title',
      '$content',
      time,
      platform,
      payload: 'payload'
  );
}

notification with cut text

Philippe Fanaro
  • 6,148
  • 6
  • 38
  • 76
ahmed el-shafei
  • 610
  • 7
  • 10
  • Please show the code you're using for the implementation of your notification. If you're using a simple `Text` widget, maybe specifying the max number of lines will provide more lines to the notification. Check out the [`maxLines`](https://api.flutter.dev/flutter/widgets/Text/maxLines.html) parameter of the `Text` widget. – Philippe Fanaro Apr 12 '20 at 00:06
  • @PhilippeFanaro no it's not a widget, it's a string .... await flutterLocalNotificationsPlugin.schedule( id, '$title', '$content', time, platform, payload: 'payload' ); – ahmed el-shafei Apr 12 '20 at 13:27
  • Are you using the [flutter_local_notifications](https://pub.dev/packages/flutter_local_notifications) package? – Philippe Fanaro Apr 12 '20 at 13:35
  • yes I'm using this package – ahmed el-shafei Apr 12 '20 at 13:39
  • [This other StackOverflow question](https://stackoverflow.com/q/57239754/4756173) has a similar issue. Have you tried the solution he mentions in the comment: set `style: AndroidNotificationStyle.BigText`? – Philippe Fanaro Apr 12 '20 at 13:56
  • 1
    okay finally I found the solution, your last comment helped me to get it. thank you a lot for helping me. – ahmed el-shafei Apr 12 '20 at 23:41
  • It's all thanks to that guy in the other question. – Philippe Fanaro Apr 13 '20 at 00:04

0 Answers0