Skip to content

Commit f21a981

Browse files
committed
refactor: formatted files
1 parent 773c0f3 commit f21a981

File tree

9 files changed

+166
-86
lines changed

9 files changed

+166
-86
lines changed

example/lib/firebase_options.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// File generated by FlutterFire CLI.
22
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
33
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
4-
import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform;
4+
import 'package:flutter/foundation.dart'
5+
show defaultTargetPlatform, kIsWeb, TargetPlatform;
56

67
/// Default [FirebaseOptions] for use with your Firebase apps.
78
///

example/lib/main.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class _MainApp extends StatelessWidget {
2424
return FirebaseNotificationsHandler(
2525
localNotificationsConfiguration: LocalNotificationsConfiguration(
2626
androidConfig: AndroidNotificationsConfig(
27-
channelIdGetter: (msg) => msg.notification?.android?.channelId ?? 'default',
27+
channelIdGetter: (msg) =>
28+
msg.notification?.android?.channelId ?? 'default',
2829
),
2930
iosConfig: IosNotificationsConfig(
3031
soundGetter: (_) => 'ios_sound.caf',
@@ -37,7 +38,8 @@ class _MainApp extends StatelessWidget {
3738
onOpenNotificationArrive: (info) {
3839
log(
3940
id,
40-
msg: "Notification received while app is open with payload ${info.payload}",
41+
msg:
42+
"Notification received while app is open with payload ${info.payload}",
4143
);
4244
},
4345
onTap: (info) {

example/lib/screens/home_screen.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class HomeScreen extends StatefulWidget {
2121
}
2222

2323
class _HomeScreenState extends State<HomeScreen> {
24-
static const _projectLink = 'https://pub.dev/packages/firebase_notifications_handler';
24+
static const _projectLink =
25+
'https://pub.dev/packages/firebase_notifications_handler';
2526

2627
final _notificationTaps = <NotificationInfo>[];
2728
final _notificationArrives = <NotificationInfo>[];
@@ -55,11 +56,13 @@ class _HomeScreenState extends State<HomeScreen> {
5556
),
5657
);
5758

58-
_notificationTapsSubscription =
59-
FirebaseNotificationsHandler.notificationTapsSubscription.listen(_addNotificationTap);
59+
_notificationTapsSubscription = FirebaseNotificationsHandler
60+
.notificationTapsSubscription
61+
.listen(_addNotificationTap);
6062

61-
_notificationArriveSubscription =
62-
FirebaseNotificationsHandler.notificationArrivesSubscription.listen(_addNotificationArrive);
63+
_notificationArriveSubscription = FirebaseNotificationsHandler
64+
.notificationArrivesSubscription
65+
.listen(_addNotificationArrive);
6366
}
6467

6568
@override
@@ -96,7 +99,8 @@ class _HomeScreenState extends State<HomeScreen> {
9699
const SizedBox(width: 10),
97100
IconButton(
98101
onPressed: () async {
99-
await Clipboard.setData(ClipboardData(text: value));
102+
await Clipboard.setData(
103+
ClipboardData(text: value));
100104
showSnackBar('FCM token copied to clipboard!');
101105
},
102106
icon: const Icon(Icons.copy),
@@ -120,7 +124,8 @@ class _HomeScreenState extends State<HomeScreen> {
120124
TextSpan(
121125
text: _projectLink,
122126
style: const TextStyle(color: Colors.blue),
123-
recognizer: _linkTapRecognizer..onTap = () => launchUrlString(_projectLink),
127+
recognizer: _linkTapRecognizer
128+
..onTap = () => launchUrlString(_projectLink),
124129
),
125130
const TextSpan(text: ' to see how to send notifications'),
126131
],

example/lib/utils/app_theme.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ class AppTheme {
8585
// ),
8686
pageTransitionsTheme: PageTransitionsTheme(
8787
builders: <TargetPlatform, PageTransitionsBuilder>{
88-
for (final targetValue in TargetPlatform.values) targetValue: const _SlideLeftTransitionsBuilder(),
88+
for (final targetValue in TargetPlatform.values)
89+
targetValue: const _SlideLeftTransitionsBuilder(),
8990
},
9091
),
9192
);

example/lib/utils/route_generator.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class RouteGenerator {
1919
}
2020
}
2121

22-
static MaterialPageRoute _route(Widget widget) => MaterialPageRoute(builder: (context) => widget);
22+
static MaterialPageRoute _route(Widget widget) =>
23+
MaterialPageRoute(builder: (context) => widget);
2324

2425
static Route<dynamic> _errorRoute(String? name) {
2526
return MaterialPageRoute(

lib/src/models/local_notifications_config.dart/android_config.dart

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,31 @@ class AndroidNotificationsConfig {
2323
BoolGetter? enableLightsGetter,
2424
BoolGetter? enableVibrationGetter,
2525
}) {
26-
this.channelIdGetter =
27-
channelIdGetter ?? (msg) => msg.notification?.android?.channelId ?? defaultChannelId;
26+
this.channelIdGetter = channelIdGetter ??
27+
(msg) => msg.notification?.android?.channelId ?? defaultChannelId;
2828
this.channelNameGetter = channelNameGetter ?? (_) => defaultChannelName;
29-
this.channelDescriptionGetter = channelDescriptionGetter ?? (_) => defaultChannelDescription;
29+
this.channelDescriptionGetter =
30+
channelDescriptionGetter ?? (_) => defaultChannelDescription;
3031
this.appIconGetter = appIconGetter ?? (_) => defaultAppIcon;
3132
this.colorGetter = colorGetter ?? (_) => defaultColor;
3233
this.groupKeyGetter = groupKeyGetter ?? (_) => defaultGroupKey;
33-
this.tagGetter = tagGetter ?? (msg) => msg.notification?.android?.tag ?? defaultTag;
34-
this.smallIconUrlGetter =
35-
smallIconUrlGetter ?? (msg) => msg.notification?.android?.smallIcon ?? defaultSmallIcon;
34+
this.tagGetter =
35+
tagGetter ?? (msg) => msg.notification?.android?.tag ?? defaultTag;
36+
this.smallIconUrlGetter = smallIconUrlGetter ??
37+
(msg) => msg.notification?.android?.smallIcon ?? defaultSmallIcon;
3638
this.importanceGetter = importanceGetter ?? (_) => defaultImportance;
3739
this.priorityGetter = priorityGetter ?? (_) => defaultPriority;
38-
this.soundGetter = soundGetter ?? (msg) => msg.notification?.android?.sound ?? defaultSound;
40+
this.soundGetter = soundGetter ??
41+
(msg) => msg.notification?.android?.sound ?? defaultSound;
3942
this.iconGetter = iconGetter ?? (_) => defaultIcon;
40-
this.imageUrlGetter = imageUrlGetter ?? (msg) => msg.notification?.android?.imageUrl ?? defaultImageUrl;
41-
this.hideExpandedLargeIconGetter = hideExpandedLargeIconGetter ?? (_) => defaultHideExpandedLargeIcon;
43+
this.imageUrlGetter = imageUrlGetter ??
44+
(msg) => msg.notification?.android?.imageUrl ?? defaultImageUrl;
45+
this.hideExpandedLargeIconGetter =
46+
hideExpandedLargeIconGetter ?? (_) => defaultHideExpandedLargeIcon;
4247
this.playSoundGetter = playSoundGetter ?? (_) => defaultPlaySound;
4348
this.enableLightsGetter = enableLightsGetter ?? (_) => defaultEnableLights;
44-
this.enableVibrationGetter = enableVibrationGetter ?? (_) => defaultEnableVibration;
49+
this.enableVibrationGetter =
50+
enableVibrationGetter ?? (_) => defaultEnableVibration;
4551
}
4652

4753
/// {@template channelIdGetter}
@@ -285,7 +291,9 @@ class AndroidNotificationsConfig {
285291
tag: tagGetter(message),
286292
priority: priorityGetter(message),
287293
groupKey: groupKeyGetter(message),
288-
sound: androidSound == null ? null : RawResourceAndroidNotificationSound(androidSound),
294+
sound: androidSound == null
295+
? null
296+
: RawResourceAndroidNotificationSound(androidSound),
289297
icon: iconGetter(message),
290298
playSound: playSoundGetter(message),
291299
enableLights: enableLightsGetter(message),

lib/src/models/local_notifications_config.dart/ios_config.dart

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class IosNotificationsConfig {
1919
BoolGetter? hideThumbnailGetter,
2020
IosNotificationAttachmentClippingRectGetter? thumbnailClippingRectGetter,
2121
}) {
22-
final soundGetterRef = soundGetter ?? (msg) => msg.notification?.apple?.sound?.name ?? defaultSound;
22+
final soundGetterRef = soundGetter ??
23+
(msg) => msg.notification?.apple?.sound?.name ?? defaultSound;
2324

2425
this.soundGetter = (msg) {
2526
final sound = soundGetterRef(msg);
@@ -34,19 +35,26 @@ class IosNotificationsConfig {
3435
return sound;
3536
};
3637

37-
this.subtitleGetter = subtitleGetter ?? (msg) => msg.notification?.apple?.subtitle ?? defaultSubtitle;
38-
this.imageUrlGetter = imageUrlGetter ?? (msg) => msg.notification?.apple?.imageUrl ?? defaultImageUrl;
38+
this.subtitleGetter = subtitleGetter ??
39+
(msg) => msg.notification?.apple?.subtitle ?? defaultSubtitle;
40+
this.imageUrlGetter = imageUrlGetter ??
41+
(msg) => msg.notification?.apple?.imageUrl ?? defaultImageUrl;
3942
this.badgeNumberGetter = badgeNumberGetter ?? (_) => defaultBadgeNumber;
40-
this.categoryIdentifierGetter = categoryIdentifierGetter ?? (_) => defaultCategoryIdentifier;
41-
this.threadIdentifierGetter = threadIdentifierGetter ?? (_) => defaultThreadIdentifier;
42-
this.interruptionLevelGetter = interruptionLevelGetter ?? (_) => defaultInterruptionLevel;
43-
this.hideThumbnailGetter = hideThumbnailGetter ?? (_) => defaultHideThumbnail;
44-
this.thumbnailClippingRectGetter =
45-
thumbnailClippingRectGetter ?? (_) => defaultThumbnailClippingRectGetter;
43+
this.categoryIdentifierGetter =
44+
categoryIdentifierGetter ?? (_) => defaultCategoryIdentifier;
45+
this.threadIdentifierGetter =
46+
threadIdentifierGetter ?? (_) => defaultThreadIdentifier;
47+
this.interruptionLevelGetter =
48+
interruptionLevelGetter ?? (_) => defaultInterruptionLevel;
49+
this.hideThumbnailGetter =
50+
hideThumbnailGetter ?? (_) => defaultHideThumbnail;
51+
this.thumbnailClippingRectGetter = thumbnailClippingRectGetter ??
52+
(_) => defaultThumbnailClippingRectGetter;
4653
this.presentSoundGetter = presentSoundGetter ?? (_) => defaultPresentSound;
4754
this.presentAlertGetter = presentAlertGetter ?? (_) => defaultPresentAlert;
4855
this.presentBadgeGetter = presentBadgeGetter ?? (_) => defaultPresentBadge;
49-
this.presentBannerGetter = presentBannerGetter ?? (_) => defaultPresentBanner;
56+
this.presentBannerGetter =
57+
presentBannerGetter ?? (_) => defaultPresentBanner;
5058
this.presentListGetter = presentListGetter ?? (_) => defaultPresentList;
5159
}
5260

@@ -239,7 +247,8 @@ class IosNotificationsConfig {
239247
/// The clipping rectangle for the thumbnail image.
240248
///
241249
/// {@endtemplate}
242-
static DarwinNotificationAttachmentThumbnailClippingRect? defaultThumbnailClippingRectGetter;
250+
static DarwinNotificationAttachmentThumbnailClippingRect?
251+
defaultThumbnailClippingRectGetter;
243252

244253
/// {@macro soundGetter}
245254
late NullableStringGetter soundGetter;

lib/src/utils/types.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ typedef AndroidImportanceGetter = Importance Function(RemoteMessage);
2222
typedef AndroidPriorityGetter = Priority Function(RemoteMessage);
2323

2424
typedef IosInterruptionLevelGetter = InterruptionLevel? Function(RemoteMessage);
25-
typedef IosNotificationAttachmentClippingRectGetter = DarwinNotificationAttachmentThumbnailClippingRect?
26-
Function(RemoteMessage);
25+
typedef IosNotificationAttachmentClippingRectGetter
26+
= DarwinNotificationAttachmentThumbnailClippingRect? Function(
27+
RemoteMessage);

0 commit comments

Comments
 (0)