SquigglyUnderlineSpanPainter

class SquigglyUnderlineSpanPainter(width: TextUnit = 2.sp, wavelength: TextUnit = 9.sp, amplitude: TextUnit = 1.sp, bottomOffset: TextUnit = 1.sp, animator: SquigglyUnderlineAnimator = SquigglyUnderlineAnimator.NoOp) : ExtendedSpanPainter

Draws squiggly underlines below text annotated using SpanStyle(textDecoration = Underline). Inspired from Sam Ruston's BuzzKill app.

           _....._                                     _....._         ▲
,=" "=. ,=" "=. amplitude
," ". ," ". │
," "., ,," "., ▼
""""""""""|""""""""""|."""""""""|""""""""".|""""""""""|""""""""""|
". ."
"._ _,"
"-.....-"
◀─────────────── Wavelength ──────────────▶

Parameters

bottomOffset

Distance from a line's bottom coordinate.

Constructors

Link copied to clipboard
constructor(width: TextUnit = 2.sp, wavelength: TextUnit = 9.sp, amplitude: TextUnit = 1.sp, bottomOffset: TextUnit = 1.sp, animator: SquigglyUnderlineAnimator = SquigglyUnderlineAnimator.NoOp)

Types

Link copied to clipboard
object Companion

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