SequenceDiagramStyle

interface SequenceDiagramStyle

Defines the default layout and drawing properties of a SequenceDiagram. BasicSequenceDiagramStyle is an immutable implementation of this interface.

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 
   // Most of the internal layout and drawing properties of the sequence diagram can be controlled
// via a SequenceDiagramStyle. BasicSequenceDiagramStyle is an immutable implementation of that
// interface.
SequenceDiagram(
    style = BasicSequenceDiagramStyle(
        participantSpacing = 10.dp,
        verticalSpacing = 2.dp,
        labelPadding = 16.dp,
        labelTextStyle = TextStyle(fontFamily = FontFamily.Cursive),
        notePadding = PaddingValues(8.dp),
        noteShape = RoundedCornerShape(6.dp),
        noteBackgroundBrush = Brush.radialGradient(
            0f to Color.White, 1f to Color.LightGray
        ),
        lineStyle = LineStyle(
            brush = SolidColor(Color.Blue),
            width = 4.dp,
            arrowHeadType = ArrowHeadType.Outlined,
        ),
    )
) {
    val alice = createParticipant { Note("Alice") }
    val bob = createParticipant { Note("Bob") }
    val carlos = createParticipant { Note("Carlos") }

    alice.lineTo(bob)
        .label { Label("Hello!") }

    noteOver(alice, carlos) { Note("Wide note") }
} 
   //sampleEnd
}

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val balanceLabelDimensions: Boolean

If true, labels will be measured with constraints that attempt to make their dimensions closer to square. This means long labels will be broken into multiple lines.

Link copied to clipboard
abstract val labelPadding: Dp

The amount of space between labels and their anchors. This is also used for the amount of space that spanning labels overlap their bounding Participants.

Link copied to clipboard
abstract val labelTextStyle: TextStyle

The TextStyle used for Labels.

Link copied to clipboard
abstract val lineStyle: LineStyle

Properties that control how lines are rendered for both Participants and LineBuilders. See LineStyle documentation for more information.

Link copied to clipboard
abstract val noteBackgroundBrush: Brush

The Brush used to draw the background of all Note composables.

Link copied to clipboard
abstract val notePadding: PaddingValues

The padding used internally Note composables.

Link copied to clipboard
abstract val noteShape: Shape

The Shape used for all Note composables.

Link copied to clipboard
abstract val participantSpacing: Dp

The minimum amount of space between Participants in the diagram.

Link copied to clipboard
abstract val verticalSpacing: Dp

The spacing between rows in the diagram.

Inheritors

Link copied to clipboard

Sources

Link copied to clipboard