From e2f810a926564ab6bf1a91737e071b9ee37f18bf Mon Sep 17 00:00:00 2001 From: "burak.ozturk1" Date: Thu, 17 Oct 2024 14:04:09 +0300 Subject: [PATCH] Add subtract remove icons moved to QuantityIcons --- libraries/quantity-picker-compose/README.md | 6 +++++- .../trendyol/uicomponents/quantitypicker/QuantityPicker.kt | 6 ++++-- .../trendyol/uicomponents/quantitypicker/QuantityText.kt | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libraries/quantity-picker-compose/README.md b/libraries/quantity-picker-compose/README.md index de8680d..6397972 100644 --- a/libraries/quantity-picker-compose/README.md +++ b/libraries/quantity-picker-compose/README.md @@ -28,7 +28,6 @@ dependencies { You can add **QuantityPicker** wherever you want with your modifier - | Attribute | Type | Description | | ------------------- | ----------------------- | ------------------------------------------------------------ | | modifier | Modifier | Compose modifier for QuantityPicker | @@ -87,6 +86,10 @@ QuantityPicker( ) ``` +# Repository From + +[https://github.com/selimtoksal/QuantityPicker](https://github.com/selimtoksal/QuantityPicker) + # Contributors This library is maintained mainly by Trendyol Android Team members but also other Android lovers contributes. @@ -98,3 +101,4 @@ Copyright 2023 Trendyol.com Licensed under the Apache License, Version 2.0 (t http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` + diff --git a/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityPicker.kt b/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityPicker.kt index b78f074..f3518df 100644 --- a/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityPicker.kt +++ b/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityPicker.kt @@ -1,6 +1,7 @@ package com.trendyol.uicomponents.quantitypicker import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.animateContentSize import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column @@ -133,11 +134,12 @@ internal fun HorizontalQuantityPicker( .background( color = quantityShape.backgroundColor, shape = quantityShape.shape - ), + ) + .animateContentSize(), verticalAlignment = Alignment.CenterVertically ) { - AnimatedVisibility(visible = quantityData.currentQuantity > 0 || showLoading) { + if (quantityData.currentQuantity > 0 || showLoading) { Row(verticalAlignment = Alignment.CenterVertically) { QuantitySubtractIcon( icons = icons, diff --git a/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityText.kt b/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityText.kt index a78f5e3..467ec9b 100644 --- a/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityText.kt +++ b/libraries/quantity-picker-compose/src/main/java/com/trendyol/uicomponents/quantitypicker/QuantityText.kt @@ -2,6 +2,7 @@ package com.trendyol.uicomponents.quantitypicker import androidx.compose.animation.Crossfade import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.size import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.Text @@ -59,6 +60,7 @@ internal fun QuantityText( text = text, style = textStyle, modifier = Modifier + .clickable(enabled = false) {} .background( shape.backgroundColor, shape.shape