Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ModalFullScreenScaffold has now a spacing between button in portrait and add reverse order #592

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,13 @@ 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
Loading