ListItem
This component can be used to achieve the list item templates existing in the spec.
Parameters
the headline content of the list item
Modifier to be applied to the list item
the supporting content of the list item
the leading content of the list item
the trailing meta text, icon, switch or checkbox
ListItemColors that will be used to resolve the background and content color for this list item in different states. See ListItemDefaults.listItemColors
the padding values surrounding the content
background shape of the list item. Color ListItemColors.backgroundColor
Samples
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import com.pico.spatial.ui.design.Icon
import com.pico.spatial.ui.design.ListItem
import com.pico.spatial.ui.design.Text
fun main() {
//sampleStart
ListItem(headlineContent = { Text(text = "Item") })
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import com.pico.spatial.ui.design.Icon
import com.pico.spatial.ui.design.ListItem
import com.pico.spatial.ui.design.Text
fun main() {
//sampleStart
ListItem(
headlineContent = { Text(text = "Headline content") },
leadingContent = {
Icon(
painter = painterResource(R.drawable.ic_sample_placeholder),
contentDescription = null,
)
},
supportingContent = { Text(text = "Supporting content") },
trailingContent = {
Icon(
painter = painterResource(id = R.drawable.ic_sample_listitem_check),
contentDescription = null,
)
},
)
//sampleEnd
}This component can be used to achieve the list item templates existing in the spec.
Parameters
the headline content of the list item
Modifier to be applied to the list item
the supporting content of the list item
the leading content of the list item
the trailing meta text, icon, switch or checkbox
ListItemColors that will be used to resolve the background and content color for this list item in different states. See ListItemDefaults.listItemColors
ListItemVibrants that will be used to resolve the background and content vibrant for this list item in different states. See ListItemDefaults.listItemVibrants
the padding values surrounding the content
background shape of the list item. Color ListItemColors.backgroundColor
Samples
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import com.pico.spatial.ui.design.Icon
import com.pico.spatial.ui.design.ListItem
import com.pico.spatial.ui.design.Text
fun main() {
//sampleStart
ListItem(headlineContent = { Text(text = "Item") })
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import com.pico.spatial.ui.design.Icon
import com.pico.spatial.ui.design.ListItem
import com.pico.spatial.ui.design.Text
fun main() {
//sampleStart
ListItem(
headlineContent = { Text(text = "Headline content") },
leadingContent = {
Icon(
painter = painterResource(R.drawable.ic_sample_placeholder),
contentDescription = null,
)
},
supportingContent = { Text(text = "Supporting content") },
trailingContent = {
Icon(
painter = painterResource(id = R.drawable.ic_sample_listitem_check),
contentDescription = null,
)
},
)
//sampleEnd
}