Sequence Diagram Style
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
Properties
Link copied to clipboard
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
Link copied to clipboard
Properties that control how lines are rendered for both Participants and LineBuilders. See LineStyle documentation for more information.
Link copied to clipboard
The padding used internally Note composables.
Link copied to clipboard
The minimum amount of space between Participants in the diagram.
Link copied to clipboard