Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Search field icons shown mid-transition in CupertinoSliverNavigationBar.search .automatic mode when scrolled #165689

Closed
@victorsanni

Description

@victorsanni

Steps to reproduce

  1. Create an app with a CupertinoSliverNavigationBar.search on one page and a nav bar on the other page with transitionBetweenRoutes set to true.
  2. Scroll the first page.
  3. Navigate to the next page.
  4. Go back to the first page.

Expected results

No artifacts from the search field should be shown mid-transition.

Actual results

Notice that the search field leading and trailing icons are shown mid-transition.

Code sample

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

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

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

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

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

  @override
  State<FirstPage> createState() => _FirstPageState();
}

class _FirstPageState extends State<FirstPage> {
  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: CustomScrollView(
        slivers: [
          CupertinoSliverNavigationBar.search(
            searchField: CupertinoSearchTextField(
                suffixMode: OverlayVisibilityMode.always,
                suffixIcon: Icon(
                  CupertinoIcons.mic_solid,
                )),
            largeTitle: Text('Lists'),
          ),
          SliverList(
            delegate: SliverChildBuilderDelegate(
              (BuildContext context, int index) {
                return GestureDetector(
                  onTap: () => Navigator.of(context).push(
                    CupertinoPageRoute(
                      builder: (context) => SecondPage(),
                    ),
                  ),
                  child: CupertinoListTile(
                    title: Text('Item $index'),
                  ),
                );
              },
              childCount: 20,
            ),
          ),
        ],
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
        transitionBetweenRoutes: true,
        bottom: PreferredSize(
            preferredSize: Size.fromHeight(20), child: Placeholder()),
        middle: Text('Second Page'),
      ),
      child: CustomScrollView(
        slivers: [
          SliverList(
            delegate: SliverChildBuilderDelegate(
              (BuildContext context, int index) {
                return CupertinoListTile(
                  title: Text('Entry $index'),
                );
              },
              childCount: 20,
            ),
          ),
        ],
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
search.artifacts.2.mov

Logs

No response

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.31.0-1.0.pre.160, on macOS 15.3.1 24D70 darwin-arm64, locale en)
    ! Flutter version 3.31.0-1.0.pre.160 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 repositoryfound in release: 3.29Found to occur in 3.29found in release: 3.31Found to occur in 3.31frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-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