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

ScrollController not attached to any scroll views #34

Open
pishguy opened this issue Jun 18, 2019 · 3 comments
Open

ScrollController not attached to any scroll views #34

pishguy opened this issue Jun 18, 2019 · 3 comments

Comments

@pishguy
Copy link

pishguy commented Jun 18, 2019

The following assertion was thrown while handling a gesture:

ScrollController not attached to any scroll views.
'package:flutter/src/widgets/scroll_controller.dart':
Failed assertion: line 110 pos 12: '_positions.isNotEmpty'

RubberBottomSheetState._onVerticalDragDown (package:diabetist_pro/backend/componets/rubber/src/bottom_sheet.dart:181:33)

@guillaumeprevost
Copy link

Hi, first of all thanks for the great plugin! Good work 💯

We have the same issue here!

It seems like it comes from line 182 of bottom_sheet.dart:
_hold = _scrollController.position.hold(_disposeHold);

I've tried to wrap this line into an if (_scrollController.hasClients) and this seems to prevent the exception. But I don't know the plugin well enough to know whether this may have side-effects.

Method after modification:

  void _onVerticalDragDown(DragDownDetails details) {
    if(_hasHeader){
      if(_draggingPeak(details.globalPosition)){
        _setScrolling(false);
      } else {
        _setScrolling(true);
      }
    }
    if(_shouldScroll) {
      assert(_hold == null);
      if (_scrollController.hasClients)
        _hold = _scrollController.position.hold(_disposeHold);
    }
  }

I hope this helps fixing this @mcrovero

@pishguy
Copy link
Author

pishguy commented Jun 19, 2019

@guillaumeprevost

thanks, could you send PR please?

@mcrovero
Copy link
Owner

Thanks, that's the best solution for now. I'll fix it in the next release

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

3 participants