createFragmentWithPendingStyles static method

Fragment createFragmentWithPendingStyles(
  1. FluentDocument document,
  2. String text
)

Creates a new fragment with styles from the document's pending styles. Used when inserting new text at the cursor position.

Implementation

static Fragment createFragmentWithPendingStyles(FluentDocument document, String text) {
  return Fragment(text)
    ..styles = List.from(document.pendingStyles)
    ..fontFamily = document.pendingFontFamily
    ..fontSize = document.pendingFontSize
    ..color = document.pendingColor
    ..highlightColor = document.pendingHighlightColor;
}