Skip to content

Cupertino NavBar default Close text shouldn't scale with the font #35199

Closed

Description

@miguelpruivo

Problem

If you look into the native iOS NavBar texts (such as Close, Edit, and so on) those won't scale with the font settings (thus having textScaleFactor: 1.0).
Currently, the Close button from the bottom navigation route, is being able to scale and can't have its property overriden unless you explicitly create it yourself the leading widget). This will either add a lot of boilerplate if you want to provide the best native experience possible; or make the Close button smaller/bigger than the others across the system UI.

This should also be considered to the AppBar title and action buttons (both text and icon).

Solution

A simple (and correct) solution would be to set the CupertinoButton's textScaleFactor to 1.0 in the default leadingContent of the NavBar.

leadingContent = CupertinoButton(
        child: const Text(
          'Close',
          textScaleFactor: 1.0,
        ),
        padding: EdgeInsets.zero,
        onPressed: () { route.navigator.maybePop(); },
      );

Edit: I already PR'd a solution with #35200.

Activity

  1. added
    p: cupertino_uicupertino_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jun 27, 2019
  2. LongCatIsLooong commented on Aug 1, 2019

    @LongCatIsLooong
    Contributor

    @miguelpruivo thank you for pointing that out! Looks like nav bars, tab bars and pickers are exempt from the regular "text size" setting or the accessibility "larger text" setting.

    image1

  3. github-actions commented on Aug 28, 2021

    @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.

  4. locked as resolved and limited conversation to collaborators on Aug 28, 2021
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

    frameworkflutter/packages/flutter repository. See also f: labels.p: cupertino_uicupertino_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions