为桌面上的 flutter 禁用高 DPI 缩放
Disable high DPI scaling for flutter on desktop
是否可以禁用 flutter 应用程序的高 dpi 缩放?
我的布局效果很好,但是当比例因子设置得非常高时,应用程序变得很小。
或者至少有一种方法可以考虑缩放?
我现在正在使用 responsive framework 包。这为我解决了设置 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)
)
...
是否可以禁用 flutter 应用程序的高 dpi 缩放? 我的布局效果很好,但是当比例因子设置得非常高时,应用程序变得很小。
或者至少有一种方法可以考虑缩放?
我现在正在使用 responsive framework 包。这为我解决了设置 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)
)
...