Source set: Common
public class Bullet(
public val shape: Shape,
// width and height is used to avoid introducing TextUnitSize
public val width: TextUnit,
public val height: TextUnit,
public val padding: TextUnit,
public val brush: Brush? = null,
public val alpha: Float = Float.NaN,
public val drawStyle: DrawStyle = Fill,
) : AnnotatedString.Annotation
Draws a bullet point next to a paragraph.
Bullets do not add indentation. The call site must provide sufficient leading space to accommodate the bullet and its padding, preventing overlap with the text.
There are several ways to achieve this leading space. One common approach is to use ParagraphStyle with textIndent within an AnnotatedString.
Parameters
| shape | the shape of the bullet to draw |
| width | the width of the bullet |
| height | the height of the bullet |
| padding | the padding between the end of the bullet and the start of the paragraph |
| brush | brush to draw a bullet with. If null is passed, the bullet will be drawn like the rest of the text |
| alpha | opacity to be applied to brush drawing a bullet from 0.0f to 1.0f representing fully transparent to fully opaque respectively. When Float.NaN is passed, the alpha will not be changed and the one used for drawing rest of the text is used |
| drawStyle | defines the draw style of the bullet, e.g. a fill or a stroke |
Functions
copy
Source set: Common
public fun copy(
shape: Shape = this.shape,
width: TextUnit = this.width,
height: TextUnit = this.height,
padding: TextUnit = this.padding,
brush: Brush? = this.brush,
alpha: Float = this.alpha,
drawStyle: DrawStyle = this.drawStyle,
): Bullet
Copies the existing Bullet replacing some of the fields as desired.
Members
Companion
Source set: Common
public companion object
Properties
DefaultIndentation
Source set: Common
public val DefaultIndentation: TextUnit = 1.em
Indentation required to fit Default bullet.
DefaultSize
Source set: Common
public val DefaultSize: TextUnit = 0.25.em
Height and width for Default bullet.
DefaultPadding
Source set: Common
public val DefaultPadding: TextUnit = 0.25.em
Padding between bullet and start of paragraph for Default bullet
Default
Source set: Common
public val Default: Bullet = Bullet(CircleShape, DefaultSize, DefaultSize, DefaultPadding)
Default bullet used in AnnotatedString's bullet list