cloneFragment static method
Creates a new fragment with the same styles as the source fragment.
If text is provided, uses that text; otherwise uses the source fragment's text.
Implementation
static Fragment cloneFragment(Fragment source, {String? text}) {
return Fragment(text ?? source.text)
..styles = List.from(source.styles ?? [])
..fontFamily = source.fontFamily
..fontSize = source.fontSize
..color = source.color
..highlightColor = source.highlightColor;
}