Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change dismiss item background #119

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private fun DismissBackground(
) {
val color =
when (state.dismissDirection) {
SwipeToDismissBoxValue.EndToStart -> ArkColor.UtilityError200
SwipeToDismissBoxValue.EndToStart -> ArkColor.UtilityError500
else -> if (isPinned) ArkColor.FGQuarterary else ArkColor.Secondary
}

Expand Down Expand Up @@ -150,12 +150,20 @@ private fun DismissBackground(
}
Spacer(modifier = Modifier)
if (state.dismissDirection == SwipeToDismissBoxValue.EndToStart) {
Icon(
modifier = Modifier.padding(end = 17.dp),
painter = painterResource(id = R.drawable.ic_delete),
contentDescription = "",
tint = ArkColor.FGErrorPrimary,
)
Row {
Text(
modifier = Modifier.padding(end = 4.dp),
text = stringResource(R.string.delete),
fontWeight = FontWeight.Medium,
color = Color.White,
)
Icon(
modifier = Modifier.padding(end = 17.dp),
painter = painterResource(id = R.drawable.ic_delete),
contentDescription = "",
tint = Color.White,
)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.SwipeToDismissBox
import androidx.compose.material3.SwipeToDismissBoxState
import androidx.compose.material3.SwipeToDismissBoxValue
import androidx.compose.material3.Text
import androidx.compose.material3.rememberSwipeToDismissBoxState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import dev.arkbuilders.rate.R
import dev.arkbuilders.rate.presentation.theme.ArkColor
Expand Down Expand Up @@ -53,7 +56,7 @@ fun AppSwipeToDismiss(
private fun DismissBackground(state: SwipeToDismissBoxState) {
val color =
when (state.dismissDirection) {
SwipeToDismissBoxValue.EndToStart -> ArkColor.UtilityError200
SwipeToDismissBoxValue.EndToStart -> ArkColor.UtilityError500
else -> Color.Transparent
}

Expand All @@ -66,11 +69,19 @@ private fun DismissBackground(state: SwipeToDismissBoxState) {
horizontalArrangement = Arrangement.SpaceBetween,
) {
Spacer(modifier = Modifier)
Icon(
modifier = Modifier.padding(end = 17.dp),
painter = painterResource(id = R.drawable.ic_delete),
contentDescription = "",
tint = ArkColor.FGErrorPrimary,
)
Row {
Text(
modifier = Modifier.padding(end = 4.dp),
text = stringResource(R.string.delete),
fontWeight = FontWeight.Medium,
color = Color.White,
)
Icon(
modifier = Modifier.padding(end = 17.dp),
painter = painterResource(id = R.drawable.ic_delete),
contentDescription = "",
tint = Color.White,
)
}
}
}