Skip to content

Commit

Permalink
fix: ModalFullScreenScaffold has now a spacing between button in port…
Browse files Browse the repository at this point in the history
…rait and add reverse order
  • Loading branch information
soulcramer committed Aug 3, 2023
1 parent f5170e9 commit e7eee4c
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import com.adevinta.spark.tools.preview.DevicePreviews
* @param illustration whether the modal display a close icon, and its corresponding action
* @param mainButton the main actions for this modal (should be a [ButtonFilled])
* @param supportButton the support or alternative actions for this modal (should any other button than [ButtonFilled])
* @param reverseButtonOrder inverse the order of the buttons, so the mainButton button is shown at the top in portrait mode
* @param content the center custom Composable for modal content
*/
@ExperimentalSparkApi
Expand All @@ -89,6 +90,7 @@ public fun ModalFullScreenScaffold(
@DrawableRes illustration: Int? = null,
mainButton: @Composable (Modifier) -> Unit = {},
supportButton: @Composable (Modifier) -> Unit = {},
reverseButtonOrder: Boolean = false,
content: @Composable (PaddingValues) -> Unit,
) {
val size = Layout.windowSize
Expand All @@ -106,6 +108,7 @@ public fun ModalFullScreenScaffold(
illustration = illustration,
mainButton = mainButton,
supportButton = supportButton,
reverseButtonOrder = reverseButtonOrder,
content = content,
)
}
Expand Down Expand Up @@ -194,6 +197,7 @@ private fun PhonePortraitModalScaffold(
@DrawableRes illustration: Int? = null,
mainButton: @Composable (Modifier) -> Unit = {},
supportButton: @Composable (Modifier) -> Unit = {},
reverseButtonOrder: Boolean = false,
content: @Composable (PaddingValues) -> Unit,
) {
Scaffold(
Expand All @@ -219,10 +223,14 @@ private fun PhonePortraitModalScaffold(
.fillMaxWidth()
.padding(horizontal = Layout.bodyMargin)
.padding(bottom = 16.dp),

verticalArrangement = Arrangement.spacedBy(8.dp, Alignment.Bottom),
) {
val buttonModifier = Modifier.fillMaxWidth()
if(reverseButtonOrder) mainButton(buttonModifier)
supportButton(buttonModifier)
mainButton(buttonModifier)
if(!reverseButtonOrder) mainButton(buttonModifier)

}
} else {
Row(
Expand Down

0 comments on commit e7eee4c

Please sign in to comment.