Hi All, trying to transition from one screen to a...
# multiplatform
b
Hi All, trying to transition from one screen to another (Login -≥ Main) So once the Login Button has been clicked it sets login = true and I have. if(login) { MainScreen(). }. Where MainScreen is a composable. I expect the screen to fully change from the Login Composable/UI to the Main Composable/UI. but end up with a half and half the top half is still Login the Bottom is part of Main. I don't need navgiation or a back stack as Main will start that. Please Advices, Thanks
a
Can you share screen shot ? Seems issue is with the screens that you have designed
b
Screenshot 2025-08-10 at 1.04.49 PM.png,Screenshot 2025-08-10 at 1.05.01 PM.png
Here is the Login Screen I tap Login and then get the second image which is Login in squished to the top and Main squished to the bottom. both screen at once in stead of Login becoming Main
a
It seems the issue is in modifiers, hope Login and Main screen are not in same parent view
b
explain please?
LoginScreen starts with
Copy code
MaterialTheme(
    colorScheme = theme,
) {
    Column(
        modifier = Modifier
            .fillMaxSize()
            .background(AppColors.silver)
    ) {
MainScreen starts with
Copy code
MaterialTheme(
    colorScheme = theme,
) {
    Scaffold(
        modifier = Modifier.fillMaxSize(),
        topBar =  {
a
Do you have any repo to share ?
b
sorry no just beginning to see if a KMP will work to combine two native codes sources into one.
o
Copy code
MaterialTheme(
    colorScheme = if (isDark) DarkColorScheme else LightColorScheme,
) {
    var login by remember { mutableStateOf(false) }
    if (login) {
        Column(Modifier.fillMaxSize()) { /* your login screen*/}
    } else {
        Scaffold(Modifier.fillMaxSize()) {/* Your main screen*/ }
    }
}
Try this way and there should always be one material theme in your app. I will also suggest using voyager it is the best screen, viewmodel and navigation for KMP and android.