add nullability annotations to ui/text.dart (flutter/engine#18400)

* add nullability annotations to ui/text.dart
This commit is contained in:
Yegor
2020-06-05 08:19:14 -07:00
committed by GitHub
parent 9200e49b8a
commit 84949bf44a
4 changed files with 288 additions and 288 deletions

View File

@@ -19,7 +19,7 @@ class FontWeight {
const FontWeight._(this.index);
/// The encoded integer value of this font weight.
final int index;
final int/*!*/ index;
/// Thin, the least thick
static const FontWeight w100 = FontWeight._(0);
@@ -55,7 +55,7 @@ class FontWeight {
static const FontWeight bold = w700;
/// A list of all the font weights.
static const List<FontWeight> values = <FontWeight>[
static const List<FontWeight/*!*/> values = <FontWeight/*!*/>[
w100, w200, w300, w400, w500, w600, w700, w800, w900
];
@@ -80,7 +80,7 @@ class FontWeight {
///
/// Values for `t` are usually obtained from an [Animation<double>], such as
/// an [AnimationController].
static FontWeight lerp(FontWeight a, FontWeight b, double t) {
static FontWeight/*?*/ lerp(FontWeight/*?*/ a, FontWeight/*?*/ b, double/*!*/ t) {
assert(t != null);
if (a == null && b == null)
return null;
@@ -88,7 +88,7 @@ class FontWeight {
}
@override
String toString() {
String/*!*/ toString() {
return const <int, String>{
0: 'FontWeight.w100',
1: 'FontWeight.w200',
@@ -214,7 +214,7 @@ class FontFeature {
/// See also:
///
/// * <https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#ssxx>
factory FontFeature.stylisticSet(int value) {
factory FontFeature.stylisticSet(int/*!*/ value) {
assert(value >= 1);
assert(value <= 20);
return FontFeature('ss${value.toString().padLeft(2, "0")}');
@@ -277,13 +277,13 @@ class FontFeature {
/// ASCII characters (typically lowercase letters).
///
/// See <https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags>
final String feature;
final String/*!*/ feature;
/// The value assigned to this feature.
///
/// Must be a positive integer. Many features are Boolean values that accept
/// values of either 0 (feature is disabled) or 1 (feature is enabled).
final int value;
final int/*!*/ value;
static const int _kEncodedSize = 8;
@@ -296,7 +296,7 @@ class FontFeature {
}
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -307,10 +307,10 @@ class FontFeature {
}
@override
int get hashCode => hashValues(feature, value);
int/*!*/ get hashCode => hashValues(feature, value);
@override
String toString() => 'FontFeature($feature, $value)';
String/*!*/ toString() => 'FontFeature($feature, $value)';
}
/// Whether and how to align text horizontally.
@@ -360,17 +360,17 @@ class TextDecoration {
const TextDecoration._(this._mask);
/// Creates a decoration that paints the union of all the given decorations.
factory TextDecoration.combine(List<TextDecoration> decorations) {
factory TextDecoration.combine(List<TextDecoration/*!*/>/*!*/ decorations) {
int mask = 0;
for (TextDecoration decoration in decorations)
mask |= decoration._mask;
return TextDecoration._(mask);
}
final int _mask;
final int/*!*/ _mask;
/// Whether this decoration will paint at least as much decoration as the given decoration.
bool contains(TextDecoration other) {
bool/*!*/ contains(TextDecoration/*!*/ other) {
return (_mask | other._mask) == _mask;
}
@@ -387,16 +387,16 @@ class TextDecoration {
static const TextDecoration lineThrough = TextDecoration._(0x4);
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
return other is TextDecoration
&& other._mask == _mask;
}
@override
int get hashCode => _mask.hashCode;
int/*!*/ get hashCode => _mask.hashCode;
@override
String toString() {
String/*!*/ toString() {
if (_mask == 0)
return 'TextDecoration.none';
final List<String> values = <String>[];
@@ -459,8 +459,9 @@ class TextHeightBehavior {
/// Creates a new TextHeightBehavior object from an encoded form.
///
/// See [encode] for the creation of the encoded form.
const TextHeightBehavior.fromEncoded(int encoded) : applyHeightToFirstAscent = (encoded & 0x1) == 0,
applyHeightToLastDescent = (encoded & 0x2) == 0;
const TextHeightBehavior.fromEncoded(int/*!*/ encoded)
: applyHeightToFirstAscent = (encoded & 0x1) == 0,
applyHeightToLastDescent = (encoded & 0x2) == 0;
/// Whether to apply the [TextStyle.height] modifier to the ascent of the first
@@ -473,7 +474,7 @@ class TextHeightBehavior {
/// This property only has effect if a non-null [TextStyle.height] is specified.
///
/// Defaults to true (height modifications applied as normal).
final bool applyHeightToFirstAscent;
final bool/*!*/ applyHeightToFirstAscent;
/// Whether to apply the [TextStyle.height] modifier to the descent of the last
/// line in the paragraph.
@@ -485,15 +486,15 @@ class TextHeightBehavior {
/// This property only has effect if a non-null [TextStyle.height] is specified.
///
/// Defaults to true (height modifications applied as normal).
final bool applyHeightToLastDescent;
final bool/*!*/ applyHeightToLastDescent;
/// Returns an encoded int representation of this object.
int encode() {
int/*!*/ encode() {
return (applyHeightToFirstAscent ? 0 : 1 << 0) | (applyHeightToLastDescent ? 0 : 1 << 1);
}
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (other.runtimeType != runtimeType)
return false;
return other is TextHeightBehavior
@@ -502,7 +503,7 @@ class TextHeightBehavior {
}
@override
int get hashCode {
int/*!*/ get hashCode {
return hashValues(
applyHeightToFirstAscent,
applyHeightToLastDescent,
@@ -510,7 +511,7 @@ class TextHeightBehavior {
}
@override
String toString() {
String/*!*/ toString() {
return 'TextHeightBehavior('
'applyHeightToFirstAscent: $applyHeightToFirstAscent, '
'applyHeightToLastDescent: $applyHeightToLastDescent'
@@ -523,7 +524,7 @@ class TextHeightBehavior {
/// Returns true if the lists are both null, or if they are both non-null, have
/// the same length, and contain the same elements in the same order. Returns
/// false otherwise.
bool _listEquals<T>(List<T> a, List<T> b) {
bool/*!*/ _listEquals<T>(List<T>/*?*/ a, List<T>/*?*/ b) {
if (a == null)
return b == null;
if (b == null || a.length != b.length)
@@ -570,7 +571,7 @@ Int32List _encodeTextStyle(
FontStyle fontStyle,
TextBaseline textBaseline,
String fontFamily,
List<String> fontFamilyFallback,
List<String/*!*/> fontFamilyFallback,
double fontSize,
double letterSpacing,
double wordSpacing,
@@ -578,8 +579,8 @@ Int32List _encodeTextStyle(
Locale locale,
Paint background,
Paint foreground,
List<Shadow> shadows,
List<FontFeature> fontFeatures,
List<Shadow/*!*/> shadows,
List<FontFeature/*!*/> fontFeatures,
) {
final Int32List result = Int32List(8);
if (color != null) {
@@ -692,25 +693,25 @@ class TextStyle {
/// * `foreground`: The paint used to draw the text. If this is specified, `color` must be null.
/// * `fontFeatures`: The font features that should be applied to the text.
TextStyle({
Color color,
TextDecoration decoration,
Color decorationColor,
TextDecorationStyle decorationStyle,
double decorationThickness,
FontWeight fontWeight,
FontStyle fontStyle,
TextBaseline textBaseline,
String fontFamily,
List<String> fontFamilyFallback,
double fontSize,
double letterSpacing,
double wordSpacing,
double height,
Locale locale,
Paint background,
Paint foreground,
List<Shadow> shadows,
List<FontFeature> fontFeatures,
Color/*?*/ color,
TextDecoration/*?*/ decoration,
Color/*?*/ decorationColor,
TextDecorationStyle/*?*/ decorationStyle,
double/*?*/ decorationThickness,
FontWeight/*?*/ fontWeight,
FontStyle/*?*/ fontStyle,
TextBaseline/*?*/ textBaseline,
String/*?*/ fontFamily,
List<String/*!*/>/*?*/ fontFamilyFallback,
double/*?*/ fontSize,
double/*?*/ letterSpacing,
double/*?*/ wordSpacing,
double/*?*/ height,
Locale/*?*/ locale,
Paint/*?*/ background,
Paint/*?*/ foreground,
List<Shadow/*!*/>/*?*/ shadows,
List<FontFeature/*!*/>/*?*/ fontFeatures,
}) : assert(color == null || foreground == null,
'Cannot provide both a color and a foreground\n'
'The color argument is just a shorthand for "foreground: Paint()..color = color".'
@@ -764,7 +765,7 @@ class TextStyle {
final List<FontFeature> _fontFeatures;
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other))
return true;
return other is TextStyle
@@ -784,10 +785,10 @@ class TextStyle {
}
@override
int get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontFamilyFallback, _fontSize, _letterSpacing, _wordSpacing, _height, _locale, _background, _foreground, hashList(_shadows), _decorationThickness, hashList(_fontFeatures));
int/*!*/ get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontFamilyFallback, _fontSize, _letterSpacing, _wordSpacing, _height, _locale, _background, _foreground, hashList(_shadows), _decorationThickness, hashList(_fontFeatures));
@override
String toString() {
String/*!*/ toString() {
return 'TextStyle('
'color: ${ _encoded[0] & 0x00002 == 0x00002 ? Color(_encoded[1]) : "unspecified"}, '
'decoration: ${ _encoded[0] & 0x00004 == 0x00004 ? TextDecoration._(_encoded[2]) : "unspecified"}, '
@@ -962,18 +963,18 @@ class ParagraphStyle {
///
/// * `locale`: The locale used to select region-specific glyphs.
ParagraphStyle({
TextAlign textAlign,
TextDirection textDirection,
int maxLines,
String fontFamily,
double fontSize,
double height,
TextHeightBehavior textHeightBehavior,
FontWeight fontWeight,
FontStyle fontStyle,
StrutStyle strutStyle,
String ellipsis,
Locale locale,
TextAlign/*?*/ textAlign,
TextDirection/*?*/ textDirection,
int/*?*/ maxLines,
String/*?*/ fontFamily,
double/*?*/ fontSize,
double/*?*/ height,
TextHeightBehavior/*?*/ textHeightBehavior,
FontWeight/*?*/ fontWeight,
FontStyle/*?*/ fontStyle,
StrutStyle/*?*/ strutStyle,
String/*?*/ ellipsis,
Locale/*?*/ locale,
}) : _encoded = _encodeParagraphStyle(
textAlign,
textDirection,
@@ -1004,7 +1005,7 @@ class ParagraphStyle {
final Locale _locale;
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -1020,10 +1021,10 @@ class ParagraphStyle {
}
@override
int get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontSize, _height, _ellipsis, _locale);
int/*!*/ get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontSize, _height, _ellipsis, _locale);
@override
String toString() {
String/*!*/ toString() {
return 'ParagraphStyle('
'textAlign: ${ _encoded[0] & 0x002 == 0x002 ? TextAlign.values[_encoded[1]] : "unspecified"}, '
'textDirection: ${ _encoded[0] & 0x004 == 0x004 ? TextDirection.values[_encoded[2]] : "unspecified"}, '
@@ -1156,14 +1157,14 @@ class StrutStyle {
/// of the `fontFamily` and `(height + leading) * fontSize`. Otherwise, it
/// will be determined by the Ascent + half-leading of the first text.
StrutStyle({
String fontFamily,
List<String> fontFamilyFallback,
double fontSize,
double height,
double leading,
FontWeight fontWeight,
FontStyle fontStyle,
bool forceStrutHeight,
String/*?*/ fontFamily,
List<String/*!*/>/*?*/ fontFamilyFallback,
double/*?*/ fontSize,
double/*?*/ height,
double/*?*/ leading,
FontWeight/*?*/ fontWeight,
FontStyle/*?*/ fontStyle,
bool/*?*/ forceStrutHeight,
}) : _encoded = _encodeStrut(
fontFamily,
fontFamilyFallback,
@@ -1183,7 +1184,7 @@ class StrutStyle {
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -1195,7 +1196,7 @@ class StrutStyle {
}
@override
int get hashCode => hashValues(hashList(_encoded.buffer.asInt8List()), _fontFamily);
int/*!*/ get hashCode => hashValues(hashList(_encoded.buffer.asInt8List()), _fontFamily);
}
@@ -1309,31 +1310,31 @@ class TextBox {
/// The left edge of the text box, irrespective of direction.
///
/// To get the leading edge (which may depend on the [direction]), consider [start].
final double left;
final double/*!*/ left;
/// The top edge of the text box.
final double top;
final double/*!*/ top;
/// The right edge of the text box, irrespective of direction.
///
/// To get the trailing edge (which may depend on the [direction]), consider [end].
final double right;
final double/*!*/ right;
/// The bottom edge of the text box.
final double bottom;
final double/*!*/ bottom;
/// The direction in which text inside this box flows.
final TextDirection direction;
final TextDirection/*!*/ direction;
/// Returns a rect of the same size as this box.
Rect toRect() => Rect.fromLTRB(left, top, right, bottom);
Rect/*!*/ toRect() => Rect.fromLTRB(left, top, right, bottom);
/// The [left] edge of the box for left-to-right text; the [right] edge of the box for right-to-left text.
///
/// See also:
///
/// * [direction], which specifies the text direction.
double get start {
double/*!*/ get start {
return (direction == TextDirection.ltr) ? left : right;
}
@@ -1342,12 +1343,12 @@ class TextBox {
/// See also:
///
/// * [direction], which specifies the text direction.
double get end {
double/*!*/ get end {
return (direction == TextDirection.ltr) ? right : left;
}
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other))
return true;
if (other.runtimeType != runtimeType)
@@ -1361,10 +1362,10 @@ class TextBox {
}
@override
int get hashCode => hashValues(left, top, right, bottom, direction);
int/*!*/ get hashCode => hashValues(left, top, right, bottom, direction);
@override
String toString() => 'TextBox.fromLTRBD(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)}, $direction)';
String/*!*/ toString() => 'TextBox.fromLTRBD(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)}, $direction)';
}
/// A way to disambiguate a [TextPosition] when its offset could match two
@@ -1447,7 +1448,7 @@ class TextPosition {
/// For example, given the string `'Hello'`, offset 0 represents the cursor
/// being before the `H`, while offset 5 represents the cursor being just
/// after the `o`.
final int offset;
final int/*!*/ offset;
/// Disambiguates cases where the position in the string given by [offset]
/// could represent two different visual positions in the rendered text. For
@@ -1456,10 +1457,10 @@ class TextPosition {
///
/// See the documentation for [TextAffinity] for more information on how
/// TextAffinity disambiguates situations like these.
final TextAffinity affinity;
final TextAffinity/*!*/ affinity;
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (other.runtimeType != runtimeType)
return false;
return other is TextPosition
@@ -1468,10 +1469,10 @@ class TextPosition {
}
@override
int get hashCode => hashValues(offset, affinity);
int/*!*/ get hashCode => hashValues(offset, affinity);
@override
String toString() {
String/*!*/ toString() {
return 'TextPosition(offset: $offset, affinity: $affinity)';
}
}
@@ -1508,42 +1509,42 @@ class TextRange {
/// The index of the first character in the range.
///
/// If [start] and [end] are both -1, the text range is empty.
final int start;
final int/*!*/ start;
/// The next index after the characters in this range.
///
/// If [start] and [end] are both -1, the text range is empty.
final int end;
final int/*!*/ end;
/// Whether this range represents a valid position in the text.
bool get isValid => start >= 0 && end >= 0;
bool/*!*/ get isValid => start >= 0 && end >= 0;
/// Whether this range is empty (but still potentially placed inside the text).
bool get isCollapsed => start == end;
bool/*!*/ get isCollapsed => start == end;
/// Whether the start of this range precedes the end.
bool get isNormalized => end >= start;
bool/*!*/ get isNormalized => end >= start;
/// The text before this range.
String textBefore(String text) {
String/*!*/ textBefore(String/*!*/ text) {
assert(isNormalized);
return text.substring(0, start);
}
/// The text after this range.
String textAfter(String text) {
String/*!*/ textAfter(String/*!*/ text) {
assert(isNormalized);
return text.substring(end);
}
/// The text inside this range.
String textInside(String text) {
String/*!*/ textInside(String/*!*/ text) {
assert(isNormalized);
return text.substring(start, end);
}
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other))
return true;
return other is TextRange
@@ -1552,13 +1553,13 @@ class TextRange {
}
@override
int get hashCode => hashValues(
int/*!*/ get hashCode => hashValues(
start.hashCode,
end.hashCode,
);
@override
String toString() => 'TextRange(start: $start, end: $end)';
String/*!*/ toString() => 'TextRange(start: $start, end: $end)';
}
/// Layout constraints for [Paragraph] objects.
@@ -1592,10 +1593,10 @@ class ParagraphConstraints {
/// This width is also used to position glyphs according to the [TextAlign]
/// alignment described in the [ParagraphStyle] used when building the
/// [Paragraph] with a [ParagraphBuilder].
final double width;
final double/*!*/ width;
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (other.runtimeType != runtimeType)
return false;
return other is ParagraphConstraints
@@ -1603,10 +1604,10 @@ class ParagraphConstraints {
}
@override
int get hashCode => width.hashCode;
int/*!*/ get hashCode => width.hashCode;
@override
String toString() => 'ParagraphConstraints(width: $width)';
String/*!*/ toString() => 'ParagraphConstraints(width: $width)';
}
/// Defines various ways to vertically bound the boxes returned by
@@ -1756,7 +1757,7 @@ class LineMetrics {
/// True if this line ends with an explicit line break (e.g. '\n') or is the end
/// of the paragraph. False otherwise.
final bool hardBreak;
final bool/*!*/ hardBreak;
/// The rise from the [baseline] as calculated from the font and style for this line.
///
@@ -1767,7 +1768,7 @@ class LineMetrics {
/// in fonts as negative. This is to ensure the signage of operations with these
/// metrics directly reflects the intended signage of the value. For example,
/// the y coordinate of the top edge of the line is `baseline - ascent`.
final double ascent;
final double/*!*/ ascent;
/// The drop from the [baseline] as calculated from the font and style for this line.
///
@@ -1775,7 +1776,7 @@ class LineMetrics {
/// as well as outlying runs that are very tall.
///
/// The y coordinate of the bottom edge of the line is `baseline + descent`.
final double descent;
final double/*!*/ descent;
/// The rise from the [baseline] as calculated from the font and style for this line
/// ignoring the [TextStyle.height].
@@ -1783,14 +1784,14 @@ class LineMetrics {
/// The [unscaledAscent] is provided as a positive value, even though it is typically
/// defined in fonts as negative. This is to ensure the signage of operations with
/// these metrics directly reflects the intended signage of the value.
final double unscaledAscent;
final double/*!*/ unscaledAscent;
/// Total height of the line from the top edge to the bottom edge.
///
/// This is equivalent to `round(ascent + descent)`. This value is provided
/// separately due to rounding causing sub-pixel differences from the unrounded
/// values.
final double height;
final double/*!*/ height;
/// Width of the line from the left edge of the leftmost glyph to the right
/// edge of the rightmost glyph.
@@ -1801,27 +1802,27 @@ class LineMetrics {
///
/// * [Paragraph.width], the max width passed in during layout.
/// * [Paragraph.longestLine], the width of the longest line in the paragraph.
final double width;
final double/*!*/ width;
/// The x coordinate of left edge of the line.
///
/// The right edge can be obtained with `left + width`.
final double left;
final double/*!*/ left;
/// The y coordinate of the baseline for this line from the top of the paragraph.
///
/// The bottom edge of the paragraph up to and including this line may be obtained
/// through `baseline + descent`.
final double baseline;
final double/*!*/ baseline;
/// The number of this line in the overall paragraph, with the first line being
/// index zero.
///
/// For example, the first line is line 0, second line is line 1.
final int lineNumber;
final int/*!*/ lineNumber;
@override
bool operator ==(Object other) {
bool/*!*/ operator ==(Object other) {
if (other.runtimeType != runtimeType) {
return false;
}
@@ -1838,10 +1839,10 @@ class LineMetrics {
}
@override
int get hashCode => hashValues(hardBreak, ascent, descent, unscaledAscent, height, width, left, baseline, lineNumber);
int/*!*/ get hashCode => hashValues(hardBreak, ascent, descent, unscaledAscent, height, width, left, baseline, lineNumber);
@override
String toString() {
String/*!*/ toString() {
return 'LineMetrics(hardBreak: $hardBreak, '
'ascent: $ascent, '
'descent: $descent, '
@@ -1875,38 +1876,38 @@ class Paragraph extends NativeFieldWrapperClass2 {
/// The amount of horizontal space this paragraph occupies.
///
/// Valid only after [layout] has been called.
double get width native 'Paragraph_width';
double/*!*/ get width native 'Paragraph_width';
/// The amount of vertical space this paragraph occupies.
///
/// Valid only after [layout] has been called.
double get height native 'Paragraph_height';
double/*!*/ get height native 'Paragraph_height';
/// The distance from the left edge of the leftmost glyph to the right edge of
/// the rightmost glyph in the paragraph.
///
/// Valid only after [layout] has been called.
double get longestLine native 'Paragraph_longestLine';
double/*!*/ get longestLine native 'Paragraph_longestLine';
/// The minimum width that this paragraph could be without failing to paint
/// its contents within itself.
///
/// Valid only after [layout] has been called.
double get minIntrinsicWidth native 'Paragraph_minIntrinsicWidth';
double/*!*/ get minIntrinsicWidth native 'Paragraph_minIntrinsicWidth';
/// Returns the smallest width beyond which increasing the width never
/// decreases the height.
///
/// Valid only after [layout] has been called.
double get maxIntrinsicWidth native 'Paragraph_maxIntrinsicWidth';
double/*!*/ get maxIntrinsicWidth native 'Paragraph_maxIntrinsicWidth';
/// The distance from the top of the paragraph to the alphabetic
/// baseline of the first line, in logical pixels.
double get alphabeticBaseline native 'Paragraph_alphabeticBaseline';
double/*!*/ get alphabeticBaseline native 'Paragraph_alphabeticBaseline';
/// The distance from the top of the paragraph to the ideographic
/// baseline of the first line, in logical pixels.
double get ideographicBaseline native 'Paragraph_ideographicBaseline';
double/*!*/ get ideographicBaseline native 'Paragraph_ideographicBaseline';
/// True if there is more vertical content, but the text was truncated, either
/// because we reached `maxLines` lines of text or because the `maxLines` was
@@ -1915,12 +1916,12 @@ class Paragraph extends NativeFieldWrapperClass2 {
///
/// See the discussion of the `maxLines` and `ellipsis` arguments at
/// [new ParagraphStyle].
bool get didExceedMaxLines native 'Paragraph_didExceedMaxLines';
bool/*!*/ get didExceedMaxLines native 'Paragraph_didExceedMaxLines';
/// Computes the size and position of each glyph in the paragraph.
///
/// The [ParagraphConstraints] control how wide the text is allowed to be.
void layout(ParagraphConstraints constraints) => _layout(constraints.width);
void layout(ParagraphConstraints/*!*/ constraints) => _layout(constraints.width);
void _layout(double width) native 'Paragraph_layout';
List<TextBox> _decodeTextBoxes(Float32List encoded) {
@@ -1951,7 +1952,7 @@ class Paragraph extends NativeFieldWrapperClass2 {
/// The [boxHeightStyle] and [boxWidthStyle] parameters must not be null.
///
/// See [BoxHeightStyle] and [BoxWidthStyle] for full descriptions of each option.
List<TextBox> getBoxesForRange(int start, int end, {BoxHeightStyle boxHeightStyle = BoxHeightStyle.tight, BoxWidthStyle boxWidthStyle = BoxWidthStyle.tight}) {
List<TextBox/*!*/>/*!*/ getBoxesForRange(int/*!*/ start, int/*!*/ end, {BoxHeightStyle/*!*/ boxHeightStyle = BoxHeightStyle.tight, BoxWidthStyle/*!*/ boxWidthStyle = BoxWidthStyle.tight}) {
assert(boxHeightStyle != null);
assert(boxWidthStyle != null);
return _decodeTextBoxes(_getBoxesForRange(start, end, boxHeightStyle.index, boxWidthStyle.index));
@@ -1965,13 +1966,13 @@ class Paragraph extends NativeFieldWrapperClass2 {
///
/// Coordinates of the [TextBox] are relative to the upper-left corner of the paragraph,
/// where positive y values indicate down.
List<TextBox> getBoxesForPlaceholders() {
List<TextBox/*!*/>/*!*/ getBoxesForPlaceholders() {
return _decodeTextBoxes(_getBoxesForPlaceholders());
}
Float32List _getBoxesForPlaceholders() native 'Paragraph_getRectsForPlaceholders';
/// Returns the text position closest to the given offset.
TextPosition getPositionForOffset(Offset offset) {
TextPosition/*!*/ getPositionForOffset(Offset/*!*/ offset) {
final List<int> encoded = _getPositionForOffset(offset.dx, offset.dy);
return TextPosition(offset: encoded[0], affinity: TextAffinity.values[encoded[1]]);
}
@@ -1983,7 +1984,7 @@ class Paragraph extends NativeFieldWrapperClass2 {
/// have word breaks on both sides. In such cases, this method will return
/// [offset, offset+1]. Word boundaries are defined more precisely in Unicode
/// Standard Annex #29 http://www.unicode.org/reports/tr29/#Word_Boundaries
TextRange getWordBoundary(TextPosition position) {
TextRange/*!*/ getWordBoundary(TextPosition/*!*/ position) {
final List<int> boundary = _getWordBoundary(position.offset);
return TextRange(start: boundary[0], end: boundary[1]);
}
@@ -1997,11 +1998,11 @@ class Paragraph extends NativeFieldWrapperClass2 {
///
/// This can potentially be expensive, since it needs to compute the line
/// metrics, so use it sparingly.
TextRange getLineBoundary(TextPosition position) {
TextRange/*!*/ getLineBoundary(TextPosition/*!*/ position) {
final List<int> boundary = _getLineBoundary(position.offset);
return TextRange(start: boundary[0], end: boundary[1]);
}
List<int> _getLineBoundary(int offset) native 'Paragraph_getLineBoundary';
List<int/*!*/>/*!*/ _getLineBoundary(int/*!*/ offset) native 'Paragraph_getLineBoundary';
// Redirecting the paint function in this way solves some dependency problems
// in the C++ code. If we straighten out the C++ dependencies, we can remove
@@ -2015,7 +2016,7 @@ class Paragraph extends NativeFieldWrapperClass2 {
///
/// This can potentially return a large amount of data, so it is not recommended
/// to repeatedly call this. Instead, cache the results.
List<LineMetrics> computeLineMetrics() {
List<LineMetrics/*!*/>/*!*/ computeLineMetrics() {
final Float64List encoded = _computeLineMetrics();
final int count = encoded.length ~/ 9;
int position = 0;
@@ -2057,8 +2058,7 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
/// Creates a new [ParagraphBuilder] object, which is used to create a
/// [Paragraph].
@pragma('vm:entry-point')
ParagraphBuilder(ParagraphStyle style) {
_placeholderCount = 0;
ParagraphBuilder(ParagraphStyle/*!*/ style) {
List<String> strutFontFamilies;
if (style._strutStyle != null) {
strutFontFamilies = <String>[];
@@ -2091,17 +2091,17 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
) native 'ParagraphBuilder_constructor';
/// The number of placeholders currently in the paragraph.
int get placeholderCount => _placeholderCount;
int _placeholderCount;
int/*!*/ get placeholderCount => _placeholderCount;
int/*!*/ _placeholderCount = 0;
/// The scales of the placeholders in the paragraph.
List<double> get placeholderScales => _placeholderScales;
List<double> _placeholderScales = <double>[];
List<double/*!*/>/*!*/ get placeholderScales => _placeholderScales;
List<double/*!*/>/*!*/ _placeholderScales = <double>[];
/// Applies the given style to the added text until [pop] is called.
///
/// See [pop] for details.
void pushStyle(TextStyle style) {
void pushStyle(TextStyle/*!*/ style) {
final List<String> fullFontFamilies = <String>[];
if (style._fontFamily != null)
fullFontFamilies.add(style._fontFamily);
@@ -2166,12 +2166,12 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
/// Adds the given text to the paragraph.
///
/// The text will be styled according to the current stack of text styles.
void addText(String text) {
void addText(String/*!*/ text) {
final String error = _addText(text);
if (error != null)
throw ArgumentError(error);
}
String _addText(String text) native 'ParagraphBuilder_addText';
String/*?*/ _addText(String text) native 'ParagraphBuilder_addText';
/// Adds an inline placeholder space to the paragraph.
///
@@ -2220,10 +2220,10 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
/// The `scale` parameter will scale the `width` and `height` by the specified amount,
/// and keep track of the scale. The scales of placeholders added can be accessed
/// through [placeholderScales]. This is primarily used for acessibility scaling.
void addPlaceholder(double width, double height, PlaceholderAlignment alignment, {
double scale = 1.0,
double baselineOffset,
TextBaseline baseline,
void addPlaceholder(double/*!*/ width, double/*!*/ height, PlaceholderAlignment/*!*/ alignment, {
double/*!*/ scale = 1.0,
double/*?*/ baselineOffset,
TextBaseline/*?*/ baseline,
}) {
// Require a baseline to be specified if using a baseline-based alignment.
assert((alignment == PlaceholderAlignment.aboveBaseline ||
@@ -2243,7 +2243,7 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
///
/// After calling this function, the paragraph builder object is invalid and
/// cannot be used further.
Paragraph build() {
Paragraph/*!*/ build() {
final Paragraph paragraph = Paragraph._();
_build(paragraph);
return paragraph;
@@ -2256,7 +2256,7 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 {
/// * `list`: A list of bytes containing the font file.
/// * `fontFamily`: The family name used to identify the font in text styles.
/// If this is not provided, then the family name will be extracted from the font file.
Future<void> loadFontFromList(Uint8List list, {String fontFamily}) {
Future<void>/*!*/ loadFontFromList(Uint8List/*!*/ list, {String/*?*/ fontFamily}) {
return _futurize(
(_Callback<void> callback) => _loadFontFromList(list, callback, fontFamily)
).then((_) => _sendFontChangeMessage());

View File

@@ -464,7 +464,7 @@ class SkParagraphBuilder implements ui.ParagraphBuilder {
double width,
double height,
ui.PlaceholderAlignment alignment, {
double scale,
double scale = 1.0,
double baselineOffset,
ui.TextBaseline baseline,
}) {

View File

@@ -1034,7 +1034,7 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
double width,
double height,
ui.PlaceholderAlignment alignment, {
double scale,
double scale = 1.0,
double baselineOffset,
ui.TextBaseline baseline,
}) {

View File

@@ -63,7 +63,7 @@ class FontWeight {
const FontWeight._(this.index);
/// The encoded integer value of this font weight.
final int index;
final int/*!*/ index;
/// Thin, the least thick
static const FontWeight w100 = FontWeight._(0);
@@ -99,7 +99,7 @@ class FontWeight {
static const FontWeight bold = w700;
/// A list of all the font weights.
static const List<FontWeight> values = <FontWeight>[
static const List<FontWeight/*!*/> values = <FontWeight/*!*/>[
w100,
w200,
w300,
@@ -131,16 +131,15 @@ class FontWeight {
///
/// Values for `t` are usually obtained from an [Animation<double>], such as
/// an [AnimationController].
static FontWeight lerp(FontWeight a, FontWeight b, double t) {
static FontWeight/*?*/ lerp(FontWeight/*?*/ a, FontWeight/*?*/ b, double/*!*/ t) {
assert(t != null);
return values[
lerpDouble(a?.index ?? normal.index, b?.index ?? normal.index, t)
.round()
.clamp(0, 8)];
if (a == null && b == null)
return null;
return values[lerpDouble(a?.index ?? normal.index, b?.index ?? normal.index, t).round().clamp(0, 8) as int];
}
@override
String toString() {
String/*!*/ toString() {
return const <int, String>{
0: 'FontWeight.w100',
1: 'FontWeight.w200',
@@ -201,7 +200,7 @@ class FontFeature {
/// See also:
///
/// * <https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#ssxx>
factory FontFeature.stylisticSet(int value) {
factory FontFeature.stylisticSet(int/*!*/ value) {
assert(value >= 1);
assert(value <= 20);
return FontFeature('ss${value.toString().padLeft(2, "0")}');
@@ -272,16 +271,16 @@ class FontFeature {
/// ASCII characters (typically lowercase letters).
///
/// See <https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags>
final String feature;
final String/*!*/ feature;
/// The value assigned to this feature.
///
/// Must be a positive integer. Many features are Boolean values that accept
/// values of either 0 (feature is disabled) or 1 (feature is enabled).
final int value;
final int/*!*/ value;
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other)) {
return true;
}
@@ -293,10 +292,10 @@ class FontFeature {
}
@override
int get hashCode => hashValues(feature, value);
int/*!*/ get hashCode => hashValues(feature, value);
@override
String toString() => 'FontFeature($feature, $value)';
String/*!*/ toString() => 'FontFeature($feature, $value)';
}
/// Whether and how to align text horizontally.
@@ -346,7 +345,7 @@ class TextDecoration {
const TextDecoration._(this._mask);
/// Creates a decoration that paints the union of all the given decorations.
factory TextDecoration.combine(List<TextDecoration> decorations) {
factory TextDecoration.combine(List<TextDecoration/*!*/>/*!*/ decorations) {
int mask = 0;
for (TextDecoration decoration in decorations) {
mask |= decoration._mask;
@@ -354,10 +353,10 @@ class TextDecoration {
return TextDecoration._(mask);
}
final int _mask;
final int/*!*/ _mask;
/// Whether this decoration will paint at least as much decoration as the given decoration.
bool contains(TextDecoration other) {
bool/*!*/ contains(TextDecoration/*!*/ other) {
return (_mask | other._mask) == _mask;
}
@@ -374,7 +373,7 @@ class TextDecoration {
static const TextDecoration lineThrough = TextDecoration._(0x4);
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (other is! TextDecoration) {
return false;
}
@@ -383,10 +382,10 @@ class TextDecoration {
}
@override
int get hashCode => _mask.hashCode;
int/*!*/ get hashCode => _mask.hashCode;
@override
String toString() {
String/*!*/ toString() {
if (_mask == 0) {
return 'TextDecoration.none';
}
@@ -452,8 +451,9 @@ class TextHeightBehavior {
/// Creates a new TextHeightBehavior object from an encoded form.
///
/// See [encode] for the creation of the encoded form.
const TextHeightBehavior.fromEncoded(int encoded) : applyHeightToFirstAscent = (encoded & 0x1) == 0,
applyHeightToLastDescent = (encoded & 0x2) == 0;
const TextHeightBehavior.fromEncoded(int/*!*/ encoded)
: applyHeightToFirstAscent = (encoded & 0x1) == 0,
applyHeightToLastDescent = (encoded & 0x2) == 0;
/// Whether to apply the [TextStyle.height] modifier to the ascent of the first
@@ -466,7 +466,7 @@ class TextHeightBehavior {
/// This property only has effect if a non-null [TextStyle.height] is specified.
///
/// Defaults to true (height modifications applied as normal).
final bool applyHeightToFirstAscent;
final bool/*!*/ applyHeightToFirstAscent;
/// Whether to apply the [TextStyle.height] modifier to the descent of the last
/// line in the paragraph.
@@ -478,15 +478,15 @@ class TextHeightBehavior {
/// This property only has effect if a non-null [TextStyle.height] is specified.
///
/// Defaults to true (height modifications applied as normal).
final bool applyHeightToLastDescent;
final bool/*!*/ applyHeightToLastDescent;
/// Returns an encoded int representation of this object.
int encode() {
int/*!*/ encode() {
return (applyHeightToFirstAscent ? 0 : 1 << 0) | (applyHeightToLastDescent ? 0 : 1 << 1);
}
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (other.runtimeType != runtimeType)
return false;
return other is TextHeightBehavior
@@ -495,7 +495,7 @@ class TextHeightBehavior {
}
@override
int get hashCode {
int/*!*/ get hashCode {
return hashValues(
applyHeightToFirstAscent,
applyHeightToLastDescent,
@@ -503,7 +503,7 @@ class TextHeightBehavior {
}
@override
String toString() {
String/*!*/ toString() {
return 'TextHeightBehavior('
'applyHeightToFirstAscent: $applyHeightToFirstAscent, '
'applyHeightToLastDescent: $applyHeightToLastDescent'
@@ -539,25 +539,25 @@ abstract class TextStyle {
/// * `background`: The paint drawn as a background for the text.
/// * `foreground`: The paint used to draw the text. If this is specified, `color` must be null.
factory TextStyle({
Color color,
TextDecoration decoration,
Color decorationColor,
TextDecorationStyle decorationStyle,
double decorationThickness,
FontWeight fontWeight,
FontStyle fontStyle,
TextBaseline textBaseline,
String fontFamily,
List<String> fontFamilyFallback,
double fontSize,
double letterSpacing,
double wordSpacing,
double height,
Locale locale,
Paint background,
Paint foreground,
List<Shadow> shadows,
List<FontFeature> fontFeatures,
Color/*?*/ color,
TextDecoration/*?*/ decoration,
Color/*?*/ decorationColor,
TextDecorationStyle/*?*/ decorationStyle,
double/*?*/ decorationThickness,
FontWeight/*?*/ fontWeight,
FontStyle/*?*/ fontStyle,
TextBaseline/*?*/ textBaseline,
String/*?*/ fontFamily,
List<String/*!*/>/*?*/ fontFamilyFallback,
double/*?*/ fontSize,
double/*?*/ letterSpacing,
double/*?*/ wordSpacing,
double/*?*/ height,
Locale/*?*/ locale,
Paint/*?*/ background,
Paint/*?*/ foreground,
List<Shadow/*!*/>/*?*/ shadows,
List<FontFeature/*!*/>/*?*/ fontFeatures,
}) {
if (engine.experimentalUseSkia) {
return engine.SkTextStyle(
@@ -665,18 +665,18 @@ abstract class ParagraphStyle {
///
/// * `locale`: The locale used to select region-specific glyphs.
factory ParagraphStyle({
TextAlign textAlign,
TextDirection textDirection,
int maxLines,
String fontFamily,
double fontSize,
double height,
TextHeightBehavior textHeightBehavior,
FontWeight fontWeight,
FontStyle fontStyle,
StrutStyle strutStyle,
String ellipsis,
Locale locale,
TextAlign/*?*/ textAlign,
TextDirection/*?*/ textDirection,
int/*?*/ maxLines,
String/*?*/ fontFamily,
double/*?*/ fontSize,
double/*?*/ height,
TextHeightBehavior/*?*/ textHeightBehavior,
FontWeight/*?*/ fontWeight,
FontStyle/*?*/ fontStyle,
StrutStyle/*?*/ strutStyle,
String/*?*/ ellipsis,
Locale/*?*/ locale,
}) {
if (engine.experimentalUseSkia) {
return engine.SkParagraphStyle(
@@ -749,14 +749,14 @@ abstract class StrutStyle {
/// of the [fontFamily] and `(lineHeight + leading) * fontSize`. Otherwise, it
/// will be determined by the Ascent + half-leading of the first text.
factory StrutStyle({
String fontFamily,
List<String> fontFamilyFallback,
double fontSize,
double height,
double leading,
FontWeight fontWeight,
FontStyle fontStyle,
bool forceStrutHeight,
String/*?*/ fontFamily,
List<String/*!*/>/*?*/ fontFamilyFallback,
double/*?*/ fontSize,
double/*?*/ height,
double/*?*/ leading,
FontWeight/*?*/ fontWeight,
FontStyle/*?*/ fontStyle,
bool/*?*/ forceStrutHeight,
}) = engine.EngineStrutStyle;
}
@@ -869,31 +869,31 @@ class TextBox {
/// The left edge of the text box, irrespective of direction.
///
/// To get the leading edge (which may depend on the [direction]), consider [start].
final double left;
final double/*!*/ left;
/// The top edge of the text box.
final double top;
final double/*!*/ top;
/// The right edge of the text box, irrespective of direction.
///
/// To get the trailing edge (which may depend on the [direction]), consider [end].
final double right;
final double/*!*/ right;
/// The bottom edge of the text box.
final double bottom;
final double/*!*/ bottom;
/// The direction in which text inside this box flows.
final TextDirection direction;
final TextDirection/*!*/ direction;
/// Returns a rect of the same size as this box.
Rect toRect() => Rect.fromLTRB(left, top, right, bottom);
Rect/*!*/ toRect() => Rect.fromLTRB(left, top, right, bottom);
/// The [left] edge of the box for left-to-right text; the [right] edge of the box for right-to-left text.
///
/// See also:
///
/// * [direction], which specifies the text direction.
double get start {
double/*!*/ get start {
return (direction == TextDirection.ltr) ? left : right;
}
@@ -902,12 +902,12 @@ class TextBox {
/// See also:
///
/// * [direction], which specifies the text direction.
double get end {
double/*!*/ get end {
return (direction == TextDirection.ltr) ? right : left;
}
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other)) {
return true;
}
@@ -923,10 +923,10 @@ class TextBox {
}
@override
int get hashCode => hashValues(left, top, right, bottom, direction);
int/*!*/ get hashCode => hashValues(left, top, right, bottom, direction);
@override
String toString() {
String/*!*/ toString() {
return 'TextBox.fromLTRBD(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)}, $direction)';
}
}
@@ -1011,7 +1011,7 @@ class TextPosition {
/// For example, given the string `'Hello'`, offset 0 represents the cursor
/// being before the `H`, while offset 5 represents the cursor being just
/// after the `o`.
final int offset;
final int/*!*/ offset;
/// Disambiguates cases where the position in the string given by [offset]
/// could represent two different visual positions in the rendered text. For
@@ -1020,10 +1020,10 @@ class TextPosition {
///
/// See the documentation for [TextAffinity] for more information on how
/// TextAffinity disambiguates situations like these.
final TextAffinity affinity;
final TextAffinity/*!*/ affinity;
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (other.runtimeType != runtimeType) {
return false;
}
@@ -1032,10 +1032,10 @@ class TextPosition {
}
@override
int get hashCode => hashValues(offset, affinity);
int/*!*/ get hashCode => hashValues(offset, affinity);
@override
String toString() {
String/*!*/ toString() {
return '$runtimeType(offset: $offset, affinity: $affinity)';
}
}
@@ -1069,42 +1069,42 @@ class TextRange {
/// The index of the first character in the range.
///
/// If [start] and [end] are both -1, the text range is empty.
final int start;
final int/*!*/ start;
/// The next index after the characters in this range.
///
/// If [start] and [end] are both -1, the text range is empty.
final int end;
final int/*!*/ end;
/// Whether this range represents a valid position in the text.
bool get isValid => start >= 0 && end >= 0;
bool/*!*/ get isValid => start >= 0 && end >= 0;
/// Whether this range is empty (but still potentially placed inside the text).
bool get isCollapsed => start == end;
bool/*!*/ get isCollapsed => start == end;
/// Whether the start of this range precedes the end.
bool get isNormalized => end >= start;
bool/*!*/ get isNormalized => end >= start;
/// The text before this range.
String textBefore(String text) {
String/*!*/ textBefore(String/*!*/ text) {
assert(isNormalized);
return text.substring(0, start);
}
/// The text after this range.
String textAfter(String text) {
String/*!*/ textAfter(String/*!*/ text) {
assert(isNormalized);
return text.substring(end);
}
/// The text inside this range.
String textInside(String text) {
String/*!*/ textInside(String/*!*/ text) {
assert(isNormalized);
return text.substring(start, end);
}
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (identical(this, other)) {
return true;
}
@@ -1116,13 +1116,13 @@ class TextRange {
}
@override
int get hashCode => hashValues(
int/*!*/ get hashCode => hashValues(
start.hashCode,
end.hashCode,
);
@override
String toString() => 'TextRange(start: $start, end: $end)';
String/*!*/ toString() => 'TextRange(start: $start, end: $end)';
}
/// Layout constraints for [Paragraph] objects.
@@ -1156,10 +1156,10 @@ class ParagraphConstraints {
/// This width is also used to position glyphs according to the [TextAlign]
/// alignment described in the [ParagraphStyle] used when building the
/// [Paragraph] with a [ParagraphBuilder].
final double width;
final double/*!*/ width;
@override
bool operator ==(dynamic other) {
bool/*!*/ operator ==(dynamic other) {
if (other.runtimeType != runtimeType) {
return false;
}
@@ -1168,10 +1168,10 @@ class ParagraphConstraints {
}
@override
int get hashCode => width.hashCode;
int/*!*/ get hashCode => width.hashCode;
@override
String toString() => '$runtimeType(width: $width)';
String/*!*/ toString() => '$runtimeType(width: $width)';
}
/// Defines various ways to vertically bound the boxes returned by
@@ -1260,7 +1260,7 @@ abstract class LineMetrics {
/// True if this line ends with an explicit line break (e.g. '\n') or is the end
/// of the paragraph. False otherwise.
/// {@endtemplate}
final bool hardBreak;
final bool/*!*/ hardBreak;
/// {@template dart.ui.LineMetrics.ascent}
/// The rise from the [baseline] as calculated from the font and style for this line.
@@ -1273,7 +1273,7 @@ abstract class LineMetrics {
/// metrics directly reflects the intended signage of the value. For example,
/// the y coordinate of the top edge of the line is `baseline - ascent`.
/// {@endtemplate}
final double ascent;
final double/*!*/ ascent;
/// {@template dart.ui.LineMetrics.descent}
/// The drop from the [baseline] as calculated from the font and style for this line.
@@ -1283,7 +1283,7 @@ abstract class LineMetrics {
///
/// The y coordinate of the bottom edge of the line is `baseline + descent`.
/// {@endtemplate}
final double descent;
final double/*!*/ descent;
/// {@template dart.ui.LineMetrics.unscaledAscent}
/// The rise from the [baseline] as calculated from the font and style for this line
@@ -1293,7 +1293,7 @@ abstract class LineMetrics {
/// defined in fonts as negative. This is to ensure the signage of operations with
/// these metrics directly reflects the intended signage of the value.
/// {@endtemplate}
final double unscaledAscent;
final double/*!*/ unscaledAscent;
/// {@template dart.ui.LineMetrics.height}
/// Total height of the line from the top edge to the bottom edge.
@@ -1302,7 +1302,7 @@ abstract class LineMetrics {
/// separately due to rounding causing sub-pixel differences from the unrounded
/// values.
/// {@endtemplate}
final double height;
final double/*!*/ height;
/// {@template dart.ui.LineMetrics.width}
/// Width of the line from the left edge of the leftmost glyph to the right
@@ -1315,14 +1315,14 @@ abstract class LineMetrics {
/// * [Paragraph.width], the max width passed in during layout.
/// * [Paragraph.longestLine], the width of the longest line in the paragraph.
/// {@endtemplate}
final double width;
final double/*!*/ width;
/// {@template dart.ui.LineMetrics.left}
/// The x coordinate of left edge of the line.
///
/// The right edge can be obtained with `left + width`.
/// {@endtemplate}
final double left;
final double/*!*/ left;
/// {@template dart.ui.LineMetrics.baseline}
/// The y coordinate of the baseline for this line from the top of the paragraph.
@@ -1330,7 +1330,7 @@ abstract class LineMetrics {
/// The bottom edge of the paragraph up to and including this line may be obtained
/// through `baseline + descent`.
/// {@endtemplate}
final double baseline;
final double/*!*/ baseline;
/// {@template dart.ui.LineMetrics.lineNumber}
/// The number of this line in the overall paragraph, with the first line being
@@ -1338,7 +1338,7 @@ abstract class LineMetrics {
///
/// For example, the first line is line 0, second line is line 1.
/// {@endtemplate}
final int lineNumber;
final int/*!*/ lineNumber;
}
/// A paragraph of text.
@@ -1354,18 +1354,18 @@ abstract class Paragraph {
/// The amount of horizontal space this paragraph occupies.
///
/// Valid only after [layout] has been called.
double get width;
double/*!*/ get width;
/// The amount of vertical space this paragraph occupies.
///
/// Valid only after [layout] has been called.
double get height;
double/*!*/ get height;
/// The distance from the left edge of the leftmost glyph to the right edge of
/// the rightmost glyph in the paragraph.
///
/// Valid only after [layout] has been called.
double get longestLine;
double/*!*/ get longestLine;
/// {@template dart.ui.paragraph.minIntrinsicWidth}
/// The minimum width that this paragraph could be without failing to paint
@@ -1373,7 +1373,7 @@ abstract class Paragraph {
/// {@endtemplate}
///
/// Valid only after [layout] has been called.
double get minIntrinsicWidth;
double/*!*/ get minIntrinsicWidth;
/// {@template dart.ui.paragraph.maxIntrinsicWidth}
/// Returns the smallest width beyond which increasing the width never
@@ -1381,7 +1381,7 @@ abstract class Paragraph {
/// {@endtemplate}
///
/// Valid only after [layout] has been called.
double get maxIntrinsicWidth;
double/*!*/ get maxIntrinsicWidth;
/// {@template dart.ui.paragraph.alphabeticBaseline}
/// The distance from the top of the paragraph to the alphabetic
@@ -1389,7 +1389,7 @@ abstract class Paragraph {
/// {@endtemplate}
///
/// Valid only after [layout] has been called.
double get alphabeticBaseline;
double/*!*/ get alphabeticBaseline;
/// {@template dart.ui.paragraph.ideographicBaseline}
/// The distance from the top of the paragraph to the ideographic
@@ -1397,7 +1397,7 @@ abstract class Paragraph {
/// {@endtemplate}
///
/// Valid only after [layout] has been called.
double get ideographicBaseline;
double/*!*/ get ideographicBaseline;
/// True if there is more vertical content, but the text was truncated, either
/// because we reached `maxLines` lines of text or because the `maxLines` was
@@ -1406,12 +1406,12 @@ abstract class Paragraph {
///
/// See the discussion of the `maxLines` and `ellipsis` arguments at [new
/// ParagraphStyle].
bool get didExceedMaxLines;
bool/*!*/ get didExceedMaxLines;
/// Computes the size and position of each glyph in the paragraph.
///
/// The [ParagraphConstraints] control how wide the text is allowed to be.
void layout(ParagraphConstraints constraints);
void layout(ParagraphConstraints/*!*/ constraints);
/// Returns a list of text boxes that enclose the given text range.
///
@@ -1423,15 +1423,15 @@ abstract class Paragraph {
/// The [boxHeightStyle] and [boxWidthStyle] parameters must not be null.
///
/// See [BoxHeightStyle] and [BoxWidthStyle] for full descriptions of each option.
List<TextBox> getBoxesForRange(int start, int end,
{BoxHeightStyle boxHeightStyle = BoxHeightStyle.tight,
BoxWidthStyle boxWidthStyle = BoxWidthStyle.tight});
List<TextBox/*!*/>/*!*/ getBoxesForRange(int/*!*/ start, int/*!*/ end,
{BoxHeightStyle/*!*/ boxHeightStyle = BoxHeightStyle.tight,
BoxWidthStyle/*!*/ boxWidthStyle = BoxWidthStyle.tight});
/// Returns the text position closest to the given offset.
///
/// It does so by performing a binary search to find where the tap occurred
/// within the text.
TextPosition getPositionForOffset(Offset offset);
TextPosition/*!*/ getPositionForOffset(Offset/*!*/ offset);
/// Returns the [TextRange] of the word at the given [TextPosition].
///
@@ -1439,7 +1439,7 @@ abstract class Paragraph {
/// have word breaks on both sides. In such cases, this method will return
/// [offset, offset+1]. Word boundaries are defined more precisely in Unicode
/// Standard Annex #29 http://www.unicode.org/reports/tr29/#Word_Boundaries
TextRange getWordBoundary(TextPosition position);
TextRange/*!*/ getWordBoundary(TextPosition/*!*/ position);
/// Returns the [TextRange] of the line at the given [TextPosition].
///
@@ -1449,7 +1449,7 @@ abstract class Paragraph {
///
/// This can potentially be expensive, since it needs to compute the line
/// metrics, so use it sparingly.
TextRange getLineBoundary(TextPosition position);
TextRange/*!*/ getLineBoundary(TextPosition/*!*/ position);
/// Returns a list of text boxes that enclose all placeholders in the paragraph.
///
@@ -1457,7 +1457,7 @@ abstract class Paragraph {
///
/// Coordinates of the [TextBox] are relative to the upper-left corner of the paragraph,
/// where positive y values indicate down.
List<TextBox> getBoxesForPlaceholders();
List<TextBox/*!*/>/*!*/ getBoxesForPlaceholders();
/// Returns the full list of [LineMetrics] that describe in detail the various
/// metrics of each laid out line.
@@ -1466,7 +1466,7 @@ abstract class Paragraph {
///
/// This can potentially return a large amount of data, so it is not recommended
/// to repeatedly call this. Instead, cache the results.
List<LineMetrics> computeLineMetrics();
List<LineMetrics/*!*/>/*!*/ computeLineMetrics();
}
/// Builds a [Paragraph] containing text with the given styling information.
@@ -1486,7 +1486,7 @@ abstract class Paragraph {
abstract class ParagraphBuilder {
/// Creates a [ParagraphBuilder] object, which is used to create a
/// [Paragraph].
factory ParagraphBuilder(ParagraphStyle style) {
factory ParagraphBuilder(ParagraphStyle/*!*/ style) {
if (engine.experimentalUseSkia) {
return engine.SkParagraphBuilder(style);
} else {
@@ -1497,7 +1497,7 @@ abstract class ParagraphBuilder {
/// Applies the given style to the added text until [pop] is called.
///
/// See [pop] for details.
void pushStyle(TextStyle style);
void pushStyle(TextStyle/*!*/ style);
/// Ends the effect of the most recent call to [pushStyle].
///
@@ -1510,20 +1510,20 @@ abstract class ParagraphBuilder {
/// Adds the given text to the paragraph.
///
/// The text will be styled according to the current stack of text styles.
void addText(String text);
void addText(String/*!*/ text);
/// Applies the given paragraph style and returns a [Paragraph] containing the
/// added text and associated styling.
///
/// After calling this function, the paragraph builder object is invalid and
/// cannot be used further.
Paragraph build();
Paragraph/*!*/ build();
/// The number of placeholders currently in the paragraph.
int get placeholderCount;
int/*!*/ get placeholderCount;
/// The scales of the placeholders in the paragraph.
List<double> get placeholderScales;
List<double/*!*/>/*!*/ get placeholderScales;
/// Adds an inline placeholder space to the paragraph.
///
@@ -1569,12 +1569,12 @@ abstract class ParagraphBuilder {
/// in the text buffer. For each placeholder, one object replacement character is
/// added on to the text buffer.
void addPlaceholder(
double width,
double height,
PlaceholderAlignment alignment, {
double scale,
double baselineOffset,
TextBaseline baseline,
double/*!*/ width,
double/*!*/ height,
PlaceholderAlignment/*!*/ alignment, {
double/*!*/ scale = 1.0,
double/*?*/ baselineOffset,
TextBaseline/*?*/ baseline,
});
}
@@ -1583,7 +1583,7 @@ abstract class ParagraphBuilder {
/// * `list`: A list of bytes containing the font file.
/// * `fontFamily`: The family name used to identify the font in text styles.
/// If this is not provided, then the family name will be extracted from the font file.
Future<void> loadFontFromList(Uint8List list, {String fontFamily}) {
Future<void>/*!*/ loadFontFromList(Uint8List/*!*/ list, {String/*?*/ fontFamily}) {
if (engine.experimentalUseSkia) {
return engine.skiaFontCollection.loadFontFromList(list, fontFamily: fontFamily).then(
(_) => engine.sendFontChangeMessage()