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:
2026-11-09 12:56:42 +00:00
parent 701fb98ef0
commit bb2adcc182
9 changed files with 402 additions and 3 deletions
+8
View File
@@ -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());
}
+3
View File
@@ -1,4 +1,5 @@
import '../core/session/server_session.dart';
import '../ui/scale/ui_scale.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@@ -58,6 +59,7 @@ Future<void> runPipelinesApp({
// The device's chosen font loads beside the session; a slow download does
// not hold the first frame, and applies when it lands.
final animationSpeed = AnimationSpeedController.instance.restore();
final uiScale = UiScaleController.instance.restore();
final quickSwitchAnimation = QuickSwitchAnimationController.instance
.restore();
final font = AppFontController.instance.restore(wait: appFontStartupWait);
@@ -65,6 +67,7 @@ Future<void> runPipelinesApp({
await ServerSession.load();
await font;
await animationSpeed;
await uiScale;
await quickSwitchAnimation;
final server = await resolveLaunchServer(
base: base,
+5
View File
@@ -16,6 +16,7 @@ import '../features/onboarding/onboarding_flow.dart';
import '../features/settings/server_connections.dart';
import '../features/settings/saved_servers_section.dart';
import '../features/settings/settings_store.dart';
import '../ui/scale/ui_scale.dart';
import '../ui/theme/app_font_controller.dart';
import '../ui/theme/app_theme.dart';
import 'pipelines_app.dart';
@@ -369,12 +370,16 @@ class _PipelinesRootState extends State<PipelinesRoot> {
builder: (context, _) => _cupertino
? CupertinoApp(
title: 'Pipelines',
builder: (context, child) =>
UiScaleHost(child: child ?? const SizedBox.shrink()),
theme: appCupertinoThemeWith(fontFamily: fonts.family),
debugShowCheckedModeBanner: false,
home: flow,
)
: MaterialApp(
title: 'Pipelines',
builder: (context, child) =>
UiScaleHost(child: child ?? const SizedBox.shrink()),
theme: appLightTheme(fontFamily: fonts.family),
darkTheme: appDarkTheme(fontFamily: fonts.family),
debugShowCheckedModeBanner: false,