Skip to content

Commit 0563f83

Browse files
authored
fix: update overlay config to resolve bottom padding (#149)
1 parent 18b6a46 commit 0563f83

File tree

7 files changed

+44
-25
lines changed

7 files changed

+44
-25
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [2.4.3] - 09/03/2025
2+
3+
* **Enhancements**
4+
* Update notification overlay display geometry calculation by handling bottom padding [Issue#143](https://github.com/koukibadr/Elegant-Notification/issues/143)
5+
* Add assertions on `StackedOptions` attribute
6+
7+
18
## [2.4.2] - 22/02/2025
29

310
* **Enhancements**

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.2
49+
elegant_notification: ^2.4.3
5050
```
5151

5252
## Parameters

example/pubspec.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ packages:
55
dependency: transitive
66
description:
77
name: async
8-
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
8+
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "2.12.0"
11+
version: "2.13.0"
1212
boolean_selector:
1313
dependency: transitive
1414
description:
@@ -55,15 +55,15 @@ packages:
5555
path: ".."
5656
relative: true
5757
source: path
58-
version: "2.4.1"
58+
version: "2.4.2"
5959
fake_async:
6060
dependency: transitive
6161
description:
6262
name: fake_async
63-
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
63+
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
6464
url: "https://pub.dev"
6565
source: hosted
66-
version: "1.3.2"
66+
version: "1.3.3"
6767
flutter:
6868
dependency: "direct main"
6969
description: flutter
@@ -78,10 +78,10 @@ packages:
7878
dependency: transitive
7979
description:
8080
name: leak_tracker
81-
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
81+
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
8282
url: "https://pub.dev"
8383
source: hosted
84-
version: "10.0.8"
84+
version: "10.0.9"
8585
leak_tracker_flutter_testing:
8686
dependency: transitive
8787
description:
@@ -195,10 +195,10 @@ packages:
195195
dependency: transitive
196196
description:
197197
name: vm_service
198-
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
198+
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
199199
url: "https://pub.dev"
200200
source: hosted
201-
version: "14.3.1"
201+
version: "15.0.0"
202202
sdks:
203203
dart: ">=3.7.0-0 <4.0.0"
204204
flutter: ">=3.18.0-18.0.pre.54"

lib/elegant_notification.dart

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,7 @@ class ElegantNotification extends StatefulWidget {
201201
animation != AnimationType.fromTop,
202202
);
203203
} else if (position == Alignment.topCenter) {
204-
assert(
205-
animation != AnimationType.fromBottom &&
206-
animation != AnimationType.fromLeft &&
207-
animation != AnimationType.fromRight,
208-
);
204+
assert(animation == AnimationType.fromTop);
209205
} else if (position == Alignment.topRight) {
210206
assert(
211207
animation != AnimationType.fromLeft &&
@@ -233,6 +229,21 @@ class ElegantNotification extends StatefulWidget {
233229
animation != AnimationType.fromTop,
234230
);
235231
}
232+
233+
// if notification will be shown in the bottom of the screen
234+
// stacked options should be null or stacked option type should not be [StackedType.below]
235+
if (position.y == 1) {
236+
assert(
237+
stackedOptions == null || stackedOptions?.type != StackedType.below,
238+
);
239+
}
240+
// if the notification will be shown on top
241+
// stacked options should be null or the stacked options type should not be [StackedType.above]
242+
else if (position.y == -1) {
243+
assert(
244+
stackedOptions == null || stackedOptions?.type != StackedType.above,
245+
);
246+
}
236247
}
237248

238249
/// The toast title widget

lib/resources/overlay_helper.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ class _OverlayHelper implements OverlayHelper {
6262
if (position.y == 1) {
6363
return MediaQuery.of(context).size.height -
6464
mainContainerHeight() -
65-
notificationMargin;
65+
notificationMargin -
66+
20;
6667
} else if (position.y == -1) {
6768
return notificationMargin;
6869
} else {

pubspec.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ packages:
55
dependency: transitive
66
description:
77
name: async
8-
sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
8+
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "2.12.0"
11+
version: "2.13.0"
1212
boolean_selector:
1313
dependency: transitive
1414
description:
@@ -45,10 +45,10 @@ packages:
4545
dependency: transitive
4646
description:
4747
name: fake_async
48-
sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
48+
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
4949
url: "https://pub.dev"
5050
source: hosted
51-
version: "1.3.2"
51+
version: "1.3.3"
5252
flutter:
5353
dependency: "direct main"
5454
description: flutter
@@ -71,10 +71,10 @@ packages:
7171
dependency: transitive
7272
description:
7373
name: leak_tracker
74-
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
74+
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
7575
url: "https://pub.dev"
7676
source: hosted
77-
version: "10.0.8"
77+
version: "10.0.9"
7878
leak_tracker_flutter_testing:
7979
dependency: transitive
8080
description:
@@ -196,10 +196,10 @@ packages:
196196
dependency: transitive
197197
description:
198198
name: vm_service
199-
sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
199+
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
200200
url: "https://pub.dev"
201201
source: hosted
202-
version: "14.3.1"
202+
version: "15.0.0"
203203
sdks:
204204
dart: ">=3.7.0-0 <4.0.0"
205205
flutter: ">=3.18.0-18.0.pre.54"

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.2
3+
version: 2.4.3
44
homepage: 'https://github.com/koukibadr/Elegant-Notification'
55
environment:
66
sdk: '>=2.19.0 <4.0.0'

0 commit comments

Comments
 (0)