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

Error with showFlexibleBottomSheet - DraggableScrollableController is not attached to a sheet #57

Closed
Skquark opened this issue Jun 25, 2022 · 11 comments
Labels
bug Something isn't working new issues

Comments

@Skquark
Copy link

Skquark commented Jun 25, 2022

I'm getting this error all of a sudden after upgrading to the latest version:

The following assertion was thrown building LayoutBuilder:
DraggableScrollableController is not attached to a sheet. A DraggableScrollableController must be used in a DraggableScrollableSheet before any of its methods are called.
'package:flutter/src/widgets/draggable_scrollable_sheet.dart':
package:flutter/…/widgets/draggable_scrollable_sheet.dart:1
Failed assertion: line 170 pos 7: 'isAttached'

I tried a bunch of debug steps, looked into the code, doublechecked usage of showFlexibleBottomSheet, checked all issues, and can't figure it out. It was working fine before, I'd show my code, but it's basically the same as what you show in the examples. Any suggestions?

@Skquark Skquark added the bug Something isn't working label Jun 25, 2022
@Skquark
Copy link
Author

Skquark commented Jul 5, 2022

I had to roll back to ^1.0.5 for the error to go away whenever I'd call skowFlexibleBottomSheet, even v2.0.0 was broken. Maybe it has to do with the latest Flutter update, I'm on the master channel which might have changed something with the DraggableScrollableController code. I don't know, but I'd be surprised if I'm the only person getting this bug.

@airsend
Copy link

airsend commented Jul 12, 2022

Same error

@Skquark Skquark changed the title Error calling showFlexibleBottomSheet Error with showFlexibleBottomSheet - DraggableScrollableController is not attached to a sheet Jul 23, 2022
@treacks5
Copy link

treacks5 commented Aug 9, 2022

Same 🐛

@NatsuOnFire
Copy link

NatsuOnFire commented Aug 30, 2022

Same error with new flutter 3.3.0 :

DraggableScrollableController is not attached to a sheet. A DraggableScrollableController must be used in a DraggableScrollableSheet before any of its methods are called.
'package:flutter/src/widgets/draggable_scrollable_sheet.dart':
Failed assertion: line 170 pos 7: 'isAttached'

see flutter/flutter#100269

@Darkildo
Copy link

Darkildo commented Sep 3, 2022

I fix the problem when insert check on isAttached.
изображение

@Skquark
Copy link
Author

Skquark commented Sep 4, 2022

Alright, that fix makes sense, good deal. Now it just needs to be patched in a new version release, then we'll be able to update to the corrected build. Will keep an eye out for the upgrade, would rather not create a fork to apply that change when it should be changed for everyone. Thanks!

@aprzedecki
Copy link

@Darkildo @Skquark can you create a PR with this fix ?

@aprzedecki
Copy link

Forget it, here is the PR #64

@zaharovroman
Copy link
Contributor

The reason of issue: content of FlexibleBottomSheet uses size of it's controller when controller was not attached
How was fixed: set default size for content of FlexibleBottomSheet with value of initHeight

 - currentExtent: _controller.size,
+ currentExtent: _controller.isAttached
+   ? _controller.size
+   : widget.initHeight,

Fixed on: #65

@zaharovroman
Copy link
Contributor

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2022-09-26.at.14.21.32.mp4

@KostyaLocal
Copy link

Same bug. Is it fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new issues
Projects
None yet
Development

No branches or pull requests

10 participants