Skip to content

Commit

Permalink
loading info passed add button
Browse files Browse the repository at this point in the history
  • Loading branch information
burak.ozturk1 committed Jan 7, 2025
1 parent 09f4233 commit 822290e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import kotlinx.coroutines.launch
internal fun QuantityAddIcon(
icons: QuantityIcons,
quantityData: QuantityPickerViewData,
onAddClick: (() -> Unit)?
onAddClick: (() -> Unit)?,
showLoading: Boolean
) {
val coroutineScope = rememberCoroutineScope()
var targetBackgroundColor by remember {
Expand All @@ -51,8 +52,8 @@ internal fun QuantityAddIcon(
}
}

LaunchedEffect(key1 = quantityData.currentQuantity) {
if (lastQuantityCount != quantityData.currentQuantity) {
LaunchedEffect(key1 = quantityData.currentQuantity, showLoading) {
if (lastQuantityCount != quantityData.currentQuantity && showLoading.not()) {
lastQuantityCount = quantityData.currentQuantity
iconTintColor = quantityData.getAddIconColor(icons, quantityData.currentQuantity)
setTargetBackgroundColor.invoke(quantityData.getBackgroundColor(icons))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ internal fun VerticalQuantityPicker(
QuantityAddIcon(
icons = icons,
quantityData = quantityData,
onAddClick = onAddClick
onAddClick = onAddClick,
showLoading = showLoading
)

AnimatedVisibility(visible = quantityData.currentQuantity > 0 || showLoading) {
Expand Down Expand Up @@ -158,6 +159,7 @@ internal fun HorizontalQuantityPicker(
icons = icons,
quantityData = quantityData,
onAddClick = onAddClick,
showLoading = showLoading,
)
}
}
Expand Down

0 comments on commit 822290e

Please sign in to comment.