pin_code_fields
pin_code_fields copied to clipboard
Expose textScaler
Accessibility text sizes in system settings are currently not really supported by PinCodeTextField
: The field does not resize to accommodate very large text, which is thus clipped. Currently a workaround for this was to set fontSize
in the textStyle
to the intended font size (20.0, usually) divided by the textScaleFactor
, such that fontSize * textScaleFactor would yield 20.0. With the introduction of TextScaler
and deprecation of textScaleFactor
in the latest Flutter versions this is no longer a viable solution. (In mathematical terms: The mentioned workaround uses the multiplicative inverse of textScaleFactor
, while with the potentially nonlinear textScaler
an inverse is difficult to find and not guaranteed to exist.)
Thus, expose textScaler
of the PinCodeTextField
to allow setting it to TextScaler.noScaling
. (This PR does not include a scaling for the validator as I'm not sure how to do this and do not need it.)
To test, just add
textScaler: TextScaler.noScaling,
hintCharacter: "1",
in the PinCodeTextField
of the example app and run on a device where in system settings you set font size to the maximum (preferrably iOS, which allows more radical sizes than Android, at least on the devices I tested). Tested with Flutter 3.16.0.
P.S.: You may need to upgrade deployment targets or Gradle version for the example app.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
activity
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
activity