refactor: Add parameters for custom rotation values in ArrowButton

This commit is contained in:
Ushie 2024-08-08 02:49:07 +03:00
parent edc11b6e1d
commit 936a9efd0b
No known key found for this signature in database
GPG Key ID: B3AAD18842E34632

View File

@ -13,10 +13,16 @@ import androidx.compose.ui.res.stringResource
import app.revanced.manager.R
@Composable
fun ArrowButton(modifier: Modifier = Modifier, expanded: Boolean, onClick: (() -> Unit)?) {
fun ArrowButton(
modifier: Modifier = Modifier,
expanded: Boolean,
onClick: (() -> Unit)?,
rotationInitial: Float = 0f,
rotationFinal: Float = 180f
) {
val description = if (expanded) R.string.collapse_content else R.string.expand_content
val rotation by animateFloatAsState(
targetValue = if (expanded) 0f else 180f,
targetValue = if (expanded) rotationInitial else rotationFinal,
label = "rotation"
)