I’m new to Flutter and aim to use it primarily to make a Desktop app (Linux, Win, Mac), with tablet/web versions from the same codebase a future, not present priority.
Well, a simple hello-worldish “docs-driven” starter app on my KDE system (1920×1200, 14″ screen) has too tiny font sizes showing by default, apart from the app-bar headline:
Standard entry-level stuff: this is a root StatelessWidget returning in its build
a MaterialApp
with a home: Scaffold(...)
that has an appBar: AppBar(...)
and a body: Text(...)
and a bottomNavigationBar: BottomNavigationBar(...)
. No font size customizations applied so far. Let’s ignore the bottom-nav-bar’s inconsistent font sizes (I guess that must be by someone’s design) but focus on the fact that relative to the rest of the KDE desktop setup, the Text and BottomNavigationBar font-sizes at the very least are too tiny.
Now my idea was to have in the app a single text-scale setting that the user could set and that would be applied automagically to all text renditions by all Flutter builtin text-rendering Widgets. From research, I thought using TextScaler
like so would do the trick:
Widget build(BuildContext context) {
TextScaler textScaler = const TextScaler.linear(2.0); // later user-settable
// ... setup `MaterialApp materialApp` with children here...
return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaler: textScaler),
child: materialApp,
);
but the result is odd:
- bottom-nav-bar buttons don’t apply parent TextScaler apparently
- app-bar headline got scaled only a little but not “2x”, only the
Text
got scaled properly “2x”
Does anyone know how to scale “across-the-board” without fine-tuning all individual fontSize settings?
(Come to think of it, even a “scale not just text but everything, images icons etc” one-step mechanism would be fine for me — perhaps even preferable, all things considered).