JetpackComposeでダイアログ出したら
これを消すのに苦労したのでそのやり方
・ダイアログ
やり方
https://techbooster.org/android/ui/18505/
AlertDialog( onDismissRequest = {}, title = { Text() }, text = { Text() }, confirmButton = { TextButton() { Text(stringResource(id = R.string.hogehoge)) } }, dismissButton = { TextButton() { Text(stringResource(id = R.string.hogehoge)) } }, )
・出しわけ
で、出しわけのやり方
以下になってたらrememberの変数を上書きしてrecomposeを発生させて
else側に通せば非表示になる。
この感覚が掴めなくてすごい時間食った
if (isShow) { ShowDialog() // <- JetpackComposeのダイアログを出すやつ } else { }
関連記事:
- Compose Recetteの6章〜19章を読んだ
- JetpackComposeでOverflow Menuの作り方
- Cassandra: The Definitive Guideの3章と4章を読んだ