Skip to content

CupertinoSliverNavigationBar's collapse animation can get stuck in an infinite loop #164458

@loic-sharma

Description

@loic-sharma

Steps to reproduce

  1. Create a Cupertino app with a CupertinoSliverNavigationBar where the scrollable content extends past the viewport only if CupertinoSliverNavigationBar is expanded, but fits within the viewport if CupertinoSliverNavigationBar is collapsed.

  2. Scroll down to the bottom.

Expected results

The CupertinoSliverNavigationBar should collapse and stay collapsed.

Actual results

The CupertinoSliverNavigationBar loops between its collapsed and expanded mode forever.

Code sample

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

void main() {
  runApp(
    CupertinoApp(
      home: CupertinoPageScaffold(
        child: CustomScrollView(
          slivers: [
            CupertinoSliverNavigationBar(
              largeTitle: Text('Hello World!'),
            ),
            SliverList.builder(
              // TODO: Edit the item count such that the list
              // extends past the viewport when the navigation
              // bar is expanded, but fits in the viewport when
              // the navigation bar is collapsed
              itemCount: 14,
              itemBuilder: (context, index) {
                return CupertinoListTile(
                  title: Text('Item $index'),
                );
              },
            ),
          ],
        ),
      ),
    ),
  );
}

Screenshots or Video

Screenshots / Video demonstration

Image

Logs

N/A

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.29.0-1.0.pre.184, on Microsoft Windows [Version 10.0.26100.3194], locale en-US) [1,986ms]
    • Flutter version 3.29.0-1.0.pre.184 on channel master at C:\Code\f\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d8585d936 (4 weeks ago), 2025-01-30 15:30:45 -0800
    • Engine revision 4d8585d936
    • Dart version 3.8.0 (build 3.8.0-24.0.dev)
    • DevTools version 2.42.0

[✓] Windows Version (11 Pro 64-bit, 24H2, 2009) [1,839ms]

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [1,298ms]
    • Android SDK at C:\Users\sharm\AppData\Local\Android\sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\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 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Chrome - develop for the web [73ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.2) [72ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34018.315
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2021.2) [17ms]
    • Android Studio at C:\Program Files\Android\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
    • android-studio-dir = C:\Program Files\Android\Android Studio
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[✓] VS Code (version 1.97.2) [15ms]
    • VS Code at C:\Users\sharm\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.104.0

[✓] Connected device (3 available) [169ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26100.3194]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 130.0.6723.70
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 133.0.3065.92

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

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: cupertinoflutter/packages/flutter/cupertino repositoryf: scrollingViewports, list views, slivers, etc.found in release: 3.29Found to occur in 3.29found in release: 3.30Found to occur in 3.30frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions