google / flutter.widgets

https://pub.dev/packages/flutter_widgets
BSD 3-Clause "New" or "Revised" License
1.37k stars 474 forks source link

[ScrollablePositionedList] with StickyHeader #516

Open daddowzoubair opened 7 months ago

daddowzoubair commented 7 months ago

I'm using sticky_headers: ^0.3.0+2 with scrollable_positioned_list: ^0.3.8

using this code

  return ScrollablePositionedList.builder(
      initialScrollIndex: _initialScrollIndex,
      shrinkWrap: true,
      itemCount: products.length,
      itemBuilder: (context, mainIndex) => 
      StickyHeader(
        header: ProductsListItem(
            listItem: products[mainIndex].first,
          ), 
        content:  ListView.builder(
          shrinkWrap: true,
          physics: const ClampingScrollPhysics(),
          itemCount: products[mainIndex].length - 1,
          itemBuilder: (context, index) {
            return ProductsListItem(
              listItem: products[mainIndex][index + 1],
            );
          }
        )
      )
    );

And this is my flutter doctor information [✓] Flutter (Channel stable, 3.16.9, on macOS 14.2.1 23C71 darwin-arm64, locale en-AE) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.86.1) [✓] VS Code (version 1.76.2) [✓] Connected device (3 available) [✓] Network resources

When I scroll beside the initialScrollIndex I have this dancing for the header

https://github.com/google/flutter.widgets/assets/117348118/a6aa4be8-6006-4a00-8b4b-95555127ab4f