From a6722196e2c2eed75bb21881cea0d06d5244ba1a Mon Sep 17 00:00:00 2001 From: Soumya Ranjan Patra Date: Wed, 10 Jul 2024 16:14:18 +0530 Subject: [PATCH] =?UTF-8?q?TP-73396=20|=20removing=20this.then=20from=20se?= =?UTF-8?q?tWidth=20and=20setHeight=20to=20ensure=20n=E2=80=A6=20(#503)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/navi/uitron/utils/Ext.kt | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/navi-uitron/src/main/java/com/navi/uitron/utils/Ext.kt b/navi-uitron/src/main/java/com/navi/uitron/utils/Ext.kt index 1b41f1c..cc56c57 100644 --- a/navi-uitron/src/main/java/com/navi/uitron/utils/Ext.kt +++ b/navi-uitron/src/main/java/com/navi/uitron/utils/Ext.kt @@ -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) {