Skip to content

Commit

Permalink
feat: rework flutter_notification_center design
Browse files Browse the repository at this point in the history
  • Loading branch information
mike doornenbal committed Jun 6, 2024
1 parent b57bc7c commit 1692281
Show file tree
Hide file tree
Showing 21 changed files with 492 additions and 467 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [2.0.0] - 6 June 2024

* Rework design for notification center
* Added iconica linter

## [1.4.1] - 4 June 2024

* Fix notification amount number to properly size and show plus icon when above certain amount
Expand Down
29 changes: 5 additions & 24 deletions packages/flutter_notification_center/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
include: package:flutter_iconica_analysis/analysis_options.yaml

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
# Possible to overwrite the rules from the package

analyzer:
exclude:

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ linter:
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
1 change: 0 additions & 1 deletion packages/flutter_notification_center/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class _NotificationCenterDemoState extends State<NotificationCenterDemo> {
notificationTranslations: const NotificationTranslations.empty(),
context: context,
),
seperateNotificationsWithDivider: true,
);
popupHandler = PopupHandler(context: context, config: config);
}
Expand Down
13 changes: 5 additions & 8 deletions packages/flutter_notification_center/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: example
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: "none" # Remove this line if you wish to publish to pub.dev

version: 1.0.0

environment:
sdk: '>=3.3.2 <4.0.0'
sdk: ">=3.3.2 <4.0.0"

dependencies:
flutter:
Expand All @@ -17,20 +17,18 @@ dependencies:
flutter_notification_center:
git:
url: https://github.com/Iconica-Development/flutter_notification_center
ref: 1.4.0
path: packages/flutter_notification_center
ref: 2.0.0

flutter_notification_center_firebase:
git:
url: https://github.com/Iconica-Development/flutter_notification_center
ref: 1.4.0
path: packages/flutter_notification_center_firebase


ref: 2.0.0

dev_dependencies:
flutter_test:
sdk: flutter
sdk: flutter
flutter_iconica_analysis:
git:
url: https://github.com/Iconica-Development/flutter_iconica_analysis
Expand All @@ -39,4 +37,3 @@ dev_dependencies:
# The following section is specific to Flutter packages.
flutter:
uses-material-design: true

Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
//
// SPDX-License-Identifier: BSD-3-Clause

export "package:flutter_animated_widgets/flutter_animated_widgets.dart";

export "src/models/notification.dart";
export "src/models/notification_config.dart";
export "src/models/notification_theme.dart";
export "src/models/notification_translation.dart";
export "src/notification_bell.dart";
export "src/notification_dialog.dart";
export "src/popup_handler.dart";
export "src/notification_snackbar.dart";
export "src/notification_detail.dart";
export "src/notification_bell_story.dart";
export "src/notification_center.dart";
export "src/notification_detail.dart";
export "src/notification_dialog.dart";
export "src/notification_snackbar.dart";
export "src/popup_handler.dart";
export "src/services/notification_service.dart";
export "package:flutter_animated_widgets/flutter_animated_widgets.dart";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import "package:flutter/material.dart";

import '../../flutter_notification_center.dart';
import "package:flutter_notification_center/flutter_notification_center.dart";

/// Configuration class for notifications.
class NotificationConfig {
Expand All @@ -12,7 +12,6 @@ class NotificationConfig {
/// translations for notification messages.
const NotificationConfig({
required this.service,
this.seperateNotificationsWithDivider = true,
this.translations = const NotificationTranslations.empty(),
this.notificationWidgetBuilder,
this.showAsSnackBar = true,
Expand All @@ -23,17 +22,15 @@ class NotificationConfig {
/// The notification service to use for delivering notifications.
final NotificationService service;

/// Whether to seperate notifications with a divider.
final bool seperateNotificationsWithDivider;

/// Translations for notification messages.
final NotificationTranslations translations;

/// Widget for building each notification item.
final Widget Function(NotificationModel, BuildContext)?
notificationWidgetBuilder;

/// Whether to show notifications as snackbars. If false show notifications as a dialog.
/// Whether to show notifications as snackbars.
/// If false show notifications as a dialog.
final bool showAsSnackBar;

/// Whether to show notification popups.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NotificationTranslations {
});

const NotificationTranslations.empty({
this.appBarTitle = "Notification Center",
this.appBarTitle = "Notifications",
this.noNotifications = "No unread notifications available.",
this.notificationDismissed = "Notification dismissed.",
this.notificationPinned = "Notification pinned.",
Expand Down Expand Up @@ -63,18 +63,17 @@ class NotificationTranslations {
String? datePrefix,
String? notAvailable,
String? dissmissDialog,
}) {
return NotificationTranslations(
appBarTitle: appBarTitle ?? this.appBarTitle,
noNotifications: noNotifications ?? this.noNotifications,
notificationDismissed:
notificationDismissed ?? this.notificationDismissed,
notificationPinned: notificationPinned ?? this.notificationPinned,
notificationUnpinned: notificationUnpinned ?? this.notificationUnpinned,
errorMessage: errorMessage ?? this.errorMessage,
datePrefix: datePrefix ?? this.datePrefix,
notAvailable: notAvailable ?? this.notAvailable,
dissmissDialog: dissmissDialog ?? this.dissmissDialog,
);
}
}) =>
NotificationTranslations(
appBarTitle: appBarTitle ?? this.appBarTitle,
noNotifications: noNotifications ?? this.noNotifications,
notificationDismissed:
notificationDismissed ?? this.notificationDismissed,
notificationPinned: notificationPinned ?? this.notificationPinned,
notificationUnpinned: notificationUnpinned ?? this.notificationUnpinned,
errorMessage: errorMessage ?? this.errorMessage,
datePrefix: datePrefix ?? this.datePrefix,
notAvailable: notAvailable ?? this.notAvailable,
dissmissDialog: dissmissDialog ?? this.dissmissDialog,
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "package:flutter/material.dart";
import "../flutter_notification_center.dart";
import "package:flutter_notification_center/flutter_notification_center.dart";

/// A bell icon widget that displays the number of active notifications.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "package:flutter/material.dart";
import "../flutter_notification_center.dart";
import "package:flutter_notification_center/flutter_notification_center.dart";

/// A widget representing a notification bell.
class NotificationBellWidgetStory extends StatelessWidget {
Expand Down
Loading

0 comments on commit 1692281

Please sign in to comment.