fix(desktop): width cap ordering, platform icon weight, Settings hierarchy

Three related fixes:

ReadingColumn modifier ordering:
- fillMaxSize().widthIn(max = 720) was locking width to parent before
  widthIn could cap it, so the cap had no effect in practice. Switched
  to widthIn(max = 720).fillMaxWidth().fillMaxHeight() which now caps
  correctly on wide displays. Same fix applied to the three screens
  that use Box+widthIn inline (UserProfile, Search, Settings).

Platform-aware Material Symbols weight:
- ProvideMaterialSymbols now takes an optional weight parameter that
  defaults to MaterialSymbolsDefaults.WEIGHT (300) so Android keeps
  current behavior. Desktop passes PlatformIconWeight.current which
  maps:
    macOS   → 200 (thin, matches SF Symbols stroke)
    GNOME   → 300 (matches libadwaita symbolic icons)
    KDE     → 300 (matches Breeze)
    Windows → 400 (matches Fluent Icons)
    other   → 300

Settings section hierarchy:
- "Wallet Connect (NWC)" and "Relay Settings" section headers dropped
  from titleLarge (22sp) to titleSmall (14sp) so they're smaller than
  the "Settings" screen title (titleMedium 16sp). Restores the
  visual hierarchy the user reported inverted.

https://claude.ai/code/session_01NufduPfZvYQVYwLkbCjCUo
This commit is contained in:
Claude
2026-04-24 15:27:53 +00:00
parent cd4dd42bc4
commit c4ae0a30eb
6 changed files with 88 additions and 13 deletions
@@ -47,24 +47,31 @@ private const val TEXT_MEASURER_CACHE_SIZE = 64
/**
* Builds the Material Symbols FontFamily and a shared TextMeasurer once for the subtree and
* exposes them via CompositionLocal. Wrap app roots (AmethystTheme, desktop MaterialTheme) in this.
*
* The optional [weight] override lets callers pick a stroke thickness different from the
* library default — desktop uses per-OS weights (macOS likes the thinner SF-Symbols-ish
* look at 200, Windows Fluent icons sit closer to 400) while Android keeps the default.
*/
@Composable
fun ProvideMaterialSymbols(content: @Composable () -> Unit) {
fun ProvideMaterialSymbols(
weight: Int = MaterialSymbolsDefaults.WEIGHT,
content: @Composable () -> Unit,
) {
val font =
Font(
resource = Res.font.material_symbols_outlined,
weight = FontWeight(MaterialSymbolsDefaults.WEIGHT),
weight = FontWeight(weight),
variationSettings =
FontVariation.Settings(
FontVariation.weight(MaterialSymbolsDefaults.WEIGHT),
FontVariation.weight(weight),
FontVariation.Setting("FILL", MaterialSymbolsDefaults.FILL),
FontVariation.Setting("opsz", MaterialSymbolsDefaults.OPTICAL_SIZE),
FontVariation.Setting("GRAD", MaterialSymbolsDefaults.GRADE),
),
)
// Keyless remember: the Font wrapper identity changes every composition but the underlying
// resource is a compile-time constant, so one FontFamily for the lifetime of the subtree.
val fontFamily = remember { FontFamily(font) }
// Keyless remember is safe only when weight is stable; key on weight so a platform-
// preview override swap actually rebuilds the FontFamily.
val fontFamily = remember(weight) { FontFamily(font) }
val textMeasurer = rememberTextMeasurer(cacheSize = TEXT_MEASURER_CACHE_SIZE)
CompositionLocalProvider(
LocalMaterialSymbolsFontFamily provides fontFamily,