LineWrapperNoHyphen constructor
LineWrapperNoHyphen(
- List<
TextPartToken> tokens, - Text _text,
- TextStyle _style,
- double _maxWidth,
Constructor.
Implementation
LineWrapperNoHyphen(
List<TextPartToken> tokens, this._text, this._style, this._maxWidth) {
final Map<String, Size> tokensWidthCache = {};
_tokenIter = TokenIterator(tokens);
_painter = TextPainter(
textDirection: _text.textDirection ?? TextDirection.ltr,
maxLines: _text.maxLines,
textScaleFactor: _text.textScaleFactor ?? 1.0,
locale: _text.locale,
textAlign: _text.textAlign ?? TextAlign.start,
textHeightBehavior: _text.textHeightBehavior,
textWidthBasis: _text.textWidthBasis ?? TextWidthBasis.parent,
);
for (final TextPartToken part in tokens) {
if (part is WordToken) {
for (final WordPartToken p in part.parts) {
_setWidths(p.text, tokensWidthCache, p);
}
} else if (part is TabsAndSpacesToken) {
_setWidths(part.text, tokensWidthCache, part);
} else if (part is NewlineToken) {
part.sizeHyphen = const Size(0, 0);
part.sizeNoHyphen = part.sizeHyphen;
part.sizeCurrent = part.sizeHyphen;
}
}
// print('=== CACHE: ${tokensWidthCache}');
}