Make action sheet pickers scrollable
This commit is contained in:
@@ -1058,6 +1058,10 @@ fun MulticaCupertinoActionSheet(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
message = {
|
message = {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
) {
|
||||||
if (!message.isNullOrBlank()) {
|
if (!message.isNullOrBlank()) {
|
||||||
Text(
|
Text(
|
||||||
text = message,
|
text = message,
|
||||||
@@ -1065,22 +1069,59 @@ fun MulticaCupertinoActionSheet(
|
|||||||
color = MulticaColors.TextTertiary,
|
color = MulticaColors.TextTertiary,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
)
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
}
|
}
|
||||||
},
|
LazyColumn(
|
||||||
buttons = {
|
modifier = Modifier
|
||||||
items.forEach { item ->
|
.fillMaxWidth()
|
||||||
action(
|
.heightIn(max = 420.dp),
|
||||||
|
) {
|
||||||
|
items(items.size) { index ->
|
||||||
|
val item = items[index]
|
||||||
|
MulticaCupertinoActionSheetItemContent(
|
||||||
|
item = item,
|
||||||
onClick = {
|
onClick = {
|
||||||
|
if (!item.enabled) return@MulticaCupertinoActionSheetItemContent
|
||||||
performMulticaTapFeedback(haptic)
|
performMulticaTapFeedback(haptic)
|
||||||
item.onClick()
|
item.onClick()
|
||||||
onDismissRequest()
|
onDismissRequest()
|
||||||
},
|
},
|
||||||
style = if (item.destructive) AlertActionStyle.Destructive else AlertActionStyle.Default,
|
)
|
||||||
enabled = item.enabled,
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
buttons = {
|
||||||
|
if (!cancelText.isNullOrBlank()) {
|
||||||
|
action(
|
||||||
|
onClick = {
|
||||||
|
performMulticaTapFeedback(haptic)
|
||||||
|
onDismissRequest()
|
||||||
|
},
|
||||||
|
style = AlertActionStyle.Cancel,
|
||||||
|
enabled = true,
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = cancelText,
|
||||||
|
style = MaterialTheme.typography.bodyMedium.copy(fontSize = 15.sp, fontWeight = FontWeight.SemiBold),
|
||||||
|
color = MulticaColors.Accent,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun MulticaCupertinoActionSheetItemContent(
|
||||||
|
item: MulticaCupertinoActionSheetItem,
|
||||||
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
.clickable(enabled = item.enabled, onClick = onClick)
|
||||||
|
.padding(horizontal = 12.dp, vertical = 11.dp)
|
||||||
.semantics(mergeDescendants = true) {
|
.semantics(mergeDescendants = true) {
|
||||||
contentDescription = "Multica Cupertino Action Sheet ${item.contentDescription ?: item.title}"
|
contentDescription = "Multica Cupertino Action Sheet ${item.contentDescription ?: item.title}"
|
||||||
},
|
},
|
||||||
@@ -1147,26 +1188,6 @@ fun MulticaCupertinoActionSheet(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!cancelText.isNullOrBlank()) {
|
|
||||||
action(
|
|
||||||
onClick = {
|
|
||||||
performMulticaTapFeedback(haptic)
|
|
||||||
onDismissRequest()
|
|
||||||
},
|
|
||||||
style = AlertActionStyle.Cancel,
|
|
||||||
enabled = true,
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = cancelText,
|
|
||||||
style = MaterialTheme.typography.bodyMedium.copy(fontSize = 15.sp, fontWeight = FontWeight.SemiBold),
|
|
||||||
color = MulticaColors.Accent,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@OptIn(ExperimentalCupertinoApi::class)
|
@OptIn(ExperimentalCupertinoApi::class)
|
||||||
|
|||||||
Reference in New Issue
Block a user