Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Alignment to Row, Column and Box #233

Conversation

EpicDima
Copy link
Contributor

There is nothing more to say)

Code example in counter

setContent {
  Column(modifier = Modifier.background(Color.Red)) {
    Text("1. The count is: $count")
    Text(
      "2. The \ncount is: $count",
      modifier = Modifier.background(Color.Blue).align(Alignment.CenterHorizontally)
     )
     Row(verticalAlignment = Alignment.Bottom, modifier = Modifier.background(Color.Green)) {
       Text(" 123 \n 456 \n 789 ")
       Text(" 123 \n 456 ")
       Text(" $count ", modifier = Modifier.align(Alignment.Top))
       Text(" $count ", modifier = Modifier.align(Alignment.CenterVertically))
       Text(" $count ")
       Text(" 123 \n 456 ")
       Text(" 123 \n 456 \n 789 ")
     }
     Text(
       "2. The \ncount is: $count",
       modifier = Modifier.background(Color.Blue).align(Alignment.End)
     )
     Text("3. The count is: $count")
     Box(modifier = Modifier.background(Color.Yellow)) {
       Text(
         "4. Muuultttiline\nCounter1\nCounter2\nCounter3",
         modifier = Modifier.background(Color.BrightGreen)
       )
       Text("3. Looooooooooooooooooooooooooooooooonnnngggggg Counter")
       Text(
         "2. Noooooorrrmaaalll Counter",
         modifier = Modifier.align(Alignment.Center).background(Color.BrightMagenta)
       )
       Text(
         "1. Short Counter",
         modifier = Modifier.align(Alignment.BottomEnd).background(Color.BrightYellow)
       )
     }
  }
}

What it looks like in the terminal:
image

@JakeWharton
Copy link
Owner

Looks great! I'll try to get to a full review this week.

Copy link
Owner

@JakeWharton JakeWharton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so sweet. Great work. I'll merge all the fixes here in a sec...

@JakeWharton JakeWharton enabled auto-merge (squash) October 31, 2023 20:49
@JakeWharton JakeWharton merged commit f7ec16c into JakeWharton:trunk Oct 31, 2023
1 check passed
@EpicDima EpicDima deleted the epicdima/add_alignment_for_row_box_and_column branch November 11, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants