Skip to content

[BUG] SliverPersistentHeader does not work inside SliverMainAxisGroup wrapped by another SliverMainAxisGroup  #155395

@zs-dima

Description

@zs-dima

Steps to reproduce

For example, we have a widget that returns Sliver to reuse it in many places, we wrap the result slivers list in the SliverMainAxisGroup and it breaks the SliverPersistentHeader pin option.

Expected results

SliverPersistentHeader pinned option have to work in this case.

Actual results

SliverPersistentHeader scrolls together with list.

Code sample

Code sample
        StreamBuilder(
          builder: (context, snapshot) => allItems.isEmpty
            ? const SliverFillRemaining(
                hasScrollBody: false,
                child: Center(child: Text('No Items found')),
              )
            : SliverMainAxisGroup(
                slivers: [
                  ...allItems.map((i) => i.groups).toSet().map(
                    (group) {
                      final items = allItems.where((i) => i.status == group).toList();

                      return SliverMainAxisGroup(
                        slivers: [
                          SliverPersistentHeader(
                            pinned: true,
                            delegate: AdSetsListHeaderDelegate(group),
                          ),
                          SliverFixedExtentList(
                            itemExtent: 54,

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.24.2, on Microsoft Windows [Version 10.0.22631.4169], locale ru-RU)
    • Flutter version 3.24.2 on channel stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cf269e36d (2 weeks ago), 2024-09-03 14:30:00 -0700
    • Engine revision a6bd3f1de1
    • Dart version 3.5.2
    • DevTools version 2.37.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK
    • Platform android-35, build-tools 35.0.0
    • Java binary
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.3)
    • Visual Studio
    • Visual Studio Community 2022 version 17.11.35303.130
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.1)
    • Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.4169]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 128.0.6613.138
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 128.0.2739.79

[√] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: solvedIssue is closed as solved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions