Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavigationSheet throws assertion error when starting to scroll in list view during page transition #166

Closed
fujidaiti opened this issue Jun 9, 2024 · 2 comments · Fixed by #199
Assignees
Labels
bug Something isn't working P1
Milestone

Comments

@fujidaiti
Copy link
Owner

fujidaiti commented Jun 9, 2024

Steps to reproduce

  1. Apply the patch below to tutorial/imperative_navigation_sheet.dart.
  2. Run the app and press the Next button.
  3. Start dragging in the list view and keep holding your finger until the transition is complete.
diff --git forkSrcPrefix/cookbook/lib/tutorial/imperative_navigation_sheet.dart forkDstPrefix/cookbook/lib/tutorial/imperative_navigation_sheet.dart
index df9a733e123d51e1703f87865f3aaf0c56e0d9b8..18874db5f833c4ae6cd556acd9228f32ce8eb4fe 100644
--- forkSrcPrefix/cookbook/lib/tutorial/imperative_navigation_sheet.dart
+++ forkDstPrefix/cookbook/lib/tutorial/imperative_navigation_sheet.dart
@@ -68,6 +68,7 @@ class _DraggablePage extends StatelessWidget {
   void navigateToScrollablePage(BuildContext context) {
     // Use ScrollableNavigationSheetRoute for a scrollable page.
     final route = ScrollableNavigationSheetRoute(
+      transitionDuration: const Duration(seconds: 1),
       builder: (context) {
         return const _ScrollablePage();
       },
RocketSim_Recording_iPhone_15_6.1_2024-06-09_23.52.36.mp4
Error log
════════ Exception caught by animation library ═════════════════════════════════
The following assertion was thrown while notifying status listeners for ProxyAnimation:
'package:smooth_sheets/src/foundation/sheet_extent.dart': Failed assertion: line 400 pos 16: 'currentDrag != null': is not true.

When the exception was thrown, this was the stack:
#2      SheetExtent.beginActivity (package:smooth_sheets/src/foundation/sheet_extent.dart:400:16)
#3      NavigationSheetExtent.handleRouteTransition (package:smooth_sheets/src/navigation/navigation_sheet_extent.dart:34:9)
#4      _NavigationSheetState.didChangeTransitionState (package:smooth_sheets/src/navigation/navigation_sheet.dart:45:35)
#5      TransitionAwareStateMixin._notify (package:smooth_sheets/src/internal/transition_observer.dart:67:7)
#6      TransitionAwareStateMixin.didPush.transitionStatusListener (package:smooth_sheets/src/internal/transition_observer.dart:94:13)
#7      AnimationLocalStatusListenersMixin.notifyStatusListeners (package:flutter/src/animation/listener_helpers.dart:240:19)
#8      AnimationLocalStatusListenersMixin.notifyStatusListeners (package:flutter/src/animation/listener_helpers.dart:240:19)
#9      AnimationController._checkStatusChanged (package:flutter/src/animation/animation_controller.dart:841:7)
#10     AnimationController._tick (package:flutter/src/animation/animation_controller.dart:857:5)
#11     Ticker._tick (package:flutter/src/scheduler/ticker.dart:258:12)
#12     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1392:15)
#13     SchedulerBinding.handleBeginFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:1235:11)
#14     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#15     SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:1233:17)
#16     SchedulerBinding._handleBeginFrame (package:flutter/src/scheduler/binding.dart:1150:5)
#17     _invoke1 (dart:ui/hooks.dart:328:13)
#18     PlatformDispatcher._beginFrame (dart:ui/platform_dispatcher.dart:397:5)
#19     _beginFrame (dart:ui/hooks.dart:272:31)
(elided 2 frames from class _AssertionError)

The ProxyAnimation notifying status listeners was: AnimationController#43934(⏭ 1.000; paused; for ScrollableNavigationSheetRoute<dynamic>)➩ProxyAnimation
════════════════════════════════════════════════════════════════════════════════
Application finished.

Exited.
@fujidaiti fujidaiti added the bug Something isn't working label Jun 9, 2024
@fujidaiti fujidaiti self-assigned this Jun 9, 2024
@fujidaiti fujidaiti added the P1 label Jun 9, 2024
@fujidaiti fujidaiti added this to the v1 milestone Jun 9, 2024
@fujidaiti
Copy link
Owner Author

Should touch events be ignored during a page transition?

@appinteractive
Copy link

Should touch events be ignored during a page transition?

Would be the easiest fix I guess And solve a lot of potential issues from my prospective.

fujidaiti added a commit that referenced this issue Jul 19, 2024
## Fixes / Closes (optional)

Fixes #166.

## Description

This PR introduces `SheetActivity.shouldIgnorePointer`, a flag that
indicates whether the sheet should prevent its content from receiving
the pointer events. `TransitionSheetActivity` for `NavigationSheet` sets
this flag to `true` to avoid potential issues that caused by user
gestures during the unstable state of route transitions.

## Summary (check all that apply)

- [x] Modified / added code
- [x] Modified / added tests
- [ ] Modified / added examples
- [ ] Modified / added others (pubspec.yaml, workflows, etc...)
- [ ] Updated README
- [ ] Contains breaking changes
  - [ ] Created / updated migration guide
- [ ] Incremented version number
  - [ ] Updated CHANGELOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1
Projects
None yet
2 participants