diff --git a/app/src/main/java/com/aiosman/riderpro/ui/composables/EditCommentBottomModal.kt b/app/src/main/java/com/aiosman/riderpro/ui/composables/EditCommentBottomModal.kt index f4a6bbc..3fd49c8 100644 --- a/app/src/main/java/com/aiosman/riderpro/ui/composables/EditCommentBottomModal.kt +++ b/app/src/main/java/com/aiosman/riderpro/ui/composables/EditCommentBottomModal.kt @@ -1,5 +1,7 @@ package com.aiosman.riderpro.ui.composables +import androidx.compose.animation.Crossfade +import androidx.compose.animation.core.tween import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box @@ -24,6 +26,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -74,16 +77,25 @@ fun EditCommentBottomModal( fontSize = 20.sp, fontStyle = FontStyle.Italic ) - Image( - painter = painterResource(id = R.drawable.rider_pro_send), - contentDescription = "Send", - modifier = Modifier - .size(32.dp) - .noRippleClickable { - onSend(text) - text = "" - }, - ) + Crossfade(targetState = text.isNotEmpty(), animationSpec = tween(500)) { isNotEmpty -> + Image( + painter = rememberUpdatedState( + if (isNotEmpty) painterResource(id = R.drawable.rider_pro_send) else painterResource( + id = R.drawable.rider_pro_send_disable + ) + ).value, + contentDescription = "Send", + modifier = Modifier + .size(32.dp) + .noRippleClickable { + if (text.isNotEmpty()){ + onSend(text) + text = "" + } + + }, + ) + } } Spacer(modifier = Modifier.height(16.dp)) if (replyComment != null) { diff --git a/app/src/main/res/drawable/rider_pro_send_disable.xml b/app/src/main/res/drawable/rider_pro_send_disable.xml new file mode 100644 index 0000000..2e25ffc --- /dev/null +++ b/app/src/main/res/drawable/rider_pro_send_disable.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + +