TP-73396 | removing this.then from setWidth and setHeight to ensure n… (#503)

This commit is contained in:
Soumya Ranjan Patra
2024-07-10 16:14:18 +05:30
committed by GitHub
parent 0423b072aa
commit a6722196e2

View File

@@ -148,32 +148,28 @@ import org.json.JSONArray
import org.json.JSONObject
fun Modifier.setHeight(height: String?): Modifier =
this.then(
when (height) {
ComposeSize.MATCH_PARENT.name -> fillMaxHeight()
ComposeSize.WRAP_CONTENT.name -> wrapContentHeight()
ComposeSize.FILL_TO_CONSTRAINTS.name -> this
ComposeSize.INTRINSIC_MIN.name -> height(IntrinsicSize.Min)
ComposeSize.INTRINSIC_MAX.name -> height(IntrinsicSize.Max)
else -> {
height?.toIntOrNull()?.let { height(it.dp) } ?: kotlin.run { wrapContentHeight() }
}
when (height) {
ComposeSize.MATCH_PARENT.name -> fillMaxHeight()
ComposeSize.WRAP_CONTENT.name -> wrapContentHeight()
ComposeSize.FILL_TO_CONSTRAINTS.name -> this
ComposeSize.INTRINSIC_MIN.name -> height(IntrinsicSize.Min)
ComposeSize.INTRINSIC_MAX.name -> height(IntrinsicSize.Max)
else -> {
height?.toIntOrNull()?.let { height(it.dp) } ?: kotlin.run { wrapContentHeight() }
}
)
}
fun Modifier.setWidth(width: String?): Modifier =
this.then(
when (width) {
ComposeSize.MATCH_PARENT.name -> fillMaxWidth()
ComposeSize.WRAP_CONTENT.name -> wrapContentWidth()
ComposeSize.FILL_TO_CONSTRAINTS.name -> this
ComposeSize.INTRINSIC_MIN.name -> width(IntrinsicSize.Min)
ComposeSize.INTRINSIC_MAX.name -> width(IntrinsicSize.Max)
else -> {
width?.toIntOrNull()?.let { width(it.dp) } ?: kotlin.run { wrapContentWidth() }
}
when (width) {
ComposeSize.MATCH_PARENT.name -> fillMaxWidth()
ComposeSize.WRAP_CONTENT.name -> wrapContentWidth()
ComposeSize.FILL_TO_CONSTRAINTS.name -> this
ComposeSize.INTRINSIC_MIN.name -> width(IntrinsicSize.Min)
ComposeSize.INTRINSIC_MAX.name -> width(IntrinsicSize.Max)
else -> {
width?.toIntOrNull()?.let { width(it.dp) } ?: kotlin.run { wrapContentWidth() }
}
)
}
fun Modifier.setVerticalScroll(scrollData: ScrollData?): Modifier = composed {
if (scrollData?.enabled == true) {