Skip to content

Migration from textScaleFactor to TextScalar.scale not ready for ButtonStyleButton.scaledPadding #138547

@spydon

Description

@spydon

Is there an existing issue for this?

Steps to reproduce

Call ButtonStyleButton.scaledPadding from a context where you don't have any font size available to provide for the non-linear scaling:

    ButtonStyleButton.scaledPadding(
      const EdgeInsets.symmetric(horizontal: 16),
      const EdgeInsets.symmetric(horizontal: 8),
      const EdgeInsets.symmetric(horizontal: 4),
      MediaQuery.maybeOf(context)?.textScaler.scale(??),
    );

Expected results

A possibility to use ButtonStyleButton.scaledPadding without using the deprecated textScaleFactor variable.

Actual results

Currently it doesn't seem possible to use ButtonStyleButton.scaledPadding without using the deprecated textScaleFactor variable.

Code sample

Code sample Now:
    ButtonStyleButton.scaledPadding(
      const EdgeInsets.symmetric(horizontal: 16),
      const EdgeInsets.symmetric(horizontal: 8),
      const EdgeInsets.symmetric(horizontal: 4),
      MediaQuery.maybeOf(context)?.textScaler.scale(??),
    );

Previously:

    ButtonStyleButton.scaledPadding(
      const EdgeInsets.symmetric(horizontal: 16),
      const EdgeInsets.symmetric(horizontal: 8),
      const EdgeInsets.symmetric(horizontal: 4),
      MediaQuery.maybeOf(context)?.textScaleFactor,
    );

Screenshots or Video

No response

Logs

Other people with the same issue:
https://stackoverflow.com/questions/77494443/how-to-migrate-from-textscalefactor-to-textscalar-scale

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.16.0, on Ubuntu 23.10 6.5.0-10-generic, locale
    en_US.UTF-8)
    • Flutter version 3.16.0 on channel stable at /home/spydon/bin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (20 hours ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2

Metadata

Metadata

Labels

P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/found in release: 3.16Found to occur in 3.16found in release: 3.17Found to occur in 3.17frameworkflutter/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 team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions