From 49388b6e57066a6b46d0a87a82c97c2b658683c7 Mon Sep 17 00:00:00 2001 From: Li Qingyun Date: Fri, 4 Aug 2023 21:15:10 +0800 Subject: [PATCH 1/2] modify: fix OverlayEntry can't be removed correctly while window size changing --- lib/src/vsync_provider.dart | 7 ++++++- pubspec.yaml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/src/vsync_provider.dart b/lib/src/vsync_provider.dart index 602565b..8d728b5 100644 --- a/lib/src/vsync_provider.dart +++ b/lib/src/vsync_provider.dart @@ -30,9 +30,12 @@ class __VsyncProviderState extends State<_VsyncProvider> duration: notificationHorizontalAnimationDuration, ); + _NotificationController? _notificationController; + @override Widget build(BuildContext context) { - return _NotificationController( + _notificationController?.state.overlay?.remove(); + _notificationController = _NotificationController( state: _NotificationState( showController: _showController, verticalAnimationController: _verticalAnimationController, @@ -40,6 +43,7 @@ class __VsyncProviderState extends State<_VsyncProvider> ), child: widget.child, ); + return _notificationController!; } @override @@ -47,6 +51,7 @@ class __VsyncProviderState extends State<_VsyncProvider> _showController.dispose(); _verticalAnimationController.dispose(); _horizontalAnimationController.dispose(); + _notificationController?.state.overlay?.remove(); super.dispose(); } } diff --git a/pubspec.yaml b/pubspec.yaml index 421aede..9c0f2e3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.1.2 repository: https://github.com/cb-cloud/flutter_in_app_notification environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.12.0 <4.0.0' flutter: ">=1.17.0" dependencies: From af9c7dbabd5f5b7c5dbfe4888a934f886e40c765 Mon Sep 17 00:00:00 2001 From: Switernal Date: Sat, 5 Aug 2023 10:18:16 +0800 Subject: [PATCH 2/2] Update vsync_provider.dart --- lib/src/vsync_provider.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/vsync_provider.dart b/lib/src/vsync_provider.dart index 8d728b5..3df6631 100644 --- a/lib/src/vsync_provider.dart +++ b/lib/src/vsync_provider.dart @@ -35,7 +35,7 @@ class __VsyncProviderState extends State<_VsyncProvider> @override Widget build(BuildContext context) { _notificationController?.state.overlay?.remove(); - _notificationController = _NotificationController( + _notificationController ??= _NotificationController( state: _NotificationState( showController: _showController, verticalAnimationController: _verticalAnimationController,