Lambda parameters in a composable function should be in present tense, not past tense.
https://mrmans0n.github.io/compose-rules/rules/#naming-parameters-properly
This commit is contained in:
parent
0ba5537082
commit
37d9a9f5a9
250 changed files with 1698 additions and 1698 deletions
|
|
@ -45,8 +45,8 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
fun DialogLikeBannerMolecule(
|
||||
title: String,
|
||||
content: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
onDismissClicked: (() -> Unit)?,
|
||||
onSubmitClick: () -> Unit,
|
||||
onDismissClick: (() -> Unit)?,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Box(modifier = modifier.padding(horizontal = 16.dp, vertical = 8.dp)) {
|
||||
|
|
@ -68,9 +68,9 @@ fun DialogLikeBannerMolecule(
|
|||
color = MaterialTheme.colorScheme.primary,
|
||||
textAlign = TextAlign.Start,
|
||||
)
|
||||
if (onDismissClicked != null) {
|
||||
if (onDismissClick != null) {
|
||||
Icon(
|
||||
modifier = Modifier.clickable(onClick = onDismissClicked),
|
||||
modifier = Modifier.clickable(onClick = onDismissClick),
|
||||
imageVector = CompoundIcons.Close(),
|
||||
contentDescription = stringResource(CommonStrings.action_close)
|
||||
)
|
||||
|
|
@ -86,7 +86,7 @@ fun DialogLikeBannerMolecule(
|
|||
text = stringResource(CommonStrings.action_continue),
|
||||
size = ButtonSize.Medium,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = onSubmitClicked,
|
||||
onClick = onSubmitClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ internal fun DialogLikeBannerMoleculePreview() = ElementPreview {
|
|||
DialogLikeBannerMolecule(
|
||||
title = "Title",
|
||||
content = "Content",
|
||||
onSubmitClicked = {},
|
||||
onDismissClicked = {}
|
||||
onSubmitClick = {},
|
||||
onDismissClick = {}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
|
|||
|
||||
/**
|
||||
* A Page with:
|
||||
* - a top bar as TobAppBar with optional back button (displayed if [onBackClicked] is not null)
|
||||
* - a top bar as TobAppBar with optional back button (displayed if [onBackClick] is not null)
|
||||
* - a header, as IconTitleSubtitleMolecule
|
||||
* - a content.
|
||||
* - a footer, as ButtonColumnMolecule
|
||||
|
|
@ -52,21 +52,21 @@ fun FlowStepPage(
|
|||
iconVector: ImageVector?,
|
||||
title: String,
|
||||
modifier: Modifier = Modifier,
|
||||
onBackClicked: (() -> Unit)? = null,
|
||||
onBackClick: (() -> Unit)? = null,
|
||||
subTitle: String? = null,
|
||||
content: @Composable () -> Unit = {},
|
||||
buttons: @Composable ColumnScope.() -> Unit = {},
|
||||
) {
|
||||
BackHandler(enabled = onBackClicked != null) {
|
||||
onBackClicked?.invoke()
|
||||
BackHandler(enabled = onBackClick != null) {
|
||||
onBackClick?.invoke()
|
||||
}
|
||||
HeaderFooterPage(
|
||||
modifier = modifier,
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
navigationIcon = {
|
||||
if (onBackClicked != null) {
|
||||
BackButton(onClick = onBackClicked)
|
||||
if (onBackClick != null) {
|
||||
BackButton(onClick = onBackClick)
|
||||
}
|
||||
},
|
||||
title = {},
|
||||
|
|
@ -94,7 +94,7 @@ fun FlowStepPage(
|
|||
@Composable
|
||||
internal fun FlowStepPagePreview() = ElementPreview {
|
||||
FlowStepPage(
|
||||
onBackClicked = {},
|
||||
onBackClick = {},
|
||||
title = "Title",
|
||||
subTitle = "Subtitle",
|
||||
iconVector = CompoundIcons.Computer(),
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ fun ProgressDialog(
|
|||
modifier = modifier,
|
||||
text = text,
|
||||
isCancellable = isCancellable,
|
||||
onCancelClicked = onDismissRequest,
|
||||
onCancelClick = onDismissRequest,
|
||||
progressIndicator = {
|
||||
when (type) {
|
||||
is ProgressDialogType.Indeterminate -> {
|
||||
|
|
@ -98,7 +98,7 @@ private fun ProgressDialogContent(
|
|||
modifier: Modifier = Modifier,
|
||||
text: String? = null,
|
||||
isCancellable: Boolean = false,
|
||||
onCancelClicked: () -> Unit = {},
|
||||
onCancelClick: () -> Unit = {},
|
||||
progressIndicator: @Composable () -> Unit = {
|
||||
CircularProgressIndicator(
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
|
|
@ -133,7 +133,7 @@ private fun ProgressDialogContent(
|
|||
) {
|
||||
TextButton(
|
||||
text = stringResource(id = CommonStrings.action_cancel),
|
||||
onClick = onCancelClicked,
|
||||
onClick = onCancelClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ internal fun AsyncActionViewPreview(
|
|||
ConfirmationDialog(
|
||||
title = "Confirmation",
|
||||
content = "Are you sure?",
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
onDismiss = {},
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
@Composable
|
||||
fun ConfirmationDialog(
|
||||
content: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
onSubmitClick: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String? = null,
|
||||
|
|
@ -42,8 +42,8 @@ fun ConfirmationDialog(
|
|||
cancelText: String = stringResource(id = CommonStrings.action_cancel),
|
||||
destructiveSubmit: Boolean = false,
|
||||
thirdButtonText: String? = null,
|
||||
onCancelClicked: () -> Unit = onDismiss,
|
||||
onThirdButtonClicked: () -> Unit = {},
|
||||
onCancelClick: () -> Unit = onDismiss,
|
||||
onThirdButtonClick: () -> Unit = {},
|
||||
) {
|
||||
BasicAlertDialog(modifier = modifier, onDismissRequest = onDismiss) {
|
||||
ConfirmationDialogContent(
|
||||
|
|
@ -53,9 +53,9 @@ fun ConfirmationDialog(
|
|||
cancelText = cancelText,
|
||||
thirdButtonText = thirdButtonText,
|
||||
destructiveSubmit = destructiveSubmit,
|
||||
onSubmitClicked = onSubmitClicked,
|
||||
onCancelClicked = onCancelClicked,
|
||||
onThirdButtonClicked = onThirdButtonClicked,
|
||||
onSubmitClick = onSubmitClick,
|
||||
onCancelClick = onCancelClick,
|
||||
onThirdButtonClick = onThirdButtonClick,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -65,11 +65,11 @@ private fun ConfirmationDialogContent(
|
|||
content: String,
|
||||
submitText: String,
|
||||
cancelText: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
onCancelClicked: () -> Unit,
|
||||
onSubmitClick: () -> Unit,
|
||||
onCancelClick: () -> Unit,
|
||||
title: String? = null,
|
||||
thirdButtonText: String? = null,
|
||||
onThirdButtonClicked: () -> Unit = {},
|
||||
onThirdButtonClick: () -> Unit = {},
|
||||
destructiveSubmit: Boolean = false,
|
||||
icon: @Composable (() -> Unit)? = null,
|
||||
) {
|
||||
|
|
@ -77,11 +77,11 @@ private fun ConfirmationDialogContent(
|
|||
title = title,
|
||||
content = content,
|
||||
submitText = submitText,
|
||||
onSubmitClicked = onSubmitClicked,
|
||||
onSubmitClick = onSubmitClick,
|
||||
cancelText = cancelText,
|
||||
onCancelClicked = onCancelClicked,
|
||||
onCancelClick = onCancelClick,
|
||||
thirdButtonText = thirdButtonText,
|
||||
onThirdButtonClicked = onThirdButtonClicked,
|
||||
onThirdButtonClick = onThirdButtonClick,
|
||||
destructiveSubmit = destructiveSubmit,
|
||||
icon = icon,
|
||||
)
|
||||
|
|
@ -98,9 +98,9 @@ internal fun ConfirmationDialogContentPreview() =
|
|||
submitText = "OK",
|
||||
cancelText = "Cancel",
|
||||
thirdButtonText = "Disable",
|
||||
onSubmitClicked = {},
|
||||
onCancelClicked = {},
|
||||
onThirdButtonClicked = {},
|
||||
onSubmitClick = {},
|
||||
onCancelClick = {},
|
||||
onThirdButtonClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ internal fun ConfirmationDialogPreview() = ElementPreview {
|
|||
submitText = "OK",
|
||||
cancelText = "Cancel",
|
||||
thirdButtonText = "Disable",
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
onDismiss = {}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ fun ErrorDialog(
|
|||
title = title,
|
||||
content = content,
|
||||
submitText = submitText,
|
||||
onSubmitClicked = onDismiss,
|
||||
onSubmitClick = onDismiss,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ fun ErrorDialog(
|
|||
@Composable
|
||||
private fun ErrorDialogContent(
|
||||
content: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
onSubmitClick: () -> Unit,
|
||||
title: String = ErrorDialogDefaults.title,
|
||||
submitText: String = ErrorDialogDefaults.submitText,
|
||||
) {
|
||||
|
|
@ -60,7 +60,7 @@ private fun ErrorDialogContent(
|
|||
title = title,
|
||||
content = content,
|
||||
submitText = submitText,
|
||||
onSubmitClicked = onSubmitClicked,
|
||||
onSubmitClick = onSubmitClick,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ internal fun ErrorDialogContentPreview() {
|
|||
DialogPreview {
|
||||
ErrorDialogContent(
|
||||
content = "Content",
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ fun ListDialog(
|
|||
cancelText = cancelText,
|
||||
submitText = submitText,
|
||||
onDismissRequest = onDismissRequest,
|
||||
onSubmitClicked = onSubmit,
|
||||
onSubmitClick = onSubmit,
|
||||
enabled = enabled,
|
||||
listItems = listItems,
|
||||
)
|
||||
|
|
@ -78,7 +78,7 @@ fun ListDialog(
|
|||
private fun ListDialogContent(
|
||||
listItems: LazyListScope.() -> Unit,
|
||||
onDismissRequest: () -> Unit,
|
||||
onSubmitClicked: () -> Unit,
|
||||
onSubmitClick: () -> Unit,
|
||||
cancelText: String,
|
||||
submitText: String,
|
||||
title: String? = null,
|
||||
|
|
@ -90,8 +90,8 @@ private fun ListDialogContent(
|
|||
subtitle = subtitle,
|
||||
cancelText = cancelText,
|
||||
submitText = submitText,
|
||||
onCancelClicked = onDismissRequest,
|
||||
onSubmitClicked = onSubmitClicked,
|
||||
onCancelClick = onDismissRequest,
|
||||
onSubmitClick = onSubmitClick,
|
||||
enabled = enabled,
|
||||
applyPaddingToContents = false,
|
||||
) {
|
||||
|
|
@ -109,15 +109,15 @@ internal fun ListDialogContentPreview() {
|
|||
ListDialogContent(
|
||||
listItems = {
|
||||
item {
|
||||
TextFieldListItem(placeholder = "Text input", text = "", onTextChanged = {})
|
||||
TextFieldListItem(placeholder = "Text input", text = "", onTextChange = {})
|
||||
}
|
||||
item {
|
||||
TextFieldListItem(placeholder = "Another text input", text = "", onTextChanged = {})
|
||||
TextFieldListItem(placeholder = "Another text input", text = "", onTextChange = {})
|
||||
}
|
||||
},
|
||||
title = "Dialog title",
|
||||
onDismissRequest = {},
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
cancelText = "Cancel",
|
||||
submitText = "Save",
|
||||
)
|
||||
|
|
@ -131,10 +131,10 @@ internal fun ListDialogPreview() = ElementPreview {
|
|||
ListDialog(
|
||||
listItems = {
|
||||
item {
|
||||
TextFieldListItem(placeholder = "Text input", text = "", onTextChanged = {})
|
||||
TextFieldListItem(placeholder = "Text input", text = "", onTextChange = {})
|
||||
}
|
||||
item {
|
||||
TextFieldListItem(placeholder = "Another text input", text = "", onTextChanged = {})
|
||||
TextFieldListItem(placeholder = "Another text input", text = "", onTextChange = {})
|
||||
}
|
||||
},
|
||||
title = "Dialog title",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import kotlinx.collections.immutable.persistentListOf
|
|||
@Composable
|
||||
fun MultipleSelectionDialog(
|
||||
options: ImmutableList<ListOption>,
|
||||
onConfirmClicked: (List<Int>) -> Unit,
|
||||
onConfirmClick: (List<Int>) -> Unit,
|
||||
onDismissRequest: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
confirmButtonTitle: String = stringResource(CommonStrings.action_confirm),
|
||||
|
|
@ -70,7 +70,7 @@ fun MultipleSelectionDialog(
|
|||
subtitle = decoratedSubtitle,
|
||||
options = options,
|
||||
confirmButtonTitle = confirmButtonTitle,
|
||||
onConfirmClicked = onConfirmClicked,
|
||||
onConfirmClick = onConfirmClick,
|
||||
dismissButtonTitle = dismissButtonTitle,
|
||||
onDismissRequest = onDismissRequest,
|
||||
initialSelected = initialSelection,
|
||||
|
|
@ -82,7 +82,7 @@ fun MultipleSelectionDialog(
|
|||
private fun MultipleSelectionDialogContent(
|
||||
options: ImmutableList<ListOption>,
|
||||
confirmButtonTitle: String,
|
||||
onConfirmClicked: (List<Int>) -> Unit,
|
||||
onConfirmClick: (List<Int>) -> Unit,
|
||||
dismissButtonTitle: String,
|
||||
onDismissRequest: () -> Unit,
|
||||
title: String? = null,
|
||||
|
|
@ -97,11 +97,11 @@ private fun MultipleSelectionDialogContent(
|
|||
title = title,
|
||||
subtitle = subtitle,
|
||||
submitText = confirmButtonTitle,
|
||||
onSubmitClicked = {
|
||||
onConfirmClicked(selectedOptionIndexes.toList())
|
||||
onSubmitClick = {
|
||||
onConfirmClick(selectedOptionIndexes.toList())
|
||||
},
|
||||
cancelText = dismissButtonTitle,
|
||||
onCancelClicked = onDismissRequest,
|
||||
onCancelClick = onDismissRequest,
|
||||
applyPaddingToContents = false,
|
||||
) {
|
||||
LazyColumn {
|
||||
|
|
@ -138,7 +138,7 @@ internal fun MultipleSelectionDialogContentPreview() {
|
|||
MultipleSelectionDialogContent(
|
||||
title = "Dialog title",
|
||||
options = options,
|
||||
onConfirmClicked = {},
|
||||
onConfirmClick = {},
|
||||
onDismissRequest = {},
|
||||
confirmButtonTitle = "Save",
|
||||
dismissButtonTitle = "Cancel",
|
||||
|
|
@ -159,7 +159,7 @@ internal fun MultipleSelectionDialogPreview() = ElementPreview {
|
|||
MultipleSelectionDialog(
|
||||
title = "Dialog title",
|
||||
options = options,
|
||||
onConfirmClicked = {},
|
||||
onConfirmClick = {},
|
||||
onDismissRequest = {},
|
||||
confirmButtonTitle = "Save",
|
||||
dismissButtonTitle = "Cancel",
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ private fun RetryDialogContent(
|
|||
title = title,
|
||||
content = content,
|
||||
submitText = retryText,
|
||||
onSubmitClicked = onRetry,
|
||||
onSubmitClick = onRetry,
|
||||
cancelText = dismissText,
|
||||
onCancelClicked = onDismiss,
|
||||
onCancelClick = onDismiss,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import kotlinx.collections.immutable.persistentListOf
|
|||
@Composable
|
||||
fun SingleSelectionDialog(
|
||||
options: ImmutableList<ListOption>,
|
||||
onOptionSelected: (Int) -> Unit,
|
||||
onSelectOption: (Int) -> Unit,
|
||||
onDismissRequest: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
title: String? = null,
|
||||
|
|
@ -65,7 +65,7 @@ fun SingleSelectionDialog(
|
|||
title = title,
|
||||
subtitle = decoratedSubtitle,
|
||||
options = options,
|
||||
onOptionSelected = onOptionSelected,
|
||||
onOptionClick = onSelectOption,
|
||||
dismissButtonTitle = dismissButtonTitle,
|
||||
onDismissRequest = onDismissRequest,
|
||||
initialSelection = initialSelection,
|
||||
|
|
@ -76,7 +76,7 @@ fun SingleSelectionDialog(
|
|||
@Composable
|
||||
private fun SingleSelectionDialogContent(
|
||||
options: ImmutableList<ListOption>,
|
||||
onOptionSelected: (Int) -> Unit,
|
||||
onOptionClick: (Int) -> Unit,
|
||||
dismissButtonTitle: String,
|
||||
onDismissRequest: () -> Unit,
|
||||
title: String? = null,
|
||||
|
|
@ -87,7 +87,7 @@ private fun SingleSelectionDialogContent(
|
|||
title = title,
|
||||
subtitle = subtitle,
|
||||
submitText = dismissButtonTitle,
|
||||
onSubmitClicked = onDismissRequest,
|
||||
onSubmitClick = onDismissRequest,
|
||||
applyPaddingToContents = false,
|
||||
) {
|
||||
LazyColumn {
|
||||
|
|
@ -96,7 +96,7 @@ private fun SingleSelectionDialogContent(
|
|||
headline = option.title,
|
||||
supportingText = option.subtitle,
|
||||
selected = index == initialSelection,
|
||||
onSelected = { onOptionSelected(index) },
|
||||
onSelect = { onOptionClick(index) },
|
||||
compactLayout = true,
|
||||
modifier = Modifier.padding(start = 8.dp)
|
||||
)
|
||||
|
|
@ -118,7 +118,7 @@ internal fun SingleSelectionDialogContentPreview() {
|
|||
SingleSelectionDialogContent(
|
||||
title = "Dialog title",
|
||||
options = options,
|
||||
onOptionSelected = {},
|
||||
onOptionClick = {},
|
||||
onDismissRequest = {},
|
||||
dismissButtonTitle = "Cancel",
|
||||
initialSelection = 0
|
||||
|
|
@ -138,7 +138,7 @@ internal fun SingleSelectionDialogPreview() = ElementPreview {
|
|||
SingleSelectionDialog(
|
||||
title = "Dialog title",
|
||||
options = options,
|
||||
onOptionSelected = {},
|
||||
onSelectOption = {},
|
||||
onDismissRequest = {},
|
||||
dismissButtonTitle = "Cancel",
|
||||
initialSelection = 0
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import kotlinx.collections.immutable.toImmutableList
|
|||
fun MultipleSelectionListItem(
|
||||
headline: String,
|
||||
options: ImmutableList<ListOption>,
|
||||
onSelectionChanged: (List<Int>) -> Unit,
|
||||
onSelectionChange: (List<Int>) -> Unit,
|
||||
resultFormatter: (List<Int>) -> String?,
|
||||
modifier: Modifier = Modifier,
|
||||
supportingText: String? = null,
|
||||
|
|
@ -87,9 +87,9 @@ fun MultipleSelectionListItem(
|
|||
MultipleSelectionDialog(
|
||||
title = headline,
|
||||
options = options,
|
||||
onConfirmClicked = { newSelectedIndexes ->
|
||||
onConfirmClick = { newSelectedIndexes ->
|
||||
if (newSelectedIndexes != selectedIndexes.toList()) {
|
||||
onSelectionChanged(newSelectedIndexes)
|
||||
onSelectionChange(newSelectedIndexes)
|
||||
selectedIndexes.clear()
|
||||
selectedIndexes.addAll(newSelectedIndexes)
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ internal fun MutipleSelectionListItemPreview() {
|
|||
MultipleSelectionListItem(
|
||||
headline = "Headline",
|
||||
options = options,
|
||||
onSelectionChanged = {},
|
||||
onSelectionChange = {},
|
||||
supportingText = "Supporting text",
|
||||
resultFormatter = { result -> formatResult(result, options) },
|
||||
)
|
||||
|
|
@ -125,7 +125,7 @@ internal fun MutipleSelectionListItemSelectedPreview() {
|
|||
MultipleSelectionListItem(
|
||||
headline = "Headline",
|
||||
options = options,
|
||||
onSelectionChanged = {},
|
||||
onSelectionChange = {},
|
||||
supportingText = "Supporting text",
|
||||
resultFormatter = {
|
||||
val selectedValues = formatResult(it, options)
|
||||
|
|
@ -145,7 +145,7 @@ internal fun MutipleSelectionListItemSelectedTrailingContentPreview() {
|
|||
MultipleSelectionListItem(
|
||||
headline = "Headline",
|
||||
options = options,
|
||||
onSelectionChanged = {},
|
||||
onSelectionChange = {},
|
||||
supportingText = "Supporting text",
|
||||
resultFormatter = { selected.size.toString() },
|
||||
displayResultInTrailingContent = true,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
fun RadioButtonListItem(
|
||||
headline: String,
|
||||
selected: Boolean,
|
||||
onSelected: () -> Unit,
|
||||
onSelect: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
supportingText: String? = null,
|
||||
trailingContent: ListItemContent? = null,
|
||||
|
|
@ -42,6 +42,6 @@ fun RadioButtonListItem(
|
|||
trailingContent = trailingContent,
|
||||
style = style,
|
||||
enabled = enabled,
|
||||
onClick = onSelected,
|
||||
onClick = onSelect,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import kotlin.time.Duration.Companion.seconds
|
|||
fun SingleSelectionListItem(
|
||||
headline: String,
|
||||
options: ImmutableList<ListOption>,
|
||||
onSelectionChanged: (Int) -> Unit,
|
||||
onSelectionChange: (Int) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
supportingText: String? = null,
|
||||
leadingContent: ListItemContent? = null,
|
||||
|
|
@ -86,9 +86,9 @@ fun SingleSelectionListItem(
|
|||
SingleSelectionDialog(
|
||||
title = headline,
|
||||
options = options,
|
||||
onOptionSelected = { index ->
|
||||
onSelectOption = { index ->
|
||||
if (index != selectedIndex) {
|
||||
onSelectionChanged(index)
|
||||
onSelectionChange(index)
|
||||
selectedIndex = index
|
||||
}
|
||||
// Delay hiding the dialog for a bit so the new state is displayed in it before being dismissed
|
||||
|
|
@ -110,7 +110,7 @@ internal fun SingleSelectionListItemPreview() {
|
|||
SingleSelectionListItem(
|
||||
headline = "Headline",
|
||||
options = listOptionOf("Option 1", "Option 2", "Option 3"),
|
||||
onSelectionChanged = {},
|
||||
onSelectionChange = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@ internal fun SingleSelectionListItemUnselectedWithSupportingTextPreview() {
|
|||
headline = "Headline",
|
||||
options = listOptionOf("Option 1", "Option 2", "Option 3"),
|
||||
supportingText = "Supporting text",
|
||||
onSelectionChanged = {},
|
||||
onSelectionChange = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ internal fun SingleSelectionListItemSelectedInSupportingTextPreview() {
|
|||
headline = "Headline",
|
||||
options = listOptionOf("Option 1", "Option 2", "Option 3"),
|
||||
supportingText = "Supporting text",
|
||||
onSelectionChanged = {},
|
||||
onSelectionChange = {},
|
||||
selected = 1,
|
||||
)
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ internal fun SingleSelectionListItemSelectedInTrailingContentPreview() {
|
|||
headline = "Headline",
|
||||
options = listOptionOf("Option 1", "Option 2", "Option 3"),
|
||||
supportingText = "Supporting text",
|
||||
onSelectionChanged = {},
|
||||
onSelectionChange = {},
|
||||
selected = 1,
|
||||
displayResultInTrailingContent = true,
|
||||
)
|
||||
|
|
@ -165,7 +165,7 @@ internal fun SingleSelectionListItemCustomFormattertPreview() {
|
|||
headline = "Headline",
|
||||
options = listOptionOf("Option 1", "Option 2", "Option 3"),
|
||||
supportingText = "Supporting text",
|
||||
onSelectionChanged = {},
|
||||
onSelectionChange = {},
|
||||
resultFormatter = { "Selected index: $it" },
|
||||
selected = 1,
|
||||
displayResultInTrailingContent = true,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
|||
fun TextFieldListItem(
|
||||
placeholder: String?,
|
||||
text: String,
|
||||
onTextChanged: (String) -> Unit,
|
||||
onTextChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
error: String? = null,
|
||||
maxLines: Int = 1,
|
||||
|
|
@ -45,7 +45,7 @@ fun TextFieldListItem(
|
|||
|
||||
OutlinedTextField(
|
||||
value = text,
|
||||
onValueChange = { onTextChanged(it) },
|
||||
onValueChange = { onTextChange(it) },
|
||||
placeholder = placeholder?.let { @Composable { Text(it) } },
|
||||
colors = OutlinedTextFieldDefaults.colors(
|
||||
disabledBorderColor = Color.Transparent,
|
||||
|
|
@ -68,7 +68,7 @@ fun TextFieldListItem(
|
|||
fun TextFieldListItem(
|
||||
placeholder: String?,
|
||||
text: TextFieldValue,
|
||||
onTextChanged: (TextFieldValue) -> Unit,
|
||||
onTextChange: (TextFieldValue) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
error: String? = null,
|
||||
maxLines: Int = 1,
|
||||
|
|
@ -79,7 +79,7 @@ fun TextFieldListItem(
|
|||
|
||||
OutlinedTextField(
|
||||
value = text,
|
||||
onValueChange = { onTextChanged(it) },
|
||||
onValueChange = { onTextChange(it) },
|
||||
placeholder = placeholder?.let { @Composable { Text(it) } },
|
||||
colors = OutlinedTextFieldDefaults.colors(
|
||||
disabledBorderColor = Color.Transparent,
|
||||
|
|
@ -105,7 +105,7 @@ internal fun TextFieldListItemEmptyPreview() {
|
|||
TextFieldListItem(
|
||||
placeholder = "Placeholder",
|
||||
text = "",
|
||||
onTextChanged = {},
|
||||
onTextChange = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ internal fun TextFieldListItemPreview() {
|
|||
TextFieldListItem(
|
||||
placeholder = "Placeholder",
|
||||
text = "Text",
|
||||
onTextChanged = {},
|
||||
onTextChange = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ internal fun TextFieldListItemTextFieldValuePreview() {
|
|||
TextFieldListItem(
|
||||
placeholder = "Placeholder",
|
||||
text = TextFieldValue("Text field value"),
|
||||
onTextChanged = {},
|
||||
onTextChange = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
|
|||
@Composable
|
||||
fun PreferencePage(
|
||||
title: String,
|
||||
onBackPressed: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
snackbarHost: @Composable () -> Unit = {},
|
||||
content: @Composable ColumnScope.() -> Unit,
|
||||
|
|
@ -58,7 +58,7 @@ fun PreferencePage(
|
|||
topBar = {
|
||||
PreferenceTopAppBar(
|
||||
title = title,
|
||||
onBackPressed = onBackPressed,
|
||||
onBackClick = onBackClick,
|
||||
)
|
||||
},
|
||||
snackbarHost = snackbarHost,
|
||||
|
|
@ -79,11 +79,11 @@ fun PreferencePage(
|
|||
@Composable
|
||||
private fun PreferenceTopAppBar(
|
||||
title: String,
|
||||
onBackPressed: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
) {
|
||||
TopAppBar(
|
||||
navigationIcon = {
|
||||
BackButton(onClick = onBackPressed)
|
||||
BackButton(onClick = onBackClick)
|
||||
},
|
||||
title = {
|
||||
Text(
|
||||
|
|
@ -101,7 +101,7 @@ private fun PreferenceTopAppBar(
|
|||
internal fun PreferencePagePreview() = ElementPreview {
|
||||
PreferencePage(
|
||||
title = "Preference screen",
|
||||
onBackPressed = {},
|
||||
onBackClick = {},
|
||||
) {
|
||||
PreferenceCategory(
|
||||
title = "Category title",
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ private fun TextFieldDialog(
|
|||
TextFieldListItem(
|
||||
placeholder = placeholder.orEmpty(),
|
||||
text = textFieldContents,
|
||||
onTextChanged = {
|
||||
onTextChange = {
|
||||
error = if (!validation(it.text)) onValidationErrorMessage else null
|
||||
textFieldContents = it
|
||||
},
|
||||
|
|
|
|||
|
|
@ -54,14 +54,14 @@ import kotlin.math.max
|
|||
internal fun SimpleAlertDialogContent(
|
||||
content: String,
|
||||
submitText: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
onSubmitClick: () -> Unit,
|
||||
title: String? = null,
|
||||
subtitle: @Composable (() -> Unit)? = null,
|
||||
destructiveSubmit: Boolean = false,
|
||||
cancelText: String? = null,
|
||||
onCancelClicked: () -> Unit = {},
|
||||
onCancelClick: () -> Unit = {},
|
||||
thirdButtonText: String? = null,
|
||||
onThirdButtonClicked: () -> Unit = {},
|
||||
onThirdButtonClick: () -> Unit = {},
|
||||
applyPaddingToContents: Boolean = true,
|
||||
icon: @Composable (() -> Unit)? = null,
|
||||
) {
|
||||
|
|
@ -77,11 +77,11 @@ internal fun SimpleAlertDialogContent(
|
|||
},
|
||||
submitText = submitText,
|
||||
destructiveSubmit = destructiveSubmit,
|
||||
onSubmitClicked = onSubmitClicked,
|
||||
onSubmitClick = onSubmitClick,
|
||||
cancelText = cancelText,
|
||||
onCancelClicked = onCancelClicked,
|
||||
onCancelClick = onCancelClick,
|
||||
thirdButtonText = thirdButtonText,
|
||||
onThirdButtonClicked = onThirdButtonClicked,
|
||||
onThirdButtonClick = onThirdButtonClick,
|
||||
applyPaddingToContents = applyPaddingToContents,
|
||||
)
|
||||
}
|
||||
|
|
@ -89,14 +89,14 @@ internal fun SimpleAlertDialogContent(
|
|||
@Composable
|
||||
internal fun SimpleAlertDialogContent(
|
||||
submitText: String,
|
||||
onSubmitClicked: () -> Unit,
|
||||
onSubmitClick: () -> Unit,
|
||||
title: String? = null,
|
||||
subtitle: @Composable (() -> Unit)? = null,
|
||||
destructiveSubmit: Boolean = false,
|
||||
cancelText: String? = null,
|
||||
onCancelClicked: () -> Unit = {},
|
||||
onCancelClick: () -> Unit = {},
|
||||
thirdButtonText: String? = null,
|
||||
onThirdButtonClicked: () -> Unit = {},
|
||||
onThirdButtonClick: () -> Unit = {},
|
||||
applyPaddingToContents: Boolean = true,
|
||||
enabled: Boolean = true,
|
||||
icon: @Composable (() -> Unit)? = null,
|
||||
|
|
@ -115,7 +115,7 @@ internal fun SimpleAlertDialogContent(
|
|||
modifier = Modifier.testTag(TestTags.dialogNeutral),
|
||||
text = thirdButtonText,
|
||||
size = ButtonSize.Medium,
|
||||
onClick = onThirdButtonClicked,
|
||||
onClick = onThirdButtonClick,
|
||||
)
|
||||
}
|
||||
if (cancelText != null) {
|
||||
|
|
@ -123,14 +123,14 @@ internal fun SimpleAlertDialogContent(
|
|||
modifier = Modifier.testTag(TestTags.dialogNegative),
|
||||
text = cancelText,
|
||||
size = ButtonSize.Medium,
|
||||
onClick = onCancelClicked,
|
||||
onClick = onCancelClick,
|
||||
)
|
||||
Button(
|
||||
modifier = Modifier.testTag(TestTags.dialogPositive),
|
||||
text = submitText,
|
||||
enabled = enabled,
|
||||
size = ButtonSize.Medium,
|
||||
onClick = onSubmitClicked,
|
||||
onClick = onSubmitClick,
|
||||
destructive = destructiveSubmit,
|
||||
)
|
||||
} else {
|
||||
|
|
@ -139,7 +139,7 @@ internal fun SimpleAlertDialogContent(
|
|||
text = submitText,
|
||||
enabled = enabled,
|
||||
size = ButtonSize.Medium,
|
||||
onClick = onSubmitClicked,
|
||||
onClick = onSubmitClick,
|
||||
destructive = destructiveSubmit,
|
||||
)
|
||||
}
|
||||
|
|
@ -444,7 +444,7 @@ internal fun DialogWithTitleIconAndOkButtonPreview() {
|
|||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
|
||||
" or prompt for a decision to be made. Learn more",
|
||||
submitText = "OK",
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -461,7 +461,7 @@ internal fun DialogWithTitleAndOkButtonPreview() {
|
|||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
|
||||
" or prompt for a decision to be made. Learn more",
|
||||
submitText = "OK",
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -477,7 +477,7 @@ internal fun DialogWithOnlyMessageAndOkButtonPreview() {
|
|||
content = "A dialog is a type of modal window that appears in front of app content to provide critical information," +
|
||||
" or prompt for a decision to be made. Learn more",
|
||||
submitText = "OK",
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -494,7 +494,7 @@ internal fun DialogWithDestructiveButtonPreview() {
|
|||
cancelText = "Cancel",
|
||||
submitText = "Delete",
|
||||
destructiveSubmit = true,
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -511,7 +511,7 @@ internal fun DialogWithThirdButtonPreview() {
|
|||
cancelText = "Cancel",
|
||||
submitText = "Delete",
|
||||
thirdButtonText = "Other",
|
||||
onSubmitClicked = {},
|
||||
onSubmitClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ fun Slider(
|
|||
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
|
||||
// @IntRange(from = 0)
|
||||
steps: Int = 0,
|
||||
onValueChangeFinished: (() -> Unit)? = null,
|
||||
onValueChangeFinish: (() -> Unit)? = null,
|
||||
colors: SliderColors = SliderDefaults.colors(),
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
|
||||
) {
|
||||
|
|
@ -50,7 +50,7 @@ fun Slider(
|
|||
enabled = enabled,
|
||||
valueRange = valueRange,
|
||||
steps = steps,
|
||||
onValueChangeFinished = onValueChangeFinished,
|
||||
onValueChangeFinished = onValueChangeFinish,
|
||||
colors = colors,
|
||||
interactionSource = interactionSource,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue