mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
style: Adjust LoadingButton styling
This commit is contained in:
parent
6f94dd091b
commit
4d60166fa1
2 changed files with 12 additions and 8 deletions
|
@ -40,7 +40,6 @@ fun LoadingButton(
|
|||
text: () -> String,
|
||||
loading: () -> Boolean,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val transition = updateTransition(
|
||||
targetState = loading(),
|
||||
|
@ -57,7 +56,7 @@ fun LoadingButton(
|
|||
)
|
||||
Button(
|
||||
onClick = onClick,
|
||||
modifier = modifier.defaultMinSize(minWidth = 1.dp),
|
||||
modifier = Modifier.defaultMinSize(minWidth = 1.dp),
|
||||
contentPadding = PaddingValues(
|
||||
horizontal = horizontalContentPadding,
|
||||
vertical = 8.dp,
|
||||
|
@ -145,7 +144,6 @@ private fun LoadingButtonPreview() {
|
|||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
LoadingButton(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = { "Test" },
|
||||
loading = { false },
|
||||
onClick = {},
|
||||
|
|
|
@ -4,11 +4,13 @@ import android.content.Context
|
|||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.widget.FrameLayout
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.AbstractComposeView
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
|
@ -50,12 +52,16 @@ class LoadingButtonComposeView @JvmOverloads constructor(
|
|||
@Composable
|
||||
override fun Content() {
|
||||
YokaiTheme {
|
||||
LoadingButton(
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
LoadingButton(
|
||||
text = { text },
|
||||
loading = { isLoading },
|
||||
onClick = onClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue