From b7e0a42efd36d2aed24b19691bea333d6b1e95df Mon Sep 17 00:00:00 2001 From: Shengyou Fan <shengyoufan@gmail.com> Date: Thu, 24 Aug 2023 20:08:36 +0800 Subject: [PATCH] add padding when the length of text is greater than 10 in chip --- .../samples/standalone/customs/ui/PlatformChips.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/customs/ui/PlatformChips.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/customs/ui/PlatformChips.kt index a02f50fe2..60430a3b6 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/customs/ui/PlatformChips.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/customs/ui/PlatformChips.kt @@ -1,8 +1,11 @@ package org.jetbrains.jewel.samples.standalone.customs.ui import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import org.jetbrains.jewel.Chip import org.jetbrains.jewel.Text import org.jetbrains.jewel.samples.standalone.customs.data.Platform @@ -15,7 +18,12 @@ fun PlatformChips(supportedPlatforms: List<Platform>, modifier: Modifier = Modif enabled = true, onChipClick = {} ) { - Text(platform.name) + Text( + text = platform.name, + modifier = Modifier.padding( + horizontal = if (platform.name.length < 10) 6.dp else 12.dp + ) + ) } } }