Skip to content

[How to use] CustomScrollView 中SliverList.builder 想要实现IM保持消息位置需要怎么实现? #125

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

Closed
floatTop opened this issue Apr 3, 2025 · 3 comments
Assignees

Comments

@floatTop
Copy link

floatTop commented Apr 3, 2025

Platforms

dart

Description

直接ListViewObserver和ChatScrollObserver好像并不能实现这样场景

My code

ListViewObserver(
                controller: controller.observerController,
                child: SmartRefresher(
                  physics: ChatObserverClampingScrollPhysics(
                      observer: controller.chatObserver),
                  scrollController: controller.scrollController,
                  enablePullUp: true,
                  enablePullDown: true,
                  controller: controller.refreshController,
                  onRefresh: controller.onRefresh,
                  onLoading: controller.onLoading,
                  header: RefreshHeaderWidget(),
                  footer: buildCustomFooter,
                  child: CustomScrollView(
                    slivers: [
                      SliverToBoxAdapter(child: _buildGoldenDogInfo()),
                      SliverToBoxAdapter(child: _buildResetButton()),
                      _buildSignalList()
                    ],
                  ),
                ),
              ),

Try do it

No response

@LinXunFeng
Copy link
Member

通过 ListViewObserversliverListContexts 回调返回你要观察的 SliverListBuildContext 即可。

@floatTop
Copy link
Author

floatTop commented Apr 8, 2025

通过 ListViewObserversliverListContexts 回调返回你要观察的 SliverListBuildContext 即可。

有相应的demo么?

@LinXunFeng
Copy link
Member

没有,只需要通过 sliverListContexts 传个 _buildSignalListBuildContext 而已,sliverListContexts 的使用可以在示例代码里找

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

2 participants