Posts

Showing posts with the label alertdialog

Showing Alert Dialog with compose example android

Image
 With new compose library you can show alert dialog using the android compose below is the example : @Composable fun showDialog (message: String , onDismiss: () -> Unit) { AlertDialog ( text = { Text (message) } , onDismissRequest = onDismiss , buttons = { Column { Divider ( androidx.compose.ui.Modifier. padding ( horizontal = 12 . dp ) , color = MaterialTheme. colors . onSurface .copy( alpha = 0.2f ) ) Column { TextButton ( onClick = onDismiss , shape = RectangleShape , contentPadding = PaddingValues( 16 . dp ) , modifier = androidx.compose.ui.Modifier. fillMaxWidth () , ) { Text ( "Yes" ) } TextButton ( onClick = onDismiss ,