note Over
abstract fun noteOver(participants: Collection<Participant>, label: @Composable () -> Unit)
Content copied to clipboard
Specifies a composable that represents a note that is placed "over", or covering, one or more participants.
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
// In addition to lines, notes can also be placed around participants.
SequenceDiagram {
val alice = createParticipant { Note("Alice") }
createParticipant { Note("Bob") }
val carlos = createParticipant { Note("Carlos") }
noteToStartOf(alice) { Note("Note to the start of Alice") }
noteOver(alice) { Note("Note over Alice") }
noteToEndOf(alice) { Note("Note to the end of Alice") }
noteOver(alice, carlos) { Note("Note over multiple participants") }
}
//sampleEnd
}
Parameters
participants
The list of Participants that this note covers. Must contain at least one element. If the note only covers a single participant, the width of the label will be used to determine the space around that Participant. If it contains more than one element, it will span from the start-most Participant to the end-most one. The order of the collection does not matter.
label
The composable that represents the note. In most cases this should be the Note composable. If the SequenceDiagramStyle.balanceLabelDimensions flag is true, the label will be measured with a max width less than its intrinsic max width to try to make it closer to square.