Skip to content

Instantly share code, notes, and snippets.

@chiragthummar
Created August 18, 2023 05:51
Show Gist options
  • Save chiragthummar/82d15c10333b13ee369637675b7ecb77 to your computer and use it in GitHub Desktop.
Save chiragthummar/82d15c10333b13ee369637675b7ecb77 to your computer and use it in GitHub Desktop.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DashboardScreen(navigateTo: (route: String) -> Unit) {
Scaffold(topBar = {
TopAppBar(
title = { Text(text = "Dashboard") },
colors = TopAppBarDefaults.topAppBarColors(containerColor = MaterialTheme.colorScheme.primary)
)
}) {
Box(
Modifier
.padding(it)
.fillMaxSize(), contentAlignment = Alignment.Center
) {
Text(text = "Dashboard Screen Content")
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun LoginScreen(navigateTo: (route: String) -> Unit) {
Scaffold(topBar = {
TopAppBar(
title = { Text(text = "Login") },
colors = TopAppBarDefaults.topAppBarColors(containerColor = MaterialTheme.colorScheme.primary)
)
}) {
Column(
Modifier
.padding(it)
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Button(onClick = {
navigateTo(Screens.Dashboard.route)
}) {
Text(text = "Login")
}
Button(onClick = {
navigateTo(Screens.Home.Register.route)
}) {
Text(text = "Register")
}
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun RegisterScreen(navigateTo: (route: String) -> Unit) {
Scaffold(topBar = {
TopAppBar(
title = { Text(text = "Register") },
colors = TopAppBarDefaults.topAppBarColors(containerColor = MaterialTheme.colorScheme.primary)
)
}) {
Box(
Modifier
.padding(it)
.fillMaxSize(), contentAlignment = Alignment.Center
) {
Button(onClick = {
navigateTo(Screens.Dashboard.route)
}) {
Text(text = "Register")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment