fix distorted buttons in nia-catalog

pull/29/head
YvesKalume 3 years ago
parent ef42543b32
commit aefbf8a9c0

@ -35,4 +35,5 @@ dependencies {
implementation(project(":core-ui")) implementation(project(":core-ui"))
implementation(libs.androidx.activity.compose) implementation(libs.androidx.activity.compose)
implementation(libs.accompanist.flowlayout)
} }

@ -37,6 +37,7 @@ 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.ui.component.NiaDropdownMenuButton import com.google.samples.apps.nowinandroid.core.ui.component.NiaDropdownMenuButton
import com.google.samples.apps.nowinandroid.core.ui.component.NiaFilledButton import com.google.samples.apps.nowinandroid.core.ui.component.NiaFilledButton
import com.google.samples.apps.nowinandroid.core.ui.component.NiaFilterChip import com.google.samples.apps.nowinandroid.core.ui.component.NiaFilterChip
@ -76,7 +77,7 @@ fun NiaCatalog() {
} }
item { Text("Buttons", Modifier.padding(top = 16.dp)) } item { Text("Buttons", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton(onClick = {}) { NiaFilledButton(onClick = {}) {
Text(text = "Enabled") Text(text = "Enabled")
} }
@ -90,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 {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
enabled = false enabled = false
@ -113,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 {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
text = { Text(text = "Enabled") }, text = { Text(text = "Enabled") },
@ -139,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 {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
enabled = false, enabled = false,
@ -168,7 +169,7 @@ fun NiaCatalog() {
} }
item { Text("Buttons with trailing icons", Modifier.padding(top = 16.dp)) } item { Text("Buttons with trailing icons", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
text = { Text(text = "Enabled") }, text = { Text(text = "Enabled") },
@ -194,7 +195,7 @@ fun NiaCatalog() {
} }
item { Text("Disabled buttons with trailing icons", Modifier.padding(top = 16.dp)) } item { Text("Disabled buttons with trailing icons", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
enabled = false, enabled = false,
@ -223,7 +224,7 @@ fun NiaCatalog() {
} }
item { Text("Small buttons", Modifier.padding(top = 16.dp)) } item { Text("Small buttons", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
small = true small = true
@ -246,7 +247,7 @@ fun NiaCatalog() {
} }
item { Text("Disabled small buttons", Modifier.padding(top = 16.dp)) } item { Text("Disabled small buttons", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
enabled = false, enabled = false,
@ -272,7 +273,7 @@ fun NiaCatalog() {
} }
item { Text("Small buttons with leading icons", Modifier.padding(top = 16.dp)) } item { Text("Small buttons with leading icons", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
small = true, small = true,
@ -306,7 +307,7 @@ fun NiaCatalog() {
) )
} }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
enabled = false, enabled = false,
@ -338,7 +339,7 @@ fun NiaCatalog() {
} }
item { Text("Small buttons with trailing icons", Modifier.padding(top = 16.dp)) } item { Text("Small buttons with trailing icons", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
small = true, small = true,
@ -372,7 +373,7 @@ fun NiaCatalog() {
) )
} }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
NiaFilledButton( NiaFilledButton(
onClick = {}, onClick = {},
enabled = false, enabled = false,
@ -413,7 +414,7 @@ fun NiaCatalog() {
} }
item { Text("Chips", Modifier.padding(top = 16.dp)) } item { Text("Chips", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
var firstChecked by remember { mutableStateOf(false) } var firstChecked by remember { mutableStateOf(false) }
NiaFilterChip( NiaFilterChip(
checked = firstChecked, checked = firstChecked,
@ -437,7 +438,7 @@ fun NiaCatalog() {
} }
item { Text("Toggle buttons", Modifier.padding(top = 16.dp)) } item { Text("Toggle buttons", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
var firstChecked by remember { mutableStateOf(false) } var firstChecked by remember { mutableStateOf(false) }
NiaToggleButton( NiaToggleButton(
checked = firstChecked, checked = firstChecked,
@ -498,7 +499,7 @@ fun NiaCatalog() {
} }
item { Text("View toggle", Modifier.padding(top = 16.dp)) } item { Text("View toggle", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
var firstExpanded by remember { mutableStateOf(false) } var firstExpanded by remember { mutableStateOf(false) }
NiaViewToggleButton( NiaViewToggleButton(
expanded = firstExpanded, expanded = firstExpanded,
@ -517,7 +518,7 @@ fun NiaCatalog() {
} }
item { Text("Tags", Modifier.padding(top = 16.dp)) } item { Text("Tags", Modifier.padding(top = 16.dp)) }
item { item {
Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) { FlowRow(mainAxisSpacing = 16.dp) {
var firstFollowed by remember { mutableStateOf(false) } var firstFollowed by remember { mutableStateOf(false) }
NiaTopicTag( NiaTopicTag(
followed = firstFollowed, followed = firstFollowed,

Loading…
Cancel
Save