1

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?

CaptainDario
  • 83
  • 1
  • 7
  • I had the exact same problem and came to the conclusion to edit all size numbers or make them responsible. But would be interesting if there is an solution. – Thoxh Mar 09 '22 at 20:40
  • @Thoxh I would like to not change those values because without scaling everything will be very big. A way to at least access the dpi scaling value would be needed. – CaptainDario Mar 10 '22 at 09:52
  • @Thoxh I am now using [responsive framework](https://pub.dev/packages/responsive_framework) which solves the scaling problem by setting `defaultScale: true`. – CaptainDario Mar 13 '22 at 19:30

1 Answers1

2

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)
  )
...
CaptainDario
  • 83
  • 1
  • 7