Skip to content
This repository has been archived by the owner on Dec 3, 2022. It is now read-only.

android Sticky-TimeLineView that made with jetpack-compose

License

Notifications You must be signed in to change notification settings

jisungbin/ComposeTimeLineView

Repository files navigation

ComposeTimeLineView

android Sticky-TimeLineView that made with jetpack-compose.


Download

implementation "io.github.jisungbin:timelineview:${version}"

Preview

Usage

1. Create item model class

data class Item(override val key: Int) : TimeLineItem<Int>

model class must be extends TimeLineView<K> !

TimeLineView<K>

K value will be TimeLineView-Header item.

2. Use TimeLineView

@Composable
fun <K, E : TimeLineItem<K>> TimeLine(
    items: List<E>,
    modifier: Modifier = Modifier,
    timeLineOption: TimeLineOption = TimeLineOption(),
    timeLinePadding: TimeLinePadding = TimeLinePadding(),
    header: @Composable (K) -> Unit,
    content: @Composable (E) -> Unit
)

TimeLineOption

fun TimeLineOption(
    @DrawableRes circleIcon: Int = R.drawable.ic_outline_circle_24,
    circleSize: Dp = Dp.Unspecified,
    circleColor: Color = Color.Gray,
    lineColor: Color = Color(0xFF6200EE),
    lineWidth: Dp = 2.dp,
    contentHeight: Dp = 100.dp
): TimeLineOption

TimeLinePadding

fun TimeLinePadding(
    defaultPadding: PaddingValues = PaddingValues(16.dp),
    contentStart: Dp = 4.dp,
    circleLineGap: Dp = 1.dp
): TimeLinePadding

License

TimeLineView license is under the MIT License.

Please see license file.


🤗 Happy Coding :)