Skip to content

Commit

Permalink
modify: consider view padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurogoma4D committed Jun 17, 2021
1 parent 7e12eae commit fb0dc6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class NotificationBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 24, 16, 0),
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
child: DecoratedBox(
decoration: BoxDecoration(
boxShadow: [
Expand Down
6 changes: 3 additions & 3 deletions lib/src/in_app_notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ class _InAppNotificationState extends State<InAppNotification>
}

return Positioned(
bottom: MediaQuery.of(context).size.height - _currentPosition,
bottom: MediaQuery.of(context).size.height -
MediaQuery.of(context).viewPadding.top -
_currentPosition,
left: 0,
right: 0,
child: SizeListenableContainer(
Expand Down Expand Up @@ -187,8 +189,6 @@ class _InAppNotificationState extends State<InAppNotification>

void _onVerticalDragEnd(DragEndDetails details) async {
final percentage = _currentPosition.abs() / _notificationSize.height;
print(_screenSize);
print('velocity: ${details.primaryVelocity}');
final velocity = details.velocity.pixelsPerSecond.dy * _screenSize.height;
if (velocity <= -1.0) {
await dismiss(animationFrom: percentage);
Expand Down

0 comments on commit fb0dc6c

Please sign in to comment.