-
Notifications
You must be signed in to change notification settings - Fork 498
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
[scrollable_positioned_list] _scrollableListState == null using PageView #231
Comments
Please, someone help me. It could be that I'm doing something wrong. |
This seems to be the same problem I had a few years ago: #39 |
Please, help me. |
1 similar comment
Please, help me. |
i need help too,5555 |
The problem is that the ItemScrollController can only be attached to one ScrollablePositionedList at a time. However, when you switch pages in the PageView, there are two ScrollablePositionedList visible for a moment and you're trying to have the ItemScrollController attached to both. You'll need to come up with a way to have a different ItemScrollController for each page. |
Okay, Tarobins, I'll try. Thanks for your help! |
I put the ItemScrollController and the ItemPositionListener inside the PageView.builder's itemBuilder, solved the problem. Thanks @tarobins for the tip. |
@oseiasmribeiro can you share the code here, because I'm having the same issue with Page view builder |
A state problem occurs when using the ScrollablePositionedList inside a PageView. The problem can be reproduced through the sample repository: https://github.com/oseiasmribeiro/scrollablepositionedlistpageview
Actual behavior
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Expanded(flex: 1):
'package:scrollable_positioned_list/src/scrollable_positioned_list.dart': Failed assertion: line 222 pos 12: '_scrollableListState == null': is not true.
The relevant error-causing widget was
Expanded
lib/bible.dart:156
When the exception was thrown, this was the stack
#2 ItemScrollController._attach
package:scrollable_positioned_list/src/scrollable_positioned_list.dart:222
#3 _ScrollablePositionedListState.initState
package:scrollable_positioned_list/src/scrollable_positioned_list.dart:271
#4 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4765
#5 ComponentElement.mount
package:flutter/…/widgets/framework.dart:4601
... Normal element mounting (7 frames)
...
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
'package:scrollable_positioned_list/src/scrollable_positioned_list.dart': Failed assertion: line 222 pos 12: '_scrollableListState == null': is not true.
The relevant error-causing widget was
Expanded
lib/bible.dart:152
════════════════════════════════════════════════════════════════════════════════
Environment
scrollable_positioned_list: 1.9.0
MacBook Pro 16,2 / macOS 10.15.7 (19H15)
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.7 19H15 darwin-x64, locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.53.2)
[✓] Connected device (1 available)
The text was updated successfully, but these errors were encountered: