Convert to TextPosition for getWordBoundary (#44611)

Convert the call to getWordBoundary to use a TextPosition, in preparation for landing flutter/engine#13727, which switches the desired API to the final desired API.
This commit is contained in:
Greg Spencer 2019-11-11 14:27:06 -08:00 committed by GitHub
parent 86c91b12d8
commit 23d1ae0ff7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -818,7 +818,7 @@ class TextPainter {
assert(!_needsLayout); assert(!_needsLayout);
// TODO(gspencergoog): remove the List<int>-based code when the engine API // TODO(gspencergoog): remove the List<int>-based code when the engine API
// returns a TextRange instead of a List<int>. // returns a TextRange instead of a List<int>.
final dynamic boundary = _paragraph.getWordBoundary(position.offset); final dynamic boundary = _paragraph.getWordBoundary(position);
if (boundary is List<int>) { if (boundary is List<int>) {
final List<int> indices = boundary; final List<int> indices = boundary;
return TextRange(start: indices[0], end: indices[1]); return TextRange(start: indices[0], end: indices[1]);