Reputation: 83
Is it possible to disable the high dpi scaling for a flutter app? My layout works well, but when the scale factor is set to something very high the app becomes tiny.
Or is there atleast a way to take the scaling into account?
Upvotes: 1
Views: 1752
Reputation: 83
I am now using the responsive framework package. This solves the scaling problems for me when setting defaultScale: true
. When adding breakpoints the behavior can be customized.
I am using it in my MaterialApp.OnGenerateRoute
:
PageRouteBuilder switchScreen (Widget screen) =>
PageRouteBuilder(
pageBuilder: (_, __, ___) => ResponsiveWrapper.builder(
screen,
defaultScale: true,
breakpoints: [
const ResponsiveBreakpoint.resize(450, name: MOBILE),
const ResponsiveBreakpoint.autoScale(800, name: TABLET),
const ResponsiveBreakpoint.autoScale(1000, name: TABLET),
const ResponsiveBreakpoint.resize(1200, name: DESKTOP),
const ResponsiveBreakpoint.autoScale(2460, name: "4K"),
],
),
settings: settings,
transitionsBuilder: (_, a, __, c) =>
FadeTransition(opacity: a, child: c)
)
...
Upvotes: 2