Wikipedia: always show card background (Compose)

This commit is contained in:
MM20 2021-09-24 21:29:25 +02:00
parent 5f2dd67486
commit d1244ae198
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 13 additions and 8 deletions

View File

@ -28,12 +28,11 @@ fun WikipediaItem(
initialRepresentation: Representation, initialRepresentation: Representation,
onRepresentationChange: ((Representation) -> Unit) onRepresentationChange: ((Representation) -> Unit)
) { ) {
val hPadding = if (initialRepresentation == Representation.Full) 8.dp else 16.dp
Column( Column(
modifier = Modifier modifier = Modifier
) { ) {
Column( Column(
modifier = Modifier.padding(start = hPadding, end = hPadding, top = 16.dp) modifier = Modifier.padding(start = 16.dp, end = 24.dp, top = 16.dp)
) { ) {
Text( Text(
text = wikipedia.label, text = wikipedia.label,

View File

@ -1,9 +1,11 @@
package de.mm20.launcher2.ui.search package de.mm20.launcher2.ui.search
import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.material.Card
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
import de.mm20.launcher2.ui.SectionDivider import de.mm20.launcher2.ui.SectionDivider
import de.mm20.launcher2.wikipedia.WikipediaViewModel import de.mm20.launcher2.wikipedia.WikipediaViewModel
@ -15,12 +17,16 @@ fun wikipediaResult(): LazyListScope.() -> Unit {
return { return {
wikipedia?.let { wikipedia?.let {
item { item {
WikipediaItem( Card(
wikipedia = it, elevation = 0.dp
representation = Representation.Full, ) {
initialRepresentation = Representation.Full, WikipediaItem(
onRepresentationChange = {} wikipedia = it,
) representation = Representation.Full,
initialRepresentation = Representation.Full,
onRepresentationChange = {}
)
}
} }
SectionDivider() SectionDivider()
} }