lineTo

abstract infix fun Participant.lineTo(other: Participant): LineBuilder

Specifies a line drawn from this Participant to other. The optional properties of the line can be configured by calling methods on the returned LineBuilder.

Samples

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import com.zachklipp.seqdiag.ArrowHeadType
import com.zachklipp.seqdiag.BasicSequenceDiagramStyle
import com.zachklipp.seqdiag.Label
import com.zachklipp.seqdiag.LineStyle
import com.zachklipp.seqdiag.Note
import com.zachklipp.seqdiag.SequenceDiagram
import com.zachklipp.seqdiag.arrowHeadType
import com.zachklipp.seqdiag.color
import com.zachklipp.seqdiag.createParticipant
import com.zachklipp.seqdiag.noteOver
fun main() { 
   //sampleStart 
   // Specifies a simple sequence diagram that consists of three participants with some lines
// between them.
SequenceDiagram {
    val alice = createParticipant { Note("Alice") }
    val bob = createParticipant { Note("Bob") }
    val carlos = createParticipant { Note("Carlos") }

    // Lines can be specified between any two participants, with their
    alice.lineTo(bob)
        .label { Label("Hello!") }
    bob.lineTo(carlos)
        .label { Label("Alice says hi") }

    // Lines don't need to have labels, and they can be styled.
    carlos.lineTo(bob)
        .color(Color.Blue)
        .arrowHeadType(ArrowHeadType.Outlined)

    // Lines can span multiple participants.
    carlos.lineTo(alice)
        .label { Label("Hello back!") }
} 
   //sampleEnd
}

Sources

Link copied to clipboard