Merge pull request #2546 from vitorpamplona/claude/increase-icon-size-x4vc7

Fix Material Symbol icon rendering and adjust bottom bar icon sizes
This commit is contained in:
Vitor Pamplona
2026-04-24 09:16:48 -04:00
committed by GitHub
3 changed files with 11 additions and 8 deletions
@@ -51,8 +51,8 @@ import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.DividerThickness import com.vitorpamplona.amethyst.ui.theme.DividerThickness
import com.vitorpamplona.amethyst.ui.theme.Size0dp import com.vitorpamplona.amethyst.ui.theme.Size0dp
import com.vitorpamplona.amethyst.ui.theme.Size10Modifier import com.vitorpamplona.amethyst.ui.theme.Size10Modifier
import com.vitorpamplona.amethyst.ui.theme.Size20dp import com.vitorpamplona.amethyst.ui.theme.Size24dp
import com.vitorpamplona.amethyst.ui.theme.Size23dp import com.vitorpamplona.amethyst.ui.theme.Size27dp
@Composable @Composable
fun AppBottomBar( fun AppBottomBar(
@@ -141,8 +141,8 @@ private fun NotifiableIcon(
destination: Route, destination: Route,
accountViewModel: AccountViewModel, accountViewModel: AccountViewModel,
) { ) {
Box(Modifier.size(Size23dp)) { Box(Modifier.size(Size27dp)) {
val iconSizeModifier = Modifier.size(Size20dp) val iconSizeModifier = Modifier.size(Size24dp)
val description = stringRes(def.labelRes) val description = stringRes(def.labelRes)
Icon( Icon(
symbol = def.icon, symbol = def.icon,
@@ -119,6 +119,7 @@ val Size22dp = 22.dp
val Size23dp = 23.dp val Size23dp = 23.dp
val Size24dp = 24.dp val Size24dp = 24.dp
val Size25dp = 25.dp val Size25dp = 25.dp
val Size27dp = 27.dp
val Size30dp = 30.dp val Size30dp = 30.dp
val Size34dp = 34.dp val Size34dp = 34.dp
val Size35dp = 35.dp val Size35dp = 35.dp
@@ -66,20 +66,22 @@ private class MaterialSymbolPainter(
override fun DrawScope.onDraw() { override fun DrawScope.onDraw() {
val sizePx = size.minDimension val sizePx = size.minDimension
val fontSize = with(density) { sizePx.toSp() } val fontSize = with(density) { sizePx.toSp() }
// TextStyle omits color; we override at draw time so TextMeasurer's cache hits across tints. // Bake the tint into the measured style. drawText(color = ...) override is unreliable
// across Compose versions when the measured style has Color.Unspecified — falls back to
// Color.Black and produces black-on-black icons.
val layout = val layout =
textMeasurer.measure( textMeasurer.measure(
text = symbol.glyph, text = symbol.glyph,
style = TextStyle(fontFamily = fontFamily, fontSize = fontSize), style = TextStyle(fontFamily = fontFamily, fontSize = fontSize, color = tint),
) )
val tx = (size.width - layout.size.width) / 2f val tx = (size.width - layout.size.width) / 2f
val ty = (size.height - layout.size.height) / 2f val ty = (size.height - layout.size.height) / 2f
if (symbol.autoMirror && rtl) { if (symbol.autoMirror && rtl) {
scale(scaleX = -1f, scaleY = 1f, pivot = Offset(size.width / 2f, size.height / 2f)) { scale(scaleX = -1f, scaleY = 1f, pivot = Offset(size.width / 2f, size.height / 2f)) {
translate(tx, ty) { drawText(layout, color = tint) } translate(tx, ty) { drawText(layout) }
} }
} else { } else {
translate(tx, ty) { drawText(layout, color = tint) } translate(tx, ty) { drawText(layout) }
} }
} }
} }