Skip to content

akardas16/SwipeActions

Repository files navigation

Jatpack-Compose / SwipeActions

Showcases

Install

Basic Usage

 var isExpanded by remember { mutableStateOf(false) }

 SwipeActionsRight(modifier = Modifier
            .fillMaxWidth(0.95f)
            .height(100.dp), 
            isExpanded = isExpanded, onChangedCard = { isExpanded = it }) {
            Row(modifier = Modifier  //Your Custom UI
                    .fillMaxWidth()
                    .fillMaxHeight()
                    .padding(15.dp),
                horizontalArrangement = Arrangement.SpaceAround
            ) {
                Column(modifier = Modifier.fillMaxHeight(),
                    verticalArrangement = Arrangement.SpaceAround) {
                    Text(
                        text = "Swipe Actions", color = Color.Black,
                        fontSize = 18.sp, fontFamily = FontFamily(Font(R.font.lato_bold))
                    )

                    Text(
                        text = "For more options, swipe the cardddd", color = Color.Black,
                        fontSize = 16.sp, fontFamily = FontFamily(Font(R.font.lato_regular))
                    )
                }

            }
        }
  • Toggle / Extend / Collapse
isExpanded = !isExpanded //switch status

isExpanded = true //open

isExpanded = false //close
  • Required Parameters
SwipeActionsRight(isExpanded:Boolean, onChangedCard:(isExpanded:Boolean) -> Unit)
  • Available parameters
modifier: Modifier = Modifier,
                    isExpanded:Boolean, numberOfActions:Int = 2,
                    onChangedCard:(isExpanded:Boolean) -> Unit,
                    type: Type = Type.Icon, iconPadding: Dp = 29.dp,
                    cornerRadius: Dp = 24.dp, itemWidth: Dp = 100.dp,
                    actionOneColor: Color = Color.Red, actionTwoColor: Color = Color.White,
                    actionOneText: String = "Delete", actionTwoText: String = "Mail",
                    actionOneImage: ImageVector = Icons.Rounded.Delete,
                    actionTwoImage: ImageVector = Icons.Default.Mail,
                    actionOneBackColor: Color = Color(0x5EA5A3A3),
                    actionTwoBackColor: Color = Color(0x5EA5A3A3),
                    cardBackground:Color = Color(0xFFCACACE),
                    actionOneClicked:() -> Unit = {}, actionTwoClicked:() -> Unit = {}

Want to see showcase?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages