pref: 对话框布局
This commit is contained in:
parent
13b478ae90
commit
fa3c87bc3d
|
|
@ -192,7 +192,7 @@ fun ConfirmDialog(
|
|||
onDismiss: (() -> Unit)? = null,
|
||||
confirmText: String = stringResource(id = R.string.button_sure_default),
|
||||
cancelText: String = stringResource(id = R.string.button_cancel),
|
||||
title: @Composable (DialogScope.() -> Unit) = {},
|
||||
title: @Composable (DialogScope.() -> Unit)? = null,
|
||||
content: @Composable (DialogScope.() -> Unit) = {},
|
||||
) {
|
||||
Dialog(
|
||||
|
|
@ -205,7 +205,7 @@ fun ConfirmDialog(
|
|||
DialogNegativeButton(text = cancelText, onClick = onCancel)
|
||||
},
|
||||
) {
|
||||
Column(modifier = Modifier.padding(horizontal = 12.dp)) {
|
||||
Column(modifier = Modifier.padding(horizontal = 24.dp)) {
|
||||
ProvideTextStyle(value = MaterialTheme.typography.body1) {
|
||||
ProvideContentColor(color = ExtendedTheme.colors.text) {
|
||||
content()
|
||||
|
|
@ -231,7 +231,7 @@ fun PromptDialog(
|
|||
onCancel: (() -> Unit)? = null,
|
||||
confirmText: String = stringResource(id = R.string.button_sure_default),
|
||||
cancelText: String = stringResource(id = R.string.button_cancel),
|
||||
title: @Composable (DialogScope.() -> Unit) = {},
|
||||
title: @Composable (DialogScope.() -> Unit)? = null,
|
||||
content: @Composable (DialogScope.() -> Unit) = {},
|
||||
) {
|
||||
var textVal by remember { mutableStateOf(initialValue) }
|
||||
|
|
@ -256,6 +256,7 @@ fun PromptDialog(
|
|||
.padding(horizontal = 24.dp)
|
||||
.padding(bottom = 16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
ProvideTextStyle(value = MaterialTheme.typography.body1) {
|
||||
ProvideContentColor(color = ExtendedTheme.colors.text) {
|
||||
|
|
@ -297,7 +298,7 @@ fun Dialog(
|
|||
modifier: Modifier = Modifier,
|
||||
dialogState: DialogState = rememberDialogState(),
|
||||
onDismiss: (() -> Unit)? = null,
|
||||
title: @Composable (DialogScope.() -> Unit) = {},
|
||||
title: @Composable (DialogScope.() -> Unit)? = null,
|
||||
cancelable: Boolean = true,
|
||||
cancelableOnTouchOutside: Boolean = true,
|
||||
buttons: @Composable (DialogScope.() -> Unit) = {},
|
||||
|
|
@ -344,6 +345,7 @@ fun Dialog(
|
|||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
ProvideContentColor(color = ExtendedTheme.colors.text) {
|
||||
if (title != null) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 24.dp)
|
||||
|
|
@ -353,6 +355,7 @@ fun Dialog(
|
|||
dialogScope.title()
|
||||
}
|
||||
}
|
||||
}
|
||||
Box(modifier = Modifier.align(Alignment.CenterHorizontally)) {
|
||||
dialogScope.content()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue