JengaTimelineItem

fun JengaTimelineItem(state: JengaTimelineState, title: String, position: JengaTimelinePosition, modifier: Modifier = Modifier, subtitle: String? = null, trailingContent: @Composable () -> Unit? = null, stateDescription: String? = null, markerSize: Dp = JengaTimelineDefaults.MarkerSize, contentPadding: PaddingValues = JengaTimelineDefaults.contentPadding, titleStyle: TextStyle = JengaTimelineDefaults.titleStyle, subtitleStyle: TextStyle = JengaTimelineDefaults.subtitleStyle, colors: JengaTimelineColors = JengaTimelineDefaults.colors())(source)

One stage of a vertical timeline: a state marker with a title and optional subtitle beside it, and a connector line down to the next stage. Stack items in a column or lazy list, giving each its position; each item draws its own connector, so no measuring pass is needed. The connector below a done stage is drawn in the reached color.

Parameters

state

the stage's progress; see JengaTimelineState.

title

the stage name.

position

where the stage sits; see JengaTimelinePosition.

modifier

the Modifier for this item.

subtitle

optional line under the title (e.g. a date or who did it).

trailingContent

optional end slot; inherits the subtitle color.

stateDescription

spoken description of state (e.g. "Done").

markerSize

the marker diameter.

contentPadding

padding around the stage text.

titleStyle

the title text style.

subtitleStyle

the subtitle text style.

colors

the color set; defaults to JengaTimelineDefaults.colors.

Samples

Column(
    content = {
        JengaTimelineItem(
            state = JengaTimelineState.Done,
            title = "Lead created",
            position = JengaTimelinePosition.First,
            subtitle = "12 Mar",
        )
        JengaTimelineItem(
            state = JengaTimelineState.Current,
            title = "Quotation",
            position = JengaTimelinePosition.Middle,
        )
        JengaTimelineItem(
            state = JengaTimelineState.ToDo,
            title = "Installation",
            position = JengaTimelinePosition.Last,
        )
    },
)

fun JengaTimelineItem(position: JengaTimelinePosition, marker: @Composable () -> Unit, modifier: Modifier = Modifier, lineColor: Color = JengaTimelineDefaults.colors().connector, markerSize: Dp = JengaTimelineDefaults.MarkerSize, contentPadding: PaddingValues = JengaTimelineDefaults.contentPadding, content: @Composable () -> Unit)(source)

One item of a vertical timeline with any marker and any content: a marker with the content beside it, and a line in lineColor from the marker down to the next item. The line follows the item's height. Stack items in a column or give each its own item {} in a lazy list, with JengaTimelinePosition.of for position.

Parameters

position

where the item sits; the last and only items draw no line below.

marker

the marker, e.g. a JengaTimelineMarker; drawn in a markerSize wide column.

modifier

the Modifier for this item.

lineColor

the color of the line below this item.

markerSize

the width of the marker column; the line starts this far below the top.

contentPadding

padding around content.

content

the item body.