禁用桌面上抖动的高 DPI 缩放

发布于 2025-01-12 19:30:08 字数 95 浏览 1 评论 0原文

是否可以禁用 flutter 应用程序的高 dpi 缩放? 我的布局效果很好,但是当比例因子设置为非常高时,应用程序会变得很小。

或者至少有一种方法可以考虑缩放?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飘然心甜 2025-01-19 19:30:08

我现在使用 响应式框架 包。这解决了我设置 defaultScale: true 时的缩放问题。添加断点时,可以自定义行为。

我在我的 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)
  )
...

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)
  )
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文