Skip to content

Fix: PopScope not working with modals in Flutter 3.24+ #310

Fix: PopScope not working with modals in Flutter 3.24+

Fix: PopScope not working with modals in Flutter 3.24+ #310

GitHub Actions / Test Report (with Flutter 3.24.0) succeeded Aug 31, 2024 in 1s

52 passed, 0 failed and 0 skipped

Tests passed successfully

✅ /home/runner/work/smooth_sheets/smooth_sheets/flutter-test-report.json

52 tests were completed in 13s with 52 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
test/draggable/draggable_sheet_test.dart 4✅ 971ms
test/foundation/physics_test.dart 20✅ 113ms
test/foundation/sheet_notification_test.dart 3✅ 371ms
test/foundation/sheet_viewport_test.dart 4✅ 524ms
test/modal/modal_sheet_test.dart 6✅ 1s
test/navigation/navigation_sheet_test.dart 8✅ 1s
test/scrollable/scrollable_sheet_test.dart 7✅ 2s

✅ test/draggable/draggable_sheet_test.dart

✅ Inherited controller should be attached
✅ Opening keyboard does not interrupt sheet animation
SheetKeyboardDismissible
  ✅ should dismiss the keyboard when dragging
  ✅ should dismiss the keyboard when scrolling

✅ test/foundation/physics_test.dart

✅ FixedBouncingBehavior returns same value for same input metrics
✅ DirectionAwareBouncingBehavior respects gesture direction
SheetPhysics subclasses
  ✅ can create dynamic inheritance relationships
Default configuration of SheetPhysics
  ✅ does not allow over/under dragging
  ✅ does not apply any resistance if position is in bounds
  ✅ prevents position from going out of bounds
  ✅ creates no ballistic simulation if position is in bounds
  ✅ creates ballistic simulation which ends at the nearest edge
  ✅ creates no settling simulation if the position is in bounds
  ✅ creates settling simulation which ends at nearest edge
SnapToNearestEdge
  ✅ snaps to nearest edge if velocity is small enough
  ✅ is aware of fling gesture direction
  ✅ is disabled if position is out of bounds
SnapToNearest
  ✅ snaps to nearest edge if velocity is small enough
  ✅ is aware of fling gesture direction
  ✅ is disabled if position is out of bounds
BouncingSheetPhysics
  ✅ progressively applies friction if position is out of bounds
  ✅ does not allow to go beyond bounceable bounds
  ✅ applies friction even if position is on boundary
  ✅ can apply a reasonable friction to extremely large offset

✅ test/foundation/sheet_notification_test.dart

✅ Drag gesture should dispatch drag start/update/end notifications in sequence
✅ Sheet animation should dispatch metrics update notifications
✅ Over-darg gesture should dispatch both darg and overflow notifications

✅ test/foundation/sheet_viewport_test.dart

Ignore pointer test:
  ✅ pointer events on a sheet should be ignored if activity says to do so
  ✅ content in a sheet should receive pointer events if activity allows
  ✅ content obscured by a sheet should never receive pointer events
  ✅ content not obscured by a sheet should always receive pointer events

✅ test/modal/modal_sheet_test.dart

Swipe-to-dismiss action test
  ✅ modal should be dismissed if swipe gesture has enough speed
  ✅ modal should not be dismissed if swipe gesture has not enough speed
  ✅ modal should be dismissed if drag distance is enough
  ✅ modal should not be dismissed if drag distance is not enough
PopScope test
  ✅ PopScope.onPopInvoked should be called when tap on barrier
  ✅ PopScope.onPopInvoked should be called when swipe to dismiss

✅ test/navigation/navigation_sheet_test.dart

✅ Attached controller emits correct pixel values when dragging
✅ Attached controller emits correct boundary values
✅ Inherited controller should be attached
✅ Works with DropdownButton without crashing
✅ Opening keyboard does not interrupts sheet animation
✅ Drag gestures should be ignored during a page transition
SheetKeyboardDismissible
  ✅ should dismiss the keyboard when dragging
  ✅ should dismiss the keyboard when scrolling

✅ test/scrollable/scrollable_sheet_test.dart

✅ Inherited controller should be attached
✅ Opening keyboard does not interrupt sheet animation
✅ Infinite ballistic scroll activity test
Press-and-hold gesture should stop momentum scrolling
  ✅ in a plain ListView
  ✅ in a PageView with multiple ListViews
SheetKeyboardDismissible
  ✅ should dismiss the keyboard when dragging
  ✅ should dismiss the keyboard when scrolling