Created
December 21, 2023 02:23
-
-
Save MachFour/f0fd1aa12705c055edacc939a14e7852 to your computer and use it in GitHub Desktop.
Jetpack Compose crash
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
import androidx.compose.foundation.layout.* | |
import androidx.compose.material.DropdownMenu | |
import androidx.compose.material.DropdownMenuItem | |
import androidx.compose.material.OutlinedTextField | |
import androidx.compose.material.Surface | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.getValue | |
import androidx.compose.runtime.mutableStateOf | |
import androidx.compose.runtime.remember | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.tooling.preview.Preview | |
@Preview | |
@Composable | |
fun Preview() { | |
val expanded by remember { mutableStateOf(false) } // works if set to true | |
Surface { | |
Column( | |
modifier = Modifier.width(IntrinsicSize.Min) | |
) { | |
OutlinedTextField( | |
value = "", | |
onValueChange = { }, | |
trailingIcon = { | |
DropdownMenu( | |
expanded = expanded, | |
onDismissRequest = { }, | |
) { | |
DropdownMenuItem({ }) { Text("") } | |
} | |
} | |
) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment