showBigTextNotification static method

Future<void> showBigTextNotification(
  1. String? title,
  2. String body,
  3. NotificationBody? notificationBody,
  4. FlutterLocalNotificationsPlugin fln,
)

Implementation

static Future<void> showBigTextNotification(
  String? title,
  String body,
  NotificationBody? notificationBody,
  FlutterLocalNotificationsPlugin fln,
) async {
  List<AndroidNotificationAction> action = [];

  if (notificationBody != null) {
    if (notificationBody.growlytics!.buttons != null) {
      notificationBody.growlytics!.buttons!.forEach((element) {
        action.add(AndroidNotificationAction(
            element.label.toString(), element.label.toString(),
            showsUserInterface: true));
      });
    }
  }

  BigTextStyleInformation bigTextStyleInformation = BigTextStyleInformation(
    body,
    htmlFormatBigText: true,
    contentTitle: title,
    htmlFormatContentTitle: true,
  );
  AndroidNotificationDetails androidPlatformChannelSpecifics =
      AndroidNotificationDetails('growlytics', 'growlytics',
          importance: Importance.max,
          styleInformation: bigTextStyleInformation,
          priority: Priority.max,
          playSound: true,
          actions: action
          //  sound: const RawResourceAndroidNotificationSound('notification'),
          );
  NotificationDetails platformChannelSpecifics =
      NotificationDetails(android: androidPlatformChannelSpecifics);
  await fln.show(0, title, body, platformChannelSpecifics,
      payload: notificationBody != null
          ? jsonEncode(notificationBody.toJson())
          : null);
}