Skip to content

Commit 8ca8c34

Browse files
committed
Simplify button definition.
1 parent 252b8f7 commit 8ca8c34

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

  • Jetsnack/app/src/main/java/com/example/jetsnack/ui/components

Jetsnack/app/src/main/java/com/example/jetsnack/ui/components/Button.kt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,12 @@ package com.example.jetsnack.ui.components
2121
import android.content.res.Configuration.UI_MODE_NIGHT_YES
2222
import androidx.compose.foundation.clickable
2323
import androidx.compose.foundation.interaction.MutableInteractionSource
24-
import androidx.compose.foundation.layout.Arrangement
25-
import androidx.compose.foundation.layout.Box
2624
import androidx.compose.foundation.layout.Row
2725
import androidx.compose.foundation.layout.RowScope
28-
import androidx.compose.foundation.layout.defaultMinSize
2926
import androidx.compose.foundation.style.ExperimentalFoundationStyleApi
3027
import androidx.compose.foundation.style.Style
3128
import androidx.compose.foundation.style.rememberUpdatedStyleState
3229
import androidx.compose.foundation.style.styleable
33-
import androidx.compose.foundation.style.then
34-
import androidx.compose.material3.ButtonDefaults
35-
import androidx.compose.material3.ripple
3630
import androidx.compose.runtime.Composable
3731
import androidx.compose.runtime.remember
3832
import androidx.compose.ui.Alignment
@@ -58,9 +52,11 @@ fun Button(
5852
}
5953
Row(
6054
modifier = modifier
61-
.semantics(properties = {
62-
role = Role.Button
63-
})
55+
.semantics(
56+
properties = {
57+
role = Role.Button
58+
},
59+
)
6460
.clickable(
6561
enabled = enabled,
6662
onClick = onClick,
@@ -69,7 +65,7 @@ fun Button(
6965
)
7066
.styleable(styleState, JetsnackTheme.styles.buttonStyle, style),
7167
content = content,
72-
verticalAlignment = Alignment.CenterVertically
68+
verticalAlignment = Alignment.CenterVertically,
7369
)
7470
}
7571

@@ -92,7 +88,8 @@ private fun ButtonPreview() {
9288
private fun RectangleButtonPreview() {
9389
JetsnackTheme {
9490
Button(
95-
onClick = {}, style = {
91+
onClick = {},
92+
style = {
9693
shape(RectangleShape)
9794
},
9895
) {

0 commit comments

Comments
 (0)