'Always show drawer on tablet with Jetpack Compose

I am trying to create a tablet Jetpack Compose app:

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            SeatbackTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colors.background
                ) {
                    ScaffoldWithPanel()
                }
            }
        }
    }
}


@Composable
fun MainContent() {
    return Column {
        // Some content here
        Text(text = "MainContent")
    }
}

@Composable
fun SidePanel() {
    return Column {
        // Some content here
        Text(text = "SidePanel")
    }
}


@Composable
fun ScaffoldWithPanel() {
    Scaffold(
        content = { MainContent()},
        drawerContent = { SidePanel()}
    )
}

@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
    SeatbackTheme {
        ScaffoldWithPanel()
    }
}

I'd like the Drawer to always be shown on tablet landscape mode. However, my code currently here is always hiding the drawer unless I drag it (which is fine for mobile devices) but I'd like to be shown all the time on Tablet Landscape.

How would I achieve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source