Skip to content

Commit 7ddfb00

Browse files
authored
[flutter_local_notifications] format constructors (#525)
* format code * bump version and update changelog
1 parent bc6cc8e commit 7ddfb00

File tree

10 files changed

+103
-82
lines changed

10 files changed

+103
-82
lines changed

flutter_local_notifications/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# [1.2.2]
2+
3+
* [Android] Added ability to specify if the timestamp for when a notification occurred should be displayed. Thanks to the PR from [mojtabaghiasi](https://github.com/mojtabaghiasi)
4+
15
# [1.2.1]
26

37
* [Android] Fixed issue [512](https://github.com/MaikuB/flutter_local_notifications/issues/512) where calling `getNotificationAppLaunchDetails()` within the `onSelectNotification` callback could indicating that the app was launched by tapping on a notification when it wasn't the case

flutter_local_notifications/example/lib/main.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ class ReceivedNotification {
2929
final String body;
3030
final String payload;
3131

32-
ReceivedNotification(
33-
{@required this.id,
34-
@required this.title,
35-
@required this.body,
36-
@required this.payload});
32+
ReceivedNotification({
33+
@required this.id,
34+
@required this.title,
35+
@required this.body,
36+
@required this.payload,
37+
});
3738
}
3839

3940
/// IMPORTANT: running the following code on its own won't work as there is setup required for each platform head project.
@@ -76,8 +77,11 @@ Future<void> main() async {
7677
class PaddedRaisedButton extends StatelessWidget {
7778
final String buttonText;
7879
final VoidCallback onPressed;
79-
const PaddedRaisedButton(
80-
{@required this.buttonText, @required this.onPressed});
80+
81+
const PaddedRaisedButton({
82+
@required this.buttonText,
83+
@required this.onPressed,
84+
});
8185

8286
@override
8387
Widget build(BuildContext context) {

flutter_local_notifications/lib/src/platform_specifics/android/message.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ class Message {
2121
/// The original text will be used if the content or MIME type isn't supported
2222
final String dataUri;
2323

24-
Message(this.text, this.timestamp, this.person,
25-
{this.dataMimeType, this.dataUri}) {
24+
Message(
25+
this.text,
26+
this.timestamp,
27+
this.person, {
28+
this.dataMimeType,
29+
this.dataUri,
30+
}) {
2631
assert(timestamp != null, 'timestamp must be provided');
2732
assert(
2833
(dataMimeType == null && dataUri == null) ||

flutter_local_notifications/lib/src/platform_specifics/android/notification_details.dart

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -152,40 +152,43 @@ class AndroidNotificationDetails {
152152
String category;
153153

154154
AndroidNotificationDetails(
155-
this.channelId, this.channelName, this.channelDescription,
156-
{this.icon,
157-
this.importance = Importance.Default,
158-
this.priority = Priority.Default,
159-
this.style = AndroidNotificationStyle.Default,
160-
this.styleInformation,
161-
this.playSound = true,
162-
this.sound,
163-
this.enableVibration = true,
164-
this.vibrationPattern,
165-
this.groupKey,
166-
this.setAsGroupSummary,
167-
this.groupAlertBehavior = GroupAlertBehavior.All,
168-
this.autoCancel = true,
169-
this.ongoing,
170-
this.color,
171-
this.largeIcon,
172-
this.largeIconBitmapSource,
173-
this.onlyAlertOnce,
174-
this.showWhen = true,
175-
this.channelShowBadge = true,
176-
this.showProgress = false,
177-
this.maxProgress = 0,
178-
this.progress = 0,
179-
this.indeterminate = false,
180-
this.channelAction = AndroidNotificationChannelAction.CreateIfNotExists,
181-
this.enableLights = false,
182-
this.ledColor,
183-
this.ledOnMs,
184-
this.ledOffMs,
185-
this.ticker,
186-
this.visibility,
187-
this.timeoutAfter,
188-
this.category});
155+
this.channelId,
156+
this.channelName,
157+
this.channelDescription, {
158+
this.icon,
159+
this.importance = Importance.Default,
160+
this.priority = Priority.Default,
161+
this.style = AndroidNotificationStyle.Default,
162+
this.styleInformation,
163+
this.playSound = true,
164+
this.sound,
165+
this.enableVibration = true,
166+
this.vibrationPattern,
167+
this.groupKey,
168+
this.setAsGroupSummary,
169+
this.groupAlertBehavior = GroupAlertBehavior.All,
170+
this.autoCancel = true,
171+
this.ongoing,
172+
this.color,
173+
this.largeIcon,
174+
this.largeIconBitmapSource,
175+
this.onlyAlertOnce,
176+
this.showWhen = true,
177+
this.channelShowBadge = true,
178+
this.showProgress = false,
179+
this.maxProgress = 0,
180+
this.progress = 0,
181+
this.indeterminate = false,
182+
this.channelAction = AndroidNotificationChannelAction.CreateIfNotExists,
183+
this.enableLights = false,
184+
this.ledColor,
185+
this.ledOnMs,
186+
this.ledOffMs,
187+
this.ticker,
188+
this.visibility,
189+
this.timeoutAfter,
190+
this.category,
191+
});
189192

190193
/// Create a [Map] object that describes the [AndroidNotificationDetails] object.
191194
///

flutter_local_notifications/lib/src/platform_specifics/android/person.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ class Person {
2323
/// Uri for this person.
2424
final String uri;
2525

26-
Person(
27-
{this.bot,
28-
this.icon,
29-
this.iconSource,
30-
this.important,
31-
this.key,
32-
this.name,
33-
this.uri});
26+
Person({
27+
this.bot,
28+
this.icon,
29+
this.iconSource,
30+
this.important,
31+
this.key,
32+
this.name,
33+
this.uri,
34+
});
3435

3536
/// Create a [Map] object that describes the [Person] object.
3637
///

flutter_local_notifications/lib/src/platform_specifics/android/styles/inbox_style_information.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ class InboxStyleInformation extends DefaultStyleInformation {
2020
/// Specifies if formatting should be applied to the first line of text after the detail section in the big form of the template.
2121
final bool htmlFormatSummaryText;
2222

23-
InboxStyleInformation(this.lines,
24-
{this.htmlFormatLines = false,
25-
this.contentTitle,
26-
this.htmlFormatContentTitle = false,
27-
this.summaryText,
28-
this.htmlFormatSummaryText = false,
29-
bool htmlFormatContent = false,
30-
bool htmlFormatTitle = false})
31-
: super(htmlFormatContent, htmlFormatTitle);
23+
InboxStyleInformation(
24+
this.lines, {
25+
this.htmlFormatLines = false,
26+
this.contentTitle,
27+
this.htmlFormatContentTitle = false,
28+
this.summaryText,
29+
this.htmlFormatSummaryText = false,
30+
bool htmlFormatContent = false,
31+
bool htmlFormatTitle = false,
32+
}) : super(htmlFormatContent, htmlFormatTitle);
3233

3334
/// Create a [Map] object that describes the [InboxStyleInformation] object.
3435
///

flutter_local_notifications/lib/src/platform_specifics/android/styles/messaging_style_information.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ class MessagingStyleInformation extends DefaultStyleInformation {
1616
/// Messages to be displayed by this notification
1717
final List<Message> messages;
1818

19-
MessagingStyleInformation(this.person,
20-
{this.conversationTitle,
21-
this.groupConversation,
22-
this.messages,
23-
bool htmlFormatContent = false,
24-
bool htmlFormatTitle = false})
25-
: super(htmlFormatContent, htmlFormatTitle) {
19+
MessagingStyleInformation(
20+
this.person, {
21+
this.conversationTitle,
22+
this.groupConversation,
23+
this.messages,
24+
bool htmlFormatContent = false,
25+
bool htmlFormatTitle = false,
26+
}) : super(htmlFormatContent, htmlFormatTitle) {
2627
assert(this.person?.name != null, 'Must provide the details of the person');
2728
}
2829

flutter_local_notifications/lib/src/platform_specifics/ios/initialization_settings.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ class IOSInitializationSettings {
4141
/// Applicable to iOS versions below 10.
4242
final DidReceiveLocalNotificationCallback onDidReceiveLocalNotification;
4343

44-
const IOSInitializationSettings(
45-
{this.requestAlertPermission = true,
46-
this.requestSoundPermission = true,
47-
this.requestBadgePermission = true,
48-
this.defaultPresentAlert = true,
49-
this.defaultPresentSound = true,
50-
this.defaultPresentBadge = true,
51-
this.onDidReceiveLocalNotification});
44+
const IOSInitializationSettings({
45+
this.requestAlertPermission = true,
46+
this.requestSoundPermission = true,
47+
this.requestBadgePermission = true,
48+
this.defaultPresentAlert = true,
49+
this.defaultPresentSound = true,
50+
this.defaultPresentBadge = true,
51+
this.onDidReceiveLocalNotification,
52+
});
5253

5354
/// Create a [Map] object that describes the [IOSInitializationSettings] object.
5455
///

flutter_local_notifications/lib/src/platform_specifics/ios/notification_details.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ class IOSNotificationDetails {
2626
/// Specify null to leave the current badge unchanged.
2727
final int badgeNumber;
2828

29-
IOSNotificationDetails(
30-
{this.presentAlert,
31-
this.presentBadge,
32-
this.presentSound,
33-
this.sound,
34-
this.badgeNumber});
29+
IOSNotificationDetails({
30+
this.presentAlert,
31+
this.presentBadge,
32+
this.presentSound,
33+
this.sound,
34+
this.badgeNumber,
35+
});
3536

3637
/// Create a [Map] object that describes the [IOSNotificationDetails] object.
3738
///

flutter_local_notifications/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_local_notifications
22
description: A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform.
3-
version: 1.2.1
3+
version: 1.2.2
44
homepage: https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications
55

66
dependencies:

0 commit comments

Comments
 (0)