Skip to content

Instantly share code, notes, and snippets.

@yasukotelin
Created June 10, 2021 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasukotelin/db611c797fc5e9ddecf50e96b064f7da to your computer and use it in GitHub Desktop.
Save yasukotelin/db611c797fc5e9ddecf50e96b064f7da to your computer and use it in GitHub Desktop.
Jetpack Compose Center composable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@Composable
fun Center(
modifier: Modifier = Modifier,
content: @Composable () -> Unit,
) {
Column(
modifier = modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
content()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment