How to center a text? ```Column(Modifier.fillMaxSi...
# compose
k
How to center a text?
Copy code
Column(Modifier.fillMaxSize()) {
   Text("Dashboard will be here", Modifier.wrapContentSize(Alignment.Center))
}
is not working
Copy code
Column(
    Modifier.fillMaxSize(),
    verticalArrangement = Arrangement.Center,
    horizontalAlignment = Alignment.CenterHorizontally
)
worked for me. Let me know if there's any better way
c
You have to say - Column(Modifier.fillMaxWidth()) {
k
@Chethan I thought
fillMaxSize()
is a combination of both (width and height)
a
Use
Box
instead of Column
c
Even I thought the same , but I am wonder why it doesn’t work
a
Because column only work with horizontal alignament
Column and Row only expand to it's "negative" axis
Someone explained it better days ago, but can't find the answer now
k
@alorma yup.
Copy code
Box(
    Modifier.fillMaxSize(),
    alignment = Alignment.Center
)
works perfect. Thanks!