Skip to content

Commit

Permalink
[flutter_local_notifications] format constructors (#525)
Browse files Browse the repository at this point in the history
* format code

* bump version and update changelog
  • Loading branch information
MaikuB authored Mar 11, 2020
1 parent bc6cc8e commit 7ddfb00
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 82 deletions.
4 changes: 4 additions & 0 deletions flutter_local_notifications/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# [1.2.2]

* [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)

# [1.2.1]

* [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
Expand Down
18 changes: 11 additions & 7 deletions flutter_local_notifications/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ class ReceivedNotification {
final String body;
final String payload;

ReceivedNotification(
{@required this.id,
@required this.title,
@required this.body,
@required this.payload});
ReceivedNotification({
@required this.id,
@required this.title,
@required this.body,
@required this.payload,
});
}

/// IMPORTANT: running the following code on its own won't work as there is setup required for each platform head project.
Expand Down Expand Up @@ -76,8 +77,11 @@ Future<void> main() async {
class PaddedRaisedButton extends StatelessWidget {
final String buttonText;
final VoidCallback onPressed;
const PaddedRaisedButton(
{@required this.buttonText, @required this.onPressed});

const PaddedRaisedButton({
@required this.buttonText,
@required this.onPressed,
});

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ class Message {
/// The original text will be used if the content or MIME type isn't supported
final String dataUri;

Message(this.text, this.timestamp, this.person,
{this.dataMimeType, this.dataUri}) {
Message(
this.text,
this.timestamp,
this.person, {
this.dataMimeType,
this.dataUri,
}) {
assert(timestamp != null, 'timestamp must be provided');
assert(
(dataMimeType == null && dataUri == null) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,40 +152,43 @@ class AndroidNotificationDetails {
String category;

AndroidNotificationDetails(
this.channelId, this.channelName, this.channelDescription,
{this.icon,
this.importance = Importance.Default,
this.priority = Priority.Default,
this.style = AndroidNotificationStyle.Default,
this.styleInformation,
this.playSound = true,
this.sound,
this.enableVibration = true,
this.vibrationPattern,
this.groupKey,
this.setAsGroupSummary,
this.groupAlertBehavior = GroupAlertBehavior.All,
this.autoCancel = true,
this.ongoing,
this.color,
this.largeIcon,
this.largeIconBitmapSource,
this.onlyAlertOnce,
this.showWhen = true,
this.channelShowBadge = true,
this.showProgress = false,
this.maxProgress = 0,
this.progress = 0,
this.indeterminate = false,
this.channelAction = AndroidNotificationChannelAction.CreateIfNotExists,
this.enableLights = false,
this.ledColor,
this.ledOnMs,
this.ledOffMs,
this.ticker,
this.visibility,
this.timeoutAfter,
this.category});
this.channelId,
this.channelName,
this.channelDescription, {
this.icon,
this.importance = Importance.Default,
this.priority = Priority.Default,
this.style = AndroidNotificationStyle.Default,
this.styleInformation,
this.playSound = true,
this.sound,
this.enableVibration = true,
this.vibrationPattern,
this.groupKey,
this.setAsGroupSummary,
this.groupAlertBehavior = GroupAlertBehavior.All,
this.autoCancel = true,
this.ongoing,
this.color,
this.largeIcon,
this.largeIconBitmapSource,
this.onlyAlertOnce,
this.showWhen = true,
this.channelShowBadge = true,
this.showProgress = false,
this.maxProgress = 0,
this.progress = 0,
this.indeterminate = false,
this.channelAction = AndroidNotificationChannelAction.CreateIfNotExists,
this.enableLights = false,
this.ledColor,
this.ledOnMs,
this.ledOffMs,
this.ticker,
this.visibility,
this.timeoutAfter,
this.category,
});

/// Create a [Map] object that describes the [AndroidNotificationDetails] object.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ class Person {
/// Uri for this person.
final String uri;

Person(
{this.bot,
this.icon,
this.iconSource,
this.important,
this.key,
this.name,
this.uri});
Person({
this.bot,
this.icon,
this.iconSource,
this.important,
this.key,
this.name,
this.uri,
});

/// Create a [Map] object that describes the [Person] object.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ class InboxStyleInformation extends DefaultStyleInformation {
/// Specifies if formatting should be applied to the first line of text after the detail section in the big form of the template.
final bool htmlFormatSummaryText;

InboxStyleInformation(this.lines,
{this.htmlFormatLines = false,
this.contentTitle,
this.htmlFormatContentTitle = false,
this.summaryText,
this.htmlFormatSummaryText = false,
bool htmlFormatContent = false,
bool htmlFormatTitle = false})
: super(htmlFormatContent, htmlFormatTitle);
InboxStyleInformation(
this.lines, {
this.htmlFormatLines = false,
this.contentTitle,
this.htmlFormatContentTitle = false,
this.summaryText,
this.htmlFormatSummaryText = false,
bool htmlFormatContent = false,
bool htmlFormatTitle = false,
}) : super(htmlFormatContent, htmlFormatTitle);

/// Create a [Map] object that describes the [InboxStyleInformation] object.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ class MessagingStyleInformation extends DefaultStyleInformation {
/// Messages to be displayed by this notification
final List<Message> messages;

MessagingStyleInformation(this.person,
{this.conversationTitle,
this.groupConversation,
this.messages,
bool htmlFormatContent = false,
bool htmlFormatTitle = false})
: super(htmlFormatContent, htmlFormatTitle) {
MessagingStyleInformation(
this.person, {
this.conversationTitle,
this.groupConversation,
this.messages,
bool htmlFormatContent = false,
bool htmlFormatTitle = false,
}) : super(htmlFormatContent, htmlFormatTitle) {
assert(this.person?.name != null, 'Must provide the details of the person');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ class IOSInitializationSettings {
/// Applicable to iOS versions below 10.
final DidReceiveLocalNotificationCallback onDidReceiveLocalNotification;

const IOSInitializationSettings(
{this.requestAlertPermission = true,
this.requestSoundPermission = true,
this.requestBadgePermission = true,
this.defaultPresentAlert = true,
this.defaultPresentSound = true,
this.defaultPresentBadge = true,
this.onDidReceiveLocalNotification});
const IOSInitializationSettings({
this.requestAlertPermission = true,
this.requestSoundPermission = true,
this.requestBadgePermission = true,
this.defaultPresentAlert = true,
this.defaultPresentSound = true,
this.defaultPresentBadge = true,
this.onDidReceiveLocalNotification,
});

/// Create a [Map] object that describes the [IOSInitializationSettings] object.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ class IOSNotificationDetails {
/// Specify null to leave the current badge unchanged.
final int badgeNumber;

IOSNotificationDetails(
{this.presentAlert,
this.presentBadge,
this.presentSound,
this.sound,
this.badgeNumber});
IOSNotificationDetails({
this.presentAlert,
this.presentBadge,
this.presentSound,
this.sound,
this.badgeNumber,
});

/// Create a [Map] object that describes the [IOSNotificationDetails] object.
///
Expand Down
2 changes: 1 addition & 1 deletion flutter_local_notifications/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_local_notifications
description: A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform.
version: 1.2.1
version: 1.2.2
homepage: https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications

dependencies:
Expand Down

0 comments on commit 7ddfb00

Please sign in to comment.