浏览代码

update

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
f7c98853
共有 14 个文件被更改,包括 489 次插入290 次删除
  1. 14
      com.unity.uiwidgets/Runtime/foundation/debug.cs
  2. 2
      com.unity.uiwidgets/Runtime/painting/beveled_rectangle_border.cs
  3. 273
      com.unity.uiwidgets/Runtime/painting/border_radius.cs
  4. 2
      com.unity.uiwidgets/Runtime/painting/continuous_rectangle_border.cs
  5. 15
      com.unity.uiwidgets/Runtime/painting/inline_span.cs
  6. 220
      com.unity.uiwidgets/Runtime/painting/matrix_utils.cs
  7. 4
      com.unity.uiwidgets/Runtime/painting/rounded_rectangle_border.cs
  8. 4
      com.unity.uiwidgets/Runtime/painting/shape_decoration.cs
  9. 7
      com.unity.uiwidgets/Runtime/painting/stadium_border.cs
  10. 29
      com.unity.uiwidgets/Runtime/painting/strut_style.cs
  11. 31
      com.unity.uiwidgets/Runtime/painting/text_painter.cs
  12. 2
      com.unity.uiwidgets/Runtime/painting/text_span.cs
  13. 165
      com.unity.uiwidgets/Runtime/painting/text_style.cs
  14. 11
      com.unity.uiwidgets/Runtime/widgets/debug.cs

14
com.unity.uiwidgets/Runtime/foundation/debug.cs


}*/
}
}
public static int? debugFloatPrecision;
public static string debugFormatFloat(float? value) {
if (value == null) {
return "null";
}
if (debugFloatPrecision != null) {
return value.Value.ToString($"N{debugFloatPrecision}");
}
return value.Value.ToString($"N1");
}
}
[Serializable]

2
com.unity.uiwidgets/Runtime/painting/beveled_rectangle_border.cs


public override ShapeBorder scale(float t) {
return new BeveledRectangleBorder(
side: side.scale(t),
borderRadius: borderRadius * t
borderRadius: (BorderRadius) (borderRadius * t)
);
}

273
com.unity.uiwidgets/Runtime/painting/border_radius.cs


return a.add((b.subtract(a)) * t);
}
public abstract BorderRadius resolve(TextDirection direction);
//
// @override
// String toString() {
// String visual, logical;
// if (_topLeft == _topRight &&
// _topRight == _bottomLeft &&
// _bottomLeft == _bottomRight) {
// if (_topLeft != Radius.zero) {
// if (_topLeft.x == _topLeft.y) {
// visual = 'BorderRadius.circular(${_topLeft.x.toStringAsFixed(1)})';
// }
// else {
// visual = 'BorderRadius.all($_topLeft)';
// }
// }
// }
// else {
// // visuals aren't the same and at least one isn't zero
// final StringBuffer result = StringBuffer();
// result.write('BorderRadius.only(');
// bool comma = false;
// if (_topLeft != Radius.zero) {
// result.write('topLeft: $_topLeft');
// comma = true;
// }
//
// if (_topRight != Radius.zero) {
// if (comma)
// result.write(', ');
// result.write('topRight: $_topRight');
// comma = true;
// }
//
// if (_bottomLeft != Radius.zero) {
// if (comma)
// result.write(', ');
// result.write('bottomLeft: $_bottomLeft');
// comma = true;
// }
//
// if (_bottomRight != Radius.zero) {
// if (comma)
// result.write(', ');
// result.write('bottomRight: $_bottomRight');
// }
//
// result.write(')');
// visual = result.toString();
// }
//
// if (_topStart == _topEnd &&
// _topEnd == _bottomEnd &&
// _bottomEnd == _bottomStart) {
// if (_topStart != Radius.zero) {
// if (_topStart.x == _topStart.y) {
// logical = 'BorderRadiusDirectional.circular(${_topStart.x.toStringAsFixed(1)})';
// }
// else {
// logical = 'BorderRadiusDirectional.all($_topStart)';
// }
// }
// }
// else {
// // logicals aren't the same and at least one isn't zero
// final StringBuffer result = StringBuffer();
// result.write('BorderRadiusDirectional.only(');
// bool comma = false;
// if (_topStart != Radius.zero) {
// result.write('topStart: $_topStart');
// comma = true;
// }
//
// if (_topEnd != Radius.zero) {
// if (comma)
// result.write(', ');
// result.write('topEnd: $_topEnd');
// comma = true;
// }
//
// if (_bottomStart != Radius.zero) {
// if (comma)
// result.write(', ');
// result.write('bottomStart: $_bottomStart');
// comma = true;
// }
//
// if (_bottomEnd != Radius.zero) {
// if (comma)
// result.write(', ');
// result.write('bottomEnd: $_bottomEnd');
// }
//
// result.write(')');
// logical = result.toString();
// }
//
// if (visual != null && logical != null)
// return '$visual + $logical';
// if (visual != null)
// return visual;
// if (logical != null)
// return logical;
// return 'BorderRadius.zero';
// }
public abstract BorderRadius resolve(TextDirection? textDirection);
public override string ToString() {
String visual = null, logical = null;
if (_topLeft == _topRight &&
_topRight == _bottomLeft &&
_bottomLeft == _bottomRight) {
if (_topLeft != Radius.zero) {
if (_topLeft.x == _topLeft.y) {
visual = $"BorderRadius.circular({_topLeft.x})";
}
else {
visual = $"BorderRadius.all({_topLeft})";
}
}
}
else {
StringBuilder result = new StringBuilder();
result.Append("BorderRadius.only(");
bool comma = false;
if (_topLeft != Radius.zero) {
result.Append($"topLeft: {_topLeft}");
comma = true;
}
if (_topRight != Radius.zero) {
if (comma)
result.Append(", ");
result.Append($"topRight: {_topRight}");
comma = true;
}
if (_bottomLeft != Radius.zero) {
if (comma)
result.Append(", ");
result.Append($"bottomLeft: {_bottomLeft}");
comma = true;
}
if (_bottomRight != Radius.zero) {
if (comma)
result.Append(", ");
result.Append($"bottomRight: {_bottomRight}");
}
result.Append(")");
visual = result.ToString();
}
if (_topStart == _topEnd &&
_topEnd == _bottomEnd &&
_bottomEnd == _bottomStart) {
if (_topStart != Radius.zero) {
if (_topStart.x == _topStart.y) {
logical = $"BorderRadiusDirectional.circular({_topStart.x})";
}
else {
logical = $"BorderRadiusDirectional.all({_topStart})";
}
}
}
else {
StringBuilder result = new StringBuilder();
result.Append("BorderRadiusDirectional.only(");
bool comma = false;
if (_topStart != Radius.zero) {
result.Append($"topStart: {_topStart}");
comma = true;
}
if (_topEnd != Radius.zero) {
if (comma)
result.Append(", ");
result.Append($"topEnd: {_topEnd}");
comma = true;
}
if (_bottomStart != Radius.zero) {
if (comma)
result.Append(", ");
result.Append($"bottomStart: {_bottomStart}");
comma = true;
}
if (_bottomEnd != Radius.zero) {
if (comma)
result.Append(", ");
result.Append($"bottomEnd: {_bottomEnd}");
}
result.Append(")");
logical = result.ToString();
}
if (visual != null && logical != null)
return $"{visual} + {logical}";
if (visual != null)
return visual;
if (logical != null)
return logical;
return "BorderRadius.zero";
}
public static bool operator ==(BorderRadiusGeometry left, BorderRadiusGeometry right) {
return Equals(left, right);

return !Equals(a, b);
}
public override BorderRadius resolve(TextDirection textDirection) => this;
public override string ToString() {
string visual = null;
if (topLeft == topRight &&
topRight == bottomLeft &&
bottomLeft == bottomRight) {
if (topLeft != Radius.zero) {
if (topLeft.x == topLeft.y) {
visual = $"BorderRadius.circular({topLeft.x:F1})";
}
else {
visual = $"BorderRadius.all({topLeft})";
}
}
}
else {
var result = new StringBuilder();
result.Append("BorderRadius.only(");
bool comma = false;
if (topLeft != Radius.zero) {
result.Append($"topLeft: {topLeft}");
comma = true;
}
if (topRight != Radius.zero) {
if (comma) {
result.Append(", ");
}
result.Append($"topRight: {topRight}");
comma = true;
}
if (bottomLeft != Radius.zero) {
if (comma) {
result.Append(", ");
}
result.Append($"bottomLeft: {bottomLeft}");
comma = true;
}
if (bottomRight != Radius.zero) {
if (comma) {
result.Append(", ");
}
result.Append($"bottomRight: {bottomRight}");
}
result.Append(")");
visual = result.ToString();
}
if (visual != null) {
return visual;
}
return "BorderRadius.zero";
}
public override BorderRadius resolve(TextDirection? textDirection) => this;
}

);
}
public override BorderRadius resolve(TextDirection direction) {
public override BorderRadius resolve(TextDirection? direction) {
switch (direction) {
case TextDirection.rtl:
return BorderRadius.only(

);
}
public override BorderRadius resolve(TextDirection direction) {
public override BorderRadius resolve(TextDirection? direction) {
switch (direction) {
case TextDirection.rtl:
return BorderRadius.only(

2
com.unity.uiwidgets/Runtime/painting/continuous_rectangle_border.cs


public override ShapeBorder scale(float t) {
return new ContinuousRectangleBorder(
side: side.scale(t),
borderRadius: borderRadius * t
borderRadius: (BorderRadius) (borderRadius * t)
);
}

15
com.unity.uiwidgets/Runtime/painting/inline_span.cs


public abstract class InlineSpan : DiagnosticableTree, IEquatable<InlineSpan> {
public InlineSpan(
TextStyle style = null
TextStyle style = null
public abstract void build(ParagraphBuilder builder,
float textScaleFactor = 1, List<PlaceholderDimensions> dimensions = null
);

public virtual string toPlainText(
bool includeSemanticsLabels = true,
bool includePlaceholders = true)
{
bool includePlaceholders = true) {
StringBuilder buffer = new StringBuilder();
computeToPlainText(buffer, includeSemanticsLabels: includeSemanticsLabels,
includePlaceholders: includePlaceholders);

public abstract void computeToPlainText(
StringBuilder buffer,
bool includeSemanticsLabels = true,
bool includeSemanticsLabels = true,
bool includePlaceholders = true);
public int? codeUnitAt(int index) {

public virtual bool debugAssertIsValid() => true;
public abstract RenderComparison compareTo(InlineSpan other);
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
public virtual void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.defaultDiagnosticsTreeStyle = DiagnosticsTreeStyle.whitespace;
if (style != null) {

public override int GetHashCode() {
return (style != null ? style.GetHashCode() : 0);
}
public static bool operator ==(InlineSpan left, InlineSpan right) {
return Equals(left, right);
}

220
com.unity.uiwidgets/Runtime/painting/matrix_utils.cs


public static float dot(this Vector3 left, Vector3 right) {
return left.x * right.x + left.y * right.y + left.z * right.z;
}
public static Offset getAsTranslation(this Matrix4 values) {
if (values[0] == 1 && // col 1
values[1] == 0 &&

return null;
}
}
q.w = Mathf.Sqrt( Mathf.Max( 0, 1 + m.entry(0,0) + m.entry(1,1) + m.entry(2,2) ) ) / 2;
q.x = Mathf.Sqrt( Mathf.Max( 0, 1 + m.entry(0,0) - m.entry(1,1) - m.entry(2,2) ) ) / 2;
q.y = Mathf.Sqrt( Mathf.Max( 0, 1 - m.entry(0,0) + m.entry(1,1) - m.entry(2,2) ) ) / 2;
q.z = Mathf.Sqrt( Mathf.Max( 0, 1 - m.entry(0,0) - m.entry(1,1) + m.entry(2,2) ) ) / 2;
q.x *= Mathf.Sign( q.x * ( m.entry(2,1) - m.entry(1,2) ) );
q.y *= Mathf.Sign( q.y * ( m.entry(0,2) - m.entry(2,0) ) );
q.z *= Mathf.Sign( q.z * ( m.entry(1,0) - m.entry(0,1) ) );
q.w = Mathf.Sqrt(Mathf.Max(0, 1 + m.entry(0, 0) + m.entry(1, 1) + m.entry(2, 2))) / 2;
q.x = Mathf.Sqrt(Mathf.Max(0, 1 + m.entry(0, 0) - m.entry(1, 1) - m.entry(2, 2))) / 2;
q.y = Mathf.Sqrt(Mathf.Max(0, 1 - m.entry(0, 0) + m.entry(1, 1) - m.entry(2, 2))) / 2;
q.z = Mathf.Sqrt(Mathf.Max(0, 1 - m.entry(0, 0) - m.entry(1, 1) + m.entry(2, 2))) / 2;
q.x *= Mathf.Sign(q.x * (m.entry(2, 1) - m.entry(1, 2)));
q.y *= Mathf.Sign(q.y * (m.entry(0, 2) - m.entry(2, 0)));
q.z *= Mathf.Sign(q.z * (m.entry(1, 0) - m.entry(0, 1)));
}
public static Quaternion scaled(this Quaternion lhs, float scale) {

lhs.w *= scale;
return lhs;
}
public static Quaternion add(this Quaternion lhs, Quaternion rhs) {
lhs.x += rhs.x;
lhs.y += rhs.y;

return new List<string> {"null"};
}
List<string> result = new List<string>(3);
List<string> result = new List<string>(){
$"[0] ${D.debugFormatFloat(transform.entry(0, 0))},${D.debugFormatFloat(transform.entry(0, 1))},${D.debugFormatFloat(transform.entry(0, 2))},${D.debugFormatFloat(transform.entry(0, 3))}",
$"[1] ${D.debugFormatFloat(transform.entry(1, 0))},${D.debugFormatFloat(transform.entry(1, 1))},${D.debugFormatFloat(transform.entry(1, 2))},${D.debugFormatFloat(transform.entry(1, 3))}",
$"[2] ${D.debugFormatFloat(transform.entry(2, 0))},${D.debugFormatFloat(transform.entry(2, 1))},${D.debugFormatFloat(transform.entry(2, 2))},${D.debugFormatFloat(transform.entry(2, 3))}",
$"[3] ${D.debugFormatFloat(transform.entry(3, 0))},${D.debugFormatFloat(transform.entry(3, 1))},${D.debugFormatFloat(transform.entry(3, 2))},${D.debugFormatFloat(transform.entry(3, 3))}"
};
for (int i = 0; i < 3; i++) {
result.Add($"[{i}] {transform[i * 3]}, {transform[i * 3 + 1]}, {transform[i * 3 + 2]}");
}

public static Offset transformPoint(Matrix4 transform, Offset point) {
Vector3 position3 = new Vector3(point.dx, point.dy, 0);
Vector3 transformed3 = transform.perspectiveTransform(position3);
return new Offset(transformed3.x, transformed3.y);
float[] storage = transform.storage;
float x = point.dx;
float y = point.dy;
float rx = storage[0] * x + storage[4] * y + storage[12];
float ry = storage[1] * x + storage[5] * y + storage[13];
float rw = storage[3] * x + storage[7] * y + storage[15];
if (rw == 1.0f) {
return new Offset(rx, ry);
}
else {
return new Offset(rx / rw, ry / rw);
}
}
internal static Rect _safeTransformRect(Matrix4 transform, Rect rect) {
float[] storage = transform.storage;
bool isAffine = storage[3] == 0.0 &&
storage[7] == 0.0 &&
storage[15] == 1.0;
_minMax = _minMax ?? new float[4];
_accumulate(storage, rect.left, rect.top, true, isAffine);
_accumulate(storage, rect.right, rect.top, false, isAffine);
_accumulate(storage, rect.left, rect.bottom, false, isAffine);
_accumulate(storage, rect.right, rect.bottom, false, isAffine);
return Rect.fromLTRB(_minMax[0], _minMax[1], _minMax[2], _minMax[3]);
}
static float[] _minMax;
static void _accumulate(float[] m, float x, float y, bool first, bool isAffine) {
float w = isAffine ? 1.0f : 1.0f / (m[3] * x + m[7] * y + m[15]);
float tx = (m[0] * x + m[4] * y + m[12]) * w;
float ty = (m[1] * x + m[5] * y + m[13]) * w;
if (first) {
_minMax[0] = _minMax[2] = tx;
_minMax[1] = _minMax[3] = ty;
}
else {
if (tx < _minMax[0]) {
_minMax[0] = tx;
}
if (ty < _minMax[1]) {
_minMax[1] = ty;
}
if (tx > _minMax[2]) {
_minMax[2] = tx;
}
if (ty > _minMax[3]) {
_minMax[3] = ty;
}
}
Offset point1 = transformPoint(transform, rect.topLeft);
Offset point2 = transformPoint(transform, rect.topRight);
Offset point3 = transformPoint(transform, rect.bottomLeft);
Offset point4 = transformPoint(transform, rect.bottomRight);
return Rect.fromLTRB(
_min4(point1.dx, point2.dx, point3.dx, point4.dx),
_min4(point1.dy, point2.dy, point3.dy, point4.dy),
_max4(point1.dx, point2.dx, point3.dx, point4.dx),
_max4(point1.dy, point2.dy, point3.dy, point4.dy)
);
float[] storage = transform.storage;
float x = rect.left;
float y = rect.top;
float w = rect.right - x;
float h = rect.bottom - y;
if (!w.isFinite() || !h.isFinite()) {
return _safeTransformRect(transform, rect);
}
float wx = storage[0] * w;
float hx = storage[4] * h;
float rx = storage[0] * x + storage[4] * y + storage[12];
float wy = storage[1] * w;
float hy = storage[5] * h;
float ry = storage[1] * x + storage[5] * y + storage[13];
if (storage[3] == 0.0f && storage[7] == 0.0f && storage[15] == 1.0f) {
float left = rx;
float right = rx;
if (wx < 0) {
left += wx;
}
else {
right += wx;
}
if (hx < 0) {
left += hx;
}
else {
right += hx;
}
float top = ry;
float bottom = ry;
if (wy < 0) {
top += wy;
}
else {
bottom += wy;
}
if (hy < 0) {
top += hy;
}
else {
bottom += hy;
}
return Rect.fromLTRB(left, top, right, bottom);
}
else {
float ww = storage[3] * w;
float hw = storage[7] * h;
float rw = storage[3] * x + storage[7] * y + storage[15];
float ulx = rx / rw;
float uly = ry / rw;
float urx = (rx + wx) / (rw + ww);
float ury = (ry + wy) / (rw + ww);
float llx = (rx + hx) / (rw + hw);
float lly = (ry + hy) / (rw + hw);
float lrx = (rx + wx + hx) / (rw + ww + hw);
float lry = (ry + wy + hy) / (rw + ww + hw);
return Rect.fromLTRB(
_min4(ulx, urx, llx, lrx),
_min4(uly, ury, lly, lry),
_max4(ulx, urx, llx, lrx),
_max4(uly, ury, lly, lry)
);
}
}
static bool isIdentity(Matrix4 a) {

&& a[14] == 0.0
&& a[15] == 1.0;
}
public static Rect inverseTransformRect(Matrix4 transform, Rect rect) {
D.assert(rect != null);
D.assert(transform.determinant() != 0.0);

return transformRect(transform, rect);
}
return Mathf.Min(a, Mathf.Min(b, Mathf.Min(c, d)));
float e = (a < b) ? a : b;
float f = (c < d) ? c : d;
return (e < f) ? e : f;
return Mathf.Max(a, Mathf.Max(b, Mathf.Max(c, d)));
float e = (a > b) ? a : b;
float f = (c > d) ? c : d;
return (e > f) ? e : f;
}
static Matrix4 createCylindricalProjectionTransform(
float radius,
float angle,
float perspective = 0.001f,
Axis? orientation = null
) {
D.assert(perspective >= 0 && perspective <= 1.0);
if (orientation == null) {
orientation = Axis.vertical;
}
Matrix4 result = Matrix4.identity();
result.setEntry(3, 2, -perspective);
result.setEntry(2, 3, -radius);
result.setEntry(3, 3, perspective * radius + 1.0f);
result = result * ((
orientation == Axis.horizontal
? Matrix4.rotationY(angle)
: Matrix4.rotationX(angle)
) * Matrix4.translationValues(0.0f, 0.0f, radius)) as Matrix4;
return result;
}
static Matrix4 forceToPoint(Offset offset) {
var result = Matrix4.identity();
result.setRow(0, new Vector4(0, 0, 0, offset.dx));
result.setRow(1, new Vector4(0, 0, 0, offset.dy));
return result;
}
}

object defaultValue = null,
DiagnosticLevel level = DiagnosticLevel.info
) : base(name, value, showName: showName, defaultValue: defaultValue ?? foundation_.kNoDefaultValue,
level: level) { }
level: level) {
}
protected override string valueToString(TextTreeConfiguration parentConfiguration = null) {
if (parentConfiguration != null && !parentConfiguration.lineBreakProperties) {

4
com.unity.uiwidgets/Runtime/painting/rounded_rectangle_border.cs


public override ShapeBorder scale(float t) {
return new RoundedRectangleBorder(
side: side.scale(t),
borderRadius: borderRadius * t
borderRadius: (BorderRadius) (borderRadius * t)
);
}

public override ShapeBorder scale(float t) {
return new _RoundedRectangleToCircleBorder(
side: side.scale(t),
borderRadius: borderRadius * t,
borderRadius: (BorderRadius) (borderRadius * t),
circleness: t
);
}

4
com.unity.uiwidgets/Runtime/painting/shape_decoration.cs


public override Path getClipPath(Rect rect, TextDirection textDirection) {
return shape.getOuterPath(rect);
}
public override EdgeInsetsGeometry padding {
get { return shape.dimensions; }
}

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.defaultDiagnosticsTreeStyle = DiagnosticsTreeStyle.whitespace;
properties.add(new DiagnosticsProperty<Color>("color", color,
properties.add(new ColorProperty("color", color,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<Gradient>("gradient", gradient,
defaultValue: foundation_.kNullDefaultValue));

7
com.unity.uiwidgets/Runtime/painting/stadium_border.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.painting {

}
public override string ToString() {
return $"{GetType()}({side})";
return $"{foundation_.objectRuntimeType(this, "StadiumBorder")}({side})";
}
}

}
public override string ToString() {
return $"StadiumBorder($side, {circleness * 100:F1}% " +
return $"StadiumBorder({side}, {circleness * 100:F1}% " +
"of the way to being a CircleBorder)";
}
}

public override ShapeBorder scale(float t) {
return new _StadiumToRoundedRectangleBorder(
side: side.scale(t),
borderRadius: borderRadius * t,
borderRadius: (BorderRadius) (borderRadius * t),
rectness: t
);
}

29
com.unity.uiwidgets/Runtime/painting/strut_style.cs


}
public override string toStringShort() {
return $"{GetType()}";
return $"{foundation_.objectRuntimeType(this, "StrutStyle")}";
debugFillProperties(properties, "");
}
public void debugFillProperties(DiagnosticPropertiesBuilder properties, string prefix = "") {
properties.add(new MessageProperty("debugLabel", debugLabel));
properties.add(new MessageProperty($"{prefix}debugLabel", debugLabel));
styles.Add(new StringProperty("family", fontFamily, defaultValue: foundation_.kNullDefaultValue,
styles.Add(new StringProperty($"{prefix}family", fontFamily, defaultValue: foundation_.kNullDefaultValue,
styles.Add(new EnumerableProperty<string>("familyFallback", fontFamilyFallback));
styles.Add(new DiagnosticsProperty<float?>("size", fontSize,
styles.Add(new EnumerableProperty<string>($"{prefix}familyFallback", fontFamilyFallback));
styles.Add(new DiagnosticsProperty<float?>($"{prefix}size", fontSize,
defaultValue: foundation_.kNullDefaultValue));
string weightDescription = "";
if (fontWeight != null) {

styles.Add(new DiagnosticsProperty<FontWeight>(
"weight", fontWeight,
$"{prefix}weight", fontWeight,
styles.Add(new EnumProperty<FontStyle?>("style", fontStyle,
styles.Add(new EnumProperty<FontStyle?>($"{prefix}style", fontStyle,
styles.Add(new DiagnosticsProperty<float?>("height", height,
defaultValue: foundation_.kNullDefaultValue));
styles.Add(new FlagProperty("forceStrutHeight", value: forceStrutHeight,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}height", height,
styles.Add(new FlagProperty($"{prefix}forceStrutHeight", value: forceStrutHeight,
defaultValue: foundation_.kNullDefaultValue, ifTrue: $"{prefix}<strut height forced>",
ifFalse: $"{prefix}<strut height normal>"));
bool styleSpecified = styles.Any((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info));
foreach (var style in styles) {

if (!styleSpecified) {
properties.add(new FlagProperty("forceStrutHeight", value: forceStrutHeight,
ifTrue: "<strut height forced>",
ifFalse: "<strut height normal>"));
ifTrue: $"{prefix}<strut height forced>",
ifFalse: $"{prefix}<strut height normal>"));
}
}
}

31
com.unity.uiwidgets/Runtime/painting/text_painter.cs


markNeedsLayout();
}
}
get {
return _locale;
}
get { return _locale; }
set {
if (_locale == value)
return;

}
public TextWidthBasis textWidthBasis {
get { return _textWidthBasis; }
set {

_paragraph.layout(new ParagraphConstraints(newWidth));
}
}
_inlinePlaceholderBoxes = _paragraph.getBoxesForPlaceholders();
}

BoxHeightStyle boxHeightStyle = BoxHeightStyle.tight,
BoxWidthStyle boxWidthStyle = BoxWidthStyle.tight) {
D.assert(!_needsLayout);
var results = _paragraph.getBoxesForRange(selection.start, selection.end, boxHeightStyle: boxHeightStyle,
var results = _paragraph.getBoxesForRange(
selection.start,
selection.end,
boxHeightStyle: boxHeightStyle,
boxWidthStyle: boxWidthStyle);
return results;
}

D.assert(!_needsLayout);
return _paragraph.getLineBoundary(position);
}
List<ui.LineMetrics> computeLineMetrics() {
D.assert(!_needsLayout);
return _paragraph.computeLineMetrics();
}
ParagraphStyle _createParagraphStyle(TextDirection defaultTextDirection = TextDirection.ltr) {
D.assert(textAlign != null);

textDirection: textDirection ?? defaultTextDirection,
textScaleFactor: textScaleFactor,
maxLines: _maxLines,
// textHeightBehavior: _textHeightBehavior,
ellipsis: _ellipsis
// locale: _locale,
// strutStyle: _strutStyle,
textHeightBehavior: _textHeightBehavior,
ellipsis: _ellipsis,
locale: _locale,
strutStyle: _strutStyle
ellipsis: ellipsis
// locale: locale,
ellipsis: ellipsis,
locale: locale
);
}

2
com.unity.uiwidgets/Runtime/painting/text_span.cs


}
public override string toStringShort() {
return GetType().ToString();
return foundation_.objectRuntimeType(this, "TextSpan");
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

165
com.unity.uiwidgets/Runtime/painting/text_style.cs


}
public RenderComparison compareTo(TextStyle other) {
if (inherit != other.inherit || fontFamily != other.fontFamily ||
fontSize != other.fontSize || fontWeight != other.fontWeight ||
fontStyle != other.fontStyle || letterSpacing != other.letterSpacing ||
wordSpacing != other.wordSpacing || textBaseline != other.textBaseline ||
height != other.height || background != other.background ||
shadows.equalsList(other.shadows) || fontFeatures.equalsList(other.fontFeatures)) {
if (ReferenceEquals(this, other))
return RenderComparison.identical;
if (inherit != other.inherit ||
fontFamily != other.fontFamily ||
fontSize != other.fontSize ||
fontWeight != other.fontWeight ||
fontStyle != other.fontStyle ||
letterSpacing != other.letterSpacing ||
wordSpacing != other.wordSpacing ||
textBaseline != other.textBaseline ||
height != other.height ||
foreground != other.foreground ||
background != other.background ||
!shadows.equalsList(other.shadows) ||
!fontFeatures.equalsList(other.fontFeatures) ||
!fontFamilyFallback.equalsList(other.fontFamilyFallback)) {
if (color != other.color || decoration != other.decoration ||
if (color != other.color ||
backgroundColor != other.backgroundColor ||
decoration != other.decoration ||
decorationColor != other.decorationColor ||
decorationStyle != other.decorationStyle) {
return RenderComparison.paint;

}
public ParagraphStyle getParagraphStyle(TextAlign textAlign,
TextDirection textDirection, string ellipsis, int? maxLines,
public ParagraphStyle getParagraphStyle(
TextAlign textAlign,
TextDirection textDirection,
float? textScaleFactor = 1.0f,
string ellipsis = null,
int? maxLines = null,
float textScaleFactor = 1.0f) {
return new ParagraphStyle(
Locale locale = null,
String fontFamily = null,
float? fontSize = null,
FontWeight fontWeight = null,
FontStyle? fontStyle = null,
float? height = null,
StrutStyle strutStyle = null
) {
D.assert(textScaleFactor != null);
D.assert(maxLines == null || maxLines > 0);
return new ui.ParagraphStyle(
fontWeight: fontWeight,
fontStyle: fontStyle,
maxLines: maxLines,
fontSize: (fontSize ?? _defaultFontSize) * textScaleFactor,
fontFamily: fontFamily,
height: height,
fontWeight: fontWeight ?? this.fontWeight,
fontStyle: fontStyle ?? this.fontStyle,
fontFamily: fontFamily ?? this.fontFamily,
fontSize: (fontSize ?? this.fontSize ?? _defaultFontSize) * textScaleFactor,
height: height ?? this.height,
ellipsis: ellipsis
strutStyle: strutStyle == null
? null
: new ui.StrutStyle(
fontFamily: strutStyle.fontFamily,
fontFamilyFallback: strutStyle.fontFamilyFallback,
fontSize: strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor,
height: strutStyle.height,
leading: strutStyle.leading,
fontWeight: strutStyle.fontWeight,
fontStyle: strutStyle.fontStyle,
forceStrutHeight: strutStyle.forceStrutHeight
),
maxLines: maxLines,
ellipsis: ellipsis,
locale: locale
);
}

decorationThickness: decorationThickness == null
? null
: decorationThickness * decorationThicknessFactor + decorationThicknessDelta,
shadows: shadows ?? this.shadows,
shadows: shadows ?? this.shadows,
fontFeatures: fontFeatures,
debugLabel: modifiedDebugLabel
);

);
}
ui.ParagraphStyle getParagraphStyle(
TextAlign? textAlign = null,
TextDirection? textDirection = null,
float textScaleFactor = 1.0f,
String ellipsis = null,
int? maxLines = null,
ui.TextHeightBehavior textHeightBehavior = null,
Locale locale = null,
String fontFamily = null,
float? fontSize = null,
FontWeight fontWeight = null,
FontStyle? fontStyle = null,
float? height = null,
StrutStyle strutStyle = null
) {
D.assert(maxLines == null || maxLines > 0);
return new ui.ParagraphStyle(
textAlign: textAlign,
textDirection: textDirection,
fontWeight: fontWeight ?? this.fontWeight,
fontStyle: fontStyle ?? this.fontStyle,
fontFamily: fontFamily ?? this.fontFamily,
fontSize: (fontSize ?? this.fontSize ?? _defaultFontSize) * textScaleFactor,
height: height ?? this.height,
textHeightBehavior: textHeightBehavior,
strutStyle: strutStyle == null
? null
: new ui.StrutStyle(
fontFamily: strutStyle.fontFamily,
fontFamilyFallback: strutStyle.fontFamilyFallback,
fontSize: strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor,
height: strutStyle.height,
leading: strutStyle.leading,
fontWeight: strutStyle.fontWeight,
fontStyle: strutStyle.fontStyle,
forceStrutHeight: strutStyle.forceStrutHeight
),
maxLines: maxLines,
ellipsis: ellipsis,
locale: locale
);
}
public ui.TextStyle getTextStyle(float textScaleFactor = 1.0f) {
var backgroundPaint = new Paint();
if (background != null) {

);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
debugFillProperties(properties, "");
}
public void debugFillProperties(DiagnosticPropertiesBuilder properties, string prefix = "") {
styles.Add(new DiagnosticsProperty<Color>("color", color,
styles.Add(new ColorProperty($"{prefix}color", color,
styles.Add(new DiagnosticsProperty<Color>("backgroundColor", backgroundColor,
styles.Add(new ColorProperty($"{prefix}backgroundColor", backgroundColor,
styles.Add(new StringProperty("family", fontFamily, defaultValue: foundation_.kNullDefaultValue,
styles.Add(new StringProperty($"{prefix}family", fontFamily, defaultValue: foundation_.kNullDefaultValue,
styles.Add(new EnumerableProperty<string>("familyFallback", fontFamilyFallback,
styles.Add(new EnumerableProperty<string>($"{prefix}familyFallback", fontFamilyFallback,
styles.Add(new DiagnosticsProperty<float?>("size", fontSize,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}size", fontSize,
defaultValue: foundation_.kNullDefaultValue));
string weightDescription = "";
if (fontWeight != null) {

description: weightDescription,
defaultValue: foundation_.kNullDefaultValue
));
styles.Add(new EnumProperty<FontStyle?>("style", fontStyle,
styles.Add(new EnumProperty<FontStyle?>($"{prefix}style", fontStyle,
styles.Add(new DiagnosticsProperty<float?>("letterSpacing", letterSpacing,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}letterSpacing", letterSpacing,
styles.Add(new DiagnosticsProperty<float?>("wordSpacing", wordSpacing,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}wordSpacing", wordSpacing,
styles.Add(new EnumProperty<TextBaseline?>("baseline", textBaseline,
styles.Add(new EnumProperty<TextBaseline?>($"{prefix}baseline", textBaseline,
styles.Add(new DiagnosticsProperty<float?>("height", height,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}height", height,
styles.Add(new StringProperty("foreground", foreground == null ? null : foreground.ToString(),
styles.Add(new StringProperty($"{prefix}foreground", foreground == null ? null : foreground.ToString(),
styles.Add(new StringProperty("background", background == null ? null : background.ToString(),
styles.Add(new StringProperty($"{prefix}background", background == null ? null : background.ToString(),
defaultValue: foundation_.kNullDefaultValue, quoted: false));
if (decoration != null) {
List<string> decorationDescription = new List<string>();

styles.Add(new DiagnosticsProperty<Color>("decorationColor", decorationColor,
styles.Add(new ColorProperty($"{prefix}decorationColor", decorationColor,
defaultValue: foundation_.kNullDefaultValue,
level: DiagnosticLevel.fine));
if (decorationColor != null) {

styles.Add(new DiagnosticsProperty<TextDecoration>("decoration", decoration,
styles.Add(new DiagnosticsProperty<TextDecoration>($"{prefix}decoration", decoration,
decorationDescription.Add("$decoration");
decorationDescription.Add($"{decoration}");
styles.Add(new MessageProperty("decoration", string.Join(" ", decorationDescription.ToArray())));
styles.Add(new FloatProperty("decorationThickness", decorationThickness, unit: "x",
styles.Add(new MessageProperty($"{prefix}decoration", string.Join(" ", decorationDescription.ToArray())));
styles.Add(new FloatProperty($"{prefix}decorationThickness", decorationThickness, unit: "x",
defaultValue: foundation_.kNoDefaultValue));
}

}
if (!styleSpecified) {
properties.add(new FlagProperty("inherit", value: inherit, ifTrue: "<all styles inherited>",
ifFalse: "<no style specified>"));
properties.add(new FlagProperty("inherit", value: inherit, ifTrue: $"{prefix}<all styles inherited>",
ifFalse: $"{prefix}<no style specified>"));
}
}

Equals(background, other.background) &&
fontFamilyFallback.equalsList(other.fontFamilyFallback) &&
shadows.equalsList(other.shadows) &&
fontFeatures.equalsList(other.fontFeatures) &&
fontFeatures.equalsList(other.fontFeatures) &&
string.Equals(fontFamily, other.fontFamily);
}

11
com.unity.uiwidgets/Runtime/widgets/debug.cs


return true;
}
/*static int debugDoublePrecision;
public static string debugFormatDouble(float value) {
if (value == null) {
return "null";
}
if (debugDoublePrecision != null) {
return value.toStringAsPrecision(debugDoublePrecision);
}
return value.toStringAsFixed(1);
}*/
internal static UIWidgetsErrorDetails _debugReportException(
string context,
Exception exception,

正在加载...
取消
保存