Unverified Commit 66cf8d47 authored by HeavenOSK's avatar HeavenOSK Committed by GitHub

[Improvement] Add prefix `Alignment.` for toString of Alignment (#67860)

* modify: add prefix `Alignment.` for toString of Alignment
parent 4b351ac1
......@@ -348,23 +348,23 @@ class Alignment extends AlignmentGeometry {
static String _stringify(double x, double y) {
if (x == -1.0 && y == -1.0)
return 'topLeft';
return 'Alignment.topLeft';
if (x == 0.0 && y == -1.0)
return 'topCenter';
return 'Alignment.topCenter';
if (x == 1.0 && y == -1.0)
return 'topRight';
return 'Alignment.topRight';
if (x == -1.0 && y == 0.0)
return 'centerLeft';
return 'Alignment.centerLeft';
if (x == 0.0 && y == 0.0)
return 'center';
return 'Alignment.center';
if (x == 1.0 && y == 0.0)
return 'centerRight';
return 'Alignment.centerRight';
if (x == -1.0 && y == 1.0)
return 'bottomLeft';
return 'Alignment.bottomLeft';
if (x == 0.0 && y == 1.0)
return 'bottomCenter';
return 'Alignment.bottomCenter';
if (x == 1.0 && y == 1.0)
return 'bottomRight';
return 'Alignment.bottomRight';
return 'Alignment(${x.toStringAsFixed(1)}, '
'${y.toStringAsFixed(1)})';
}
......
......@@ -212,10 +212,10 @@ void main() {
test('AlignmentGeometry toString', () {
expect(const Alignment(1.0001, 2.0001).toString(), 'Alignment(1.0, 2.0)');
expect(const Alignment(0.0, 0.0).toString(), 'center');
expect(const Alignment(-1.0, 1.0).add(const AlignmentDirectional(1.0, 0.0)).toString(), 'bottomLeft + AlignmentDirectional.centerEnd');
expect(const Alignment(0.0, 0.0).toString(), 'Alignment.center');
expect(const Alignment(-1.0, 1.0).add(const AlignmentDirectional(1.0, 0.0)).toString(), 'Alignment.bottomLeft + AlignmentDirectional.centerEnd');
expect(const Alignment(0.0001, 0.0001).toString(), 'Alignment(0.0, 0.0)');
expect(const Alignment(0.0, 0.0).toString(), 'center');
expect(const Alignment(0.0, 0.0).toString(), 'Alignment.center');
expect(const AlignmentDirectional(0.0, 0.0).toString(), 'AlignmentDirectional.center');
expect(const Alignment(1.0, 1.0).add(const AlignmentDirectional(1.0, 1.0)).toString(), 'Alignment(1.0, 2.0) + AlignmentDirectional.centerEnd');
});
......
......@@ -352,8 +352,8 @@ void main() {
' When DecorationImagePainter.paint() was called, there was no text\n'
' direction provided in the ImageConfiguration object to match.\n'
' The DecorationImage was:\n'
' DecorationImage(SynchronousTestImageProvider(), center, match\n'
' text direction, scale: 1.0)\n'
' DecorationImage(SynchronousTestImageProvider(),\n'
' Alignment.center, match text direction, scale: 1.0)\n'
' The ImageConfiguration was:\n'
' ImageConfiguration(size: Size(100.0, 100.0))\n'
);
......
......@@ -187,7 +187,7 @@ void main() {
],
).toString(),
equals(
'LinearGradient(topLeft, bottomLeft, [Color(0x33333333), Color(0x66666666)], null, TileMode.clamp)',
'LinearGradient(Alignment.topLeft, Alignment.bottomLeft, [Color(0x33333333), Color(0x66666666)], null, TileMode.clamp)',
),
);
});
......
......@@ -517,7 +517,7 @@ void main() {
' parentData: MISSING\n'
' constraints: MISSING\n'
' size: MISSING\n'
' alignment: center\n'
' alignment: Alignment.center\n'
' textDirection: ltr\n'),
);
});
......
......@@ -37,7 +37,7 @@ Future<void> main() async {
' constraints: BoxConstraints(25.0<=w<=100.0, 25.0<=h<=100.0)\n'
' size: Size(25.0, 25.0)\n'
' image: $squareImage\n'
' alignment: center\n'
' alignment: Alignment.center\n'
' invertColors: false\n'
' filterQuality: low\n'
),
......
......@@ -36,7 +36,7 @@ void main() {
' │ parentData: <none>\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n'
' │ alignment: center\n'
' │ alignment: Alignment.center\n'
' │ minWidth: 0.0\n'
' │ maxWidth: Infinity\n'
' │ minHeight: 0.0\n'
......@@ -122,7 +122,7 @@ void main() {
' │ parentData: <none>\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n'
' │ alignment: center\n'
' │ alignment: Alignment.center\n'
' │ minWidth: 10.0\n'
' │ maxWidth: 500.0\n'
' │ minHeight: 0.0\n'
......@@ -158,7 +158,7 @@ void main() {
' │ parentData: <none>\n'
' │ constraints: BoxConstraints(w=800.0, h=600.0)\n'
' │ size: Size(800.0, 600.0)\n'
' │ alignment: center\n'
' │ alignment: Alignment.center\n'
' │ minWidth: 10.0\n'
' │ maxWidth: use parent maxWidth constraint\n'
' │ minHeight: use parent minHeight constraint\n'
......@@ -173,5 +173,4 @@ void main() {
),
);
});
}
......@@ -327,11 +327,11 @@ void main() {
test('UnconstrainedBox toString', () {
expect(
const UnconstrainedBox(constrainedAxis: Axis.vertical,).toString(),
equals('UnconstrainedBox(alignment: center, constrainedAxis: vertical)'),
equals('UnconstrainedBox(alignment: Alignment.center, constrainedAxis: vertical)'),
);
expect(
const UnconstrainedBox(constrainedAxis: Axis.horizontal, textDirection: TextDirection.rtl, alignment: Alignment.topRight).toString(),
equals('UnconstrainedBox(alignment: topRight, constrainedAxis: horizontal, textDirection: rtl)'),
equals('UnconstrainedBox(alignment: Alignment.topRight, constrainedAxis: horizontal, textDirection: rtl)'),
);
});
......
......@@ -94,7 +94,7 @@ void main() {
' │ parentData: offset=Offset(7.0, 7.0) (can use size)\n'
' │ constraints: BoxConstraints(w=39.0, h=64.0)\n'
' │ size: Size(39.0, 64.0)\n'
' │ alignment: bottomRight\n'
' │ alignment: Alignment.bottomRight\n'
' │ widthFactor: expand\n'
' │ heightFactor: expand\n'
' │\n'
......@@ -167,7 +167,7 @@ void main() {
' │ parentData: offset=Offset(7.0, 7.0) (can use size)\n'
' │ constraints: BoxConstraints(w=39.0, h=64.0)\n'
' │ size: Size(39.0, 64.0)\n'
' │ alignment: bottomRight\n'
' │ alignment: Alignment.bottomRight\n'
' │ widthFactor: expand\n'
' │ heightFactor: expand\n'
' │\n'
......@@ -265,7 +265,7 @@ void main() {
' │ layer: null\n'
' │ semantics node: null\n'
' │ size: Size(39.0, 64.0)\n'
' │ alignment: bottomRight\n'
' │ alignment: Alignment.bottomRight\n'
' │ textDirection: null\n'
' │ widthFactor: expand\n'
' │ heightFactor: expand\n'
......@@ -392,7 +392,7 @@ void main() {
' │ isBlockingSemanticsOfPreviouslyPaintedNodes: false\n'
' │ isSemanticBoundary: false\n'
' │ size: Size(39.0, 64.0)\n'
' │ alignment: bottomRight\n'
' │ alignment: Alignment.bottomRight\n'
' │ textDirection: null\n'
' │ widthFactor: expand\n'
' │ heightFactor: expand\n'
......
......@@ -44,7 +44,7 @@ void main() {
.where((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info))
.map((DiagnosticsNode n) => n.toString()).toList();
expect(description, <String>[
'alignment: center',
'alignment: Alignment.center',
'minWidth: 1.0',
'maxWidth: 2.0',
'minHeight: 3.0',
......
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