karvulf / flutter-reorderable-grid-view

BSD 3-Clause "New" or "Revised" License
158 stars 23 forks source link

Potential bug: Scrollable.of() was called with a context that does not contain a Scrollable widget. #62

Closed gmarizy closed 1 year ago

gmarizy commented 1 year ago

I encountered this crash after upgrading flutter to 3.7. I didn't downgraded flutter to confirm this hypothesis, but found that other people encountered this error (with other widgets) since upgrading to 3.7: https://github.com/flutter/flutter/issues/115705 https://stackoverflow.com/questions/74324417/scrollable-of-was-called-with-a-context-that-does-not-contain-a-scrollable-wid/75251778#75251778.

As a workaround, I wrapped with Scrollable.

Scrollable(
      viewportBuilder: (BuildContext context, ViewportOffset position) => ReorderableBuilder(...)
);
karvulf commented 1 year ago

Hi @gmarizy Thanks for noticing me about this issue. The next days, I am really busy and cannot fix this issue, but I will try to fix that the next week.

gmarizy commented 1 year ago

Don't worry for me, the workaround work just fine.

KnightJun commented 1 year ago

Wrapped with Scrollable can cause other problems for me. I changed the code of flutter-reorderable-grid-view to use Scrollable.beOf instead of Scrollable.of to solve this problem, but this method only works for flutter 3.7

RoyalCoder88 commented 1 year ago

having the same problem :( how can we fix this issue? thanks in advance!

RoyalCoder88 commented 1 year ago

Hi friends,

A quick fix for this issue, just warp your recordable list in a Scrollable widget , like this:

                        Scrollable(
                          viewportBuilder:
                              (BuildContext context, ViewportOffset position) =>
                                  _buildReorderableWidget(),
                        ),
karvulf commented 1 year ago

I fixed this error with the new version 4.0.0. This version only contains the bugfix because of the flutter upgrade. @gmarizy @KnightJun @RoyalCoder88

gmarizy commented 1 year ago

Thank you for your reactivity.