Rounded Corner Span Painter
class RoundedCornerSpanPainter(cornerRadius: TextUnit = 8.sp, stroke: RoundedCornerSpanPainter.Stroke? = null, padding: RoundedCornerSpanPainter.TextPaddingValues = TextPaddingValues(horizontal = 2.sp, vertical = 2.sp), topMargin: TextUnit = 1.sp, bottomMargin: TextUnit = 1.sp) : ExtendedSpanPainter
Draws round rectangles behind text annotated using SpanStyle(background = …).
topMargin and bottomMargin are placeholder values that will be automatically calculated from font metrics in the future once Compose UI starts exposing them (Issue tracker). In the meantime, you can calculate these depending upon your text's font size and line height.
Constructors
Link copied to clipboard
constructor(cornerRadius: TextUnit = 8.sp, stroke: RoundedCornerSpanPainter.Stroke? = null, padding: RoundedCornerSpanPainter.TextPaddingValues = TextPaddingValues(horizontal = 2.sp, vertical = 2.sp), topMargin: TextUnit = 1.sp, bottomMargin: TextUnit = 1.sp)
Functions
Link copied to clipboard
open override fun decorate(span: SpanStyle, start: Int, end: Int, text: AnnotatedString, builder: AnnotatedString.Builder): SpanStyle
Can be used for removing any existing spans from text so that they can be drawn manually.
Link copied to clipboard