fluttercandies / flutter_scrollview_observer

A widget for observing data related to the child widgets being displayed in a ScrollView. Maintainer: @LinXunFeng
https://pub.dev/packages/scrollview_observer
MIT License
438 stars 47 forks source link

[How to use] Bug in example #77

Closed geghamh2 closed 7 months ago

geghamh2 commented 7 months ago

Platforms

ANDROID

Description

In your example in ChatPage, when we change _addMessage(RandomTool.genInt(min: 1, max: 3))=> _addMessage(RandomTool.genInt(min: 10, max: 15)); keep position is not working correctly;

My code

No response

Try do it

No response

LinXunFeng commented 7 months ago

Please refer to the last description of 3.1、Basic usage

Note: This feature relies on the latest message view before the message is inserted as a reference to calculate the offset, so if too many messages are inserted at once and the reference message view cannot be rendered, this feature will fail, and you need to try to avoid this problem by setting a reasonable value for cacheExtent of ScrollView by yourself!

The size calculation of cacheExtent can refer to the following formula:

cacheExtent = [maximum height of a message] * [number of messages inserted at one time] + 200