flutter_stripe
flutter_stripe copied to clipboard
Support flutter textScaleFactor for font sizes in native views like CardFormField, CardField
Describe the bug Changing the CardFormField font size changes the text whilst using the device text scaling instead of using MediaQuery.of(context).textScaleFactor. The device text scaling should only be used if the textScaleFactor value is null.
To Reproduce Steps to reproduce the behavior:
- Wrap the app or the Stripe CardFormField widget with
MediaQuery( data: MediaQuery.of(context).copyWith(textScaleFactor: 1.2 child: CardFormField( - Observe the behaviour of the text in the CardFormField
Expected behavior The text font size inside the CardFormField should be affected by the device text scaling when textScaleFactor is null otherwise it uses the textScaleFactor to scale the fontSize property provided to the CardFormStyle style property of CardFormField.
Smartphone / tablet
- Device: LG V50, iPhone X
- OS: iOS 15.5, Android 12
- Package version: 3.2.0
- Flutter version 2.10.1
Additional context The app's whole text sizing is handled via the textScaleFactor property so the inconsistent behaviour is an issue.
Thanks for sharing this! I have renamed this to add support textScaleFactor across all the SDK, so it is more clear for when we work on this. I will add it to the backlog
If it is important for your project consider to use it like this until is implemented:
CardFormField(
style: CardFormStyle(
fontSize: 24 * MediaQuery.of(context).textScaleFactor,
),
),
I will post any update about this here
Thanks for sharing this! I have renamed this to add support textScaleFactor across all the SDK, so it is more clear for when we work on this. I will add it to the backlog
If it is important for your project consider to use it like this until is implemented:
CardFormField( style: CardFormStyle( fontSize: 24 * MediaQuery.of(context).textScaleFactor, ), ),I will post any update about this here
The suggested workaround does not work for my use case. Scaling the fontSize in the card form style with the textScaleFactor is scaled again by the operating system's text scaling. Our app allows changing of the textScaleFactor and that is being used in other places in the app. The package is scaling this again.
Currently there are no plans to support textscalefactor automatically. We have no control over how stripe native widgets behave. For the best UI experience I would recommend using the paymentsheet as this has by far the best experience when it comes to scaling and UX.