Skip to content

Title jumps during a CupertinoNavigationBar -> CupertinoNavigationBar hero transition #90589

Closed

Description

@henry2man

August 2024 update:


Steps to Reproduce

This issue is very similar to #45068 but it differs in one thing: I can reproduce similar text jumps with non default text Scale when the transition is done between two pages both using CupertinoSliverNavigationBar (in #45068 was a CupertinoSliverNavigationBar -> CupertinoNavigationBar and, in my tests, this issue is not present in the current SDK)

I'm using latest Flutter stable 2.5.1 and iOS 15. The issue is present both on simulator and physical devices.

Steps to reproduce the issue:

  1. Run flutter create bug.
  2. Update the main.dart file as follows:
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';

void main() {
  return runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const CupertinoApp(
      home: InitPage(),
    );
  }
}

class InitPage extends StatelessWidget {
  const InitPage({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double textScale = MediaQuery.of(context).textScaleFactor;
    return CupertinoPageScaffold(
        child: CustomScrollView(slivers: [
      CupertinoSliverNavigationBar(
        largeTitle: Text("${textScale == 1.0 ? "Good" : "BUGGY"} header"),
      ),
      SliverFillRemaining(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              "Actual Scale: $textScale",
              style: const TextStyle(fontSize: 30),
            ),
            const Padding(padding: EdgeInsets.only(bottom: 20)),
            CupertinoButton(
                child: const Text("Push page >"),
                color: CupertinoColors.systemRed,
                onPressed: () => Navigator.push(
                    context,
                    CupertinoPageRoute(
                        builder: (context) => const SliverBugHeader(),
                        settings: const RouteSettings(name: "Title")))),
          ],
        ),
      ),
    ]));
  }
}

class SliverBugHeader extends StatelessWidget {
  const SliverBugHeader({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double textScale = MediaQuery.of(context).textScaleFactor;
    return CupertinoPageScaffold(
      child: CustomScrollView(
        slivers: [
          CupertinoSliverNavigationBar(
            trailing: CupertinoButton(
              child: const Text("Top right"),
              padding: EdgeInsets.zero,
              onPressed: () {},
            ),
            largeTitle: Text("${textScale == 1.0 ? "Good" : "BUGGY"} header"),
          ),
          SliverFillRemaining(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text(
                  "Actual Scale: $textScale",
                  style: const TextStyle(fontSize: 30),
                ),
                const Padding(padding: EdgeInsets.only(bottom: 20)),
                CupertinoButton(
                    child: const Text("Push new page >"),
                    color: CupertinoColors.systemRed,
                    onPressed: () => Navigator.push(
                          context,
                          CupertinoPageRoute(
                              builder: (context) => const SliverBugHeader(),
                              settings: const RouteSettings(name: "Title")),
                        )),
                CupertinoButton(
                    child: const Text("< Pop page"),
                    color: CupertinoColors.systemBlue,
                    onPressed: () => Navigator.pop(context)),
              ],
            ),
          )
        ],
      ),
    );
  }
}
  1. Navigate with default text scale (1.0) between pages. The header should be fine. Then change the text scale (using ⌥⌘+ and ⌥⌘- on iOS simulator or control center shortcuts on physical devices)
  2. Then navigate again between pages. The issue will be reproduced.

Expected results: Clear transitions like the ones that we're having with default scale.

Actual results: Unexpected text jumps in header elements font size when the transition is going to end.

Simulator Screen Recording - iPhone 13 - 2021-09-23 at 11 59 41

Logs

N/A

[✓] Flutter (Channel stable, 2.5.1, on macOS 11.5.2 20G95 darwin-arm, locale
    es-ES)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.60.1)
[✓] Connected device (3 available)

• No issues found!

Activity

  1. darshankawar commented on Sep 23, 2021

    @darshankawar
    Member

    @henry2man
    Tried your code sample on iPhone 6s (OS 14.4.1) and observed below:

    RPReplay-Final1632395233.MP4
    RPReplay-Final1632395271.MP4

    If I understand the issue correctly, the title text Header jumps or rebounds a bit while navigating back when we increase the text scale ?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Sep 23, 2021
  3. henry2man commented on Sep 23, 2021

    @henry2man
    Author

    @darshankawar Yes, both the title text AND the upper left and right buttons & icons rebounds while navigating back.

    The issue is more pronounced the higher the font size is raised.

    I'm not an absolute UIKit specialist but as far as I know the scale should always stay at 1.0, following Apple's guidelines. It seems that during the transition the scale goes from 1.0 to the scale set by the user.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Sep 23, 2021
  5. darshankawar commented on Sep 24, 2021

    @darshankawar
    Member

    Thanks for the details. I see the same behavior based on my earlier comment. Keeping it open for further insights from the team on the expected / intended behavior.

    stable, master flutter doctor -v
    [✓] Flutter (Channel stable, 2.5.1, on Mac OS X 10.15.4 19E2269 darwin-x64,
        locale en-GB)
        • Flutter version 2.5.1 at /Users/dhs/documents/fluttersdk/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ffb2ecea52 (2 days ago), 2021-09-17 15:26:33 -0400
        • Engine revision b3af521a05
        • Dart version 2.14.2
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30)
        • Android SDK at /Users/dhs/Library/Android/sdk
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /Users/dhs/Library/Android/sdk
        • Java binary at: /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
          Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.    
    
    [✓] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.3, Build version 12C33
        • CocoaPods version 1.10.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
          Studio.app/Contents
        • 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
          1.8.0_242-release-1644-b3-6915495)        
    
    [✓] VS Code (version 1.57.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [✓] Connected device (4 available)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 93.0.4577.82
    
    
    • No issues found!
    
    [✓] Flutter (Channel master, 2.6.0-6.0.pre.197, on Mac OS X 10.15.4 19E2269
        darwin-x64, locale en-GB)
        • Flutter version 2.6.0-6.0.pre.197 at
          /Users/dhs/documents/fluttersdk/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 37c1d87def (2 hours ago), 2021-09-23 23:53:06 -0400
        • Engine revision 5ef2faeb10
        • Dart version 2.15.0 (build 2.15.0-142.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30)
        • Android SDK at /Users/dhs/Library/Android/sdk
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /Users/dhs/Library/Android/sdk
        • Java binary at: /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
          Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.    
    
    [✓] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.5.1, Build version 12E507
        • CocoaPods version 1.10.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
          Studio.app/Contents
        • 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
          1.8.0_242-release-1644-b3-6915495)        
    
    [✓] VS Code (version 1.57.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.21.0
    
    [[✓] Connected device (4 available)
        • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
          ios            • iOS 14.4.1 18D61
        • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
          ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)            • macos                                    •
          darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
        • Chrome (web)               • chrome                                   •
          web-javascript • Google Chrome 93.0.4577.82
    
    
    • No issues found!
    
    
    
    
    
  6. darshankawar commented on Sep 24, 2021

    @darshankawar
    Member

    similar issue for reference: #45068

    /cc: @justinmc

  7. added
    f: routesNavigator, Router, and related APIs.
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-iosiOS applications specifically
    a: qualityA truly polished experience
    on Sep 24, 2021
  8. 14 remaining items

  9. changed the title [-][BUG] [IOS] Navbar text jumps during a CupertinoSliverNavigationBar -> CupertinoSliverNavigationBar transition[/-] [+]Title jumps during a CupertinoNavigationBar -> CupertinoNavigationBar hero transition[/+] on Aug 22, 2024
  10. added
    P2Important issues not at the top of the work list
    a: fidelityMatching the OEM platforms better
    on Aug 22, 2024
  11. victorsanni commented on Nov 11, 2024

    @victorsanni
    Contributor

    @henry2man is this the same as #67269?

  12. self-assigned this
    on May 2, 2025
  13. added
    r: fixedIssue is closed as already fixed in a newer version
    on May 15, 2025
  14. removed their assignment
    on May 15, 2025
  15. github-actions commented on May 29, 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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: animationAnimation APIsa: fidelityMatching the OEM platforms bettera: qualityA truly polished experiencea: typographyText rendering, possibly libtxtf: routesNavigator, Router, and related APIs.found in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cupertino_uicupertino_ui package in flutter/packagesplatform-iosiOS 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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions