File tree Expand file tree Collapse file tree
app/src/main/java/com/syntaxspin/sakura Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,7 +71,8 @@ class MainActivity : ComponentActivity() {
7171 Switchify ()
7272 dividerText(" Slider" )
7373 sliderSyntax()
74- }
74+ dividerText(" DropDownMenu" )
75+ initDropDown() }
7576 }
7677 }
7778 }
@@ -256,6 +257,29 @@ fun sliderSyntax(){
256257 onValueChange = {sliderPosition = it},
257258 modifier = Modifier .padding(18 .dp)
258259 )
260+ }
261+ @Composable
262+ fun initDropDown (){
263+ var expand by remember {mutableStateOf(false )}
264+ Button (
265+ text = " Click Me" ,
266+ onClick = {expand = ! expand}
267+ modifier = Modifier .padding(8 .dp)
268+ )
269+ DropDownMenu (
270+ expand = expand,
271+ shape = MaterialTheme .shapes.medium,
272+ onDismissRequest= { expand = false }
273+ DropDownMenuItem (
274+ text = " SyntaxSpin" ,
275+ onClick{expand = false }
276+ )
277+ DropDownMenuItem (
278+ text = " Jetpack Compose" ,
279+ onClick{expand = false }
280+ )
281+ )
282+
259283}
260284 }
261285
You can’t perform that action at this time.
0 commit comments