Disable high DPI scaling for flutter on desktop

Issue

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?

Solution

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)
  )
...

Answered By – CaptainDario

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *