Skip to content

weird log for DraggableScrollableSheet #89681

@liodali

Description

@liodali

this code work in previous flutter version 2.2 but when i upgraded to v2.5 shows me weird error
the error start shows when i scroll the sheet to the minchildSize
this is the code

Scaffold(
      body: DraggableScrollableSheet(
        initialChildSize: 0.55,
        maxChildSize: 0.65,
        minChildSize: .25,
        expand: true,
        builder: (ctx, sheetController) {
          return ScrollConfiguration(
            behavior: ScrollBehavior().copyWith(
              overscroll: false,
              scrollbars: false,
            ),
            child: SingleChildScrollView(
              controller: sheetController,
              physics: AlwaysScrollableScrollPhysics(),
              child: ConstrainedBox(
                constraints: BoxConstraints(
                  minHeight: 120,
                  maxHeight: MediaQuery.of(context).size.height * 0.65,
                ),
                child: LayoutBuilder(
                  builder: (ctx, constraint) {
                    return Card(
                      color: Colors.red,
                    );
                  },
                ),
              ),
            ),
          );
        },
      ),
    )

Flutter log
======== Exception caught by gesture ===============================================================
The following assertion was thrown while handling a gesture:
'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 654 pos 12: '_drag == null': 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      ScrollableState._handleDragEnd (package:flutter/src/widgets/scrollable.dart:654:12)
#3      DragGestureRecognizer._checkEnd.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:486:47)
#4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:193:24)
#5      DragGestureRecognizer._checkEnd (package:flutter/src/gestures/monodrag.dart:486:5)
#6      DragGestureRecognizer.didStopTrackingLastPointer (package:flutter/src/gestures/monodrag.dart:393:9)
#7      OneSequenceGestureRecognizer.stopTrackingPointer (package:flutter/src/gestures/recognizer.dart:387:9)
#8      DragGestureRecognizer._giveUpPointer (package:flutter/src/gestures/monodrag.dart:402:5)
#9      DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:321:7)
#10     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:94:12)
#11     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:139:9)
#12     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:400:8)
#13     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:137:18)
#14     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:123:7)
#15     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:440:19)
#16     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:420:22)
#17     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:278:11)
#18     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#19     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#20     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
#21     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
#25     _invoke1 (dart:ui/hooks.dart:185:10)
#26     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:293:7)
#27     _dispatchPointerDataPacket (dart:ui/hooks.dart:98:31)
(elided 5 frames from class _AssertionError and dart:async)
Handler: "onEnd"
Recognizer: VerticalDragGestureRecognizer#f6117
  start behavior: start
====================================================================================================

======== Exception caught by animation library =====================================================
The following assertion was thrown while notifying listeners for AnimationController:
A _DraggableScrollableSheetScrollPosition was used after being disposed.

Once you have called dispose() on a _DraggableScrollableSheetScrollPosition, it can no longer be used.
When the exception was thrown, this was the stack: 
#0      ChangeNotifier._debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:114:9)
#1      ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:120:6)
#2      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:288:12)
#3      ScrollPosition.notifyListeners (package:flutter/src/widgets/scroll_position.dart:968:11)
#4      ScrollPosition.setPixels (package:flutter/src/widgets/scroll_position.dart:278:9)
#5      ScrollPositionWithSingleContext.setPixels (package:flutter/src/widgets/scroll_position_with_single_context.dart:82:18)
#6      BallisticScrollActivity.applyMoveTo (package:flutter/src/widgets/scroll_activity.dart:566:21)
#7      BallisticScrollActivity._tick (package:flutter/src/widgets/scroll_activity.dart:553:10)
#8      AnimationLocalListenersMixin.notifyListeners (package:flutter/src/animation/listener_helpers.dart:155:19)
#9      AnimationController._tick (package:flutter/src/animation/animation_controller.dart:829:5)
#10     Ticker._tick (package:flutter/src/scheduler/ticker.dart:238:12)
#11     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#12     SchedulerBinding.handleBeginFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:1056:11)
#13     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:400:8)
#14     SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:1054:17)
#15     SchedulerBinding._handleBeginFrame (package:flutter/src/scheduler/binding.dart:975:5)
#19     _invoke1 (dart:ui/hooks.dart:185:10)
#20     PlatformDispatcher._beginFrame (dart:ui/platform_dispatcher.dart:248:5)
#21     _beginFrame (dart:ui/hooks.dart:116:31)
(elided 3 frames from dart:async)
The AnimationController notifying listeners was: AnimationController#0fd80(▶ -25.516; for BallisticScrollActivity)

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: regressionIt was better in the past than it is nowf: scrollingViewports, list views, slivers, etc.found in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions