dbenitez-bcn / solid_bottom_sheet

Apache License 2.0
58 stars 19 forks source link

Exception caught by Gesture when dragging the bottom sheet with draggableBody set to false #24

Open edocabhi opened 4 years ago

edocabhi commented 4 years ago

I get this exception in the debug console when dragging the bottom_sheet. However, the sheet seems to be working fine. Any leads to fixing this would be appreciated. Thanks

How my bottom sheet looks

bottomSheet: SolidBottomSheet(
                toggleVisibilityOnTap: false,
                maxHeight: 200,
                showOnAppear: true,
                controller: _controller,
                draggableBody: false,
                headerBar: Container(),
                body: Container(
                ....  ......
                  ),
                ),
              ),

Exception in console

══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter ( 6003): The following assertion was thrown while handling a gesture:
I/flutter ( 6003): Failed assertion: boolean expression must not be null
I/flutter ( 6003):
I/flutter ( 6003): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter ( 6003): more information in this error message to help you determine and fix the underlying cause.
I/flutter ( 6003): In either case, please report this assertion by filing a bug on GitHub:
I/flutter ( 6003):   https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter ( 6003):
I/flutter ( 6003): When the exception was thrown, this was the stack:
I/flutter ( 6003): #0      _SolidBottomSheetState._onVerticalDragEnd (package:solid_bottom_sheet/src/solidBottomSheet.dart:115:9)
I/flutter ( 6003): #1      DragGestureRecognizer._checkEnd.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:439:41)
I/flutter ( 6003): #2      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
I/flutter ( 6003): #3      DragGestureRecognizer._checkEnd (package:flutter/src/gestures/monodrag.dart:439:5)
I/flutter ( 6003): #4      DragGestureRecognizer.didStopTrackingLastPointer (package:flutter/src/gestures/monodrag.dart:348:9)
I/flutter ( 6003): #5      OneSequenceGestureRecognizer.stopTrackingPointer (package:flutter/src/gestures/recognizer.dart:336:9)
I/flutter ( 6003): #6      DragGestureRecognizer._giveUpPointer (package:flutter/src/gestures/monodrag.dart:357:5)
I/flutter ( 6003): #7      DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:281:7)
I/flutter ( 6003): #8      PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12)
I/flutter ( 6003): #9      PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:117:9)
I/flutter ( 6003): #10     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
I/flutter ( 6003): #11     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:115:18)
I/flutter ( 6003): #12     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:7)
I/flutter ( 6003): #13     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
I/flutter ( 6003): #14     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
I/flutter ( 6003): #15     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
I/flutter ( 6003): #16     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
I/flutter ( 6003): #17     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
I/flutter ( 6003): #21     _invoke1 (dart:ui/hooks.dart:273:10)
I/flutter ( 6003): #22     _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
I/flutter ( 6003): (elided 3 frames from package dart:async)
I/flutter ( 6003):
I/flutter ( 6003): Handler: "onEnd"
I/flutter ( 6003): Recognizer:
I/flutter ( 6003):   VerticalDragGestureRecognizer#e6776
I/flutter ( 6003): ════════════════════════════════════════════════════════════════════════════════════════════════════
edocabhi commented 4 years ago

On a closer analysis, it seems like an uninitialized variable causing the exception. Please correct if I am wrong.

dbenitez-bcn commented 4 years ago

I will have a look. Thanks for your investigation. Appresiated :D

P-B1101 commented 4 years ago

i think it's happened when the parameter isDragDirectionUp in library class is null. and this parameter initialized only in this part of code

void _onVerticalDragUpdate(data) {
    _setNativeSmoothness();
    if (((widget.controller.height - data.delta.dy) > widget.minHeight) &&
        ((widget.controller.height - data.delta.dy) < widget.maxHeight)) {
      isDragDirectionUp = data.delta.dy <= 0;
      widget.controller.height -= data.delta.dy;
    }
  }

in my case it was maxHeight == 0 . so isDragDirectionUp could not be initialized.

xarmatura commented 3 years ago

@dbenitez-bcn Any updates?

sandifb commented 1 year ago

@dbenitez-bcn any updates ?