Skip to content

Commit

Permalink
Fix padding for dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Sep 8, 2023
1 parent 521db02 commit 854f0c2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ fun ListItem(

@Composable
fun ChangeListItem(text: String) {
val smallPadding = Dimens.smallPadding

ConstraintLayout {
val (bullet, changeLog) = createRefs()
Expand All @@ -170,7 +169,7 @@ fun ChangeListItem(text: String) {
modifier =
Modifier.absolutePadding(left = Dimens.mediumPadding).constrainAs(changeLog) {
top.linkTo(parent.top)
bottom.linkTo(parent.bottom, margin = smallPadding)
bottom.linkTo(parent.bottom)
start.linkTo(parent.start)
end.linkTo(parent.end)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package net.mullvad.mullvadvpn.compose.dialog

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
Expand Down Expand Up @@ -39,13 +39,16 @@ fun ChangelogDialog(changesList: List<String>, version: String, onDismiss: () ->
)
},
text = {
Column {
Column(
modifier = Modifier.fillMaxWidth(),
verticalArrangement =
Arrangement.spacedBy(dimensionResource(id = R.dimen.small_padding))
) {
Text(
text = stringResource(R.string.changes_dialog_subtitle),
fontSize = 18.sp,
color = Color.White,
modifier =
Modifier.padding(vertical = dimensionResource(id = R.dimen.medium_padding))
modifier = Modifier.fillMaxWidth()
)

changesList.forEach { changeItem -> ChangeListItem(text = changeItem) }
Expand All @@ -55,7 +58,6 @@ fun ChangelogDialog(changesList: List<String>, version: String, onDismiss: () ->
Button(
modifier =
Modifier.wrapContentHeight()
.padding(all = dimensionResource(id = R.dimen.medium_padding))
.defaultMinSize(minHeight = dimensionResource(id = R.dimen.button_height))
.fillMaxWidth(),
colors =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package net.mullvad.mullvadvpn.compose.dialog

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
Expand Down Expand Up @@ -58,17 +57,17 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () ->
text = {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.padding(top = verticalSpacing)
) {
Text(
text = message,
color = colorResource(id = R.color.white),
fontSize = dimensionResource(id = R.dimen.text_small).value.sp,
fontStyle = FontStyle.Normal,
textAlign = TextAlign.Start,
modifier = Modifier.padding(bottom = verticalSpacing).fillMaxWidth()
modifier = Modifier.fillMaxWidth()
)
if (additionalInfo != null) {
Spacer(modifier = Modifier.height(verticalSpacing))
HtmlText(
htmlFormattedString = additionalInfo,
textColor = colorResource(id = R.color.white).toArgb(),
Expand All @@ -80,11 +79,7 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () ->
},
confirmButton = {
Button(
modifier =
Modifier.wrapContentHeight()
.padding(all = dimensionResource(id = R.dimen.medium_padding))
.defaultMinSize(minHeight = dimensionResource(id = R.dimen.button_height))
.fillMaxWidth(),
modifier = Modifier.wrapContentHeight().fillMaxWidth(),
colors =
ButtonDefaults.buttonColors(
containerColor = colorResource(id = R.color.blue),
Expand Down

0 comments on commit 854f0c2

Please sign in to comment.