Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Amr committed Nov 8, 2021
1 parent 05a2481 commit 5769e1e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
Expand All @@ -20,6 +21,8 @@ data class Action(
@DrawableRes val iconRes: Int? = null,
val color: Color,
val text: String = "",
val textColor: Color = Color.White,
val widthInDp: Dp = Dp.Unspecified,
val onAction: () -> Unit
)

Expand All @@ -31,6 +34,7 @@ fun SwipeableAction(
Box(
modifier = Modifier
.height(actionHeightDp)
.width(action.widthInDp)
.clickable { action.onAction() }
.background(color = action.color)
.padding(6.dp)
Expand All @@ -47,7 +51,7 @@ fun SwipeableAction(
}
Text(
text = action.text,
color = Color.White,
color = action.textColor,
modifier = Modifier
.padding(top = 4.dp)
.align(
Expand Down

0 comments on commit 5769e1e

Please sign in to comment.