rebelappstudio / accessibility_tools

MIT License
70 stars 4 forks source link

allow setting of range for text scaling #60

Open TDuffinNTU opened 1 week ago

TDuffinNTU commented 1 week ago

In our app we use maxScaleFactor to limit the size of the text scaling a user can apply (namely to ensure useful elements are always visible on-screen). We do this through making our app's layout the child Widget of a MediaQuery Widget like so:

return MaterialApp (

...

  builder: (context, _) {
    // Set the text scale limit
    final MediaQueryData mediaQueryData = MediaQuery.of(context);
    final TextScaler textScaler =
        mediaQueryData.textScaler.clamp(minScaleFactor: 0, maxScaleFactor: 1.4);
    child = MediaQuery(
      data: mediaQueryData.copyWith(textScaler: textScaler),
      child: child,
    );

    ...

    return SomeWidget(child: child);
  }
)

However, accessibility_tools still allows you to override this limit through its tools menu. It would be nice if we could set this limit in the tools menu too so that we don't get unnecessary complaints from our designers and internal testers of layout issues when trying factors beyond what a release build can achieve.

Not a major issue for me, just a nice-to-have :) Thanks!

aednlaxer commented 5 days ago

Hi Thomas,

Thanks for using accessibility tools and thank you for this good suggestion. Another option to fix this could be to detect max scale factor from MediaQuery and set it as max value in the tools menu but I think having an option to go beyond the limit is nice to have for development purposes (it helps breaking layouts and finding overflows). Your suggestion sounds good, let's add it 👍