Skip to content

Commit d15c0f6

Browse files
committed
feat : Learned DropDown
1 parent 9991256 commit d15c0f6

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

app/src/main/java/com/syntaxspin/sakura/MainActivity.kt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)