Add an interface size setting (0.5x to 2x)
Settings > Appearance > Interface size scales every dimension, text, icon and dialog on this device. The app lays out in a smaller or larger viewport and paints it scaled to the window, so hit testing and layout stay consistent; the value is saved per device and applies when the slider is released.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import '../ui/adaptive/platform.dart';
|
||||
import '../ui/theme/app_font_controller.dart';
|
||||
import '../ui/theme/app_theme.dart';
|
||||
import '../ui/scale/ui_scale.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -58,12 +59,14 @@ class MyApp extends StatelessWidget {
|
||||
if (router != null) {
|
||||
return CupertinoApp.router(
|
||||
title: 'Pipelines',
|
||||
builder: _scaled,
|
||||
theme: theme,
|
||||
routerConfig: router,
|
||||
);
|
||||
}
|
||||
return CupertinoApp(
|
||||
title: 'Pipelines',
|
||||
builder: _scaled,
|
||||
theme: theme,
|
||||
home: AdaptiveShell(
|
||||
destinationBodies: destinationBodies,
|
||||
@@ -76,6 +79,7 @@ class MyApp extends StatelessWidget {
|
||||
if (router != null) {
|
||||
return MaterialApp.router(
|
||||
title: 'Pipelines',
|
||||
builder: _scaled,
|
||||
theme: appLightTheme(fontFamily: fontFamily),
|
||||
darkTheme: appDarkTheme(fontFamily: fontFamily),
|
||||
themeMode: ThemeMode.system,
|
||||
@@ -84,6 +88,7 @@ class MyApp extends StatelessWidget {
|
||||
}
|
||||
return MaterialApp(
|
||||
title: 'Pipelines',
|
||||
builder: _scaled,
|
||||
theme: appLightTheme(fontFamily: fontFamily),
|
||||
darkTheme: appDarkTheme(fontFamily: fontFamily),
|
||||
themeMode: ThemeMode.system,
|
||||
@@ -96,4 +101,7 @@ class MyApp extends StatelessWidget {
|
||||
}
|
||||
|
||||
bool get _platformIsCupertino => prefersCupertino();
|
||||
|
||||
static Widget _scaled(BuildContext context, Widget? child) =>
|
||||
UiScaleHost(child: child ?? const SizedBox.shrink());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user