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

Using the back button with showDatePicker() is breaking the Navigator #77

Open
leonardo2204 opened this issue Dec 17, 2021 · 0 comments

Comments

@leonardo2204
Copy link

Describe the bug
Using the back button with showDatePicker() shown is breaking the Navigator.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
Using this very same repository, I added a Button inside onboarding_flow "OnboardingUsage" widget with the code below:

TextButton(
                      onPressed: () =>
                          showDatePicker(
                              context: context,
                              initialDate: DateTime.now(),
                              firstDate: DateTime.now(),
                              lastDate: DateTime.now()),
                      child: const Text('asdasd')
                  ),

I even tried using useRootNavigator as false, but the same errors pops out.
I saw that the navigation behind still occurs, so it feels like the back button interceptor used by flow_builder is not correctly "intercepting" this modal.

**Logs **

======== Exception caught by gesture ===============================================================
The following assertion was thrown while handling a gesture:
'package:flutter/src/widgets/navigator.dart': Failed assertion: line 4842 pos 12: '!_debugLocked': is not true.


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack: 
#2      NavigatorState.pop (package:flutter/src/widgets/navigator.dart:4842:12)
#3      Navigator.pop (package:flutter/src/widgets/navigator.dart:2432:27)
#4      _DatePickerDialogState._handleCancel (package:flutter/src/material/date_picker.dart:386:15)
#5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989:21)
#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:608:11)
#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5)
#9      BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:230:7)
#10     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:563:9)
#11     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:94:12)
#12     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:139:9)
#13     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:539:8)
#14     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:137:18)
#15     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:123:7)
#16     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:439:19)
#17     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
#18     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:322:11)
#19     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#20     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#21     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
#22     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
#26     _invoke1 (dart:ui/hooks.dart:169:10)
#27     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:293:7)
#28     _dispatchPointerDataPacket (dart:ui/hooks.dart:88:31)
(elided 5 frames from class _AssertionError and dart:async)
Handler: "onTap"
Recognizer: TapGestureRecognizer#d0b09
  debugOwner: GestureDetector
  state: possible
  won arena
  finalPosition: Offset(267.4, 589.3)
  finalLocalPosition: Offset(46.7, 20.6)
  button: 1
  sent tap down
====================================================================================================

Paste the output of running flutter doctor -v here.

/Users/leonardo2204/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 2.8.0, on macOS 12.0.1 21A559 darwin-x64, locale pt-BR)
    • Flutter version 2.8.0 at /Users/leonardo2204/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cf44000065 (9 days ago), 2021-12-08 14:06:50 -0800
    • Engine revision 40a99c5951
    • Dart version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/leonardo2204/Library/Android/sdk/
    • Platform android-31, build-tools 31.0.0
    • ANDROID_SDK_ROOT = /Users/leonardo2204/Library/Android/sdk/
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.20.1)
    • VS Code at /Users/leonardo2204/Downloads/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 8.1.0 (API 27) (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 96.0.4664.110

• No issues found!

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant