Skip to content

Commit

Permalink
animation duration support (#88)
Browse files Browse the repository at this point in the history
* #Added support of animation duration to [showSimpleNotification]

* #version bump 2.1.0 -> 2.1.1

* #Support reverseAnimationDuration

* #version bump 2.1.1 -> 2..1.2
  • Loading branch information
LeonidVeremchuk committed Feb 22, 2023
1 parent 5c8d0c4 commit 51b3655
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions lib/src/notification/overlay_notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,29 @@ import 'package:overlay_support/overlay_support.dart';
/// if null , will be set to [kNotificationDuration].
/// if zero , will not auto dismiss in the future.
///
/// [animationDuration] the notification display animation duration..
/// if null , will be set to [kNotificationSlideDuration].
/// if zero , will display immediately.
///
/// [reverseAnimationDuration] the notification hide animation duration..
/// if null , will be set to [kNotificationSlideDuration].
/// if zero , will hide immediately.
///
/// [position] the position of notification, default is [NotificationPosition.top],
/// can be [NotificationPosition.top] or [NotificationPosition.bottom].
///
OverlaySupportEntry showOverlayNotification(
WidgetBuilder builder, {
Duration? duration,
Duration? animationDuration,
Duration? reverseAnimationDuration,
Key? key,
NotificationPosition position = NotificationPosition.top,
BuildContext? context,
}) {
duration ??= kNotificationDuration;
animationDuration ??= kNotificationSlideDuration;
reverseAnimationDuration ??= kNotificationSlideDuration;
return showOverlay(
(context, t) {
var alignment = MainAxisAlignment.start;
Expand All @@ -34,6 +46,8 @@ OverlaySupportEntry showOverlayNotification(
);
},
duration: duration,
animationDuration: animationDuration,
reverseAnimationDuration: reverseAnimationDuration,
key: key,
context: context,
);
Expand Down Expand Up @@ -73,6 +87,8 @@ OverlaySupportEntry showSimpleNotification(
*/
double elevation = 16,
Duration? duration,
Duration? animationDuration,
Duration? reverseAnimationDuration,
Key? key,
/**
* True to auto hide after duration [kNotificationDuration].
Expand Down Expand Up @@ -122,6 +138,8 @@ OverlaySupportEntry showSimpleNotification(
);
},
duration: autoDismiss ? duration : Duration.zero,
animationDuration: animationDuration,
reverseAnimationDuration: reverseAnimationDuration,
key: key,
position: position,
context: context,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: overlay_support
description: provider support for overlay, easy to build toast and internal notification
version: 2.1.0
version: 2.1.2
homepage: https://github.com/boyan01/overlay_support

environment:
Expand Down

0 comments on commit 51b3655

Please sign in to comment.