improved menu layout
This commit is contained in:
@@ -36,153 +36,97 @@ fun MenuScreen(modifier: Modifier = Modifier) {
|
|||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.Center
|
verticalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
// Button to trigger the dialog
|
MenuButton({ showDialog = true }, "Odhlásit se")
|
||||||
Button(
|
|
||||||
onClick = { showDialog = true },
|
Spacer(modifier = Modifier.height(80.dp))
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
contentColor = Color.White,
|
MenuButton({ screenToShow.value = Screen.SignIn }, "Změnit přihlášení")
|
||||||
containerColor = Color.Black
|
|
||||||
),
|
Spacer(modifier = Modifier.height(80.dp))
|
||||||
|
|
||||||
|
MenuButton({ isShowing.value = IsShowing.About }, "O aplikaci")
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(80.dp))
|
||||||
|
|
||||||
|
MenuButton({ isShowing.value = IsShowing.Settings }, "Nastavení")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dialog implementation
|
||||||
|
if (showDialog) {
|
||||||
|
AlertDialog(
|
||||||
|
onDismissRequest = { showDialog = false }, // Close the dialog on dismiss
|
||||||
|
title = {
|
||||||
|
Text(text = "Odhlásit se", color = Color.White)
|
||||||
|
},
|
||||||
|
text = {
|
||||||
|
Text("Opravdu se chcete odhlásit? Tato akce zavře aplikaci.", color = Color.White)
|
||||||
|
},
|
||||||
|
containerColor = Color.Black,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.border(
|
.border(width = 5.dp, color = PastelYellow, shape = RoundedCornerShape(
|
||||||
width = 5.dp,
|
roundedCornerDimen)), // Yellow border
|
||||||
shape = RoundedCornerShape(roundedCornerDimen),
|
confirmButton = {
|
||||||
color = PastelYellow
|
Button(
|
||||||
)
|
onClick = {
|
||||||
.width(230.dp)
|
showDialog = false
|
||||||
.height(80.dp)
|
Util.deleteFile(userDataFilePath)
|
||||||
) {
|
Util.deleteFile(timeTableFilePath)
|
||||||
Text(
|
Util.deleteFile(marksFilePath)
|
||||||
text = "Odhlásit se",
|
Util.deleteFile(accountDataFilePath)
|
||||||
fontSize = 23.sp
|
exitProcess(0)
|
||||||
)
|
},
|
||||||
}
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
containerColor = Color.Black, // Black background for the button
|
||||||
Spacer(modifier = Modifier.height(100.dp))
|
contentColor = Color.White // Yellow text for the button
|
||||||
|
),
|
||||||
// Dialog implementation
|
modifier = Modifier
|
||||||
if (showDialog) {
|
.border(width = 5.dp, color = PastelYellow, shape = RoundedCornerShape(
|
||||||
AlertDialog(
|
roundedCornerDimen)) // Yellow border
|
||||||
onDismissRequest = { showDialog = false }, // Close the dialog on dismiss
|
) {
|
||||||
title = {
|
Text("Ano")
|
||||||
Text(text = "Odhlásit se", color = Color.White)
|
|
||||||
},
|
|
||||||
text = {
|
|
||||||
Text("Opravdu se chcete odhlásit? Tato akce zavře aplikaci.", color = Color.White)
|
|
||||||
},
|
|
||||||
containerColor = Color.Black,
|
|
||||||
modifier = Modifier
|
|
||||||
.border(width = 5.dp, color = PastelYellow, shape = RoundedCornerShape(
|
|
||||||
roundedCornerDimen)), // Yellow border
|
|
||||||
confirmButton = {
|
|
||||||
Button(
|
|
||||||
onClick = {
|
|
||||||
showDialog = false
|
|
||||||
Util.deleteFile(userDataFilePath)
|
|
||||||
Util.deleteFile(timeTableFilePath)
|
|
||||||
Util.deleteFile(marksFilePath)
|
|
||||||
Util.deleteFile(accountDataFilePath)
|
|
||||||
exitProcess(0)
|
|
||||||
},
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = Color.Black, // Black background for the button
|
|
||||||
contentColor = Color.White // Yellow text for the button
|
|
||||||
),
|
|
||||||
modifier = Modifier
|
|
||||||
.border(width = 5.dp, color = PastelYellow, shape = RoundedCornerShape(
|
|
||||||
roundedCornerDimen)) // Yellow border
|
|
||||||
) {
|
|
||||||
Text("Ano")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dismissButton = {
|
|
||||||
Button(
|
|
||||||
onClick = {
|
|
||||||
showDialog = false
|
|
||||||
},
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = Color.Black, // Black background for the button
|
|
||||||
contentColor = Color.White,
|
|
||||||
// Yellow text for the button
|
|
||||||
),
|
|
||||||
modifier = Modifier
|
|
||||||
.border(width = 5.dp, color = PastelYellow, shape = RoundedCornerShape(
|
|
||||||
roundedCornerDimen)) // Yellow border
|
|
||||||
) {
|
|
||||||
Text("Ne")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Button(onClick = {
|
|
||||||
screenToShow.value = Screen.SignIn
|
|
||||||
},
|
},
|
||||||
colors = ButtonDefaults.buttonColors(
|
dismissButton = {
|
||||||
contentColor = Color.White,
|
Button(
|
||||||
containerColor = Color.Black
|
onClick = {
|
||||||
),
|
showDialog = false
|
||||||
modifier = Modifier
|
},
|
||||||
.border(
|
colors = ButtonDefaults.buttonColors(
|
||||||
width = 5.dp,
|
containerColor = Color.Black, // Black background for the button
|
||||||
shape = RoundedCornerShape(roundedCornerDimen),
|
contentColor = Color.White,
|
||||||
color = PastelYellow
|
// Yellow text for the button
|
||||||
)
|
),
|
||||||
.width(230.dp)
|
modifier = Modifier
|
||||||
.height(80.dp)
|
.border(width = 5.dp, color = PastelYellow, shape = RoundedCornerShape(
|
||||||
) {
|
roundedCornerDimen)) // Yellow border
|
||||||
Text(
|
) {
|
||||||
text = "Změnit přihlášení",
|
Text("Ne")
|
||||||
fontSize = 23.sp
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MenuButton(onClick: () -> Unit, text: String) {
|
||||||
|
Button(
|
||||||
|
onClick = onClick,
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
contentColor = Color.White,
|
||||||
|
containerColor = Color.Black
|
||||||
|
),
|
||||||
|
modifier = Modifier
|
||||||
|
.border(
|
||||||
|
width = 5.dp,
|
||||||
|
shape = RoundedCornerShape(roundedCornerDimen),
|
||||||
|
color = PastelYellow
|
||||||
)
|
)
|
||||||
}
|
.width(230.dp)
|
||||||
|
.height(80.dp)
|
||||||
Spacer(modifier = Modifier.height(100.dp))
|
) {
|
||||||
|
Text(
|
||||||
Button(onClick = {
|
text = text,
|
||||||
isShowing.value = IsShowing.About
|
fontSize = 23.sp
|
||||||
},
|
)
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
contentColor = Color.White,
|
|
||||||
containerColor = Color.Black
|
|
||||||
),
|
|
||||||
modifier = Modifier
|
|
||||||
.border(
|
|
||||||
width = 5.dp,
|
|
||||||
shape = RoundedCornerShape(roundedCornerDimen),
|
|
||||||
color = PastelYellow
|
|
||||||
)
|
|
||||||
.width(230.dp)
|
|
||||||
.height(80.dp)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = "O aplikaci",
|
|
||||||
fontSize = 23.sp
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(100.dp))
|
|
||||||
|
|
||||||
Button(onClick = {
|
|
||||||
isShowing.value = IsShowing.Settings
|
|
||||||
},
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
contentColor = Color.White,
|
|
||||||
containerColor = Color.Black
|
|
||||||
),
|
|
||||||
modifier = Modifier
|
|
||||||
.border(
|
|
||||||
width = 5.dp,
|
|
||||||
shape = RoundedCornerShape(roundedCornerDimen),
|
|
||||||
color = PastelYellow
|
|
||||||
)
|
|
||||||
.width(230.dp)
|
|
||||||
.height(80.dp)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = "Nastavení",
|
|
||||||
fontSize = 23.sp
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user