Skip to content

Commit

Permalink
[various] Added bigText to ActiveNotification (#2290)
Browse files Browse the repository at this point in the history
* Added bigText to ActiveNotification

* updated example app to return bigText for active notification

* updated api docs for bigText for active notification

* Google Java Format

---------

Co-authored-by: Michael Bui <25263378+MaikuB@users.noreply.github.com>
Co-authored-by: github-actions <>
  • Loading branch information
vulpeep and MaikuB committed Apr 21, 2024
1 parent a6b2e98 commit f63f9c1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,8 @@ private void getActiveNotifications(Result result) {
activeNotificationPayload.put(
"title", notification.extras.getCharSequence("android.title"));
activeNotificationPayload.put("body", notification.extras.getCharSequence("android.text"));
activeNotificationPayload.put(
"bigText", notification.extras.getCharSequence("android.bigText"));
activeNotificationsPayload.add(activeNotificationPayload);
}
result.success(activeNotificationsPayload);
Expand Down
5 changes: 4 additions & 1 deletion flutter_local_notifications/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2638,14 +2638,17 @@ class _HomePageState extends State<HomePage> {
'title: ${activeNotification.title}\n'
'body: ${activeNotification.body}',
),
if (Platform.isAndroid && activeNotification.id != null)
if (Platform.isAndroid &&
activeNotification.id != null) ...<Widget>[
Text('bigText: ${activeNotification.bigText}'),
TextButton(
child: const Text('Get messaging style'),
onPressed: () {
_getActiveNotificationMessagingStyle(
activeNotification.id!, activeNotification.tag);
},
),
],
const Divider(color: Colors.black),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class MethodChannelFlutterLocalNotificationsPlugin
title: p['title'],
body: p['body'],
payload: p['payload'],
bigText: p['bigText'],
))
.toList() ??
<ActiveNotification>[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ActiveNotification {
this.body,
this.payload,
this.tag,
this.bigText,
});

/// The notification's id.
Expand Down Expand Up @@ -76,6 +77,11 @@ class ActiveNotification {
///
/// Returned only on Android.
final String? tag;

/// The notification's longer text displayed using big text style.
///
/// Returned only on Android.
final String? bigText;
}

/// Details of a Notification Action that was triggered.
Expand Down

0 comments on commit f63f9c1

Please sign in to comment.