Skip to content

SliverMainAxisGroup does not handle scrollOffsetCorrection #174368

Closed

Description

@manu-sncf

Steps to reproduce

  1. Display a SliverList in SliverMainAxisGroup.
  2. Scroll to middle/end of list.
  3. Press an item to unhide elements
  4. Scroll up, list breaks, doesn't show all elements

The example issue is similar to #59819 but on SliverMainAxisGroup.

Expected results

The items display is consistent during the scroll.

Actual results

The scroll position is not consistent.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Sliver Example'), backgroundColor: Colors.blue),
        body: const _MyAnomalyWidget(),
      ),
    ),
  );
}

class _MyAnomalyWidget extends StatefulWidget {
  const _MyAnomalyWidget();

  @override
  State<_MyAnomalyWidget> createState() => __MyAnomalyWidgetState();
}

class __MyAnomalyWidgetState extends State<_MyAnomalyWidget> {
  bool skip = true;

  @override
  Widget build(BuildContext context) {
    Widget buildItem(BuildContext context, int index) {
      return !skip || index.isEven
          ? InkWell(
              onTap: () => setState(() => skip = !skip),
              child: Card(
                child: ListTile(title: Text('item$index', style: const TextStyle(fontSize: 80))),
              ),
            )
          : Container();
    }

    return CustomScrollView(
      slivers: <Widget>[
        SliverMainAxisGroup(
          slivers: <Widget>[
            SliverList(delegate: SliverChildBuilderDelegate(buildItem, childCount: 30)),
          ],
        ),
      ],
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
issue.mp4

Logs

Logs
Restarted application in 668ms.
D/EGL_emulation(15514): app_time_stats: avg=726.62ms min=0.77ms max=2903.44ms count=4
D/EGL_emulation(15514): app_time_stats: avg=11344.32ms min=11344.32ms max=11344.32ms count=1
D/EGL_emulation(15514): app_time_stats: avg=7.33ms min=1.01ms max=30.22ms count=58
D/EGL_emulation(15514): app_time_stats: avg=12.83ms min=0.91ms max=28.78ms count=58
D/EGL_emulation(15514): app_time_stats: avg=64.03ms min=9.10ms max=1124.57ms count=24
D/EGL_emulation(15514): app_time_stats: avg=89.59ms min=11.72ms max=1535.21ms count=24
D/EGL_emulation(15514): app_time_stats: avg=16.25ms min=7.17ms max=25.81ms count=61
D/EGL_emulation(15514): app_time_stats: avg=14.22ms min=1.27ms max=32.84ms count=58
D/EGL_emulation(15514): app_time_stats: avg=8.02ms min=0.97ms max=178.13ms count=48
D/EGL_emulation(15514): app_time_stats: avg=45.39ms min=1.08ms max=1236.98ms count=39
D/EGL_emulation(15514): app_time_stats: avg=9.85ms min=0.98ms max=25.00ms count=60
D/EGL_emulation(15514): app_time_stats: avg=2.16ms min=0.89ms max=9.06ms count=61
D/EGL_emulation(15514): app_time_stats: avg=17.63ms min=0.88ms max=544.41ms count=48
D/EGL_emulation(15514): app_time_stats: avg=21.86ms min=10.32ms max=119.29ms count=47
D/EGL_emulation(15514): app_time_stats: avg=163.83ms min=17.87ms max=882.79ms count=7
D/EGL_emulation(15514): app_time_stats: avg=69.51ms min=7.27ms max=1348.90ms count=25
D/EGL_emulation(15514): app_time_stats: avg=16.26ms min=7.27ms max=25.79ms count=61
D/EGL_emulation(15514): app_time_stats: avg=15.92ms min=9.89ms max=22.39ms count=61
D/EGL_emulation(15514): app_time_stats: avg=16.64ms min=4.30ms max=36.11ms count=58
D/EGL_emulation(15514): app_time_stats: avg=35.44ms min=6.49ms max=615.66ms count=33
D/EGL_emulation(15514): app_time_stats: avg=13.20ms min=1.13ms max=51.64ms count=56

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.33.0-1.0.pre-1252, on macOS 15.6 24G84 darwin-arm64, locale fr-FR) [2,3s]
    • Flutter version 3.33.0-1.0.pre-1252 on channel master at /Users/emmanuel_lefebvre/fvm/versions/master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fc28781423 (3 weeks ago), 2025-08-03 10:36:42 -0400
    • Engine revision fc28781423
    • Dart version 3.10.0 (build 3.10.0-59.0.dev)
    • DevTools version 2.48.0
    • Pub download mirror https://artifact.socrate.vsct.fr/artifactory/api/pub/all-pub
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [1 689ms]
    • Android SDK at /Users/emmanuel_lefebvre/Library/Android/sdk
    • Emulator version 35.5.10.0 (build_id 13402964) (CL:N/A)
    • Platform android-36, build-tools 35.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [1 405ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [7ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (3 available) [6,8s]
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 15 (API 35) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 15.6 24G84 darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 139.0.7258.139
    ! Error: Browsing on the local area network for iPhone XS. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources [266ms]
    • All expected network resources are available.

Activity

  1. darshankawar commented on Aug 26, 2025

    @darshankawar
    Member

    Thanks for the report and potential fix. Seeing the same behavior as reported on latest sdk versions.

    stable : 3.35.1
    master : 3.36.0-1.0.pre-253
    
  2. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    f: scrollingViewports, list views, slivers, etc.
    and removed
    in triagePresently being triaged by the triage team
    on Aug 26, 2025
  3. added
    P2Important issues not at the top of the work list
    on Aug 26, 2025
  4. added
    r: fixedIssue is closed as already fixed in a newer version
    on Sep 8, 2025
  5. github-actions commented on Sep 22, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.found in release: 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions