浏览代码

temporary fix

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
b094c0f3
共有 8 个文件被更改,包括 1067 次插入235 次删除
  1. 34
      com.unity.uiwidgets/Runtime/painting/basic_types.cs
  2. 2
      com.unity.uiwidgets/Runtime/rendering/performance_overlay.cs
  3. 34
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  4. 176
      com.unity.uiwidgets/Runtime/rendering/stack.cs
  5. 5
      com.unity.uiwidgets/Runtime/widgets/automatic_keep_alive.cs
  6. 112
      com.unity.uiwidgets/Runtime/widgets/banner.cs
  7. 932
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  8. 7
      com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs

34
com.unity.uiwidgets/Runtime/painting/basic_types.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

Axis axis,
bool reverse) {
switch (axis) {
case Axis.horizontal:
/*case Axis.horizontal:
return reverse ? AxisDirection.up : AxisDirection.down;*/
case Axis.horizontal:
D.assert(WidgetsD.debugCheckHasDirectionality(context));
TextDirection textDirection = Directionality.of(context);
AxisDirection axisDirection = (AxisDirection)textDirectionToAxisDirection(textDirection);
return reverse ? flipAxisDirection(axisDirection) : axisDirection;
case Axis.vertical:
return null;
}
public static AxisDirection? textDirectionToAxisDirection(TextDirection textDirection) {
D.assert(textDirection != null);
switch (textDirection) {
case TextDirection.rtl:
return AxisDirection.left;
case TextDirection.ltr:
return AxisDirection.right;
}
return null;
}
public static AxisDirection? flipAxisDirection(AxisDirection axisDirection) {
D.assert(axisDirection != null);
switch (axisDirection) {
case AxisDirection.up:
return AxisDirection.down;
case AxisDirection.right:
return AxisDirection.left;
case AxisDirection.down:
return AxisDirection.up;
case AxisDirection.left:
return AxisDirection.right;
}
return null;
}
}

2
com.unity.uiwidgets/Runtime/rendering/performance_overlay.cs


namespace Unity.UIWidgets.rendering {
public enum PerformanceOverlayOption {
//drawFPS, //default
//drawFrameCost,
displayRasterizerStatistics,
visualizeRasterizerStatistics,
displayEngineStatistics,

34
com.unity.uiwidgets/Runtime/rendering/proxy_box.cs


}
public class RenderAspectRatio : RenderProxyBox {
public RenderAspectRatio(float aspectRatio, RenderBox child = null) : base(child) {
public RenderAspectRatio(
float aspectRatio,
RenderBox child = null) : base(child) {
_aspectRatio = aspectRatio;
}

public class RenderTransform : RenderProxyBox {
public RenderTransform(
Matrix4 transform,
Matrix4 transform ,
Alignment alignment = null,
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,
bool transformHitTests = true,
RenderBox child = null
) : base(child) {

this.textDirection = textDirection;
this.transformHitTests = transformHitTests;
}

Offset _origin;
public Alignment alignment {
public AlignmentGeometry alignment {
get { return _alignment; }
set {
if (_alignment == value) {

}
}
Alignment _alignment;
AlignmentGeometry _alignment;
public TextDirection? textDirection {
get { return _textDirection; }
set {
if (_textDirection == value)
return;
_textDirection = value;
markNeedsPaint();
//markNeedsSemanticsUpdate();
}
}
TextDirection? _textDirection;
public bool transformHitTests;

Matrix4 _effectiveTransform {
get {
Alignment resolvedAlignment = alignment;
Alignment resolvedAlignment = alignment?.resolve(textDirection);
if (_origin == null && resolvedAlignment == null) {
return _transform;
}

base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Matrix4>("transform matrix", _transform));
properties.add(new DiagnosticsProperty<Offset>("origin", origin));
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
}
}

176
com.unity.uiwidgets/Runtime/rendering/stack.cs


public class RenderStack : RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<RenderBox,
StackParentData> {
public RenderStack(
StackFit? fit,
Overflow? overflow,
TextDirection textDirection,
Alignment alignment = null) {
this.textDirection = textDirection;
_alignment = alignment ?? Alignment.topLeft;
_fit = fit ?? StackFit.loose;
_overflow = overflow ?? Overflow.clip;
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,
StackFit fit = StackFit.loose,
Overflow overflow = Overflow.clip
) {
_textDirection = textDirection;
_alignment = alignment ?? AlignmentDirectional.topStart;
_fit = fit;
_overflow = overflow;
addAll(children);
}

child.parentData = new StackParentData();
}
}
void _resolve() {
if (_resolvedAlignment != null)
return;
_resolvedAlignment = alignment.resolve(textDirection);
}
Alignment _resolvedAlignment;

}
public TextDirection textDirection {
public TextDirection? textDirection {
get {
return _textDirection;
}

}
}
TextDirection _textDirection;
TextDirection? _textDirection;
Alignment _alignment;
AlignmentGeometry _alignment;
public Alignment alignment {
public AlignmentGeometry alignment {
get { return _alignment; }
set {
if (_alignment == value) {

}
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
_resolve();
D.assert(_resolvedAlignment != null);
size = constraints.biggest;
return;
size = constraints.biggest;
D.assert(size.isFinite);
return;
}
float width = constraints.minWidth;

D.assert(fit != null);
case StackFit.loose:
nonPositionedConstraints = constraints.loosen();
break;
case StackFit.expand:
nonPositionedConstraints = BoxConstraints.tight(constraints.biggest);
break;
case StackFit.passthrough:
nonPositionedConstraints = constraints;
break;
case StackFit.loose:
nonPositionedConstraints = constraints.loosen();
break;
case StackFit.expand:
nonPositionedConstraints = BoxConstraints.tight(constraints.biggest);
break;
case StackFit.passthrough:
nonPositionedConstraints = constraints;
break;
D.assert(nonPositionedConstraints != null);
StackParentData childParentData = (StackParentData) child.parentData;
StackParentData childParentData = child.parentData as StackParentData;
if (!childParentData.isPositioned) {
hasNonPositionedChildren = true;
if (!childParentData.isPositioned) {
hasNonPositionedChildren = true;
child.layout(nonPositionedConstraints, parentUsesSize: true);
child.layout(nonPositionedConstraints, parentUsesSize: true);
Size childSize = child.size;
width = Mathf.Max(width, childSize.width);
height = Mathf.Max(height, childSize.height);
}
Size childSize = child.size;
width = Mathf.Max(width, childSize.width);
height = Mathf.Max(height, childSize.height);
}
child = childParentData.nextSibling;
child = childParentData.nextSibling;
size = new Size(width, height);
D.assert(size.width == constraints.constrainWidth(width));
D.assert(size.height == constraints.constrainHeight(height));
}
else {
size = constraints.biggest;
size = new Size(width, height);
D.assert(size.width == constraints.constrainWidth(width));
D.assert(size.height == constraints.constrainHeight(height));
} else {
size = constraints.biggest;
D.assert(size.isFinite);
StackParentData childParentData = (StackParentData) child.parentData;
if (!childParentData.isPositioned) {
childParentData.offset = _alignment.alongOffset(size - child.size);
}
else {
BoxConstraints childConstraints = new BoxConstraints();
if (childParentData.left != null && childParentData.right != null) {
childConstraints =
childConstraints.tighten(
width: size.width - childParentData.right - childParentData.left);
}
else if (childParentData.width != null) {
childConstraints = childConstraints.tighten(width: childParentData.width);
}
if (childParentData.top != null && childParentData.bottom != null) {
childConstraints =
childConstraints.tighten(
height: size.height - childParentData.bottom - childParentData.top);
}
else if (childParentData.height != null) {
childConstraints = childConstraints.tighten(height: childParentData.height);
}
child.layout(childConstraints, parentUsesSize: true);
float x;
if (childParentData.left != null) {
x = childParentData.left.Value;
}
else if (childParentData.right != null) {
x = size.width - childParentData.right.Value - child.size.width;
}
else {
x = _alignment.alongOffset(size - child.size).dx;
}
if (x < 0.0 || x + child.size.width > size.width) {
_hasVisualOverflow = true;
}
float y;
if (childParentData.top != null) {
y = childParentData.top.Value;
}
else if (childParentData.bottom != null) {
y = size.height - childParentData.bottom.Value - child.size.height;
}
else {
y = _alignment.alongOffset(size - child.size).dy;
}
StackParentData childParentData = child.parentData as StackParentData;
if (y < 0.0 || y + child.size.height > size.height) {
_hasVisualOverflow = true;
}
childParentData.offset = new Offset(x, y);
}
if (!childParentData.isPositioned) {
childParentData.offset = _resolvedAlignment.alongOffset(size - child.size as Offset);
} else {
_hasVisualOverflow = layoutPositionedChild(child, childParentData, size, _resolvedAlignment) || _hasVisualOverflow;
}
D.assert(child.parentData == childParentData);
child = childParentData.nextSibling;
D.assert(child.parentData == childParentData);
child = childParentData.nextSibling;
}
}

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new EnumProperty<StackFit>("fit", fit));
properties.add(new EnumProperty<Overflow>("overflow", overflow));
}

public RenderIndexedStack(
List<RenderBox> children = null,
Alignment alignment = null,
TextDirection textDirection = default,
int? index = 0
) : base(fit: null, overflow: null, textDirection: textDirection, children: children, alignment: alignment ?? Alignment.topLeft) {
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,
int index = 0
) : base(
children: children,
alignment: alignment ?? AlignmentDirectional.topStart,
textDirection: textDirection) {
public int? index {
public int index {
get { return _index; }
set {
if (_index != value) {

}
}
int? _index;
int _index;
RenderBox _childAtIndex() {
D.assert(index != null);

5
com.unity.uiwidgets/Runtime/widgets/automatic_keep_alive.cs


}
public override void didUpdateWidget(StatefulWidget oldWidget) {
oldWidget = (AutomaticKeepAlive)oldWidget;
base.didUpdateWidget(oldWidget);
_updateChild();
}

handle.removeListener(_handles[handle]);
}
}
base.dispose();
}

//ParentDataElement
ParentDataElement<KeepAliveParentDataMixin> childElement = _getChildElement();
if (childElement != null) {
_updateParentDataOfChild(childElement);

if (!mounted) {
return;
}
ParentDataElement<KeepAliveParentDataMixin> childElement1 = _getChildElement();
D.assert(childElement1 != null);
_updateParentDataOfChild(childElement1);

112
com.unity.uiwidgets/Runtime/widgets/banner.cs


public class BannerPainter : AbstractCustomPainter {
public BannerPainter(
string message,
BannerLocation? location,
string message = null,
TextDirection? textDirection = null,
BannerLocation? location = null,
TextDirection? layoutDirection = null,
D.assert(textDirection != null);
this.color = color ?? BannerConstants._kColor;
this.textDirection = textDirection;
this.layoutDirection = layoutDirection;
this.color = color ?? BannerConstants._kColor;
public readonly TextDirection? textDirection;
public readonly TextDirection? layoutDirection;
public readonly Color color;

_paintBanner.color = color;
_textPainter = new TextPainter(
text: new TextSpan(style: textStyle, text: message),
textAlign: TextAlign.center
textAlign: TextAlign.center,
textDirection: textDirection ?? TextDirection.ltr
);
_prepared = true;
}

}
float _translationX(float width) {
switch (location) {
case BannerLocation.bottomEnd:
return width - BannerConstants._kBottomOffset;
case BannerLocation.topEnd:
return width;
case BannerLocation.bottomStart:
return BannerConstants._kBottomOffset;
case BannerLocation.topStart:
return 0.0f;
default:
throw new Exception("Unknown location: " + location);
D.assert(location != null);
D.assert(layoutDirection != null);
switch (layoutDirection) {
case TextDirection.rtl:
switch (location) {
case BannerLocation.bottomEnd:
return BannerConstants._kBottomOffset;
case BannerLocation.topEnd:
return 0.0f;
case BannerLocation.bottomStart:
return width - BannerConstants._kBottomOffset;
case BannerLocation.topStart:
return width;
}
break;
case TextDirection.ltr:
switch (location) {
case BannerLocation.bottomEnd:
return width - BannerConstants._kBottomOffset;
case BannerLocation.topEnd:
return width;
case BannerLocation.bottomStart:
return BannerConstants._kBottomOffset;
case BannerLocation.topStart:
return 0.0f;
}
break;
return 0.0f;
}
float _translationY(float height) {

float _rotation {
get {
switch (location) {
case BannerLocation.bottomStart:
case BannerLocation.topEnd:
return Mathf.PI / 4.0f;
case BannerLocation.bottomEnd:
case BannerLocation.topStart:
return -Mathf.PI / 4.0f;
default:
throw new Exception("Unknown location: " + location);
D.assert(location != null);
D.assert(layoutDirection != null);
switch (layoutDirection) {
case TextDirection.rtl:
switch (location) {
case BannerLocation.bottomStart:
case BannerLocation.topEnd:
return -Mathf.PI / 4.0f;
case BannerLocation.bottomEnd:
case BannerLocation.topStart:
return Mathf.PI / 4.0f;
}
break;
case TextDirection.ltr:
switch (location) {
case BannerLocation.bottomStart:
case BannerLocation.topEnd:
return Mathf.PI / 4.0f;
case BannerLocation.bottomEnd:
case BannerLocation.topStart:
return -Mathf.PI / 4.0f;
}
break;
return 0.0f;
}
}
}

Key key = null,
Widget child = null,
string message = null,
TextDirection? textDirection = null,
TextDirection? layoutDirection = null,
D.assert(location != null);
this.layoutDirection = layoutDirection;
this.textDirection = textDirection;
this.location = location;
this.color = color ?? BannerConstants._kColor;
this.textStyle = textStyle ?? BannerConstants._kTextStyle;

public readonly string message;
public readonly TextDirection? textDirection;
public readonly TextDirection? layoutDirection;
public readonly BannerLocation? location;

public override Widget build(BuildContext context) {
D.assert(WidgetsD.debugCheckHasDirectionality(context));
D.assert((textDirection != null && layoutDirection != null)|| WidgetsD.debugCheckHasDirectionality(context));
textDirection: textDirection ?? Directionality.of(context),
layoutDirection: layoutDirection ?? Directionality.of(context),
color: color,
textStyle: textStyle
),

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new StringProperty("message", message, showName: false));
properties.add(new EnumProperty<BannerLocation?>("location", location));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
properties.add(new EnumProperty<BannerLocation>("location", (BannerLocation)location));
properties.add(new EnumProperty<TextDirection>("layoutDirection", (TextDirection)layoutDirection, defaultValue: null));
textStyle?.debugFillProperties(properties);
textStyle?.debugFillProperties(properties, prefix: "text ");
}
}

result = new Banner(
child: result,
message: "DEBUG",
textDirection: TextDirection.ltr,
location: BannerLocation.topEnd
);
return true;

932
com.unity.uiwidgets/Runtime/widgets/basic.cs
文件差异内容过多而无法显示
查看文件

7
com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs


public class RequestFocusAction : _RequestFocusActionBase {
/// Creates a [RequestFocusAction] with a fixed [key].
public RequestFocusAction(LocalKey key) : base(key) {
public RequestFocusAction() : base(key) {
/// The [LocalKey] that uniquely identifies this action to an [Intent].
static readonly LocalKey key = new ValueKey<Type>(typeof(RequestFocusAction));
public static readonly LocalKey key = new ValueKey<Type>(typeof(RequestFocusAction));
public override void invoke(FocusNode node, Intent intent) => FocusTravesalUtils._focusAndEnsureVisible(node);
public override void invoke(FocusNode node, Intent intent) => FocusTravesalUtils._focusAndEnsureVisible(node);
}
public class NextFocusAction : _RequestFocusActionBase {

正在加载...
取消
保存