Merge pull request #665 from AnirudhPudari/migrate-to-compose_flowlayouts

[Bug]: Migrate away from accompanist/flowlayout
pull/640/head
Milosz Moczkowski 2 years ago committed by GitHub
commit 2c18740d62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -67,6 +67,5 @@ android {
dependencies { dependencies {
implementation(project(":core:designsystem")) implementation(project(":core:designsystem"))
implementation(project(":core:ui")) implementation(project(":core:ui"))
implementation(libs.accompanist.flowlayout)
implementation(libs.androidx.activity.compose) implementation(libs.androidx.activity.compose)
} }

@ -17,6 +17,8 @@
package com.google.samples.apps.niacatalog.ui package com.google.samples.apps.niacatalog.ui
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.add import androidx.compose.foundation.layout.add
import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.asPaddingValues
@ -36,7 +38,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.google.accompanist.flowlayout.FlowRow
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaButton import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaButton
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaFilterChip import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaFilterChip
import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaIconToggleButton import com.google.samples.apps.nowinandroid.core.designsystem.component.NiaIconToggleButton
@ -54,6 +55,7 @@ import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme
/** /**
* Now in Android component catalog. * Now in Android component catalog.
*/ */
@OptIn(ExperimentalLayoutApi::class)
@Composable @Composable
fun NiaCatalog() { fun NiaCatalog() {
NiaTheme { NiaTheme {
@ -75,7 +77,7 @@ fun NiaCatalog() {
} }
item { Text("Buttons", Modifier.padding(top = 16.dp)) } item { Text("Buttons", Modifier.padding(top = 16.dp)) }
item { item {
FlowRow(mainAxisSpacing = 16.dp) { FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
NiaButton(onClick = {}) { NiaButton(onClick = {}) {
Text(text = "Enabled") Text(text = "Enabled")
} }
@ -89,7 +91,7 @@ fun NiaCatalog() {
} }
item { Text("Disabled buttons", Modifier.padding(top = 16.dp)) } item { Text("Disabled buttons", Modifier.padding(top = 16.dp)) }
item { item {
FlowRow(mainAxisSpacing = 16.dp) { FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
NiaButton( NiaButton(
onClick = {}, onClick = {},
enabled = false, enabled = false,
@ -112,7 +114,7 @@ fun NiaCatalog() {
} }
item { Text("Buttons with leading icons", Modifier.padding(top = 16.dp)) } item { Text("Buttons with leading icons", Modifier.padding(top = 16.dp)) }
item { item {
FlowRow(mainAxisSpacing = 16.dp) { FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
NiaButton( NiaButton(
onClick = {}, onClick = {},
text = { Text(text = "Enabled") }, text = { Text(text = "Enabled") },
@ -138,7 +140,7 @@ fun NiaCatalog() {
} }
item { Text("Disabled buttons with leading icons", Modifier.padding(top = 16.dp)) } item { Text("Disabled buttons with leading icons", Modifier.padding(top = 16.dp)) }
item { item {
FlowRow(mainAxisSpacing = 16.dp) { FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
NiaButton( NiaButton(
onClick = {}, onClick = {},
enabled = false, enabled = false,
@ -168,7 +170,7 @@ fun NiaCatalog() {
item { Text("Dropdown menus", Modifier.padding(top = 16.dp)) } item { Text("Dropdown menus", Modifier.padding(top = 16.dp)) }
item { Text("Chips", Modifier.padding(top = 16.dp)) } item { Text("Chips", Modifier.padding(top = 16.dp)) }
item { item {
FlowRow(mainAxisSpacing = 16.dp) { FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
var firstChecked by remember { mutableStateOf(false) } var firstChecked by remember { mutableStateOf(false) }
NiaFilterChip( NiaFilterChip(
selected = firstChecked, selected = firstChecked,
@ -197,7 +199,7 @@ fun NiaCatalog() {
} }
item { Text("Icon buttons", Modifier.padding(top = 16.dp)) } item { Text("Icon buttons", Modifier.padding(top = 16.dp)) }
item { item {
FlowRow(mainAxisSpacing = 16.dp) { FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
var firstChecked by remember { mutableStateOf(false) } var firstChecked by remember { mutableStateOf(false) }
NiaIconToggleButton( NiaIconToggleButton(
checked = firstChecked, checked = firstChecked,
@ -270,7 +272,7 @@ fun NiaCatalog() {
} }
item { Text("View toggle", Modifier.padding(top = 16.dp)) } item { Text("View toggle", Modifier.padding(top = 16.dp)) }
item { item {
FlowRow(mainAxisSpacing = 16.dp) { FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
var firstExpanded by remember { mutableStateOf(false) } var firstExpanded by remember { mutableStateOf(false) }
NiaViewToggleButton( NiaViewToggleButton(
expanded = firstExpanded, expanded = firstExpanded,
@ -296,7 +298,7 @@ fun NiaCatalog() {
} }
item { Text("Tags", Modifier.padding(top = 16.dp)) } item { Text("Tags", Modifier.padding(top = 16.dp)) }
item { item {
FlowRow(mainAxisSpacing = 16.dp) { FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
NiaTopicTag( NiaTopicTag(
followed = true, followed = true,
onClick = {}, onClick = {},

@ -27,7 +27,6 @@ android {
} }
dependencies { dependencies {
implementation(libs.accompanist.flowlayout)
implementation(libs.kotlinx.datetime) implementation(libs.kotlinx.datetime)
implementation(libs.androidx.activity.compose) implementation(libs.androidx.activity.compose)
} }

@ -53,7 +53,6 @@ secrets = "2.0.1"
turbine = "0.12.1" turbine = "0.12.1"
[libraries] [libraries]
accompanist-flowlayout = { group = "com.google.accompanist", name = "accompanist-flowlayout", version.ref = "accompanist" }
accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanist" } accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanist" }
accompanist-testharness = { group = "com.google.accompanist", name = "accompanist-testharness", version.ref = "accompanist" } accompanist-testharness = { group = "com.google.accompanist", name = "accompanist-testharness", version.ref = "accompanist" }
android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" }

Loading…
Cancel
Save