Skip to content

Transition between two CupertinoSliverNavigationBar.search routes shows search artifacts mid-transition if one is collapsed and one is extended #168494

@victorsanni

Description

@victorsanni

Steps to reproduce

  1. Create two routes with CupertinoSliverNavigationBar.search, transitionBetweenRoutes = true and bottomMode = .automatic
  2. Scroll to collapse either of the nav bars
  3. Navigate either forward or backwards

Expected results

No search artifacts are shown mid-transition

Actual results

Search artifacts are shown mid-transition

Code sample

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

void main() => runApp(const NavBarBlueApp());

class NavBarBlueApp extends StatelessWidget {
  const NavBarBlueApp({super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      theme: CupertinoThemeData(),
      home: FirstPage(),
    );
  }
}

class FirstPage extends StatelessWidget {
  const FirstPage({super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: CustomScrollView(
        slivers: [
          CupertinoSliverNavigationBar.search(
            stretch: true,
            previousPageTitle: "Page 1",
            trailing: CupertinoButton(
                padding: EdgeInsets.zero,
                alignment: Alignment.center,
                child: Icon(CupertinoIcons.add_circled),
                onPressed: () {}),
            searchField: Builder(builder: (context) {
              return CupertinoSearchTextField(
                  autofocus: true,
                  suffixMode: OverlayVisibilityMode.always,
                  suffixIcon: Icon(
                    CupertinoIcons.mic_solid,
                  ));
            }),
            largeTitle: Text('iPhone'),
          ),
          SliverList(
            delegate: SliverChildBuilderDelegate(
              (BuildContext context, int index) {
                return GestureDetector(
                  onTap: () => Navigator.of(context).push(
                    CupertinoPageRoute(
                      builder: (context) => SecondPage(),
                    ),
                  ),
                  child: CupertinoListTile(
                    title: Text('Entry $index'),
                  ),
                );
              },
              childCount: 20,
            ),
          ),
        ],
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  const SecondPage({super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: CustomScrollView(
        slivers: [
          CupertinoSliverNavigationBar.search(
            stretch: true,
            previousPageTitle: 'iPhone',
            searchField: CupertinoSearchTextField(),
            largeTitle: Text('Third Page'),
          ),
          SliverList(
            delegate: SliverChildBuilderDelegate(
              (BuildContext context, int index) {
                return CupertinoListTile(
                  title: Text('Entry $index'),
                );
              },
              childCount: 20,
            ),
          ),
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

If the first page is collapsed

Image

If the second page is collapsed

Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.32.0-1.0.pre.439, on macOS
    15.4.1 24E263 darwin-arm64, locale en)
    ! Flutter version 3.32.0-1.0.pre.439 on channel [user-branch] at
      /Users/victorsanni/development/flutter
      Currently on an unknown channel. Run `flutter channel` to
      switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following
      instructions at https://flutter.dev/setup.
    ! Upstream repository [email protected]:victorsanni/flutter.git is
      not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to
      [email protected]:victorsanni/flutter.git to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK
    version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.88.1)
[✓] Connected device (3 available)
    ! Error: Browsing on the local area network for Victor’s iPhone.
      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

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: cupertinoflutter/packages/flutter/cupertino repositoryframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions