Skip to content

Commit

Permalink
Change dismiss item background (#119)
Browse files Browse the repository at this point in the history
* Change dismiss item background

* Change dismiss item background
  • Loading branch information
mdrlzy authored Oct 11, 2024
1 parent 8ec1677 commit 3ee6134
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
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,
)
}
}
}

0 comments on commit 3ee6134

Please sign in to comment.