diff --git a/packages/flutter_notification_center/example/lib/custom_notification.dart b/packages/flutter_notification_center/example/lib/custom_notification.dart index d1d2185..454e67d 100644 --- a/packages/flutter_notification_center/example/lib/custom_notification.dart +++ b/packages/flutter_notification_center/example/lib/custom_notification.dart @@ -6,14 +6,12 @@ import 'package:flutter_notification_center_firebase/flutter_notification_center class CustomNotificationWidget extends StatelessWidget { final NotificationModel notification; - final NotificationStyle style; final FirebaseNotificationService notificationService; final NotificationTranslations notificationTranslations; final BuildContext context; const CustomNotificationWidget({ required this.notification, - required this.style, required this.notificationTranslations, required this.notificationService, required this.context, @@ -56,26 +54,18 @@ class CustomNotificationWidget extends StatelessWidget { onTap: () async => _navigateToNotificationDetail(context, notification), child: ListTile( - leading: style.showNotificationIcon != null - ? Icon( - notification.icon, - color: style.leadingIconColor, - ) - : null, title: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Text( notification.title, - style: style.titleTextStyle, ), ), ], ), trailing: IconButton( icon: const Icon(Icons.push_pin), - color: style.pinnedIconColor, onPressed: () async => _navigateToNotificationDetail(context, notification), padding: const EdgeInsets.only(left: 60.0), @@ -147,9 +137,8 @@ class CustomNotificationWidget extends StatelessWidget { margin: const EdgeInsets.only(right: 8.0), width: 12.0, height: 12.0, - decoration: BoxDecoration( + decoration: const BoxDecoration( shape: BoxShape.circle, - color: style.isReadDotColor, ), ) : null, @@ -170,7 +159,6 @@ class CustomNotificationWidget extends StatelessWidget { builder: (context) => NotificationDetailPage( translations: notificationTranslations, notification: notification, - notificationStyle: style, ), ), ); diff --git a/packages/flutter_notification_center/example/lib/main.dart b/packages/flutter_notification_center/example/lib/main.dart index 39ac1cf..04be4cf 100644 --- a/packages/flutter_notification_center/example/lib/main.dart +++ b/packages/flutter_notification_center/example/lib/main.dart @@ -63,21 +63,6 @@ class _NotificationCenterDemoState extends State { notificationWidgetBuilder: (notification, context) => CustomNotificationWidget( notification: notification, - style: const NotificationStyle( - appTitleTextStyle: TextStyle( - color: Colors.black, - fontSize: 20, - ), - titleTextStyle: TextStyle( - color: Colors.black, - fontWeight: FontWeight.w400, - fontSize: 16, - ), - leadingIconColor: Colors.grey, - pinnedIconColor: Colors.grey, - isReadDotColor: Colors.red, - showNotificationIcon: true, - ), notificationService: service, notificationTranslations: const NotificationTranslations.empty(), context: context, diff --git a/packages/flutter_notification_center/example/pubspec.yaml b/packages/flutter_notification_center/example/pubspec.yaml index 610a6c8..d286274 100644 --- a/packages/flutter_notification_center/example/pubspec.yaml +++ b/packages/flutter_notification_center/example/pubspec.yaml @@ -18,13 +18,13 @@ dependencies: git: url: https://github.com/Iconica-Development/flutter_notification_center path: packages/flutter_notification_center - ref: 2.0.0 + ref: 3.0.0 flutter_notification_center_firebase: git: url: https://github.com/Iconica-Development/flutter_notification_center path: packages/flutter_notification_center_firebase - ref: 2.0.0 + ref: 3.0.0 dev_dependencies: flutter_test: diff --git a/packages/flutter_notification_center_firebase/lib/src/services/firebase_notification_service.dart b/packages/flutter_notification_center_firebase/lib/src/services/firebase_notification_service.dart index 751d9b5..c3494da 100644 --- a/packages/flutter_notification_center_firebase/lib/src/services/firebase_notification_service.dart +++ b/packages/flutter_notification_center_firebase/lib/src/services/firebase_notification_service.dart @@ -238,7 +238,7 @@ class FirebaseNotificationService .doc(notificationModel.id); await documentReference.delete(); listOfActiveNotifications - .removeAt(listOfActiveNotifications.indexOf(notificationModel)); + .removeWhere((element) => element.id == notificationModel.id); notifyListeners(); } on Exception catch (e) { debugPrint("Error deleting document: $e"); @@ -403,6 +403,7 @@ class FirebaseNotificationService .collection(activeNotificationsCollection) .doc(userId) .collection(activeNotificationsCollection) + .where("isRead", isEqualTo: false) .snapshots() .map((e) => e.docs.length); yield* amount; diff --git a/packages/flutter_notification_center_firebase/pubspec.yaml b/packages/flutter_notification_center_firebase/pubspec.yaml index 8af27fc..ad78e41 100644 --- a/packages/flutter_notification_center_firebase/pubspec.yaml +++ b/packages/flutter_notification_center_firebase/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_notification_center_firebase description: "A new Flutter project." publish_to: "none" -version: 2.0.0 +version: 3.0.0 environment: sdk: ">=2.18.0 <3.0.0" @@ -21,7 +21,7 @@ dependencies: flutter_notification_center: git: url: https://github.com/Iconica-Development/flutter_notification_center - ref: 2.0.0 + ref: 3.0.0 path: packages/flutter_notification_center dev_dependencies: