Skip to content

Commit 22a1bbe

Browse files
authored
Fix#152 resolve null check on overlay helper (#154)
* fix: update overlay config to resolve bottom padding * fix #152: update overlay helper constraints initialization
1 parent a88bc44 commit 22a1bbe

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [2.4.5] - 16/04/2025
2+
3+
* **Changes**
4+
* Mark `onCloseButtonPressed` as deprecated and replace it with `onDismiss` callback [PR#153](https://github.com/koukibadr/Elegant-Notification/pull/153)
5+
6+
* **Bug Fix**
7+
* Fix null check operator when initializing overlay helper constraints [Issue#152](https://github.com/koukibadr/Elegant-Notification/issues/152)
8+
19
## [2.4.4] - 30/03/2025
210

311
* **Bug Fix**

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ To use this elegant notification package you need to add the dependency in `pubs
4646

4747
```yaml
4848
dependencies:
49-
elegant_notification: ^2.4.4
49+
elegant_notification: ^2.4.5
5050
```
5151

5252
## Parameters

lib/resources/overlay_helper.dart

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,20 @@ class _OverlayHelper implements OverlayHelper {
9898
double alignmentToLeftPos() {
9999
// Checking the vertical axis position of the overlay
100100
// -1 = left, 0 = center, 1 = right
101-
if (position.x == 1) {
102-
return MediaQuery.of(context).size.width -
103-
mainContainerWidth() -
104-
notificationMargin;
105-
} else if (position.x == -1) {
106-
return notificationMargin;
107-
} else {
108-
return ((position.x + 1) / 2) * MediaQuery.of(context).size.width -
109-
(mainContainerWidth() / 2);
101+
try {
102+
if (position.x == 1) {
103+
return MediaQuery.of(context).size.width -
104+
mainContainerWidth() -
105+
notificationMargin;
106+
} else if (position.x == -1) {
107+
return notificationMargin;
108+
} else {
109+
return ((position.x + 1) / 2) * MediaQuery.of(context).size.width -
110+
(mainContainerWidth() / 2);
111+
}
112+
} catch (e) {
113+
// Handle any exceptions that may occur
114+
return notificationMargin; // Default value in case of an error
110115
}
111116
}
112117

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: elegant_notification
22
description: 'A new flutter package to display notifications on top of the screen, full customizable with built-in themes'
3-
version: 2.4.4
3+
version: 2.4.5
44
homepage: 'https://github.com/koukibadr/Elegant-Notification'
55
environment:
66
sdk: '>=2.19.0 <4.0.0'

0 commit comments

Comments
 (0)