Skip to content

Commit 7700880

Browse files
committed
chore: simplify badge handling to reduce size
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 61662e0 commit 7700880

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

  • app/src/main/java/com/getcode/ui/components

app/src/main/java/com/getcode/ui/components/Badge.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ import androidx.compose.animation.fadeIn
55
import androidx.compose.animation.fadeOut
66
import androidx.compose.animation.scaleIn
77
import androidx.compose.animation.scaleOut
8+
import androidx.compose.foundation.layout.padding
9+
import androidx.compose.foundation.layout.size
810
import androidx.compose.material.Text
911
import androidx.compose.runtime.Composable
1012
import androidx.compose.ui.Modifier
13+
import androidx.compose.ui.draw.drawBehind
1114
import androidx.compose.ui.graphics.Color
1215
import androidx.compose.ui.text.font.FontWeight
16+
import androidx.compose.ui.unit.dp
1317
import com.getcode.theme.CodeTheme
18+
import com.getcode.ui.components.chat.ChatNodeDefaults
1419
import com.getcode.ui.utils.circleBackground
1520

1621

@@ -31,7 +36,13 @@ fun Badge(
3136
text = text,
3237
color = contentColor,
3338
style = CodeTheme.typography.body1.copy(fontWeight = FontWeight.W700),
34-
modifier = modifier.circleBackground(color = color, padding = CodeTheme.dimens.staticGrid.x1)
39+
modifier = modifier
40+
.drawBehind {
41+
drawCircle(
42+
color = color,
43+
radius = this.size.maxDimension / 2f
44+
)
45+
}.padding(2.dp)
3546
)
3647
}
3748
}

0 commit comments

Comments
 (0)