Improve rendering of "All chats" regarding fontScale. (#984)

This commit is contained in:
Benoit Marty 2023-07-27 15:42:47 +02:00 committed by Benoit Marty
parent fb870a0903
commit 96b7923979
2 changed files with 15 additions and 1 deletions

View file

@ -52,3 +52,11 @@ fun Dp.toPx(): Float = with(LocalDensity.current) { toPx() }
*/
@Composable
fun Dp.roundToPx(): Int = with(LocalDensity.current) { roundToPx() }
/**
* Return the maximum value between the receiver value and the value with fonScale applied.
*/
@Composable
fun Dp.scaleMax(): Dp = with(LocalDensity.current) {
return this@scaleMax * fontScale.coerceAtMost(1f)
}