diff --git a/.fvmrc b/.fvmrc
index cf744906..e1504264 100644
--- a/.fvmrc
+++ b/.fvmrc
@@ -1,3 +1,3 @@
{
- "flutter": "3.22.3"
+ "flutter": "3.24.1"
}
\ No newline at end of file
diff --git a/.github/workflows/dry_publish.yaml b/.github/workflows/dry_publish.yaml
index 71eb3658..293d370e 100644
--- a/.github/workflows/dry_publish.yaml
+++ b/.github/workflows/dry_publish.yaml
@@ -3,7 +3,6 @@ on:
push:
branches: main
pull_request:
- branches: main
jobs:
dry-publish:
diff --git a/.vscode/settings.json b/.vscode/settings.json
index acb7585a..4430793a 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,3 @@
{
- "dart.flutterSdkPath": ".fvm/versions/3.22.3"
+ "dart.flutterSdkPath": ".fvm/versions/3.24.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e4d495f..c0059cdc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## 1.0.0-f324.0.9.4 Sep 1, 2024
+
+**This version requires Flutter 3.24.0 or later.** See the [README](https://github.com/fujidaiti/smooth_sheets/edit/main/README.md#for-developers-using-flutter-324) for more details.
+
+- Fix: PopScope not working with modals in Flutter 3.24+ (#237)
+
## 0.9.4 Aug 31, 2024
- Add `SwipeDismissSensitivity`, a way to customize sensitivity of swipe-to-dismiss action on modal sheet (#222)
diff --git a/README.md b/README.md
index cdd1c898..f335f1dc 100644
--- a/README.md
+++ b/README.md
@@ -13,9 +13,25 @@
-**CAUTION🚨**
+## For developers using Flutter 3.24+
-This library is currently in the experimental stage. The API may undergo changes without prior notice. For documentation of the latest published version, please visit the [package site](https://pub.dev/packages/smooth_sheets) on pub.dev.
+If your project uses Flutter 3.24.0 or later, we recommend using the pre-release versions named `1.0.0-f324.x.x.x`. While you can still use the non-pre-release versions (e.g., `0.9.4`) with Flutter 3.24+, you may encounter issues related to the `PopScope` widget due to a breaking change in Flutter 3.24. There are no functional or API differences between the pre-release and non-pre-release versions, except that the pre-release versions require Flutter 3.24.0 or later.
+
+```yaml
+dependencies:
+ # For projects that uses the pre-release versions (requires Flutter 3.24+)
+ smooth_sheets: ^1.0.0-f324.0.9.4
+ # For projects that uses the non-pre-release versions
+ smooth_sheets: ^0.9.4
+```
+
+
+Background
+
+This package previously used the `Route.onPopInvoked` method to invoke `PopScope.onPopInvoked` callbacks when users performed a swipe-to-dismiss gesture. However, these methods were deprecated in Flutter 3.24.0 as part of a [breaking change](https://docs.flutter.dev/release/breaking-changes/popscope-with-result) related to the `PopScope` widget. The problem is that `ModalRoute.onPopInvoked`, which was an override of `Route.onPopInvoked` and where `PopScope.onPopInvoked` callbacks were actually invoked, was removed. As a result, the `PopScope.onPopInvoked` callback is no longer invoked in Flutter 3.24+. These changes led to issues such as [#233](https://github.com/fujidaiti/smooth_sheets/issues/233).
+
+The only possible solution was to replace `Route.onPopInvoked` with `Route.onPopInvokedWithResult`, which was introduced in Flutter 3.24.0. However, migrating to the new API would require increasing the lower bound of the SDK constraint to 3.24.0. For those using an SDK version lower than 3.24, this change would be a significant breaking change. Ultimately, we decided to publish different versions for different SDK constraints to maintain backward compatibility.
+
diff --git a/example/lib/showcase/ai_playlist_generator.dart b/example/lib/showcase/ai_playlist_generator.dart
index e535288f..86aaa111 100644
--- a/example/lib/showcase/ai_playlist_generator.dart
+++ b/example/lib/showcase/ai_playlist_generator.dart
@@ -179,7 +179,7 @@ class _SheetShell extends StatelessWidget {
bottom: false,
child: PopScope(
canPop: false,
- onPopInvoked: (didPop) async {
+ onPopInvokedWithResult: (didPop, _) async {
if (!didPop) {
final shouldPop = await showCancelDialog() ?? false;
if (shouldPop && context.mounted) {
diff --git a/example/lib/tutorial/declarative_modal_sheet.dart b/example/lib/tutorial/declarative_modal_sheet.dart
index 99e94d18..388bff02 100644
--- a/example/lib/tutorial/declarative_modal_sheet.dart
+++ b/example/lib/tutorial/declarative_modal_sheet.dart
@@ -74,7 +74,7 @@ class _ExampleSheet extends StatelessWidget {
// the system back gestures and tapping on the barrier, all in one place.
return PopScope(
canPop: false,
- onPopInvoked: (didPop) async {
+ onPopInvokedWithResult: (didPop, _) async {
if (!didPop) {
final shouldPop = await showConfirmationDialog(context);
if (shouldPop == true && context.mounted) {
diff --git a/example/lib/tutorial/imperative_modal_sheet.dart b/example/lib/tutorial/imperative_modal_sheet.dart
index 546491ef..e5d5f697 100644
--- a/example/lib/tutorial/imperative_modal_sheet.dart
+++ b/example/lib/tutorial/imperative_modal_sheet.dart
@@ -58,7 +58,7 @@ class _ExampleSheet extends StatelessWidget {
// the system back gestures and tapping on the barrier, all in one place.
return PopScope(
canPop: false,
- onPopInvoked: (didPop) async {
+ onPopInvokedWithResult: (didPop, _) async {
if (!didPop) {
final shouldPop = await showConfirmationDialog(context);
if (shouldPop == true && context.mounted) {
diff --git a/example/pubspec.lock b/example/pubspec.lock
index b8618ad7..acf3ad1b 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -116,18 +116,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
- sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
+ sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
- version: "10.0.4"
+ version: "10.0.5"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
- sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
+ sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
- version: "3.0.3"
+ version: "3.0.5"
leak_tracker_testing:
dependency: transitive
description:
@@ -164,18 +164,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
- sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
+ sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
- version: "0.8.0"
+ version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
- sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
+ sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
- version: "1.12.0"
+ version: "1.15.0"
path:
dependency: transitive
description:
@@ -240,10 +240,10 @@ packages:
dependency: transitive
description:
name: test_api
- sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
+ sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
url: "https://pub.dev"
source: hosted
- version: "0.7.0"
+ version: "0.7.2"
typed_data:
dependency: transitive
description:
@@ -264,10 +264,10 @@ packages:
dependency: transitive
description:
name: vm_service
- sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
+ sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
- version: "14.2.1"
+ version: "14.2.5"
sdks:
- dart: ">=3.3.0 <4.0.0"
- flutter: ">=3.18.0-18.0.pre.54"
+ dart: ">=3.5.0 <4.0.0"
+ flutter: ">=3.24.0"
diff --git a/lib/smooth_sheets.dart b/lib/smooth_sheets.dart
index a8e7e4fc..abbc8c9f 100644
--- a/lib/smooth_sheets.dart
+++ b/lib/smooth_sheets.dart
@@ -1,7 +1,7 @@
/// Comprehensive bottom sheet library supporting imperative and declarative
/// navigation APIs, nested navigation, persistent and modal styles (including
/// the iOS flavor), and more.
-library smooth_sheets;
+library;
export 'src/draggable/draggable.dart';
export 'src/foundation/foundation.dart';
diff --git a/lib/src/modal/modal_sheet.dart b/lib/src/modal/modal_sheet.dart
index e1ae95f7..9f1754a9 100644
--- a/lib/src/modal/modal_sheet.dart
+++ b/lib/src/modal/modal_sheet.dart
@@ -406,7 +406,7 @@ class _SwipeDismissibleController with SheetGestureTamperer {
}
if (invokePop) {
- route.onPopInvoked(didPop);
+ route.onPopInvokedWithResult(didPop, null);
}
return true;
diff --git a/lib/src/scrollable/sheet_content_scroll_position.dart b/lib/src/scrollable/sheet_content_scroll_position.dart
index 49d4f7ab..c714356c 100644
--- a/lib/src/scrollable/sheet_content_scroll_position.dart
+++ b/lib/src/scrollable/sheet_content_scroll_position.dart
@@ -67,6 +67,7 @@ class SheetContentScrollPosition extends ScrollPositionWithSingleContext {
/// Whether the scroll view should prevent its contents from receiving
/// pointer events.
+ @override
bool get shouldIgnorePointer => activity!.shouldIgnorePointer;
/// Sets the user scroll direction.
diff --git a/pubspec.yaml b/pubspec.yaml
index 206b9ead..737b925f 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: smooth_sheets
description: Sheet widgets with smooth motion and great flexibility. Also supports nested navigation in both imperative and declarative ways.
-version: 0.9.4
+version: 1.0.0-f324.0.9.4
repository: https://github.com/fujidaiti/smooth_sheets
screenshots:
- description: Practical examples of smooth_sheets.
@@ -11,8 +11,8 @@ topics:
- bottom-sheet
environment:
- sdk: ">=3.2.0 <4.0.0"
- flutter: ">=3.16.0"
+ sdk: ">=3.5.0 <4.0.0"
+ flutter: ">=3.24.0"
dependencies:
collection: ^1.17.1