getFullHeightForCaret method

double getFullHeightForCaret(
  1. TextPosition position,
  2. Rect caretPrototype
)

Returns the strut bounded height of the glyph at the given position.

Valid only after layout has been called.

Implementation

double getFullHeightForCaret(TextPosition position, Rect caretPrototype) {
  if (_strutDisabled) {
    final double? heightFromCaretMetrics = _computeCaretMetrics(position)?.height;
    if (heightFromCaretMetrics != null) {
      return heightFromCaretMetrics;
    }
  }
  final TextBox textBox = _getOrCreateLayoutTemplate()
      .getBoxesForRange(0, 1, boxHeightStyle: ui.BoxHeightStyle.strut)
      .single;
  return textBox.toRect().height;
}