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,
|
text: () -> String,
|
||||||
loading: () -> Boolean,
|
loading: () -> Boolean,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val transition = updateTransition(
|
val transition = updateTransition(
|
||||||
targetState = loading(),
|
targetState = loading(),
|
||||||
|
@ -57,7 +56,7 @@ fun LoadingButton(
|
||||||
)
|
)
|
||||||
Button(
|
Button(
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
modifier = modifier.defaultMinSize(minWidth = 1.dp),
|
modifier = Modifier.defaultMinSize(minWidth = 1.dp),
|
||||||
contentPadding = PaddingValues(
|
contentPadding = PaddingValues(
|
||||||
horizontal = horizontalContentPadding,
|
horizontal = horizontalContentPadding,
|
||||||
vertical = 8.dp,
|
vertical = 8.dp,
|
||||||
|
@ -145,7 +144,6 @@ private fun LoadingButtonPreview() {
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
LoadingButton(
|
LoadingButton(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
text = { "Test" },
|
text = { "Test" },
|
||||||
loading = { false },
|
loading = { false },
|
||||||
onClick = {},
|
onClick = {},
|
||||||
|
|
|
@ -4,11 +4,13 @@ import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.AbstractComposeView
|
import androidx.compose.ui.platform.AbstractComposeView
|
||||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||||
|
@ -50,12 +52,16 @@ class LoadingButtonComposeView @JvmOverloads constructor(
|
||||||
@Composable
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
YokaiTheme {
|
YokaiTheme {
|
||||||
LoadingButton(
|
Box(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
text = { text },
|
contentAlignment = Alignment.Center,
|
||||||
loading = { isLoading },
|
) {
|
||||||
onClick = onClick,
|
LoadingButton(
|
||||||
)
|
text = { text },
|
||||||
|
loading = { isLoading },
|
||||||
|
onClick = onClick,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue