Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/flutter/lib/src/foundation/diagnostics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,9 @@ abstract class DiagnosticsNode {
/// `minLevel` specifies the minimum [DiagnosticLevel] for properties included
/// in the output.
///
/// `wrapWidth` specifies the column number where word wrapping will be
/// applied.
///
/// The [toStringDeep] method takes other arguments, but those are intended
/// for internal use when recursing to the descendants, and so can be ignored.
///
Expand All @@ -1768,12 +1771,13 @@ abstract class DiagnosticsNode {
String? prefixOtherLines,
TextTreeConfiguration? parentConfiguration,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
int wrapWidth = 65,
}) {
String result = '';
assert(() {
result = TextTreeRenderer(
minLevel: minLevel,
wrapWidth: 65,
wrapWidth: wrapWidth,
).render(
this,
prefixLineOne: prefixLineOne,
Expand Down Expand Up @@ -3315,6 +3319,9 @@ abstract class DiagnosticableTree with Diagnosticable {
/// `minLevel` specifies the minimum [DiagnosticLevel] for properties included
/// in the output.
///
/// `wrapWidth` specifies the column number where word wrapping will be
/// applied.
///
/// The [toStringDeep] method takes other arguments, but those are intended
/// for internal use when recursing to the descendants, and so can be ignored.
///
Expand All @@ -3327,8 +3334,9 @@ abstract class DiagnosticableTree with Diagnosticable {
String prefixLineOne = '',
String? prefixOtherLines,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
int wrapWidth = 65,
}) {
return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel);
return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel, wrapWidth: wrapWidth);
}

@override
Expand Down Expand Up @@ -3400,8 +3408,9 @@ mixin DiagnosticableTreeMixin implements DiagnosticableTree {
String prefixLineOne = '',
String? prefixOtherLines,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
int wrapWidth = 65,
}) {
return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel);
return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel, wrapWidth: wrapWidth);
}

@override
Expand Down
2 changes: 2 additions & 0 deletions packages/flutter/lib/src/rendering/object.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4002,11 +4002,13 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
String prefixLineOne = '',
String? prefixOtherLines = '',
DiagnosticLevel minLevel = DiagnosticLevel.debug,
int wrapWidth = 65,
}) {
return _withDebugActiveLayoutCleared(() => super.toStringDeep(
prefixLineOne: prefixLineOne,
prefixOtherLines: prefixOtherLines,
minLevel: minLevel,
wrapWidth: wrapWidth,
));
}

Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/lib/src/semantics/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3085,8 +3085,9 @@ class SemanticsNode with DiagnosticableTreeMixin {
String? prefixOtherLines,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
DebugSemanticsDumpOrder childOrder = DebugSemanticsDumpOrder.traversalOrder,
int wrapWidth = 65,
}) {
return toDiagnosticsNode(childOrder: childOrder).toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel);
return toDiagnosticsNode(childOrder: childOrder).toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel, wrapWidth: wrapWidth);
}

@override
Expand Down
10 changes: 5 additions & 5 deletions packages/flutter/test/animation/tween_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void main() {
(FlutterError error) => error.diagnostics.map((DiagnosticsNode node) => node.toString()),
'diagnostics',
<String>[
'Cannot lerp between "Color(0xff000000)" and "Color(0xffffffff)".',
'Cannot lerp between "${const Color(0xff000000)}" and "${const Color(0xffffffff)}".',
'The type Color might not fully implement `+`, `-`, and/or `*`. $kApiDocsLink',
'To lerp colors, consider ColorTween instead.',
],
Expand Down Expand Up @@ -194,10 +194,10 @@ void main() {
begin: const Color(0xff000000),
end: const Color(0xffffffff),
);
expect(tween.lerp(0.0), const Color(0xff000000));
expect(tween.lerp(0.5), const Color(0xff7f7f7f));
expect(tween.lerp(0.7), const Color(0xffb2b2b2));
expect(tween.lerp(1.0), const Color(0xffffffff));
expect(tween.lerp(0.0), isSameColorAs(const Color(0xff000000)));
expect(tween.lerp(0.5), isSameColorAs(const Color(0xff7f7f7f)));
expect(tween.lerp(0.7), isSameColorAs(const Color(0xffb2b2b2)));
expect(tween.lerp(1.0), isSameColorAs(const Color(0xffffffff)));
});

test('StepTween', () {
Expand Down
32 changes: 16 additions & 16 deletions packages/flutter/test/cupertino/colors_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,20 @@ void main() {
expect(
dynamicColor.toString(),
contains(
'CupertinoDynamicColor(*color = Color(0xff000000)*, '
'darkColor = Color(0xff000001), '
'highContrastColor = Color(0xff000003), '
'darkHighContrastColor = Color(0xff000005), '
'elevatedColor = Color(0xff000002), '
'darkElevatedColor = Color(0xff000004), '
'highContrastElevatedColor = Color(0xff000006), '
'darkHighContrastElevatedColor = Color(0xff000007)',
'CupertinoDynamicColor(*color = ${const Color(0xff000000)}*, '
'darkColor = ${const Color(0xff000001)}, '
'highContrastColor = ${const Color(0xff000003)}, '
'darkHighContrastColor = ${const Color(0xff000005)}, '
'elevatedColor = ${const Color(0xff000002)}, '
'darkElevatedColor = ${const Color(0xff000004)}, '
'highContrastElevatedColor = ${const Color(0xff000006)}, '
'darkHighContrastElevatedColor = ${const Color(0xff000007)}',
),
);
expect(notSoDynamicColor1.toString(), contains('CupertinoDynamicColor(*color = Color(0xff000000)*'));
expect(vibrancyDependentColor1.toString(), contains('CupertinoDynamicColor(*color = Color(0xff000001)*, darkColor = Color(0xff000000)'));
expect(contrastDependentColor1.toString(), contains('CupertinoDynamicColor(*color = Color(0xff000001)*, highContrastColor = Color(0xff000000)'));
expect(elevationDependentColor1.toString(), contains('CupertinoDynamicColor(*color = Color(0xff000001)*, elevatedColor = Color(0xff000000)'));
expect(notSoDynamicColor1.toString(), contains('CupertinoDynamicColor(*color = ${const Color(0xff000000)}*'));
expect(vibrancyDependentColor1.toString(), contains('CupertinoDynamicColor(*color = ${const Color(0xff000001)}*, darkColor = ${const Color(0xff000000)}'));
expect(contrastDependentColor1.toString(), contains('CupertinoDynamicColor(*color = ${const Color(0xff000001)}*, highContrastColor = ${const Color(0xff000000)}'));
expect(elevationDependentColor1.toString(), contains('CupertinoDynamicColor(*color = ${const Color(0xff000001)}*, elevatedColor = ${const Color(0xff000000)}'));

expect(
const CupertinoDynamicColor.withBrightnessAndContrast(
Expand All @@ -153,10 +153,10 @@ void main() {
darkHighContrastColor: color3,
).toString(),
contains(
'CupertinoDynamicColor(*color = Color(0xff000000)*, '
'darkColor = Color(0xff000001), '
'highContrastColor = Color(0xff000002), '
'darkHighContrastColor = Color(0xff000003)',
'CupertinoDynamicColor(*color = ${const Color(0xff000000)}*, '
'darkColor = ${const Color(0xff000001)}, '
'highContrastColor = ${const Color(0xff000002)}, '
'darkHighContrastColor = ${const Color(0xff000003)}',
),
);
});
Expand Down
32 changes: 16 additions & 16 deletions packages/flutter/test/cupertino/nav_bar_transition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void main() {
// The transition's stack is ordered. The bottom middle is inserted first.
final RenderParagraph bottomMiddle =
tester.renderObject(flying(tester, find.text('Page 1')).first);
expect(bottomMiddle.text.style!.color, const Color(0xff000306));
expect(bottomMiddle.text.style!.color, isSameColorAs(const Color(0xff000306)));
expect(bottomMiddle.text.style!.fontWeight, FontWeight.w600);
expect(bottomMiddle.text.style!.fontFamily, 'CupertinoSystemText');
expect(bottomMiddle.text.style!.letterSpacing, -0.41);
Expand All @@ -225,7 +225,7 @@ void main() {
// are flipped.
final RenderParagraph topBackLabel =
tester.renderObject(flying(tester, find.text('Page 1')).last);
expect(topBackLabel.text.style!.color, const Color(0xff000306));
expect(topBackLabel.text.style!.color, isSameColorAs(const Color(0xff000306)));
expect(topBackLabel.text.style!.fontWeight, FontWeight.w600);
expect(topBackLabel.text.style!.fontFamily, 'CupertinoSystemText');
expect(topBackLabel.text.style!.letterSpacing, -0.41);
Expand All @@ -234,14 +234,14 @@ void main() {

// Move animation further a bit.
await tester.pump(const Duration(milliseconds: 200));
expect(bottomMiddle.text.style!.color, const Color(0xff005ec5));
expect(bottomMiddle.text.style!.color, isSameColorAs(const Color(0xff005ec5)));
expect(bottomMiddle.text.style!.fontWeight, FontWeight.w400);
expect(bottomMiddle.text.style!.fontFamily, 'CupertinoSystemText');
expect(bottomMiddle.text.style!.letterSpacing, -0.41);

checkOpacity(tester, flying(tester, find.text('Page 1')).first, 0.0);

expect(topBackLabel.text.style!.color, const Color(0xff005ec5));
expect(topBackLabel.text.style!.color, isSameColorAs(const Color(0xff005ec5)));
expect(topBackLabel.text.style!.fontWeight, FontWeight.w400);
expect(topBackLabel.text.style!.fontFamily, 'CupertinoSystemText');
expect(topBackLabel.text.style!.letterSpacing, -0.41);
Expand All @@ -262,7 +262,7 @@ void main() {
// The transition's stack is ordered. The bottom middle is inserted first.
final RenderParagraph bottomMiddle =
tester.renderObject(flying(tester, find.text('Page 1')).first);
expect(bottomMiddle.text.style!.color, const Color(0xfff8fbff));
expect(bottomMiddle.text.style!.color, isSameColorAs(const Color(0xfff8fbff)));
expect(bottomMiddle.text.style!.fontWeight, FontWeight.w600);
expect(bottomMiddle.text.style!.fontFamily, 'CupertinoSystemText');
expect(bottomMiddle.text.style!.letterSpacing, -0.41);
Expand All @@ -273,7 +273,7 @@ void main() {
// are flipped.
final RenderParagraph topBackLabel =
tester.renderObject(flying(tester, find.text('Page 1')).last);
expect(topBackLabel.text.style!.color, const Color(0xfff8fbff));
expect(topBackLabel.text.style!.color, isSameColorAs(const Color(0xfff8fbff)));
expect(topBackLabel.text.style!.fontWeight, FontWeight.w600);
expect(topBackLabel.text.style!.fontFamily, 'CupertinoSystemText');
expect(topBackLabel.text.style!.letterSpacing, -0.41);
Expand All @@ -282,14 +282,14 @@ void main() {

// Move animation further a bit.
await tester.pump(const Duration(milliseconds: 200));
expect(bottomMiddle.text.style!.color, const Color(0xff409fff));
expect(bottomMiddle.text.style!.color, isSameColorAs(const Color(0xff409fff)));
expect(bottomMiddle.text.style!.fontWeight, FontWeight.w400);
expect(bottomMiddle.text.style!.fontFamily, 'CupertinoSystemText');
expect(bottomMiddle.text.style!.letterSpacing, -0.41);

checkOpacity(tester, flying(tester, find.text('Page 1')).first, 0.0);

expect(topBackLabel.text.style!.color, const Color(0xff409fff));
expect(topBackLabel.text.style!.color, isSameColorAs(const Color(0xff409fff)));
expect(topBackLabel.text.style!.fontWeight, FontWeight.w400);
expect(topBackLabel.text.style!.fontFamily, 'CupertinoSystemText');
expect(topBackLabel.text.style!.letterSpacing, -0.41);
Expand Down Expand Up @@ -365,7 +365,7 @@ void main() {
// The transition's stack is ordered. The bottom middle is inserted first.
final RenderParagraph bottomMiddle =
tester.renderObject(flying(tester, find.text('Page 1')).first);
expect(bottomMiddle.text.style!.color, const Color(0xff000306));
expect(bottomMiddle.text.style!.color, isSameColorAs(const Color(0xff000306)));

expect(
tester.getTopLeft(flying(tester, find.text('Page 1')).first),
Expand All @@ -379,7 +379,7 @@ void main() {
// are flipped.
final RenderParagraph topBackLabel =
tester.renderObject(flying(tester, find.text('Page 1')).last);
expect(topBackLabel.text.style!.color, const Color(0xff000306));
expect(topBackLabel.text.style!.color, isSameColorAs(const Color(0xff000306)));
expect(
tester.getTopLeft(flying(tester, find.text('Page 1')).last),
const Offset(
Expand Down Expand Up @@ -417,7 +417,7 @@ void main() {
// The transition's stack is ordered. The bottom middle is inserted first.
final RenderParagraph bottomMiddle =
tester.renderObject(flying(tester, find.text('Page 1')).first);
expect(bottomMiddle.text.style!.color, const Color(0xff000306));
expect(bottomMiddle.text.style!.color, isSameColorAs(const Color(0xff000306)));
expect(
tester.getTopLeft(flying(tester, find.text('Page 1')).first),
const Offset(
Expand All @@ -430,7 +430,7 @@ void main() {
// are flipped.
final RenderParagraph topBackLabel =
tester.renderObject(flying(tester, find.text('Page 1')).last);
expect(topBackLabel.text.style!.color, const Color(0xff000306));
expect(topBackLabel.text.style!.color, isSameColorAs(const Color(0xff000306)));
expect(
tester.getTopLeft(flying(tester, find.text('Page 1')).last),
const Offset(
Expand Down Expand Up @@ -1116,27 +1116,27 @@ void main() {
// The transition's stack is ordered. The bottom large title is inserted first.
final RenderParagraph bottomLargeTitle =
tester.renderObject(flying(tester, find.text('Page 1')).first);
expect(bottomLargeTitle.text.style!.color, const Color(0xff000306));
expect(bottomLargeTitle.text.style!.color, isSameColorAs(const Color(0xff000306)));
expect(bottomLargeTitle.text.style!.fontWeight, FontWeight.w700);
expect(bottomLargeTitle.text.style!.fontFamily, 'CupertinoSystemDisplay');
expect(bottomLargeTitle.text.style!.letterSpacing, moreOrLessEquals(0.35967791542410854));

// The top back label is styled exactly the same way.
final RenderParagraph topBackLabel =
tester.renderObject(flying(tester, find.text('Page 1')).last);
expect(topBackLabel.text.style!.color, const Color(0xff000306));
expect(topBackLabel.text.style!.color, isSameColorAs(const Color(0xff000306)));
expect(topBackLabel.text.style!.fontWeight, FontWeight.w700);
expect(topBackLabel.text.style!.fontFamily, 'CupertinoSystemDisplay');
expect(topBackLabel.text.style!.letterSpacing, moreOrLessEquals(0.35967791542410854));

// Move animation further a bit.
await tester.pump(const Duration(milliseconds: 200));
expect(bottomLargeTitle.text.style!.color, const Color(0xff005ec5));
expect(bottomLargeTitle.text.style!.color, isSameColorAs(const Color(0xff005ec5)));
expect(bottomLargeTitle.text.style!.fontWeight, FontWeight.w500);
expect(bottomLargeTitle.text.style!.fontFamily, 'CupertinoSystemText');
expect(bottomLargeTitle.text.style!.letterSpacing, moreOrLessEquals(-0.23270857974886894));

expect(topBackLabel.text.style!.color, const Color(0xff005ec5));
expect(topBackLabel.text.style!.color, isSameColorAs(const Color(0xff005ec5)));
expect(topBackLabel.text.style!.fontWeight, FontWeight.w500);
expect(topBackLabel.text.style!.fontFamily, 'CupertinoSystemText');
expect(topBackLabel.text.style!.letterSpacing, moreOrLessEquals(-0.23270857974886894));
Expand Down
Loading