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
440 stars 46 forks source link

[Desktop]Can not get onObserve callback #12

Closed liangsmfish closed 2 years ago

liangsmfish commented 2 years ago

Env: Flutter 3.3.6 This is my code:

  Widget getContinuousThumbnailItem(WidgetRef ref) {
    Widget builder = ListView.builder(
        itemExtent: ctWidth,
        controller: scrollController,
        scrollDirection: Axis.horizontal,
        itemCount: getCTDisplayCount(ref),
        itemBuilder: (context, i) {
          return ContinuousThumbnailItem(
            width: ctWidth,
            height: ctHeight,
            index: i,
          );
        });
    builder = ListViewObserver(
      child: builder,
      onObserve: (resultModel) {
        print('firstChild.index -- ${resultModel.firstChild?.index}');
        print('displaying -- ${resultModel.displayingChildIndexList}');
      },
    );

    return builder;
  }

It seems that onObserve is not callback

LinXunFeng commented 2 years ago

Thanks for your feedback, please update to version 1.6.2