Skip to content

Commit

Permalink
🧪 Type inference cannot resolve nullable @composable lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Jan 25, 2024
1 parent ef77975 commit 62c5828
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ private fun TextFieldSample() {
label = labelText,
placeholder = placeHolderText,
helper = helperText,
leadingContent = addonText?.let { { Text(it) } },
trailingContent = icon?.let { { Icon(it, contentDescription = null) } },
leadingContent = addonText?.let { { Text(it) } } ?: {},
trailingContent = icon?.let { { Icon(it, contentDescription = null) } } ?: {},
state = state,
stateMessage = stateMessageText,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ public fun ThemePicker(
text = {
Text(text = brand.name)
},
trailingIcon = if (brand == theme.brandMode) selectedIcon else null,
trailingIcon = if (brand == theme.brandMode) {
selectedIcon
} else {
{}
},
onClick = {
onThemeChange(theme.copy(brandMode = brand))
expanded = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ public fun DropdownMenuItem(
text: @Composable () -> Unit,
onClick: () -> Unit,
modifier: Modifier = Modifier,
leadingIcon: @Composable (() -> Unit)? = null,
trailingIcon: @Composable (() -> Unit)? = null,
leadingIcon: @Composable (() -> Unit) = {},
trailingIcon: @Composable (() -> Unit) = {},
enabled: Boolean = true,
colors: MenuItemColors = MenuDefaults.itemColors(),
contentPadding: PaddingValues = MenuDefaults.DropdownMenuItemContentPadding,
Expand Down

0 comments on commit 62c5828

Please sign in to comment.