Skip to content

Instantly share code, notes, and snippets.

View sergenes's full-sized avatar
🏠
Working from home

Sergey Neskoromny sergenes

🏠
Working from home
View GitHub Profile
@Preview
@Composable
fun TestNiceButton() {
NiceButton(title = "Test Button") { }
}
Composable
fun NiceButton(
title: String,
textColor: Color = primaryTextColor,
@Preview
@Composable
fun TestSingle() {
HomeListItem("Item Name", "03/13/21", SINGLE, false, {}, {})
}
@Preview
@Composable
fun TestTop() {
HomeListItem("Item Name", "03/13/21", TOP, false, {}, {})
if (editMode && deleteMode) {
Button(
onClick = {
onDelete()
deleteMode = false
},
modifier = Modifier
.width(deleteButtonWidth)
.fillMaxHeight(),
shape = RoundedCornerShape(noRadius),
if (!editMode && !deleteMode) {
Icon(
imageVector = Icons.Filled.ChevronRight,
contentDescription = "forward",
modifier = Modifier.align(Alignment.CenterVertically)
)
Spacer(Modifier.width(normalRadius))
}
Column(Modifier.weight(1f)) {
Column(
horizontalAlignment = Alignment.Start,
modifier = Modifier.padding(normalSpace)
) {
Text(
title,
style = MaterialTheme.typography.subtitle1,
color = secondaryColor,
maxLines = 1,
var deleteMode by remember { mutableStateOf(false) }
if (editMode && !deleteMode) {
Button(
onClick = {
deleteMode = !deleteMode
}, modifier = Modifier
.width(deleteButtonWidth)
.fillMaxHeight(),
shape = RoundedCornerShape(noRadius),
colors = ButtonDefaults.outlinedButtonColors(
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.clickable(onClick = onClick)
.padding(normalSpace, noSpace, normalSpace, noSpace)
.fillMaxWidth()
.height(rowHeight)
.clip(shape)
.background(color = primaryColor)
) {
Column {
Row(){
...
}
if (type != RowType.BOTTOM && type != RowType.SINGLE) {
Divider(
modifier = Modifier
.padding(normalSpace, noSpace, normalSpace, noSpace),
color = Color.White,
thickness = dividerNormalThickness
val shape = when (type) {
RowType.TOP -> {
RoundedCornerShape(normalRadius, normalRadius)
}
RowType.BOTTOM -> {
RoundedCornerShape(
noRadius,
noRadius,
normalRadius,
normalRadius)
@sergenes
sergenes / Constants.kt
Last active June 23, 2021 21:07
Constants1
val primaryTextColor = Color(0xFF444444)
val primaryColor = Color(0xffadf4ff)
val normalSpace = 16.dp
val smallSpace = 8.dp
val noSpace = 0.dp
val normalTouchableHeight = 44.dp
val noRadius = 0.dp
val normalRadius = 16.dp
val rowHeight = 84.dp