-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement IvySwitch component and use it in SettingsContent * Improve switch UI in Settings * Handle terms of use and privacy policy click events * Improve Settings screen's UI * Improve Settings screen's UI & SettingsButton * Implement DeleteAccountConfirmationDialog composable * Improve UI/UX * Fix event handling * Fix setting button titles * Remove not needed imports * Support button loading state
- Loading branch information
1 parent
7b22c8c
commit 13f722f
Showing
7 changed files
with
280 additions
and
63 deletions.
There are no files selected for viewing
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
49 changes: 49 additions & 0 deletions
49
composeApp/src/commonMain/kotlin/component/button/IvySwitch.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,49 @@ | ||
package component.button | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Switch | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.unit.dp | ||
import ui.theme.colorsExt | ||
|
||
@Composable | ||
fun IvySwitch( | ||
checked: Boolean, | ||
modifier: Modifier = Modifier, | ||
onCheckedChange: (Boolean) -> Unit, | ||
text: @Composable () -> Unit, | ||
) { | ||
Row( | ||
modifier = modifier | ||
.clip(MaterialTheme.shapes.medium) | ||
.clickable( | ||
onClick = { | ||
onCheckedChange(!checked) | ||
} | ||
) | ||
.background( | ||
color = MaterialTheme.colorsExt.backgroundVariant, | ||
shape = MaterialTheme.shapes.medium | ||
) | ||
.padding(horizontal = 16.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.Center | ||
) { | ||
text() | ||
Spacer(Modifier.weight(1f)) | ||
Switch( | ||
checked = checked, | ||
onCheckedChange = onCheckedChange | ||
) | ||
} | ||
} |
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
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
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
63 changes: 63 additions & 0 deletions
63
...pp/src/commonMain/kotlin/ui/screen/settings/composable/DeleteAccountConfirmationDialog.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,63 @@ | ||
package ui.screen.settings.composable | ||
|
||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.AlertDialog | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import component.button.ButtonAppearance | ||
import component.button.ButtonStyle | ||
import component.button.IvyButton | ||
import ui.screen.settings.DeleteDialogViewState | ||
import ui.theme.colorsExt | ||
|
||
@Composable | ||
fun DeleteAccountConfirmationDialog( | ||
viewState: DeleteDialogViewState, | ||
modifier: Modifier = Modifier, | ||
onConfirmDeleteAccountClick: () -> Unit, | ||
onCancelDeleteAccountClick: () -> Unit | ||
) { | ||
AlertDialog( | ||
modifier = modifier, | ||
title = { | ||
Text( | ||
text = "Confirm Account Deletion", | ||
style = MaterialTheme.typography.subtitle1 | ||
) | ||
}, | ||
text = { | ||
Text( | ||
text = "By proceeding, you confirm your request to permanently delete your account and all " + | ||
"associated data. This action is irreversible and cannot be undone. Please review our " + | ||
"Privacy Policy and Terms of Service for further details.", | ||
style = MaterialTheme.typography.subtitle2 | ||
) | ||
}, | ||
onDismissRequest = onCancelDeleteAccountClick, | ||
confirmButton = { | ||
IvyButton( | ||
appearance = ButtonAppearance.Filled(ButtonStyle.Destructive), | ||
loading = viewState.ctaLoading, | ||
onClick = onConfirmDeleteAccountClick, | ||
text = { | ||
Text(text = "DELETE ACCOUNT") | ||
} | ||
) | ||
}, | ||
dismissButton = { | ||
IvyButton( | ||
appearance = ButtonAppearance.Filled(ButtonStyle.Neutral), | ||
onClick = onCancelDeleteAccountClick, | ||
text = { | ||
Text(text = "Cancel") | ||
} | ||
) | ||
}, | ||
backgroundColor = MaterialTheme.colorsExt.backgroundVariant, | ||
contentColor = MaterialTheme.colorsExt.onBackgroundVariant, | ||
shape = RoundedCornerShape(8.dp) | ||
) | ||
} |
Oops, something went wrong.