-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Paywalls V2] Adds StackComponent (#1930)
- Loading branch information
1 parent
0563f9c
commit 39f4944
Showing
6 changed files
with
580 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/StackComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.revenuecat.purchases.paywalls.components | ||
|
||
import com.revenuecat.purchases.paywalls.components.properties.Border | ||
import com.revenuecat.purchases.paywalls.components.properties.ColorScheme | ||
import com.revenuecat.purchases.paywalls.components.properties.Dimension | ||
import com.revenuecat.purchases.paywalls.components.properties.Dimension.Vertical | ||
import com.revenuecat.purchases.paywalls.components.properties.FlexDistribution.START | ||
import com.revenuecat.purchases.paywalls.components.properties.HorizontalAlignment.CENTER | ||
import com.revenuecat.purchases.paywalls.components.properties.Padding | ||
import com.revenuecat.purchases.paywalls.components.properties.Padding.Companion.zero | ||
import com.revenuecat.purchases.paywalls.components.properties.Shadow | ||
import com.revenuecat.purchases.paywalls.components.properties.Shape | ||
import com.revenuecat.purchases.paywalls.components.properties.Size | ||
import com.revenuecat.purchases.paywalls.components.properties.SizeConstraint | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
@SerialName("stack") | ||
internal data class StackComponent( | ||
val components: List<PaywallComponent>, | ||
val dimension: Dimension = Vertical(CENTER, START), | ||
val size: Size = Size(width = SizeConstraint.Fill, height = SizeConstraint.Fit), | ||
val spacing: Float? = null, | ||
@SerialName("background_color") | ||
val backgroundColor: ColorScheme? = null, | ||
val padding: Padding = zero, | ||
val margin: Padding = zero, | ||
val shape: Shape? = null, | ||
val border: Border? = null, | ||
val shadow: Shadow? = null, | ||
val overrides: ComponentOverrides<PartialStackComponent>? = null, | ||
) : PaywallComponent | ||
|
||
@Serializable | ||
internal data class PartialStackComponent( | ||
val visible: Boolean? = true, | ||
val dimension: Dimension? = null, | ||
val size: Size? = null, | ||
val spacing: Float? = null, | ||
@SerialName("background_color") | ||
val backgroundColor: ColorScheme? = null, | ||
val padding: Padding? = null, | ||
val margin: Padding? = null, | ||
val shape: Shape? = null, | ||
val border: Border? = null, | ||
val shadow: Shadow? = null, | ||
) : PartialComponent |
9 changes: 9 additions & 0 deletions
9
purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/properties/Border.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.revenuecat.purchases.paywalls.components.properties | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
internal data class Border( | ||
val color: ColorScheme, | ||
val width: Double, | ||
) |
28 changes: 28 additions & 0 deletions
28
...ases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/properties/Dimension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.revenuecat.purchases.paywalls.components.properties | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
internal sealed interface Dimension { | ||
|
||
@Serializable | ||
@SerialName("vertical") | ||
data class Vertical( | ||
val alignment: HorizontalAlignment, | ||
val distribution: FlexDistribution, | ||
) : Dimension | ||
|
||
@Serializable | ||
@SerialName("horizontal") | ||
data class Horizontal( | ||
val alignment: VerticalAlignment, | ||
val distribution: FlexDistribution, | ||
) : Dimension | ||
|
||
@Serializable | ||
@SerialName("zlayer") | ||
data class ZLayer( | ||
val alignment: TwoDimensionalAlignment, | ||
) : Dimension | ||
} |
Oops, something went wrong.