Skip to content

Commit

Permalink
Fix detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
Aashay Gaikwad committed Oct 25, 2023
1 parent bad845d commit 0c13453
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ class SpotlightHeroDefaultVisualisation<InteractionTarget : Any>(
BaseVisualisation<InteractionTarget, State<InteractionTarget>, MutableUiState, TargetUiState>(
uiContext = uiContext
) {
private val scrollX = GenericFloatProperty(uiContext.coroutineScope, GenericFloatProperty.Target(initialState.activeIndex))
override val heroProgress = HeroProgress(uiContext.coroutineScope, GenericFloatProperty.Target(initialState.heroProgress()))
private val scrollX = GenericFloatProperty(
coroutineScope = uiContext.coroutineScope,
target = GenericFloatProperty.Target(initialState.activeIndex)
)
override val heroProgress = HeroProgress(
coroutineScope = uiContext.coroutineScope,
target = GenericFloatProperty.Target(initialState.heroProgress())
)
override val viewpointDimensions: List<Pair<(State<InteractionTarget>) -> Float, GenericFloatProperty>> =
listOf(
{ state: State<InteractionTarget> -> state.activeIndex } to scrollX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.bumble.appyx.navigation.plugin.NodeReadyObserver
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch

@Suppress("CompositionLocalAllowlist")
val LocalNavigator = compositionLocalOf { Navigator() }

class Navigator : NodeReadyObserver<RootNode> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class CakeImageNode(
@Composable
override fun View(modifier: Modifier) {
val interactionSource = remember { MutableInteractionSource() }
val heroProgress = motionPropertyRenderValue<Float, HeroProgress>() ?: 0f

Box(
modifier = modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.bumble.appyx.navigation.collections.toImmutableList
import com.bumble.appyx.navigation.modality.BuildContext
import com.bumble.appyx.navigation.node.Node
import com.bumble.appyx.navigation.node.checkout.Address.AddressOne
Expand Down Expand Up @@ -50,15 +51,15 @@ class AddressNode(
}

@Composable
private fun AddressSelection(modifier: Modifier) {
private fun AddressSelection(modifier: Modifier = Modifier) {
var selectedAddress by remember { mutableStateOf<CheckoutFormField>(AddressOne) }

Surface(
modifier = modifier.fillMaxSize()
) {
Box(contentAlignment = Alignment.Center) {
Column(
modifier = modifier.padding(16.dp),
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Text(
Expand All @@ -68,7 +69,7 @@ class AddressNode(
)
Spacer(modifier = Modifier.requiredHeight(4.dp))
Options(
values = addresses,
values = addresses.toImmutableList(),
selected = selectedAddress,
onUpdate = { selectedAddress = it }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fun CartContent(
val cartList = remember(cartItems) { cartItems.toList() }

LazyColumn(
modifier = modifier
modifier = Modifier
.fillMaxSize()
.padding(16.dp)
.weight(1f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.bumble.appyx.navigation.node.checkout

interface CheckoutFormField {
val value: String
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import com.bumble.appyx.navigation.collections.ImmutableList

@Composable
fun Options(
values: List<CheckoutFormField>,
values: ImmutableList<CheckoutFormField>,
selected: CheckoutFormField,
onUpdate: (CheckoutFormField) -> Unit,
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -54,4 +55,4 @@ private fun RadioOption(
)
Text(text = text, style = MaterialTheme.typography.bodyLarge)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class OrderConfirmedNode(
}

@Composable
private fun PaymentDetails(modifier: Modifier) {
private fun PaymentDetails(modifier: Modifier = Modifier) {
Column(
modifier = modifier.fillMaxSize().padding(16.dp),
verticalArrangement = Arrangement.Center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.bumble.appyx.navigation.collections.toImmutableList
import com.bumble.appyx.navigation.modality.BuildContext
import com.bumble.appyx.navigation.node.Node
import com.bumble.appyx.navigation.node.checkout.PaymentOption.Card
Expand Down Expand Up @@ -54,15 +55,15 @@ class PaymentNode(
}

@Composable
private fun PaymentDetails(modifier: Modifier) {
private fun PaymentDetails(modifier: Modifier = Modifier) {
var paymentOption by remember { mutableStateOf<CheckoutFormField>(Card) }

Surface(
modifier = modifier.fillMaxSize()
) {
Box(contentAlignment = Alignment.Center) {
Column(
modifier = modifier.padding(16.dp),
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Text(
Expand All @@ -72,7 +73,7 @@ class PaymentNode(
)
Spacer(modifier = Modifier.requiredHeight(4.dp))
Options(
values = paymentOptions,
values = paymentOptions.toImmutableList(),
selected = paymentOption,
onUpdate = { paymentOption = it }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.bumble.appyx.navigation.collections.toImmutableList
import com.bumble.appyx.navigation.modality.BuildContext
import com.bumble.appyx.navigation.node.Node
import com.bumble.appyx.navigation.node.checkout.ShippingMethod.Pony
Expand Down Expand Up @@ -54,15 +55,15 @@ class ShippingDetailsNode(
}

@Composable
private fun ShippingDetails(modifier: Modifier) {
private fun ShippingDetails(modifier: Modifier = Modifier) {
var shippingMethod by remember { mutableStateOf<CheckoutFormField>(Pony) }

Surface(
modifier = modifier.fillMaxSize()
) {
Box(contentAlignment = Alignment.Center) {
Column(
modifier = modifier.padding(16.dp),
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Text(
Expand All @@ -72,7 +73,7 @@ class ShippingDetailsNode(
)
Spacer(modifier = Modifier.requiredHeight(4.dp))
Options(
values = shippingMethods,
values = shippingMethods.toImmutableList(),
selected = shippingMethod,
onUpdate = { shippingMethod = it }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import androidx.compose.ui.unit.dp

@Composable
fun PlaceholderScreen(
modifier: Modifier = Modifier,
title: String,
buttonText: String,
onClick: () -> Unit
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Surface(
modifier = modifier
Expand Down

0 comments on commit 0c13453

Please sign in to comment.