Разработана предварительная версия карточки запроса по автору

Этот коммит содержится в:
Глеб Иваницкий 2024-12-12 17:50:56 +03:00
родитель 8bed264134
Коммит 120bcafabc
2 изменённых файлов: 94 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,84 @@
package ru.csasq.beeapp.ui.components
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
@Composable
fun AuthorRequestButton(
title: String,
spoilerState: MutableState<Boolean>,
) {
val backgroundColor = animateColorAsState(
targetValue = if (spoilerState.value) MaterialTheme.colorScheme.primary.copy(alpha = 0.12f) else Color.Transparent,
)
val horizontalPadding = animateDpAsState(
targetValue = if (spoilerState.value) 16.dp else 0.dp,
)
val cardColors = CardDefaults.cardColors()
Box(
modifier = Modifier
.clip(MaterialTheme.shapes.extraLarge)
.padding(
horizontal = horizontalPadding.value,
)
.fillMaxWidth()
.clickable {
spoilerState.value = !spoilerState.value
},
// colors = CardColors(
// containerColor = backgroundColor.value,
// contentColor = cardColors.contentColor,
// disabledContainerColor = cardColors.disabledContainerColor,
// disabledContentColor = cardColors.disabledContentColor,
// ),
) {
Column {
Row(
modifier = Modifier
.padding(16.dp)
.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = title,
)
}
AnimatedVisibility(
visible = spoilerState.value,
) {
HorizontalDivider()
Row(
modifier = Modifier
.fillMaxWidth()
.height(IntrinsicSize.Min),
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text(
text = "Кнопки",
)
}
}
}
}
}

Просмотреть файл

@ -7,8 +7,11 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.navigation.NavController
import ru.csasq.beeapp.ui.components.AuthorRequestButton
import ru.csasq.beeapp.ui.components.UserButton
@Composable
@ -32,6 +35,13 @@ fun UsersScreen(
caption = "Гавносос последней степени критенизма",
onClick = {},
)
val tempState = remember {
mutableStateOf(false)
}
AuthorRequestButton(
title = "Заявляю о пропаже пчел",
spoilerState = tempState,
)
}
}
}