Created
April 21, 2022 06:25
-
-
Save manojbhadane/27c554cc3635d231d3aac901445bf5a4 to your computer and use it in GitHub Desktop.
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
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
JetpackComposeDemoTheme { | |
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = MaterialTheme.colors.background | |
) { | |
HomePage() | |
} | |
} | |
} | |
} | |
} | |
@Composable | |
fun HomePage(){ | |
val showDialog = remember { mutableStateOf(false) } | |
if(showDialog.value) | |
CustomDialog(value = "", setShowDialog = { | |
showDialog.value = it | |
}) { | |
Log.i("HomePage","HomePage : $it") | |
} | |
Scaffold( | |
topBar = { | |
TopAppBar( | |
title = { | |
Text(text = "Home") | |
} | |
) | |
}) { | |
Box(modifier = Modifier.background(Color.White)) { | |
Column( | |
modifier = Modifier | |
.fillMaxSize() | |
.background(Color.White), | |
verticalArrangement = Arrangement.Center, | |
horizontalAlignment = Alignment.CenterHorizontally, | |
) { | |
Button(onClick = { | |
showDialog.value = true | |
}) { | |
Text(text = "Open Dialog") | |
} | |
} | |
} | |
} | |
} | |
@Preview(showBackground = true) | |
@Composable | |
fun DefaultPreview() { | |
JetpackComposeDemoTheme { | |
HomePage() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment