Skip to content

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

@miguelpruivo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: cupertinoflutter/packages/flutter/cupertino repositoryframeworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions