adar2378 / pin_code_fields

A flutter package which will help you to generate pin code fields with beautiful design and animations. Can be useful for OTP or pin code inputs 🤓🤓
https://pub.dev/packages/pin_code_fields
MIT License
706 stars 344 forks source link

Expose textScaler #365

Closed jakobleck closed 7 months ago

jakobleck commented 11 months ago

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.

stale[bot] commented 9 months ago

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.

jakobleck commented 9 months ago

activity

stale[bot] commented 7 months ago

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.

jakobleck commented 7 months ago

activity