diff --git a/.gitignore b/.gitignore
index bcae4682..0ed744a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -83,5 +83,5 @@ fabric.properties
# Editor-based Rest Client
.idea/httpRequests
-# Android studio 3.1+ serialized cache file
-.idea/caches/build_file_checksums.ser
+# Caches
+.idea/caches/
diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml
deleted file mode 100644
index af74dbfd..00000000
--- a/.idea/caches/deviceStreaming.xml
+++ /dev/null
@@ -1,318 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 5c94cb21..469b00f4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
index 3c472b99..09523c0e 100644
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
diff --git a/example/android/settings.gradle b/example/android/settings.gradle
index 7cd71285..af1ec35d 100644
--- a/example/android/settings.gradle
+++ b/example/android/settings.gradle
@@ -23,7 +23,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
- id "com.android.application" version "7.3.0" apply false
+ id "com.android.application" version '7.4.2' apply false
}
include ":app"
diff --git a/example/lib/showcase/ai_playlist_generator.dart b/example/lib/showcase/ai_playlist_generator.dart
index ce8d5cc6..b1c20c75 100644
--- a/example/lib/showcase/ai_playlist_generator.dart
+++ b/example/lib/showcase/ai_playlist_generator.dart
@@ -1,6 +1,7 @@
import 'dart:async';
-import 'dart:io';
+import 'package:flutter/foundation.dart'
+ show TargetPlatform, defaultTargetPlatform;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
@@ -8,7 +9,7 @@ import 'package:smooth_sheets/smooth_sheets.dart';
void main() {
// Make the system navigation bar transparent on Android.
- if (Platform.isAndroid) {
+ if (defaultTargetPlatform == TargetPlatform.android) {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.edgeToEdge,
diff --git a/lib/src/foundation/sheet_physics.dart b/lib/src/foundation/sheet_physics.dart
index 0b04a510..f7f7751f 100644
--- a/lib/src/foundation/sheet_physics.dart
+++ b/lib/src/foundation/sheet_physics.dart
@@ -1,7 +1,8 @@
-import 'dart:io';
import 'dart:math';
import 'package:collection/collection.dart';
+import 'package:flutter/foundation.dart'
+ show TargetPlatform, defaultTargetPlatform;
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
@@ -36,11 +37,12 @@ abstract class SheetPhysics {
/// the first time or after each time the drag motion stopped.
///
/// If null, no minimum threshold is enforced.
- double? get dragStartDistanceMotionThreshold {
- return Platform.isIOS
- ? const BouncingScrollPhysics().dragStartDistanceMotionThreshold
- : null;
- }
+ double? get dragStartDistanceMotionThreshold =>
+ switch (defaultTargetPlatform) {
+ TargetPlatform.iOS =>
+ const BouncingScrollPhysics().dragStartDistanceMotionThreshold,
+ _ => null,
+ };
/// Create a copy of this object appending the [ancestor] to
/// the physics chain, much like [ScrollPhysics.applyTo].
diff --git a/test/foundation/physics_test.dart b/test/foundation/physics_test.dart
index 1bb1f4ac..79d17f86 100644
--- a/test/foundation/physics_test.dart
+++ b/test/foundation/physics_test.dart
@@ -1,4 +1,6 @@
// ignore_for_file: lines_longer_than_80_chars
+import 'package:flutter/foundation.dart'
+ show debugDefaultTargetPlatformOverride;
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:smooth_sheets/smooth_sheets.dart';
@@ -71,6 +73,22 @@ void main() {
physicsUnderTest = const _SheetPhysicsWithDefaultConfiguration();
});
+ test('dragStartDistanceMotionThreshold for different platforms', () {
+ for (final testTargetPlatform in TargetPlatform.values) {
+ debugDefaultTargetPlatformOverride = testTargetPlatform;
+ switch (testTargetPlatform) {
+ case TargetPlatform.iOS:
+ expect(
+ physicsUnderTest.dragStartDistanceMotionThreshold,
+ const BouncingScrollPhysics().dragStartDistanceMotionThreshold,
+ );
+ case _:
+ expect(physicsUnderTest.dragStartDistanceMotionThreshold, null);
+ }
+ debugDefaultTargetPlatformOverride = null;
+ }
+ });
+
test('does not allow over/under dragging', () {
expect(
physicsUnderTest.computeOverflow(10, _positionAtTopEdge),