Merge pull request #493 from GetStream/feat/message-list-header-footer

feat: add support for messageListView header/footer
This commit is contained in:
Salvatore Giordano
2021-06-24 17:12:11 +02:00
committed by GitHub
2 changed files with 122 additions and 76 deletions
@@ -25,7 +25,7 @@ class BetterStreamBuilder<T> extends StatefulWidget {
final T initialData;
/// Comparator used to check if the new data is different than the last one
final bool Function(T?, T)? comparator;
final bool Function(T?, T?)? comparator;
/// Builder that builds based on the new snapshot
final Widget Function(BuildContext context, T data) builder;
@@ -96,9 +96,8 @@ class _BetterStreamBuilderState<T> extends State<BetterStreamBuilder<T>> {
void _onEvent(T event) {
_lastError = null;
final isEqual = widget.comparator != null
? widget.comparator!(_lastEvent, event)
: event == _lastEvent;
final isEqual =
widget.comparator?.call(_lastEvent, event) ?? event == _lastEvent;
if (!isEqual) {
if (mounted) {
setState(() {});