measure method

  1. @override
double measure(
  1. String text,
  2. TextStyle style
)
override

返回单行宽度,包含尾随空格,字号向零截断。

Implementation

@override
double measure(String text, TextStyle style) {
  final key = (text, style);
  final cached = _widths[key];
  if (cached != null) return cached;
  final width = _layout(text, style).width;
  if (_widths.length >= _maxWidths) _widths.clear();
  _widths[key] = width;
  return width;
}