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

[FlowLayout Documentation] Update flowlayout.md #1730

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions docs/flowlayout.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,13 @@

[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-flowlayout)](https://search.maven.org/search?q=g:com.google.accompanist)

Flow Layouts in Accompanist is now deprecated. Please see the migration guide below to begin using
Flow Layouts in Androidx.

The official `androidx.compose.foundation` FlowLayouts support is very similar to accompanist/flowlayouts, with a few changes.

It is most similar to `Row` and `Column` and shares similar modifiers and the scopes.
Unlike the standard `Row` and `Column` composables, if it runs out of space on the current row,
the children are placed in the next line, and this repeats until the children are fully placed.

## Usage

``` kotlin
FlowRow {
// row contents
}

FlowColumn {
// column contents
}
```
!!! warning
**This library is deprecated, with official FlowLayout support in androidx.compose.foundation.** The migration guide and original documentation is below.

## Migration Guide to the official FlowLayouts

The official `androidx.compose.foundation` FlowLayouts support is very similar to accompanist/flowlayouts, with a few changes.

1. Replace import packages to point to Androidx.Compose
``` kotlin
import androidx.compose.foundation.layout.FlowColumn
Expand Down Expand Up @@ -126,6 +110,24 @@ FlowRow(maxItemsInEachRow = 3) {
For examples, refer to the [Flow Row samples](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowRowSample.kt)
and the [Flow Column samples](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowColumnSample.kt).

## Original Docs

It is most similar to `Row` and `Column` and shares similar modifiers and the scopes.
Unlike the standard `Row` and `Column` composables, if it runs out of space on the current row,
the children are placed in the next line, and this repeats until the children are fully placed.

## Usage

``` kotlin
FlowRow {
// row contents
}

FlowColumn {
// column contents
}
```

## Download

[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-flowlayout)](https://search.maven.org/search?q=g:com.google.accompanist)
Expand All @@ -136,7 +138,7 @@ repositories {
}

dependencies {
implementation "androidx.compose.foundation:foundation:<compose-version>"
implementation "com.google.accompanist:accompanist-flowlayout:<version>"
}
```

Expand Down
Loading