Unverified Commit 67606281 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Typos & Style clean up (#42006)

parent 0917cb00
......@@ -15,17 +15,16 @@ import 'text_style.dart';
/// An immutable span of text.
///
/// A [TextSpan] object can be styled using its [style] property.
/// The style will be applied to the [text] and the [children].
/// A [TextSpan] object can be styled using its [style] property. The style will
/// be applied to the [text] and the [children].
///
/// A [TextSpan] object can just have plain text, or it can have
/// children [TextSpan] objects with their own styles that (possibly
/// only partially) override the [style] of this object. If a
/// [TextSpan] has both [text] and [children], then the [text] is
/// treated as if it was an unstyled [TextSpan] at the start of the
/// [children] list. Leaving the [TextSpan.text] field null results
/// in the [TextSpan] acting as an empty node in the [InlineSpan]
/// tree with a list of children.
/// A [TextSpan] object can just have plain text, or it can have children
/// [TextSpan] objects with their own styles that (possibly only partially)
/// override the [style] of this object. If a [TextSpan] has both [text] and
/// [children], then the [text] is treated as if it was an un-styled [TextSpan]
/// at the start of the [children] list. Leaving the [TextSpan.text] field null
/// results in the [TextSpan] acting as an empty node in the [InlineSpan] tree
/// with a list of children.
///
/// To paint a [TextSpan] on a [Canvas], use a [TextPainter]. To display a text
/// span in a widget, use a [RichText]. For text with a single style, consider
......@@ -46,17 +45,17 @@ import 'text_style.dart';
/// _There is some more detailed sample code in the documentation for the
/// [recognizer] property._
///
/// The [TextSpan.text] will be used as the semantics label unless overriden
/// The [TextSpan.text] will be used as the semantics label unless overridden
/// by the [TextSpan.semanticsLabel] property. Any [PlaceholderSpan]s in the
/// [TextSpan.children] list will separate the text before and after it into
/// two semantics nodes.
/// [TextSpan.children] list will separate the text before and after it into two
/// semantics nodes.
///
/// See also:
///
/// * [WidgetSpan], a leaf node that represents an embedded inline widget
/// in an [InlineSpan] tree. Specify a widget within the [children]
/// list by wrapping the widget with a [WidgetSpan]. The widget will be
/// laid out inline within the paragraph.
/// * [WidgetSpan], a leaf node that represents an embedded inline widget in an
/// [InlineSpan] tree. Specify a widget within the [children] list by
/// wrapping the widget with a [WidgetSpan]. The widget will be laid out
/// inline within the paragraph.
/// * [Text], a widget for showing uniformly-styled text.
/// * [RichText], a widget for finer control of text rendering.
/// * [TextPainter], a class for painting [TextSpan] objects on a [Canvas].
......@@ -89,8 +88,8 @@ class TextSpan extends InlineSpan {
/// If both [text] and [children] are non-null, the text will precede the
/// children.
///
/// Modifying the list after the [TextSpan] has been created is not
/// supported and may have unexpected results.
/// Modifying the list after the [TextSpan] has been created is not supported
/// and may have unexpected results.
///
/// The list must not contain any nulls.
@override
......@@ -102,19 +101,20 @@ class TextSpan extends InlineSpan {
/// object that manages the [InlineSpan] painting is also responsible for
/// dispatching events. In the rendering library, that is the
/// [RenderParagraph] object, which corresponds to the [RichText] widget in
/// the widgets layer; these objects do not bubble events in [InlineSpan]s, so a
/// [recognizer] is only effective for events that directly hit the [text] of
/// that [InlineSpan], not any of its [children].
/// the widgets layer; these objects do not bubble events in [InlineSpan]s,
/// so a [recognizer] is only effective for events that directly hit the
/// [text] of that [InlineSpan], not any of its [children].
///
/// [InlineSpan] also does not manage the lifetime of the gesture recognizer.
/// The code that owns the [GestureRecognizer] object must call
/// [GestureRecognizer.dispose] when the [InlineSpan] object is no longer used.
/// [GestureRecognizer.dispose] when the [InlineSpan] object is no longer
/// used.
///
/// {@tool sample}
///
/// This example shows how to manage the lifetime of a gesture recognizer
/// provided to an [InlineSpan] object. It defines a `BuzzingText` widget which
/// uses the [HapticFeedback] class to vibrate the device when the user
/// provided to an [InlineSpan] object. It defines a `BuzzingText` widget
/// which uses the [HapticFeedback] class to vibrate the device when the user
/// long-presses the "find the" span, which is underlined in wavy green. The
/// hit-testing is handled by the [RichText] widget.
///
......@@ -194,7 +194,11 @@ class TextSpan extends InlineSpan {
/// [TextPainter] class to paint [TextSpan] objects onto [Canvas]
/// objects.
@override
void build(ui.ParagraphBuilder builder, { double textScaleFactor = 1.0, List<PlaceholderDimensions> dimensions }) {
void build(
ui.ParagraphBuilder builder, {
double textScaleFactor = 1.0,
List<PlaceholderDimensions> dimensions,
}) {
assert(debugAssertIsValid());
final bool hasStyle = style != null;
if (hasStyle)
......@@ -204,7 +208,11 @@ class TextSpan extends InlineSpan {
if (children != null) {
for (InlineSpan child in children) {
assert(child != null);
child.build(builder, textScaleFactor: textScaleFactor, dimensions: dimensions);
child.build(
builder,
textScaleFactor: textScaleFactor,
dimensions: dimensions,
);
}
}
if (hasStyle)
......@@ -214,8 +222,8 @@ class TextSpan extends InlineSpan {
/// Walks this [TextSpan] and its descendants in pre-order and calls [visitor]
/// for each span that has text.
///
/// When `visitor` returns true, the walk will continue. When `visitor` returns
/// false, then the walk will end.
/// When `visitor` returns true, the walk will continue. When `visitor`
/// returns false, then the walk will end.
@override
bool visitChildren(InlineSpanVisitor visitor) {
if (text != null) {
......@@ -235,8 +243,8 @@ class TextSpan extends InlineSpan {
/// Walks this [TextSpan] and any descendants in pre-order and calls `visitor`
/// for each span that has content.
///
/// When `visitor` returns true, the walk will continue. When `visitor` returns
/// false, then the walk will end.
/// When `visitor` returns true, the walk will continue. When `visitor`
/// returns false, then the walk will end.
@override
@Deprecated('Use to visitChildren instead')
bool visitTextSpan(bool visitor(TextSpan span)) {
......@@ -246,7 +254,10 @@ class TextSpan extends InlineSpan {
}
if (children != null) {
for (InlineSpan child in children) {
assert(child is TextSpan, 'visitTextSpan is deprecated. Use visitChildren to support InlineSpans');
assert(
child is TextSpan,
'visitTextSpan is deprecated. Use visitChildren to support InlineSpans',
);
final TextSpan textSpanChild = child;
if (!textSpanChild.visitTextSpan(visitor))
return false;
......@@ -274,7 +285,11 @@ class TextSpan extends InlineSpan {
}
@override
void computeToPlainText(StringBuffer buffer, {bool includeSemanticsLabels = true, bool includePlaceholders = true}) {
void computeToPlainText(
StringBuffer buffer, {
bool includeSemanticsLabels = true,
bool includePlaceholders = true
}) {
assert(debugAssertIsValid());
if (semanticsLabel != null && includeSemanticsLabels) {
buffer.write(semanticsLabel);
......@@ -322,7 +337,10 @@ class TextSpan extends InlineSpan {
@override
void describeSemantics(Accumulator offset, List<int> semanticsOffsets, List<dynamic> semanticsElements) {
if (recognizer != null && (recognizer is TapGestureRecognizer || recognizer is LongPressGestureRecognizer)) {
if (
recognizer != null &&
(recognizer is TapGestureRecognizer || recognizer is LongPressGestureRecognizer)
) {
final int length = semanticsLabel?.length ?? text.length;
semanticsOffsets.add(offset.value);
semanticsOffsets.add(offset.value + length);
......@@ -331,8 +349,8 @@ class TextSpan extends InlineSpan {
offset.increment(text != null ? text.length : 0);
}
/// In checked mode, throws an exception if the object is not in a
/// valid configuration. Otherwise, returns true.
/// In checked mode, throws an exception if the object is not in a valid
/// configuration. Otherwise, returns true.
///
/// This is intended to be used as follows:
///
......@@ -369,7 +387,9 @@ class TextSpan extends InlineSpan {
children?.length != textSpan.children?.length ||
(style == null) != (textSpan.style == null))
return RenderComparison.layout;
RenderComparison result = recognizer == textSpan.recognizer ? RenderComparison.identical : RenderComparison.metadata;
RenderComparison result = recognizer == textSpan.recognizer ?
RenderComparison.identical :
RenderComparison.metadata;
if (style != null) {
final RenderComparison candidate = style.compareTo(textSpan.style);
if (candidate.index > result.index)
......@@ -405,7 +425,13 @@ class TextSpan extends InlineSpan {
}
@override
int get hashCode => hashValues(super.hashCode, text, recognizer, semanticsLabel, hashList(children));
int get hashCode => hashValues(
super.hashCode,
text,
recognizer,
semanticsLabel,
hashList(children),
);
@override
String toStringShort() => '$runtimeType';
......@@ -414,7 +440,14 @@ class TextSpan extends InlineSpan {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(StringProperty('text', text, showName: false, defaultValue: null));
properties.add(
StringProperty(
'text',
text,
showName: false,
defaultValue: null,
)
);
if (style == null && text == null && children == null)
properties.add(DiagnosticsNode.message('(empty)'));
......
......@@ -110,7 +110,7 @@ class RenderParagraph extends RenderBox
final TextPainter _textPainter;
/// The text to display
/// The text to display.
InlineSpan get text => _textPainter.text;
set text(InlineSpan value) {
assert(value != null);
......@@ -220,11 +220,12 @@ class RenderParagraph extends RenderBox
markNeedsLayout();
}
/// An optional maximum number of lines for the text to span, wrapping if necessary.
/// If the text exceeds the given number of lines, it will be truncated according
/// to [overflow] and [softWrap].
/// An optional maximum number of lines for the text to span, wrapping if
/// necessary. If the text exceeds the given number of lines, it will be
/// truncated according to [overflow] and [softWrap].
int get maxLines => _textPainter.maxLines;
/// The value may be null. If it is not null, then it must be greater than zero.
/// The value may be null. If it is not null, then it must be greater than
/// zero.
set maxLines(int value) {
assert(value == null || value > 0);
if (_textPainter.maxLines == value)
......@@ -234,10 +235,11 @@ class RenderParagraph extends RenderBox
markNeedsLayout();
}
/// Used by this paragraph's internal [TextPainter] to select a locale-specific
/// font.
/// Used by this paragraph's internal [TextPainter] to select a
/// locale-specific font.
///
/// In some cases the same Unicode character may be rendered differently depending
/// In some cases the same Unicode character may be rendered differently
/// depending
/// on the locale. For example the '骨' character is rendered differently in
/// the Chinese and Japanese locales. In these cases the [locale] may be used
/// to select a locale-specific font.
......@@ -318,11 +320,12 @@ class RenderParagraph extends RenderBox
assert(constraints != null);
assert(constraints.debugAssertIsValid());
_layoutTextWithConstraints(constraints);
// TODO(garyq): Since our metric for ideographic baseline is currently inacurrate
// and the non-alphabetic baselines are based off of the alphabetic baseline, we
// use the alphabetic for now to produce correct layouts. We should eventually change
// this back to pass the `baseline` property when the ideographic baseline is properly
// implemented (https://github.com/flutter/flutter/issues/22625).
// TODO(garyq): Since our metric for ideographic baseline is currently
// inaccurate and the non-alphabetic baselines are based off of the
// alphabetic baseline, we use the alphabetic for now to produce correct
// layouts. We should eventually change this back to pass the `baseline`
// property when the ideographic baseline is properly implemented
// (https://github.com/flutter/flutter/issues/22625).
return _textPainter.computeDistanceToActualBaseline(TextBaseline.alphabetic);
}
......@@ -412,8 +415,15 @@ class RenderParagraph extends RenderBox
RenderBox child = firstChild;
while (child != null) {
final TextParentData textParentData = child.parentData;
final Matrix4 transform = Matrix4.translationValues(textParentData.offset.dx, textParentData.offset.dy, 0.0)
..scale(textParentData.scale, textParentData.scale, textParentData.scale);
final Matrix4 transform = Matrix4.translationValues(
textParentData.offset.dx,
textParentData.offset.dy,
0.0,
)..scale(
textParentData.scale,
textParentData.scale,
textParentData.scale,
);
final bool isHit = result.addWithPaintTransform(
transform: transform,
position: position,
......@@ -464,7 +474,12 @@ class RenderParagraph extends RenderBox
void _layoutText({ double minWidth = 0.0, double maxWidth = double.infinity }) {
final bool widthMatters = softWrap || overflow == TextOverflow.ellipsis;
_textPainter.layout(minWidth: minWidth, maxWidth: widthMatters ? maxWidth : double.infinity);
_textPainter.layout(
minWidth: minWidth,
maxWidth: widthMatters ?
maxWidth :
double.infinity,
);
}
@override
......@@ -500,7 +515,9 @@ class RenderParagraph extends RenderBox
double baselineOffset;
switch (_placeholderSpans[childIndex].alignment) {
case ui.PlaceholderAlignment.baseline: {
baselineOffset = child.getDistanceToBaseline(_placeholderSpans[childIndex].baseline);
baselineOffset = child.getDistanceToBaseline(
_placeholderSpans[childIndex].baseline
);
break;
}
default: {
......@@ -618,11 +635,11 @@ class RenderParagraph extends RenderBox
void paint(PaintingContext context, Offset offset) {
// Ideally we could compute the min/max intrinsic width/height with a
// non-destructive operation. However, currently, computing these values
// will destroy state inside the painter. If that happens, we need to
// get back the correct state by calling _layout again.
// will destroy state inside the painter. If that happens, we need to get
// back the correct state by calling _layout again.
//
// TODO(abarth): Make computing the min/max intrinsic width/height
// a non-destructive operation.
// TODO(abarth): Make computing the min/max intrinsic width/height a
// non-destructive operation.
//
// If you remove this call, make sure that changing the textAlign still
// works properly.
......@@ -640,8 +657,8 @@ class RenderParagraph extends RenderBox
if (_needsClipping) {
final Rect bounds = offset & size;
if (_overflowShader != null) {
// This layer limits what the shader below blends with to be just the text
// (as opposed to the text and its background).
// This layer limits what the shader below blends with to be just the
// text (as opposed to the text and its background).
context.canvas.saveLayer(bounds, Paint());
} else {
context.canvas.save();
......@@ -819,7 +836,10 @@ class RenderParagraph extends RenderBox
RenderBox child = firstChild;
for (InlineSpanSemanticsInformation info in _combineSemanticsInfo()) {
final TextDirection initialDirection = currentDirection;
final TextSelection selection = TextSelection(baseOffset: start, extentOffset: start + info.text.length);
final TextSelection selection = TextSelection(
baseOffset: start,
extentOffset: start + info.text.length,
);
final List<ui.TextBox> rects = getBoxesForSelection(selection);
if (rects.isEmpty) {
continue;
......@@ -887,7 +907,12 @@ class RenderParagraph extends RenderBox
@override
List<DiagnosticsNode> debugDescribeChildren() {
return <DiagnosticsNode>[text.toDiagnosticsNode(name: 'text', style: DiagnosticsTreeStyle.transition)];
return <DiagnosticsNode>[
text.toDiagnosticsNode(
name: 'text',
style: DiagnosticsTreeStyle.transition,
)
];
}
@override
......@@ -895,10 +920,30 @@ class RenderParagraph extends RenderBox
super.debugFillProperties(properties);
properties.add(EnumProperty<TextAlign>('textAlign', textAlign));
properties.add(EnumProperty<TextDirection>('textDirection', textDirection));
properties.add(FlagProperty('softWrap', value: softWrap, ifTrue: 'wrapping at box width', ifFalse: 'no wrapping except at line break characters', showName: true));
properties.add(
FlagProperty(
'softWrap',
value: softWrap,
ifTrue: 'wrapping at box width',
ifFalse: 'no wrapping except at line break characters',
showName: true,
)
);
properties.add(EnumProperty<TextOverflow>('overflow', overflow));
properties.add(DoubleProperty('textScaleFactor', textScaleFactor, defaultValue: 1.0));
properties.add(DiagnosticsProperty<Locale>('locale', locale, defaultValue: null));
properties.add(
DoubleProperty(
'textScaleFactor',
textScaleFactor,
defaultValue: 1.0,
)
);
properties.add(
DiagnosticsProperty<Locale>(
'locale',
locale,
defaultValue: null,
)
);
properties.add(IntProperty('maxLines', maxLines, ifNull: 'unlimited'));
}
}
......@@ -46,7 +46,11 @@ void main() {
expect(baseSize.height, equals(14.0));
await tester.pumpWidget(const Center(
child: Text('Hello', textScaleFactor: 1.5, textDirection: TextDirection.ltr),
child: Text(
'Hello',
textScaleFactor: 1.5,
textDirection: TextDirection.ltr,
),
));
text = tester.firstWidget(find.byType(RichText));
......@@ -102,8 +106,14 @@ void main() {
TextSpan(
text: 'Hello',
children: <TextSpan>[
TextSpan(text: ' beautiful ', style: TextStyle(fontStyle: FontStyle.italic)),
TextSpan(text: 'world', style: TextStyle(fontWeight: FontWeight.bold)),
TextSpan(
text: ' beautiful ',
style: TextStyle(fontStyle: FontStyle.italic),
),
TextSpan(
text: 'world',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
textDirection: TextDirection.ltr,
......@@ -123,7 +133,9 @@ void main() {
Text.rich(
TextSpan(
children: <InlineSpan>[
const TextSpan(text: 'a very very very very very very very very very very long line'),
const TextSpan(
text: 'a very very very very very very very very very very long line',
),
WidgetSpan(
child: SizedBox(
width: 20,
......@@ -150,7 +162,11 @@ void main() {
testWidgets('semanticsLabel can override text label', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(
const Text('\$\$', semanticsLabel: 'Double dollars', textDirection: TextDirection.ltr)
const Text(
'\$\$',
semanticsLabel: 'Double dollars',
textDirection: TextDirection.ltr,
)
);
final TestSemantics expectedSemantics = TestSemantics.root(
children: <TestSemantics>[
......@@ -160,7 +176,15 @@ void main() {
),
],
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true, ignoreRect: true));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
ignoreRect: true,
),
);
await tester.pumpWidget(
const Directionality(
......@@ -168,7 +192,15 @@ void main() {
child: Text('\$\$', semanticsLabel: 'Double dollars')),
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true, ignoreRect: true));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
ignoreRect: true,
),
);
semantics.dispose();
});
......@@ -206,7 +238,15 @@ void main() {
),
],
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true, ignoreRect: true));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
ignoreRect: true,
),
);
semantics.dispose();
});
......@@ -218,7 +258,10 @@ void main() {
TextSpan(
children: <TextSpan>[
const TextSpan(text: 'hello '),
TextSpan(text: 'world', recognizer: TapGestureRecognizer()..onTap = () { }),
TextSpan(
text: 'world',
recognizer: TapGestureRecognizer()..onTap = () { },
),
const TextSpan(text: ' this is a '),
const TextSpan(text: 'cat-astrophe'),
],
......@@ -250,7 +293,15 @@ void main() {
),
],
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true, ignoreRect: true));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
ignoreRect: true,
),
);
semantics.dispose();
});
......@@ -264,7 +315,10 @@ void main() {
TextSpan(
children: <TextSpan>[
const TextSpan(text: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'),
TextSpan(text: 'world', recognizer: TapGestureRecognizer()..onTap = () { }),
TextSpan(
text: 'world',
recognizer: TapGestureRecognizer()..onTap = () { },
),
],
style: textStyle,
),
......@@ -289,7 +343,15 @@ void main() {
),
],
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true, ignoreRect: true));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
ignoreRect: true,
),
);
semantics.dispose();
});
......@@ -301,9 +363,15 @@ void main() {
TextSpan(
children: <TextSpan>[
const TextSpan(text: 'hello '),
TextSpan(text: 'world', recognizer: TapGestureRecognizer()..onTap = () { }),
TextSpan(
text: 'world',
recognizer: TapGestureRecognizer()..onTap = () { },
),
const TextSpan(text: ' this is a '),
const TextSpan(text: 'cat-astrophe', semanticsLabel: 'regrettable event'),
const TextSpan(
text: 'cat-astrophe',
semanticsLabel: 'regrettable event',
),
],
style: textStyle,
),
......@@ -333,7 +401,15 @@ void main() {
),
],
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true, ignoreRect: true));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
ignoreRect: true,
),
);
semantics.dispose();
}, skip: isBrowser);
......@@ -347,9 +423,15 @@ void main() {
style: textStyle,
children: <TextSpan>[
const TextSpan(text: 'hello world${Unicode.RLE}${Unicode.RLO} '),
TextSpan(text: 'BOY', recognizer: LongPressGestureRecognizer()..onLongPress = () { }),
TextSpan(
text: 'BOY',
recognizer: LongPressGestureRecognizer()..onLongPress = () { },
),
const TextSpan(text: ' HOW DO${Unicode.PDF} you ${Unicode.RLO} DO '),
TextSpan(text: 'SIR', recognizer: TapGestureRecognizer()..onTap = () { }),
TextSpan(
text: 'SIR',
recognizer: TapGestureRecognizer()..onTap = () { },
),
const TextSpan(text: '${Unicode.PDF}${Unicode.PDF} good bye'),
],
),
......@@ -398,7 +480,14 @@ void main() {
),
],
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
),
);
semantics.dispose();
}, skip: true); // TODO(jonahwilliams): correct once https://github.com/flutter/flutter/issues/20891 is resolved.
......@@ -410,7 +499,10 @@ void main() {
TextSpan(
children: <InlineSpan>[
const TextSpan(text: 'a '),
TextSpan(text: 'pebble', recognizer: TapGestureRecognizer()..onTap = () { }),
TextSpan(
text: 'pebble',
recognizer: TapGestureRecognizer()..onTap = () { },
),
const TextSpan(text: ' in the '),
WidgetSpan(
child: SizedBox(
......@@ -462,7 +554,15 @@ void main() {
),
],
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true, ignoreRect: true));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
ignoreRect: true,
),
);
semantics.dispose();
}, skip: isBrowser);
......@@ -474,7 +574,10 @@ void main() {
TextSpan(
children: <InlineSpan>[
const TextSpan(text: 'a '),
TextSpan(text: 'pebble', recognizer: TapGestureRecognizer()..onTap = () { }),
TextSpan(
text: 'pebble',
recognizer: TapGestureRecognizer()..onTap = () { },
),
const TextSpan(text: ' in the '),
WidgetSpan(
child: SizedBox(
......@@ -533,7 +636,14 @@ void main() {
),
],
);
expect(semantics, hasSemantics(expectedSemantics, ignoreTransform: true, ignoreId: true,));
expect(
semantics,
hasSemantics(
expectedSemantics,
ignoreTransform: true,
ignoreId: true,
),
);
semantics.dispose();
}, skip: isBrowser);
......@@ -554,7 +664,10 @@ void main() {
text: 'a long long long long text, should be clip',
);
expect(find.byType(Text), paints..clipRect(rect: const Rect.fromLTWH(0, 0, 50, 50)));
expect(
find.byType(Text),
paints..clipRect(rect: const Rect.fromLTWH(0, 0, 50, 50)),
);
}, skip: isBrowser);
testWidgets('Overflow is clipping correctly - short text with overflow: ellipsis', (WidgetTester tester) async {
......@@ -574,7 +687,10 @@ void main() {
text: 'a long long long long text, should be clip',
);
expect(find.byType(Text), paints..clipRect(rect: const Rect.fromLTWH(0, 0, 50, 50)));
expect(
find.byType(Text),
paints..clipRect(rect: const Rect.fromLTWH(0, 0, 50, 50)),
);
});
testWidgets('Overflow is clipping correctly - short text with overflow: fade', (WidgetTester tester) async {
......@@ -616,7 +732,9 @@ void main() {
child: Container(
// Each word takes up more than a half of a line. Together they
// wrap onto two lines, but leave a lot of extra space.
child: Text('twowordsthateachtakeupmorethanhalfof alineoftextsothattheywrapwithlotsofextraspace',
child: Text(
'twowordsthateachtakeupmorethanhalfof alineoftextsothattheywr'
'apwithlotsofextraspace',
textDirection: TextDirection.ltr,
textWidthBasis: textWidthBasis,
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment