lineHeightMeasure property
- @ViewChild.new('lineHeightMeasure')
set
lineHeightMeasure
(ElementRef value)
Implementation
@ViewChild('lineHeightMeasure')
set lineHeightMeasure(ElementRef 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.nativeElement as Element).clientHeight;
if (height != 0) {
_inputLineHeight = height;
_subscription?.cancel();
_subscription = null;
_changeDetector
..markForCheck()
// TODO(google): remove after the bug is fixed.
..detectChanges();
} else {
_subscription ??= _domService.onLayoutChanged.listen((_) {
lineHeightMeasure = value;
});
}
});
}