-
Notifications
You must be signed in to change notification settings - Fork 480
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
ScrollablePositionedList: Assert when reuse the ScrollablePositionedList #24
Comments
Did you add the property itemScrollController inside the builder?
|
@rockingdice I haven't been able to repo the issue. Do you have sample code available? |
@tarobins I'll try to make a repo project for you. |
@tarobins same problems jumpToscrollTo |
I was trying to repo this issue with the withControl branch of this project: https://github.com/tarobins/page_list_demo/tree/withControl The app has two pages with a list on each and a button that jumps the first list to 100. The button only controller the first list, and when the second list is showing, and you press the button you do get an error, kind of expectedly. Is this the situation you were running into or something else? Thanks Tom |
as an aside, I ran into this while trying the above #43 |
I had the same problem when using ScrollablePositionedList in a stateless widget. Converting it to a stateful widget did the trick |
Also define ItemScrollController inside initState() method. ItemScrollController _controller; |
I also had this issue, as far as I can tell I'm using everything correctly. Converting the containing widget from Stateless to Statefull fixed it with no other changes. |
@nachoapps do you have an example of where it didn't work? |
I do in my app, but it's not extracted to a reusable case right now. Also my flutter code is trash, so, sorry about that. If you want to take a look, here's the commit that fixed it: Basically what I did here was create a Stack that automatically puts 'to bottom' and 'to top' buttons in the upper right/left hand corner, hovering over a list. With the regular ListView this is awful and slow, but with your widget super fast! I'm using that stack widget here: My app has bottom tabs, and the behavior I saw was clicking between tabs could semi-randomly cause a red screen of death. |
I think #119 will fix this issue. Once that PR is closed, please let me know if not. |
Move itemScrollControllerDetachment to deactivate. Fixes google#95 Fixes google#24 ## Related Issues google#95 google#24 Closes google#119 PiperOrigin-RevId: 311859101
## Description Move itemScrollControllerDetachment to deactivate. Fixes google#95 Fixes google#24 ## Related Issues google#95 google#24 Closes google#119 PiperOrigin-RevId: 311930043
Seems fixed in 1.6, thanks! |
I'm having it back on 0.1.8... The following assertion was thrown building Container:
'package:scrollable_positioned_list/src/scrollable_positioned_list.dart': Failed assertion: line 202 pos 12: '_scrollableListState == null': is not true.
The relevant error-causing widget was
Container
lib/widgets/dive_list.dart:198
When the exception was thrown, this was the stack
#2 ItemScrollController._attach
package:scrollable_positioned_list/src/scrollable_positioned_list.dart:202
#3 _ScrollablePositionedListState.initState
package:scrollable_positioned_list/src/scrollable_positioned_list.dart:241
#4 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4765
#5 ComponentElement.mount
package:flutter/…/widgets/framework.dart:4601
... Normal element mounting (111 frames) |
Well, it's not breaking things, just an assert triggered when dispose.
flutter doctor -v:
The text was updated successfully, but these errors were encountered: