Font size setting: app-wide text scale (0.8x-1.5x, default 1.0x) via Settings > Appearance slider — applied through LocalDensity.fontScale so all sp text scales while dp layout keeps its proportions; the multiplier stacks on top of the system font scale; persisted per platform (EncryptedSharedPreferences / settings.json) like the other appearance settings
This commit is contained in:
1 parent
f79c54fead
commit
abf1374c1e
6 files changed
+90
-1
No files matched your search
@@ -13,6 +13,8 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.unit.Density
|
||||
import iris.data.SecureStore
|
||||
import iris.net.GatewayClient
|
||||
import iris.platform.setActiveController
|
||||
@@ -55,9 +57,20 @@ fun IrisApp(
|
||||
}
|
||||
val state by controller.client.state.collectAsState()
|
||||
val theme by controller.theme.collectAsState()
|
||||
val fontScale by controller.fontSizeScale.collectAsState()
|
||||
val baseDensity = LocalDensity.current
|
||||
|
||||
IrisTheme {
|
||||
CompositionLocalProvider(LocalUserTheme provides theme) {
|
||||
// Font-size setting (Settings → Appearance): a multiplier on top of the
|
||||
// system font scale. fontScale affects sp text only — dp layout is
|
||||
// untouched, so the UI keeps its proportions at any size.
|
||||
CompositionLocalProvider(
|
||||
LocalUserTheme provides theme,
|
||||
LocalDensity provides Density(
|
||||
density = baseDensity.density,
|
||||
fontScale = baseDensity.fontScale * fontScale,
|
||||
),
|
||||
) {
|
||||
// The color goes through Surface's `color` parameter: a
|
||||
// Modifier.background on the Surface would be painted *under* the
|
||||
// Surface's own colorScheme.surface fill and never show through.
|
||||
|
||||
Reference in new issue
Block a user