lineHeightMeasure property

  1. @ViewChild('lineHeightMeasure')
set lineHeightMeasure (Element? value)

Implementation

@ViewChild('lineHeightMeasure')
set lineHeightMeasure(Element? value) {
  // There's currently no strong use case of line height changing after it's
  // been measured. So we only measure it once when the view is rendered.
  _domService.scheduleRead(() {
    var isDestroyed = textareaEl == null;
    if (isDestroyed) return;

    var height = value?.clientHeight ?? 0;
    if (height != 0) {
      _inputLineHeight = height;
      _subscription?.cancel();
      _subscription = null;
      _changeDetector.markForCheck();
      // TODO(google): remove after the bug is fixed.
      //..detectChanges();
    } else if (_subscription == null) {
      // Listen to dom changes until we can read the line height.
      _subscription = _domService.onLayoutChanged!.listen((_) {
        lineHeightMeasure = value;
      });
    }
  });
}