|
1 | 1 | ## 2.9.0 |
2 | 2 |
|
| 3 | +This release introduces two-sided pagination. You can now load newer messages using the new `onStartReached` callback, while `onEndReached` continues to work for older messages. For pagination to work correctly, messages should be inserted instantly, without animation. |
| 4 | + |
| 5 | +To allow this and offer more granular control, a new optional `animated` parameter has been added to all controller operations except `update`. This is not a breaking change, but if you'd like to use it, you can update your controller like so: |
| 6 | +```dart |
| 7 | +insertMessage(Message message, {int? index}) // ❌ |
| 8 | +insertMessage(Message message, {int? index, bool animated = true}) // ✅ |
| 9 | +ChatOperation.insert(..., animated: animated) // add animated to insert operations |
| 10 | +
|
| 11 | +insertAllMessages(List<Message> messages, {int? index}) // ❌ |
| 12 | +insertAllMessages(List<Message> messages, {int? index, bool animated = true}) // ✅ |
| 13 | +ChatOperation.insertAll(..., animated: animated) // add animated to insertAll operations |
| 14 | +
|
| 15 | +removeMessage(Message message) // ❌ |
| 16 | +removeMessage(Message message, {bool animated = true}) // ✅ |
| 17 | +ChatOperation.remove(..., animated: animated) // add animated to remove operations |
| 18 | +
|
| 19 | +setMessages(List<Message> messages) // ❌ |
| 20 | +setMessages(List<Message> messages, {bool animated = true}) // ✅ |
| 21 | +ChatOperation.set(..., animated: animated) // add animated to set operations |
| 22 | +``` |
| 23 | + |
| 24 | +As an optional improvement, you can use this parameter to disable animations when clearing the chat, which is now the default behaviour in the example apps. |
| 25 | +```dart |
| 26 | +ChatOperation.set(messages, animated: messages.isEmpty ? false : animated) // inside the controller |
| 27 | +``` |
| 28 | + |
| 29 | +⚠️ There is a small potential breaking change: `LoadMoreNotifier` was updated for two-sided loading. If you used a custom **LoadMore** widget and used `LoadMoreNotifier` to measure its height, that logic has been removed as it was not used. Additionally, the internal property `_isLoading` is now `_isLoadingOlder`, and `_isLoadingNewer` has been added. |
| 30 | + |
3 | 31 | - **FEAT**: implement two-sided pagination ([#840](https://github.com/flyerhq/flutter_chat_ui/issues/840)). ([8cca3141](https://github.com/flyerhq/flutter_chat_ui/commit/8cca314116664216b9f1697fabde0eccfd1c582d)) |
4 | 32 |
|
5 | 33 | ## 2.8.1 |
|
0 commit comments