Jan Skrasek
10/29/2022, 11:19 PMJan Skrasek
10/29/2022, 11:21 PMTimeline {
TimelineItem(
status = TimelineItemStatus.DoneSuccess,
title = { Text("Check-in details") },
description = { Text("...") },
)
TimelineItem(
status = TimelineItemStatus.DoneSuccess,
title = { Text("Waiting for the airline") },
description = { Text("...") },
)
TimelineItem(
status = TimelineItemStatus.DoneSuccess,
title = { Text("Processing online check-in") },
description = { Text("...") },
)
TimelineItem(
status = TimelineItemStatus.InProgress,
title = { Text("Boarding passes ready") },
description = { Text("...") },
)
}
Jan Skrasek
10/29/2022, 11:24 PMList<@Composable () -> Unit>
and SubcomposeLayout
but it seems to be unfriendly api and avoiding subcomposition seems to be the way I'd like to try first.efemoney
10/30/2022, 8:19 AMColumn
. First each child will be offset horizontally in the column to make space for the status track then they will also report their locationInParent
(something like that) via some modifier (one of onPlaced
/ onGloballyPositioned
) plus their statuses back to the drawing state. The parent Column will have a custom drawing modifier which based on the positions the children reported can draw the trackMark Murphy
10/30/2022, 4:00 PMJan Skrasek
10/30/2022, 6:02 PMThe children can setActually, this is what I'm asking about. How to read parentData and be able to draw something. I can read parentData in Layout's MeasureScope, but I don't know how to draw additional lines there.to inform the parentparentData
of their status which will influence the status check mark & the “gradient line” you draw from one child to the next.Layout
report theirThis is something I'd like to avoid since it will draw using recomposition.locationInParent
You might also look at existing libraries for thisThx, I did so but it seems they're quite simpler (e.g. the item state doesn't affect the previous item line (color)) Anyway, you can look how I solved it: https://github.com/kiwicom/orbit-compose/pull/277 Basically the timeline item emits three composables (measurables): • item • line • gradient line overlay for the previous item's line Then the custom Layout combines them together.