浏览代码

Merge remote-tracking branch 'upstream/master' into text_edit

/main
fzhangtj 6 年前
当前提交
ee73e282
共有 276 个文件被更改,包括 1118 次插入399 次删除
  1. 19
      .editorconfig
  2. 9
      README.md
  3. 56
      Runtime/Resources/UIWidgets_canvas.shader
  4. 2
      Runtime/RuntimeExample.cs
  5. 7
      Runtime/animation/animation.cs
  6. 17
      Runtime/animation/animation_controller.cs
  7. 6
      Runtime/animation/animations.cs
  8. 17
      Runtime/animation/curves.cs
  9. 46
      Runtime/animation/listener_helpers.mixin.gen.cs
  10. 15
      Runtime/animation/tween.cs
  11. 18
      Runtime/async/coroutine.cs
  12. 5
      Runtime/async/microtask_queue.cs
  13. 2
      Runtime/async/priority_queue.cs
  14. 17
      Runtime/async/timer.cs
  15. 13
      Runtime/debugger/diagnostics.cs
  16. 13
      Runtime/debugger/inpsector_panel.cs
  17. 12
      Runtime/debugger/inspector_objectgroup.cs
  18. 5
      Runtime/debugger/inspector_service.cs
  19. 7
      Runtime/debugger/inspector_treeview.cs
  20. 11
      Runtime/debugger/inspector_window.cs
  21. 20
      Runtime/editor/editor_window.cs
  22. 2
      Runtime/editor/rasterizer.cs
  23. 8
      Runtime/editor/surface.cs
  24. 65
      Runtime/engine/WidgetCanvas.cs
  25. 5
      Runtime/flow/clip_rect_layer.cs
  26. 5
      Runtime/flow/clip_rrect_layer.cs
  27. 2
      Runtime/flow/compositor_context.cs
  28. 2
      Runtime/flow/container_layer.cs
  29. 2
      Runtime/flow/layer.cs
  30. 2
      Runtime/flow/layer_tree.cs
  31. 2
      Runtime/flow/matrix_decomposition.cs
  32. 5
      Runtime/flow/opacity_layer.cs
  33. 11
      Runtime/flow/picture_layer.cs
  34. 17
      Runtime/flow/raster_cache.cs
  35. 5
      Runtime/flow/transform_layer.cs
  36. 14
      Runtime/foundation/assertions.cs
  37. 12
      Runtime/foundation/basic_types.cs
  38. 2
      Runtime/foundation/binding.cs
  39. 2
      Runtime/foundation/callback.cs
  40. 5
      Runtime/foundation/change_notifier.cs
  41. 5
      Runtime/foundation/debug.cs
  42. 29
      Runtime/foundation/diagnostics.cs
  43. 7
      Runtime/foundation/key.cs
  44. 13
      Runtime/foundation/node.cs
  45. 25
      Runtime/foundation/node.mixin.gen.cs
  46. 5
      Runtime/foundation/observer_list.cs
  47. 13
      Runtime/foundation/print.cs
  48. 17
      Runtime/gestures/arena.cs
  49. 22
      Runtime/gestures/binding.cs
  50. 2
      Runtime/gestures/constants.cs
  51. 8
      Runtime/gestures/converter.cs
  52. 2
      Runtime/gestures/drag.cs
  53. 2
      Runtime/gestures/drag_details.cs
  54. 2
      Runtime/gestures/events.cs
  55. 2
      Runtime/gestures/hit_test.cs
  56. 2
      Runtime/gestures/long_press.cs
  57. 8
      Runtime/gestures/lsq_resolver.cs
  58. 11
      Runtime/gestures/monodrag.cs
  59. 62
      Runtime/gestures/multidrag.cs
  60. 18
      Runtime/gestures/multitap.cs
  61. 5
      Runtime/gestures/pointer_router.cs
  62. 8
      Runtime/gestures/recognizer.cs
  63. 7
      Runtime/gestures/tap.cs
  64. 5
      Runtime/gestures/team.cs
  65. 7
      Runtime/gestures/velocity_tracker.cs
  66. 28
      Runtime/material/text_selection.cs
  67. 19
      Runtime/painting/alignment.cs
  68. 2
      Runtime/painting/basic_types.cs
  69. 2
      Runtime/painting/binding.cs
  70. 57
      Runtime/painting/border_radius.cs
  71. 51
      Runtime/painting/borders.cs
  72. 25
      Runtime/painting/box_border.cs
  73. 27
      Runtime/painting/box_decoration.cs
  74. 12
      Runtime/painting/box_fit.cs
  75. 16
      Runtime/painting/box_shadow.cs
  76. 9
      Runtime/painting/circle_border.cs
  77. 2
      Runtime/painting/clip.cs
  78. 23
      Runtime/painting/decoration_image.cs
  79. 14
      Runtime/painting/edge_insets.cs
  80. 2
      Runtime/painting/gradient.cs
  81. 8
      Runtime/painting/image_cache.cs
  82. 45
      Runtime/painting/image_provider.cs
  83. 93
      Runtime/painting/image_resolution.cs
  84. 22
      Runtime/painting/image_stream.cs
  85. 14
      Runtime/painting/matrix_utils.cs
  86. 36
      Runtime/painting/rounded_rectangle_border.cs
  87. 13
      Runtime/painting/text_painter.cs
  88. 15
      Runtime/painting/text_span.cs
  89. 149
      Runtime/painting/text_style.cs
  90. 2
      Runtime/physics/clamped_simulation.cs
  91. 2
      Runtime/physics/friction_simulation.cs
  92. 2
      Runtime/physics/gravity_simulation.cs
  93. 2
      Runtime/physics/simulation.cs
  94. 2
      Runtime/physics/spring_simulation.cs
  95. 2
      Runtime/physics/tolerance.cs
  96. 2
      Runtime/physics/utils.cs
  97. 2
      Runtime/promise/EnumerableExt.cs
  98. 41
      Runtime/promise/Promise.cs
  99. 2
      Runtime/promise/PromiseException.cs
  100. 2
      Runtime/promise/PromiseHelpers.cs

19
.editorconfig


# don't use 'private' whenever possible
csharp_default_private_modifier=implicit
csharp_default_internal_modifier=implicit
# add braces whenever necessary
csharp_braces_for_ifelse=required
csharp_braces_for_for=required
csharp_braces_for_foreach=required
csharp_braces_for_while=required
csharp_braces_for_dowhile=required
csharp_braces_for_using=required
csharp_braces_for_fixed=required
csharp_braces_redundant=true
# prefer block_body to expression_body
csharp_method_or_operator_body=block_body
csharp_local_function_body=block_body
csharp_constructor_or_destructor_body=block_body
csharp_accessor_owner_body=accessors_with_block_body
###################

9
README.md


cd <YourProjectPath>/Packages
git clone https://gitlab.cds.internal.unity3d.com/upm-packages/ui-widgets/com.unity.uiwidgets.git com.unity.uiwidgets
```
## IDE
1. Use JetBrains Rider
2. Open File -> Settings Repository....
Specify Upstream URL as "git@gitlab.cds.internal.unity3d.com:upm-packages/ui-widgets/idea-settings.git"
and click "Overwrite Local" or "Merge".
REF: https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html#settings-repository
## Code Style

56
Runtime/Resources/UIWidgets_canvas.shader


}
CGINCLUDE
float2 _viewSize;
float4 _viewport;
float4 _innerCol;
float4 _outerCol;
half4 _innerCol;
half4 _outerCol;
half2 _mf_imgInc; // _mf stands for mask filter
int _mf_radius;
half _mf_kernel[25];
struct appdata_t {
float4 vertex : POSITION;
float2 tcoord : TEXCOORD0;

v2f o;
o.ftcoord = v.tcoord;
o.fpos = v.vertex;
float x = v.vertex.x - _viewport.x;
float y = v.vertex.y - _viewport.y;
o.vertex = float4(2.0 * v.vertex.x / _viewSize.x - 1.0, 2.0 * v.vertex.y / _viewSize.y - 1.0, 0, 1);
o.vertex = float4(2.0 * x / _viewport.z - 1.0, 2.0 * y / _viewport.w - 1.0, 0, 1);
o.vertex = float4(2.0 * v.vertex.x / _viewSize.x - 1.0, 1.0 - 2.0 * v.vertex.y / _viewSize.y, 0, 1);
o.vertex = float4(2.0 * x / _viewport.z - 1.0, 1.0 - 2.0 * y / _viewport.w, 0, 1);
#endif
return o;

float2 pt = (mul(_paintMat, float3(i.fpos, 1.0))).xy;
float d = clamp((sdroundrect(pt, _extent, _radius) + _feather * 0.5) / _feather, 0.0, 1.0);
float4 color = lerp(_innerCol, _outerCol, d);
half4 color = lerp(_innerCol, _outerCol, d);
return float4(0, 0, 0, 0);
return half4(0, 0, 0, 0);
float4 color = tex2D(_tex, i.ftcoord);
half4 color = tex2D(_tex, i.ftcoord);
color = float4(color.xyz * color.w, color.w);
color = half4(color.xyz * color.w, color.w);
float4 color = tex2D(_tex, i.ftcoord);
half4 color = tex2D(_tex, i.ftcoord);
color = float4(color.xyz * _innerCol.w, color.w);
color = half4(color.xyz * _innerCol.w, color.w);
float4 color = tex2D(_tex, i.ftcoord);
color = float4(1, 1, 1, color.w) * _innerCol; // tint color
color = float4(color.xyz * color.w, color.w);
half4 color = tex2D(_tex, i.ftcoord);
color = half4(1, 1, 1, color.w) * _innerCol; // tint color
color = half4(color.xyz * color.w, color.w);
return color;
}
fixed4 frag_mf (v2f i) : SV_Target {
half4 color = half4(0, 0, 0, 0);
float2 coord = i.ftcoord - _mf_radius * _mf_imgInc;
int width = _mf_radius * 2 + 1;
for (int i = 0; i < width; i++) {
color += tex2D(_tex, coord) * _mf_kernel[i];
coord += _mf_imgInc;
}
color = color * _innerCol; // tint color
color = half4(color.xyz * _innerCol.w, color.w);
return color;
}

CGPROGRAM
#pragma fragment frag_texfont
ENDCG
}
Pass { // 11, mask filter
CGPROGRAM
#pragma fragment frag_mf
ENDCG
}
}

2
Runtime/RuntimeExample.cs


return parameter3 ? (parameter1 + parameter2) : (parameter1 - parameter2);
}
}
}
}

7
Runtime/animation/animation.cs


D.assert(icon != null);
return icon;
}
public Animation<U> drive<U>(Animatable<U> child) {
D.assert(this is Animation<double>);
return child.animate(this as Animation<double>);
}
}
}

17
Runtime/animation/animation_controller.cs


this._value = newValue.clamp(this.lowerBound, this.upperBound);
if (this._value == this.lowerBound) {
this._status = AnimationStatus.dismissed;
} else if (this._value == this.upperBound) {
}
else if (this._value == this.upperBound) {
} else {
}
else {
this._status = (this._direction == _AnimationDirection.forward)
? AnimationStatus.forward
: AnimationStatus.reverse;

double range = this.upperBound - this.lowerBound;
double remainingFraction = range.isFinite() ? (target - this._value).abs() / range : 1.0;
simulationDuration = TimeSpan.FromTicks((long) (this.duration.Value.Ticks * remainingFraction));
} else if (target == this.value) {
}
else if (target == this.value) {
simulationDuration = TimeSpan.Zero;
}

double t = (timeInSeconds / this._durationInSeconds).clamp(0.0, 1.0);
if (t == 0.0) {
return this._begin;
} else if (t == 1.0) {
}
else if (t == 1.0) {
} else {
}
else {
return this._begin + (this._end - this._begin) * this._curve.transform(t);
}
}

return false;
}
}
}
}

6
Runtime/animation/animations.cs


if (this._nextTrain != null) {
if (this._currentTrain.value > this._nextTrain.value) {
this._mode = _TrainHoppingMode.maximize;
} else {
}
else {
this._mode = _TrainHoppingMode.minimize;
if (this._currentTrain.value == this._nextTrain.value) {
this._currentTrain = this._nextTrain;

if (this.next.status == AnimationStatus.forward || this.next.status == AnimationStatus.reverse) {
return this.next.status;
}
return this.first.status;
}
}

public static readonly Animation<double> kAlwaysDismissedAnimation = new _AlwaysDismissedAnimation();
}
}
}

17
Runtime/animation/curves.cs


if (estimate < t) {
start = midpoint;
} else {
}
else {
end = midpoint;
}
}

D.assert(t >= 0.0 && t <= 1.0);
if (t < 0.5) {
return (1.0 - Curves._bounce(1.0 - t)) * 0.5;
} else {
}
else {
return Curves._bounce(t * 2.0 - 1.0) * 0.5 + 0.5;
}
}

t = 2.0 * t - 1.0;
if (t < 0.0) {
return -0.5 * Math.Pow(2.0, 10.0 * t) * Math.Sin((t - s) * (Math.PI * 2.0) / this.period);
} else {
}
else {
return Math.Pow(2.0, -10.0 * t) * Math.Sin((t - s) * (Math.PI * 2.0) / this.period) * 0.5 + 1.0;
}
}

internal static double _bounce(double t) {
if (t < 1.0 / 2.75) {
return 7.5625 * t * t;
} else if (t < 2 / 2.75) {
}
else if (t < 2 / 2.75) {
} else if (t < 2.5 / 2.75) {
}
else if (t < 2.5 / 2.75) {
t -= 2.25 / 2.75;
return 7.5625 * t * t + 0.9375;
}

}
}
}
}

46
Runtime/animation/listener_helpers.mixin.gen.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.animation {
public abstract class AnimationLazyListenerMixinAnimation<T> : Animation<T> {
int _listenerCounter = 0;

}
public abstract class AnimationEagerListenerMixinAnimation<T> : Animation<T> {
protected void didRegisterListener() {
}

}
public abstract class AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
public abstract class
AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
readonly ObserverList<VoidCallback> _listeners = new ObserverList<VoidCallback>();
public override void addListener(VoidCallback listener) {

if (this._listeners.Contains(listener)) {
listener();
}
} catch (Exception exception) {
}
catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
public abstract class AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationEagerListenerMixinAnimation<T> {
public abstract class
AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationEagerListenerMixinAnimation<T> {
readonly ObserverList<VoidCallback> _listeners = new ObserverList<VoidCallback>();
public override void addListener(VoidCallback listener) {

if (this._listeners.Contains(listener)) {
listener();
}
} catch (Exception exception) {
}
catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
public abstract class AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> {
public abstract class
AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> :
AnimationLocalListenersMixinAnimationLazyListenerMixinAnimation<T> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (this._statusListeners.Contains(listener)) {
listener(status);
}
} catch (Exception exception) {
}
catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
public abstract class AnimationLocalStatusListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T> {
public abstract class
AnimationLocalStatusListenersMixinAnimationLazyListenerMixinAnimation<T> : AnimationLazyListenerMixinAnimation<T
> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (this._statusListeners.Contains(listener)) {
listener(status);
}
} catch (Exception exception) {
}
catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
public abstract class AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> : AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> {
public abstract class
AnimationLocalStatusListenersMixinAnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> :
AnimationLocalListenersMixinAnimationEagerListenerMixinAnimation<T> {
readonly ObserverList<AnimationStatusListener> _statusListeners = new ObserverList<AnimationStatusListener>();
public override void addStatusListener(AnimationStatusListener listener) {

if (this._statusListeners.Contains(listener)) {
listener(status);
}
} catch (Exception exception) {
}
catch (Exception exception) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: exception,
library: "animation library",

}
}
}
}

15
Runtime/animation/tween.cs


this.end = end;
}
public readonly T begin;
public T begin;
public readonly T end;
public T end;
public abstract T lerp(double t);

if (ReferenceEquals(null, other)) {
return false;
}
return EqualityComparer<T>.Default.Equals(this.begin, other.begin) &&
EqualityComparer<T>.Default.Equals(this.end, other.end);
}

return false;
}
return this.Equals((Tween<T>) obj);
}

}
public class DoubleTween : Tween<double> {
public DoubleTween(int begin, int end) : base(begin: begin, end: end) {
public DoubleTween(double begin, double end) : base(begin: begin, end: end) {
}
public override double lerp(double t) {

return (this.begin + (this.end - this.begin) * t);
}
}
public class CurveTween : Animatable<double> {
public CurveTween(Curve curve = null) {
D.assert(curve != null);

return $"{this.GetType()}(curve: {this.curve})";
}
}
}
}

18
Runtime/async/coroutine.cs


if (isBackground && BackgroundCallbacks.getInstance() != null) {
this._unhook = BackgroundCallbacks.getInstance().addCallback(this._moveNext);
} else {
}
else {
this._unhook = this._window.run(TimeSpan.Zero, this._moveNext, periodic: true);
}

this.lastResult = null;
if (this._isBackground) {
this._window.runInMain(() => { this._promise.Reject(lastError); });
} else {
}
else {
this._promise.Reject(lastError);
}

bool hasNext;
try {
hasNext = this._processIEnumeratorRecursive(this._routine);
} catch (Exception ex) {
}
catch (Exception ex) {
this.stop(ex);
return;
}

D.assert(this.lastError == null);
if (this._isBackground) {
this._window.runInMain(() => { this._promise.Resolve(this.lastResult); });
} else {
}
else {
this._promise.Resolve(this.lastResult);
}
}

if (_instance == null) {
_instance = new BackgroundCallbacks(2);
}
return _instance;
}

try {
callbackNode.callback();
} catch (Exception ex) {
}
catch (Exception ex) {
Debug.LogError("Failed to execute callback in BackgroundCallbacks: " + ex);
}

public volatile bool isDone;
}
}
}
}

5
Runtime/async/microtask_queue.cs


var action = this._queue.Dequeue();
try {
action();
} catch (Exception ex) {
}
catch (Exception ex) {
}
}

2
Runtime/async/priority_queue.cs


return true; // passed all checks
}
}
}
}

17
Runtime/async/timer.cs


foreach (var callback in callbacks) {
try {
callback();
} catch (Exception ex) {
}
catch (Exception ex) {
Debug.LogError("Error to execute runInMain callback: " + ex);
}
}

lock (this._queue) {
this._queue.enqueue(timer);
}
public Timer run(TimeSpan duration, Action callback) {
var timer = new TimerImpl(duration, callback);

return timer;
}

lock (this._queue) {
this._queue.enqueue(timer);
}
return timer;
}

lock (this._queue) {
foreach (var timer in appendList) {
this._queue.enqueue(timer);
}
}
}
}
}

this._interval = duration;
}
}
public TimerImpl(Action callback) {
this._deadline = 0;
this._callback = callback;

try {
this._callback();
} catch (Exception ex) {
}
catch (Exception ex) {
Debug.LogError("Error to execute timer callback: " + ex);
}

}
}
}
}
}

13
Runtime/debugger/diagnostics.cs


if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.diagnosticRef, other.diagnosticRef);
}

}
return this.Equals((DiagnosticsNode) obj);
}

properties.Add(new DiagnosticsNode(v, true));
}
}
return properties;
}
}

if (ReferenceEquals(null, other)) {
return false;
}
return string.Equals(this.id, other.id);
}

}
return this.Equals((InspectorInstanceRef) obj);
}

return $"Id: {this.id}";
}
}
}
}

13
Runtime/debugger/inpsector_panel.cs


var lastRect = GUILayoutUtility.GetLastRect();
var x = lastRect.height;
}
EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
// splitter

int blue = Util.GetIntProperty(properties, "blue");
var color = new Color(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f);
EditorGUILayout.ColorField(property.name, color, GUILayout.ExpandWidth(true));
} else {
}
else {
EditorGUILayout.TextField(property.name, property.description);
}
}

this.m_TreeView.CollapseAll();
if (item != null) {
this.m_TreeView.SetSelection(new List<int> {item.id}, TreeViewSelectionOptions.RevealAndFrame);
} else {
}
else {
this.m_TreeView.Repaint();
}
}

this.m_NeedDetailUpdate = false;
if (this.m_SelectedNodeRef == null) {
this.m_DetailTreeView.node = null;
} else {
}
else {
this.m_DetailTreeView.node =
this.m_InspectorService.getDetailsSubtree(this.m_SelectedNodeRef, this.m_GroupName);
}

public float splitOffset;
}
}
#endif
#endif

12
Runtime/debugger/inspector_objectgroup.cs


if (m_Instance == null) {
m_Instance = CreateInstance<T>();
}
return m_Instance;
}
}

if (m_CreateNonSingletonInstance) {
this.m_IsNonSingletonInstance = true;
this.Initialize();
} else if (this.m_IsNonSingletonInstance) {
}
else if (this.m_IsNonSingletonInstance) {
} else if (m_Instance == null) {
}
else if (m_Instance == null) {
} else {
}
else {
DestroyImmediate((Object) this);
}
}

return (T) instance;
}
}
}
}

5
Runtime/debugger/inspector_service.cs


if (result != null && result.diagnosticRef == previousSelectionRef) {
return previousSelection;
} else {
}
else {
return result;
}
}

Widget,
Render
}
}
}

7
Runtime/debugger/inspector_treeview.cs


var color = new Color(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f);
Util.DrawColorIcon(new Rect(xoffset, rect.yMin, rect.height, rect.height), color);
}
this.labelGUI(xoffset, rect, node.description.Replace("\n", " "));
}

if (i + 1 < fields.Count) {
obj = fieldInfo.GetValue(obj);
} else {
}
else {
fieldInfo.SetValue(obj, value);
}
}

}
}
}
#endif
#endif

11
Runtime/debugger/inspector_window.cs


this.m_InspectorService.setShowInspect(newShowInspect);
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();

selectedIndex = i + 1;
}
}
EditorUtility.DisplayCustomMenu(menuPos, labels, selectedIndex, (data, options, selected) => {
if (selected > 0) {
var selectedWindow = windows[selected - 1];

} else {
}
else {
if (this.m_InspectorService != null) {
this.closeInspect();
}

if (this.m_InspectorService == null) {
return;
}
this.m_Panels.Clear();
this.m_ShowInspect = false;
}

if (this.m_InspectorService != null) {
showInspect = this.m_InspectorService.getShowInspect();
}
this.m_ShowInspect = showInspect;
for (int i = 0; i < this.m_Panels.Count; i++) {

}
}
}
#endif
#endif

20
Runtime/editor/editor_window.cs


void _doOnGUI(Event evt) {
if (evt.type == EventType.Repaint) {
this._beginFrame();
if (this._regenerateLayerTree) {
this._regenerateLayerTree = false;
this._beginFrame();
}
else {
this._rasterizer.drawLastLayerTree();
}
return;
}

physicalX: evt.mousePosition.x * this._devicePixelRatio,
physicalY: evt.mousePosition.y * this._devicePixelRatio
);
} else if (evt.type == EventType.MouseUp || evt.rawType == EventType.MouseUp) {
}
else if (evt.type == EventType.MouseUp || evt.rawType == EventType.MouseUp) {
pointerData = new PointerData(
timeStamp: Timer.timespanSinceStartup,
change: PointerChange.up,

physicalY: evt.mousePosition.y * this._devicePixelRatio
);
} else if (evt.type == EventType.MouseDrag) {
}
else if (evt.type == EventType.MouseDrag) {
pointerData = new PointerData(
timeStamp: Timer.timespanSinceStartup,
change: PointerChange.move,

physicalY: evt.mousePosition.y * this._devicePixelRatio
);
} else if (evt.type == EventType.MouseMove) {
}
else if (evt.type == EventType.MouseMove) {
pointerData = new PointerData(
timeStamp: Timer.timespanSinceStartup,
change: PointerChange.hover,

get { return this._textInput; }
}
}
}
}

2
Runtime/editor/rasterizer.cs


callback();
}
}
}
}

8
Runtime/editor/surface.cs


public MeshPool getMeshPool() {
return this._meshPool;
}
public void Dispose() {
if (this._surface != null) {
this._surface.Dispose();

if (this._drawToTargetFunc == null) {
Graphics.DrawTexture(screenRect, this._surface.getRenderTexture(),
_getGUITextureMat());
} else {
}
else {
return true;
}

}
}
}
}
}

65
Runtime/engine/WidgetCanvas.cs


using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;

using UnityEngine.UI;
using RawImage = UnityEngine.UI.RawImage;
using Rect = UnityEngine.Rect;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.engine {
public class UIWidgetWindowAdapter : WindowAdapter {

if (!this._needsPaint) {
return;
}
base.OnGUI(evt);
}

pageRouteBuilder: this.pageRouteBuilder,
onGenerateRoute: this.onGenerateRoute,
onUnknownRoute: this.onUnknownRoute);
this._windowAdapter.attachRootWidget(root);
this._lastMouseMove = Input.mousePosition;
}

}
protected virtual Dictionary<string, WidgetBuilder> routes => null;
protected virtual Dictionary<string, WidgetBuilder> routes {
get { return null; }
}
protected virtual string initialRoute {
get { return null; }
}
protected virtual RouteFactory onGenerateRoute {
get { return null; }
}
protected virtual string initialRoute => null;
protected virtual RouteFactory onGenerateRoute => null;
protected virtual RouteFactory onUnknownRoute => null;
protected virtual RouteFactory onUnknownRoute {
get { return null; }
}
protected virtual TextStyle textStyle {
get { return null; }
}
protected virtual PageRouteFactory pageRouteBuilder {
get {
return (RouteSettings settings, WidgetBuilder builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) => builder(context)
);
}
}
protected virtual painting.TextStyle textStyle => null;
protected virtual PageRouteFactory pageRouteBuilder => (RouteSettings settings, WidgetBuilder builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (BuildContext context, Unity.UIWidgets.animation.Animation<double> animation,
Unity.UIWidgets.animation.Animation<double> secondaryAnimation) => builder(context)
);
protected override void OnDisable() {
D.assert(this._windowAdapter != null);
this._windowAdapter.OnDisable();

if (EventSystem.current != null && EventSystem.current.currentSelectedGameObject != this.gameObject) {
this.unfocusIfNeeded();
}
if (this._mouseEntered && (this._lastMouseMove.x != Input.mousePosition.x ||
this._lastMouseMove.y != Input.mousePosition.y)) {
this.handleMouseMove();

return key;
}
}
return 0;
}

RectTransformUtility.ScreenPointToLocalPointInRectangle(this.rectTransform, eventData.position,
eventData.enterEventCamera, out localPoint);
var pixelRatio = this.pixelRatio;
localPoint.x = (float)((localPoint.x - this.rectTransform.rect.min.x) * pixelRatio);
localPoint.y = (float)((this.rectTransform.rect.max.y - localPoint.y) * pixelRatio);
localPoint.x = (float) ((localPoint.x - this.rectTransform.rect.min.x) * pixelRatio);
localPoint.y = (float) ((this.rectTransform.rect.max.y - localPoint.y) * pixelRatio);
return localPoint;
}

RectTransformUtility.ScreenPointToLocalPointInRectangle(this.rectTransform, position,
eventCamera, out localPoint);
localPoint.x = (float)((localPoint.x - this.rectTransform.rect.min.x) * this.pixelRatio);
localPoint.y = (float)((this.rectTransform.rect.max.y - localPoint.y) * this.pixelRatio);
localPoint.x = (float) ((localPoint.x - this.rectTransform.rect.min.x) * this.pixelRatio);
localPoint.y = (float) ((this.rectTransform.rect.max.y - localPoint.y) * this.pixelRatio);
return localPoint;
}

}
}
}
}
}

5
Runtime/flow/clip_rect_layer.cs


try {
this.paintChildren(context);
} finally {
}
finally {
}
}

5
Runtime/flow/clip_rrect_layer.cs


try {
this.paintChildren(context);
} finally {
}
finally {
}
}

2
Runtime/flow/compositor_context.cs


this._rasterCache.sweepAfterFrame();
}
}
}
}

2
Runtime/flow/container_layer.cs


}
}
}
}
}

2
Runtime/flow/layer.cs


public abstract void paint(PaintContext context);
}
}
}

2
Runtime/flow/layer_tree.cs


}
}
}
}
}

2
Runtime/flow/matrix_decomposition.cs


public readonly Vector4 perspective;
public readonly Vector4 rotation;
}
}
}

5
Runtime/flow/opacity_layer.cs


canvas.saveLayer(this.paintBounds, paint);
try {
this.paintChildren(context);
} finally {
}
finally {
}
}

11
Runtime/flow/picture_layer.cs


this._rasterCacheResult = context.rasterCache.getPrerolledImage(
this._picture, ctm, context.devicePixelRatio, this._isComplex, this._willChange);
} else {
}
else {
this._rasterCacheResult = null;
}

try {
if (this._rasterCacheResult != null) {
this._rasterCacheResult.draw(canvas);
} else {
}
else {
} finally {
}
finally {
}
}

17
Runtime/flow/raster_cache.cs


try {
canvas.resetMatrix();
canvas.drawImage(this.image, bounds.topLeft, new Paint());
} finally {
}
finally {
canvas.restore();
}
}

if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.picture, other.picture) &&
Equals(this.matrix, other.matrix) &&
this.devicePixelRatio.Equals(other.devicePixelRatio);

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((_RasterCacheKey) obj);
}

return true;
}
RasterCacheResult _rasterizePicture(Picture picture, Matrix3 transform, float devicePixelRatio, MeshPool meshPool) {
RasterCacheResult _rasterizePicture(Picture picture, Matrix3 transform, float devicePixelRatio,
MeshPool meshPool) {
var bounds = transform.mapRect(picture.paintBounds);
var desc = new RenderTextureDescriptor(

foreach (var entry in this._cache) {
if (!entry.Value.usedThisFrame) {
dead.Add(entry);
} else {
}
else {
entry.Value.usedThisFrame = false;
}
}

entry.Value.image.image.Dispose();
}
}
}
}

5
Runtime/flow/transform_layer.cs


try {
canvas.concat(this._tranform);
this.paintChildren(context);
} finally {
}
finally {
}
}

14
Runtime/foundation/assertions.cs


if (this.context.isNotEmpty()) {
buffer.Append(", ");
}
} else {
}
else {
buffer.Append("Exception ");
}

buffer.Append(". ");
} else {
}
else {
buffer.Append("An error was caught. ");
}

IEnumerable<string> stackLines = this.exception.StackTrace.TrimEnd().Split('\n');
if (this.stackFilter != null) {
stackLines = this.stackFilter(stackLines);
} else {
}
else {
stackLines = UIWidgetsError.defaultStackFilter(stackLines);
}

if (_errorCount == 0 || forceReport) {
Debug.LogError(details.ToString());
} else {
}
else {
Debug.LogWarning("Another exception was thrown: " + details);
}

}
}
}
}
}

12
Runtime/foundation/basic_types.cs


public static T SafeDestroy<T>(T obj) where T : Object {
if (Application.isEditor) {
Object.DestroyImmediate(obj);
} else {
}
else {
Object.Destroy(obj);
}

it.TryGetValue(key, out v);
return v;
}
public static T removeLast<T>(this IList<T> it)
{
public static T removeLast<T>(this IList<T> it) {
var lastIndex = it.Count - 1;
var result = it[lastIndex];
it.RemoveAt(lastIndex);

}
}

2
Runtime/foundation/binding.cs


namespace Unity.UIWidgets.foundation {
}
}

2
Runtime/foundation/callback.cs


namespace Unity.UIWidgets.foundation {
}
}

5
Runtime/foundation/change_notifier.cs


if (this._listeners.Contains(listener)) {
listener();
}
} catch (Exception ex) {
}
catch (Exception ex) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: ex,
library: "foundation library",

return Diagnostics.describeIdentity(this) + "(" + this._value + ")";
}
}
}
}

5
Runtime/foundation/debug.cs


assert(() => {
if (innerRect != null && !innerRect.isEmpty) {
_debugDrawDoubleRect(canvas, outerRect, innerRect, new Color(0x900090FF));
} else {
}
else {
_debugDrawDoubleRect(canvas, innerRect.inflate(outlineWidth).intersect(outerRect), innerRect,
new Color(0xFF0090FF));
Paint paint = new Paint();

}
}
}
}
}

29
Runtime/foundation/diagnostics.cs


if (s == "\n") {
if (this._buffer.Length == 0) {
this._buffer.Append(this.prefixLineOne.TrimEnd());
} else if (this._atLineStart) {
}
else if (this._atLineStart) {
this._buffer.Append(this.prefixOtherLines.TrimEnd());
this._hasMultipleLines = true;
}

if (this._buffer.Length == 0) {
this._buffer.Append(this.prefixLineOne);
} else if (this._atLineStart) {
}
else if (this._atLineStart) {
this._buffer.Append(this.prefixOtherLines);
this._hasMultipleLines = true;
}

if (this.name.isNotEmpty() && this.showName) {
builder.write(this.name);
}
} else {
}
else {
if (this.name.isNotEmpty() && this.showName) {
builder.write(this.name);
if (this.showSeparator) {

string message = property.toString(parentConfiguration: config, minLevel: minLevel);
if (!config.lineBreakProperties || message.Length < kWrapWidth) {
builder.write(message);
} else {
}
else {
var lines = message.Split('\n');
for (int j = 0; j < lines.Length; ++j) {
string line = lines[j];

if (childConfig.footer.isNotEmpty()) {
builder.writeRaw(prefixChildren + childConfig.childLinkSpace + childConfig.footer);
}
} else {
}
else {
TextTreeConfiguration nextChildStyle = this._childTextConfiguration(children[i + 1], config);
string childPrefixLineOne = prefixChildren + childConfig.prefixLineOne;
string childPrefixOtherLines =

if (this.ifTrue != null) {
return this.ifTrue;
}
} else if (this.value == false) {
}
else if (this.value == false) {
if (this.ifFalse != null) {
return this.ifFalse;
}

if (this.ifPresent != null) {
return this.ifPresent;
}
} else {
}
else {
if (this.ifNull != null) {
return this.ifNull;
}

if (this.ifPresent == null) {
return DiagnosticLevel.hidden;
}
} else {
}
else {
if (this.ifNull == null) {
return DiagnosticLevel.hidden;
}

this._valueComputed = true;
try {
this._value = this._computeValue();
} catch (Exception ex) {
}
catch (Exception ex) {
this._exception = ex;
this._value = default(T);
}

return $"{o.GetType()}#{shortHash(o)}";
}
}
}
}

7
Runtime/foundation/key.cs


if (ReferenceEquals(null, other)) {
return false;
}
return EqualityComparer<T>.Default.Equals(this.value, other.value);
}

}
return this.Equals((ValueKey<T>) obj);
}

return $"[{this.GetType()} {valueString}]";
}
}
}
}

13
Runtime/foundation/node.cs


if (!_sequenceEquals((IList) item1, (IList) item2)) {
return false;
}
} else {
}
else {
if (!Equals(item1, item2)) {
return false;
}

if (ReferenceEquals(null, other)) {
return false;
}
return this._type == other._type && _sequenceEquals(this._list, other._list);
}

}
return this.Equals((_DependencyList) obj);
}

var item = list[i];
if (item is IList) {
hashCode = (hashCode * 397) ^ _sequenceHashCode((IList) item);
} else {
}
else {
hashCode = (hashCode * 397) ^ (item == null ? 0 : item.GetHashCode());
}
}

return !Equals(left, right);
}
}
}
}

25
Runtime/foundation/node.mixin.gen.cs


using Unity.UIWidgets.async;
namespace Unity.UIWidgets.foundation {
public class AbstractNode {
public class AbstractNode {
public int depth {
get { return this._depth; }
}

while (node.parent != null) {
node = node.parent;
}
D.assert(node != child); // indicates we are about to create a cycle
return true;
});

}
public class AbstractNodeMixinDiagnosticableTree : DiagnosticableTree {
public class AbstractNodeMixinDiagnosticableTree : DiagnosticableTree {
public int depth {
get { return this._depth; }
}

while (node.parent != null) {
node = node.parent;
}
D.assert(node != child); // indicates we are about to create a cycle
return true;
});

}
public abstract class CanonicalMixinDiagnosticableTree : DiagnosticableTree {
public abstract class CanonicalMixinDiagnosticableTree : DiagnosticableTree {
_DependencyList _dependencyList;
_DependencyList _getDependencyList() {

return this._dependencyList;
}
CanonicalMixinDiagnosticableTree _canonical;
CanonicalMixinDiagnosticableTree _getCanonical() {

}
}
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;

return ReferenceEquals(this._getCanonical(), ((CanonicalMixinDiagnosticableTree) obj)._getCanonical());
}
}

5
Runtime/foundation/observer_list.cs


if (this._isDirty) {
if (this._set == null) {
this._set = new HashSet<T>(this._list);
} else {
}
else {
this._set.Clear();
this._set.UnionWith(this._list);
}

get { return false; }
}
}
}
}

13
Runtime/foundation/print.cs


if (addPrefix) {
yield return prefix + message.Substring(start, lastWordEnd.Value - start);
} else {
}
else {
yield return message.Substring(start, lastWordEnd.Value - start);
addPrefix = true;
}

}
// just yield returned a line
if (lastWordEnd == index) {
// we broke at current position

}
} else {
}
else {
// we broke at the previous break point, and we"re at the start of a new one
D.assert(lastWordStart > lastWordEnd);
start = lastWordStart;

startForLengthCalculations = start - prefix.Length;
D.assert(addPrefix);
lastWordEnd = null;
} else {
}
else {
// save this break point, we"re not yet over the line width
lastWordEnd = index;
// skip to the end of this break point

}
}
}
}
}

17
Runtime/gestures/arena.cs


StringBuilder buffer = new StringBuilder();
if (this.members.isEmpty()) {
buffer.Append("<empty>");
} else {
}
else {
buffer.Append(string.Join(", ", this.members.Select(
member => member == this.eagerWinner
? $"{member} (eager winner)"

if (!state.isOpen) {
this._tryToResolveArena(pointer, state);
}
} else {
}
else {
} else {
}
else {
D.assert(this._debugLogDiagnostic(pointer,
$"Self-declared winner: {member}"));
this._resolveInFavorOf(pointer, state, member);

if (state.members.Count == 1) {
Window.instance.scheduleMicrotask(() => this._resolveByDefault(pointer, state));
} else if (state.members.isEmpty()) {
}
else if (state.members.isEmpty()) {
} else if (state.eagerWinner != null) {
}
else if (state.eagerWinner != null) {
D.assert(this._debugLogDiagnostic(pointer,
$"Eager winner: {state.eagerWinner}"));
this._resolveInFavorOf(pointer, state, state.eagerWinner);

return true;
}
}
}
}

22
Runtime/gestures/binding.cs


return true;
});
} else if (evt is PointerUpEvent || evt is PointerCancelEvent) {
}
else if (evt is PointerUpEvent || evt is PointerCancelEvent) {
} else if (evt.down) {
}
else if (evt.down) {
} else {
}
else {
return;
}

if (this.lastMoveTargets.Contains(hitTestEntry.target)) {
hitTestEntry.target.handleEvent(evt, hitTestEntry);
this.lastMoveTargets.Remove(hitTestEntry.target);
} else {
}
else {
hitTestEntry.target.handleEvent(new PointerEnterEvent(
timeStamp: evt.timeStamp,
pointer: evt.pointer,

}
}
foreach (var lastMoveTarget in this.lastMoveTargets) {
lastMoveTarget.handleEvent(new PointerLeaveEvent(
timeStamp: evt.timeStamp,

), null);
}
this.lastMoveTargets.Clear();
foreach (var hitTestEntry in result.path) {
this.lastMoveTargets.Add(hitTestEntry.target);

foreach (HitTestEntry entry in result.path) {
try {
entry.target.handleEvent(evt, entry);
} catch (Exception ex) {
}
catch (Exception ex) {
Debug.LogError("Error while dispatching a pointer event: " + ex);
}
}

this.pointerRouter.route(evt);
if (evt is PointerDownEvent) {
this.gestureArena.close(evt.pointer);
} else if (evt is PointerUpEvent) {
}
else if (evt is PointerUpEvent) {
}
}

2
Runtime/gestures/constants.cs


public const double kMaxFlingVelocity = 8000.0;
}
}
}

8
Runtime/gestures/converter.cs


// a hover event to be here.
state.lastPosition = position;
}
state.startNewPointer();
state.setDown();
yield return new PointerDownEvent(

if (!alreadyAdded) {
break;
}
D.assert(_pointers.ContainsKey(datum.device));
_PointerState state = _pointers[datum.device];

D.assert(state.down);
Offset offset = position - state.lastPosition;

device: datum.device,
position: position
);
} else {
}
else {
yield return new PointerCancelEvent(
timeStamp: timeStamp,
pointer: state.pointer,

}
}
}
}
}

2
Runtime/gestures/drag.cs


void end(DragEndDetails details);
void cancel();
}
}
}

2
Runtime/gestures/drag_details.cs


return this.GetType() + "(" + this.velocity + ")";
}
}
}
}

2
Runtime/gestures/events.cs


down: false) {
}
}
}
}

2
Runtime/gestures/hit_test.cs


$"HitTestResult({(this._path.isEmpty() ? "<empty path>" : string.Join(", ", this._path.Select(x => x.ToString()).ToArray()))})";
}
}
}
}

2
Runtime/gestures/long_press.cs


get { return "long press"; }
}
}
}
}

8
Runtime/gestures/lsq_resolver.cs


for (int i = 0; i < a._length; i += 1) {
result += a[i] * b[i];
}
return result;
}

for (int h = 0; h < m; h += 1) {
q[j, h] = a[j, h];
}
for (int i = 0; i < j; i += 1) {
double dot = q.getRow(j) * q.getRow(i);
for (int h = 0; h < m; h += 1) {

for (int h = 0; h < m; h += 1) {
q[j, h] = q[j, h] * inverseNorm;
}
for (int i = 0; i < n; i += 1) {
r[j, i] = i < j ? 0.0 : q.getRow(j) * a.getRow(i);
}

for (int h = 0; h < m; h += 1) {
wy[h] = this.y[h] * this.w[h];
}
result.coefficients[i] /= r[i, i];
}

for (int h = 0; h < m; h += 1) {
yMean += this.y[h];
}
yMean /= m;
double sumSquaredError = 0.0;

return result;
}
}
}
}

11
Runtime/gestures/monodrag.cs


return null;
});
}
} else if (this._state == _DragState.accepted) {
}
else if (this._state == _DragState.accepted) {
this.resolve(GestureDisposition.accepted);
}
}

return null;
});
}
} else {
}
else {
this._pendingDragOffset += delta;
this._lastPendingEventTimestamp = evt.timeStamp;
if (this._hasSufficientPendingDragDeltaToAccept) {

return null;
}, debugReport: () =>
$"{estimate}; fling at {velocity}.");
} else {
}
else {
this.invokeCallback<object>("onEnd", () => {
this.onEnd(new DragEndDetails(
velocity: Velocity.zero,

get { return "pan"; }
}
}
}
}

62
Runtime/gestures/multidrag.cs


Drag _client;
public Offset pendingDelta => this._pendingDelta;
public Offset pendingDelta {
get { return this._pendingDelta; }
}
public Offset _pendingDelta = Offset.zero;

public void _move(PointerMoveEvent pEvent) {
D.assert(this._arenaEntry != null);
if (!pEvent.synthesized)
if (!pEvent.synthesized) {
}
if (this._client != null) {
D.assert(this.pendingDelta == null);
this._client.update(new DragUpdateDetails(

public override void acceptGesture(int pointer) {
D.assert(this._pointers != null);
T state = this._pointers[pointer];
if (state == null)
if (state == null) {
}
state.accepted((Offset initialPosition) => this._startDrag(initialPosition, pointer));
}

D.assert(state != null);
D.assert(state._pendingDelta != null);
Drag drag = null;
if (this.onStart != null)
if (this.onStart != null) {
if (drag != null)
}
if (drag != null) {
else
}
else {
}
return drag;
}

}
void _removeState(int pointer) {
if (this._pointers == null)
if (this._pointers == null) {
}
D.assert(this._pointers.ContainsKey(pointer));
GestureBinding.instance.pointerRouter.removeRoute(pointer, this._handleEvent);
this._pointers[pointer].dispose();

public override void checkForResolutionAfterMove() {
D.assert(this.pendingDelta != null);
if (this.pendingDelta.distance > Constants.kTouchSlop)
if (this.pendingDelta.distance > Constants.kTouchSlop) {
}
}
public override void accepted(GestureMultiDragStartCallback starter) {

return new _ImmediatePointerState(pEvent.position);
}
public override string debugDescription => "multidrag";
public override string debugDescription {
get { return "multidrag"; }
}
}
public class _HorizontalPointerState : MultiDragPointerState {

public override void checkForResolutionAfterMove() {
D.assert(this.pendingDelta != null);
if (this.pendingDelta.dx.abs() > Constants.kTouchSlop)
if (this.pendingDelta.dx.abs() > Constants.kTouchSlop) {
}
}
public override void accepted(GestureMultiDragStartCallback starter) {

return new _HorizontalPointerState(pEvent.position);
}
public override string debugDescription => "horizontal multidrag";
public override string debugDescription {
get { return "horizontal multidrag"; }
}
}

public override void checkForResolutionAfterMove() {
D.assert(this.pendingDelta != null);
if (this.pendingDelta.dy.abs() > Constants.kTouchSlop)
if (this.pendingDelta.dy.abs() > Constants.kTouchSlop) {
}
}
public override void accepted(GestureMultiDragStartCallback starter) {

return new _VerticalPointerState(pEvent.position);
}
public override string debugDescription => "vertical multidrag";
public override string debugDescription {
get { return "vertical multidrag"; }
}
}
public class _DelayedPointerState : MultiDragPointerState {

public override void accepted(GestureMultiDragStartCallback starter) {
D.assert(this._starter == null);
if (this._timer == null)
if (this._timer == null) {
else
}
else {
}
}
public override void checkForResolutionAfterMove() {

public DelayedMultiDragGestureRecognizer(
TimeSpan? delay = null,
object debugOwner = null) : base(debugOwner: debugOwner) {
if (delay == null)
if (delay == null) {
}
this.delay = delay;
}

return new _DelayedPointerState(pEvent.position, this.delay);
}
public override string debugDescription => "long multidrag";
public override string debugDescription {
get { return "long multidrag"; }
}
}
}

18
Runtime/gestures/multitap.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.gestures {
public readonly Offset firstGlobalPosition;
public readonly Offset firstGlobalPosition;
class _TapTracker {
internal _TapTracker(
PointerDownEvent evt = null,

if (evt is PointerUpEvent) {
if (this._firstTap == null) {
this._registerFirstTap(tracker);
} else {
}
else {
} else if (evt is PointerMoveEvent) {
}
else if (evt is PointerMoveEvent) {
} else if (evt is PointerCancelEvent) {
}
else if (evt is PointerCancelEvent) {
this._reject(tracker);
}
}

get { return "double tap"; }
}
}
}
}

5
Runtime/gestures/pointer_router.cs


void _dispatch(PointerEvent evt, PointerRoute route) {
try {
route(evt);
} catch (Exception ex) {
}
catch (Exception ex) {
Debug.LogError("Error while routing a pointer event: " + ex);
}
}

}
}
}
}
}

8
Runtime/gestures/recognizer.cs


});
result = callback();
} catch (Exception ex) {
}
catch (Exception ex) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: ex,
library: "gesture",

if (evt is PointerMoveEvent && this._getDistance(evt) > Constants.kTouchSlop) {
this.resolve(GestureDisposition.rejected);
this.stopTrackingPointer(this.primaryPointer);
} else {
}
else {
this.handlePrimaryPointer(evt);
}
}

properties.add(new EnumProperty<GestureRecognizerState>("state", this.state));
}
}
}
}

7
Runtime/gestures/tap.cs


if (evt is PointerUpEvent) {
this._finalPosition = evt.position;
this._checkUp();
} else if (evt is PointerCancelEvent) {
}
else if (evt is PointerCancelEvent) {
this._reset();
}
}

return null;
});
}
this._sentTapDown = true;
}
}

return null;
});
}
if (this.onTap != null) {
this.invokeCallback<object>("onTap", () => {
this.onTap();

value: this._sentTapDown, ifTrue: "sent tap down"));
}
}
}
}

5
Runtime/gestures/team.cs


if (this._members.isEmpty()) {
this._entry.resolve(disposition);
}
} else {
}
else {
this._winner = this._winner ?? this._owner.captain ?? member;
this._entry.resolve(disposition);
}

return combiner._add(pointer, member);
}
}
}
}

7
Runtime/gestures/velocity_tracker.cs


if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.pixelsPerSecond, other.pixelsPerSecond);
}

}
return this.Equals((Velocity) obj);
}

return new Velocity(pixelsPerSecond: estimate.pixelsPerSecond);
}
}
}
}

28
Runtime/material/text_selection.cs


new _MaterialTextSelectionControls();
}
internal static class _TextSelectionUtils {
static class _TextSelectionUtils {
internal class _TextSelectionToolbar : StatelessWidget {
class _TextSelectionToolbar : StatelessWidget {
public _TextSelectionToolbar(Key key = null, Action handleCut = null,
Action handleCopy = null, Action handlePaste = null, Action handleSelectAll = null) : base(key: key) {
this.handleCut = handleCut;

}
}
internal class _TextSelectionToolbarLayout : SingleChildLayoutDelegate {
class _TextSelectionToolbarLayout : SingleChildLayoutDelegate {
internal _TextSelectionToolbarLayout(Size screenSize = null, Rect globalEditableRegion = null,
Offset position = null) {
this.screenSize = screenSize;

double x = globalPosition.dx - childSize.width / 2.0;
double y = globalPosition.dy - childSize.height;
if (x < _TextSelectionUtils._kToolbarScreenPadding)
if (x < _TextSelectionUtils._kToolbarScreenPadding) {
else if (x + childSize.width > this.screenSize.width - _TextSelectionUtils._kToolbarScreenPadding)
}
else if (x + childSize.width > this.screenSize.width - _TextSelectionUtils._kToolbarScreenPadding) {
}
if (y < _TextSelectionUtils._kToolbarScreenPadding)
if (y < _TextSelectionUtils._kToolbarScreenPadding) {
else if (y + childSize.height > this.screenSize.height - _TextSelectionUtils._kToolbarScreenPadding)
}
else if (y + childSize.height > this.screenSize.height - _TextSelectionUtils._kToolbarScreenPadding) {
}
return new Offset(x, y);
}

}
}
internal class _TextSelectionHandlePainter : CustomPainter {
class _TextSelectionHandlePainter : AbstractCustomPainter {
internal _TextSelectionHandlePainter(Color color) {
this.color = color;
}

}
}
internal class _MaterialTextSelectionControls : TextSelectionControls {
class _MaterialTextSelectionControls : TextSelectionControls {
get => new Size(_TextSelectionUtils._kHandleSize,
_TextSelectionUtils._kHandleSize);
get {
return new Size(_TextSelectionUtils._kHandleSize,
_TextSelectionUtils._kHandleSize);
}
}
public override Widget buildToolbar(BuildContext context, Rect globalEditableRegion, Offset position,

19
Runtime/painting/alignment.cs


if (a == null && b == null) {
return null;
}
return new Alignment(MathUtils.lerpDouble(a.x, b.x, t), MathUtils.lerpDouble(a.y, b.y, t));
}

}
return this.x.Equals(other.x) && this.y.Equals(other.y);
}

}
return this.Equals((Alignment) obj);
}

if (this.x == -1.0 && this.y == -1.0) {
return "topLeft";
}
}
}

2
Runtime/painting/basic_types.cs


throw new Exception("unknown axisDirection");
}
}
}
}

2
Runtime/painting/binding.cs


return new ImageCache();
}
}
}
}

57
Runtime/painting/border_radius.cs


public static BorderRadius all(Radius radius) {
return only(radius, radius, radius, radius);
}
return BorderRadius.all(Radius.circular(radius));
return all(Radius.circular(radius));
public static BorderRadius vertical(double? top = null, double? bottom = null) {
return only(top, top, bottom, bottom);
}

}
public static BorderRadius horizontal(double? left = null, double? right = null) {
return only(left, right, right, left);
}

Radius bottomRight = null, Radius bottomLeft = null) {
return new BorderRadius(topLeft, topRight, bottomRight, bottomLeft);
}
public static BorderRadius only(
double? topLeft = null, double? topRight = null,
double? bottomRight = null, double? bottomLeft = null) {

var blRadius = bottomLeft != null ? Radius.circular(bottomLeft.Value) : null;
return new BorderRadius(tlRadius, trRadius, brRadius, blRadius);
}

}
public static BorderRadius operator -(BorderRadius it, BorderRadius other) {
return BorderRadius.only(
return only(
topLeft: it.topLeft - other.topLeft,
topRight: it.topRight - other.topRight,
bottomLeft: it.bottomLeft - other.bottomLeft,

public static BorderRadius operator +(BorderRadius it, BorderRadius other) {
return BorderRadius.only(
return only(
topLeft: it.topLeft + other.topLeft,
topRight: it.topRight + other.topRight,
bottomLeft: it.bottomLeft + other.bottomLeft,

public static BorderRadius operator -(BorderRadius it) {
return BorderRadius.only(
return only(
topLeft: -it.topLeft,
topRight: -it.topRight,
bottomLeft: -it.bottomLeft,

public static BorderRadius operator *(BorderRadius it, double other) {
return BorderRadius.only(
return only(
topLeft: it.topLeft * other,
topRight: it.topRight * other,
bottomLeft: it.bottomLeft * other,

public static BorderRadius operator /(BorderRadius it, double other) {
return BorderRadius.only(
return only(
topLeft: it.topLeft / other,
topRight: it.topRight / other,
bottomLeft: it.bottomLeft / other,

public static BorderRadius operator %(BorderRadius it, double other) {
return BorderRadius.only(
return only(
topLeft: it.topLeft % other,
topRight: it.topRight % other,
bottomLeft: it.bottomLeft % other,

if (a == null && b == null) {
return null;
}
return BorderRadius.only(
return only(
topLeft: Radius.lerp(a.topLeft, b.topLeft, t),
topRight: Radius.lerp(a.topRight, b.topRight, t),
bottomLeft: Radius.lerp(a.bottomLeft, b.bottomLeft, t),

if (ReferenceEquals(null, other)) {
return false;
}
return this.topLeft.Equals(other.topLeft)
&& this.topRight.Equals(other.topRight)
&& this.bottomRight.Equals(other.bottomRight)

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((BorderRadius) obj);
}

}
}
public static bool operator ==(BorderRadius a, BorderRadius b) {
return Equals(a, b);
}
public static bool operator !=(BorderRadius a, BorderRadius b) {
return !Equals(a, b);
}
public override string ToString() {
string visual = null;
if (this.topLeft == this.topRight &&

if (this.topLeft.x == this.topLeft.y) {
visual = $"BorderRadius.circular({this.topLeft.x:F1})";
} else {
}
else {
} else {
}
else {
var result = new StringBuilder();
result.Append("BorderRadius.only(");
bool comma = false;

}
result.Append(")");
visual = result.ToString();
}

}
}
}

51
Runtime/painting/borders.cs


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;

bool bIsNone = b.style == BorderStyle.none && b.width == 0.0;
if (aIsNone && bIsNone) {
return BorderSide.none;
return none;
}
if (aIsNone) {

if (t == 0.0) {
return a;
}
if (t == 1.0) {
return b;
}

return BorderSide.none;
return none;
}
if (a.style == b.style) {

colorA = a.color.withAlpha(0x00);
break;
}
switch (b.style) {
case BorderStyle.solid:
colorB = b.color;

break;
}
return new BorderSide(
color: Color.lerp(colorA, colorB, t),
width: width,

if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.color, other.color) && this.width.Equals(other.width) && this.style == other.style;
}

}
return this.Equals((BorderSide) obj);
}

if (a == null) {
return this.scale(t);
}
return null;
}

}
return null;
}

if (reversed) {
mergedBorders.AddRange(this.borders);
}
} else {
}
else {
return new _CompoundBorder(mergedBorders);
}

}
public override ShapeBorder lerpFrom(ShapeBorder a, double t) {
return _CompoundBorder.lerp(a, this, t);
return lerp(a, this, t);
return _CompoundBorder.lerp(this, b, t);
return lerp(this, b, t);
}
public new static _CompoundBorder lerp(ShapeBorder a, ShapeBorder b, double t) {

continue;
}
}
return new _CompoundBorder(results);
}

}
return this.borders.Last().getInnerPath(rect);
}

if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((_CompoundBorder) obj);
}

path.lineTo(rect.right, rect.top);
if (top.width == 0.0) {
paint.style = PaintingStyle.stroke;
} else {
}
else {
canvas.drawPath(path, paint);
break;
case BorderStyle.none:

path.lineTo(rect.right, rect.bottom);
if (right.width == 0.0) {
paint.style = PaintingStyle.stroke;
} else {
}
else {
canvas.drawPath(path, paint);
break;
case BorderStyle.none:

path.lineTo(rect.left, rect.bottom);
if (bottom.width == 0.0) {
paint.style = PaintingStyle.stroke;
} else {
}
else {
canvas.drawPath(path, paint);
break;
case BorderStyle.none:

path.lineTo(rect.left, rect.top);
if (left.width == 0.0) {
paint.style = PaintingStyle.stroke;
} else {
}
else {
canvas.drawPath(path, paint);
break;
case BorderStyle.none:

}
}
}

25
Runtime/painting/box_border.cs


public override ShapeBorder lerpFrom(ShapeBorder a, double t) {
if (a is Border border) {
return Border.lerp(border, this, t);
return lerp(border, this, t);
}
return base.lerpFrom(a, t);

if (b is Border border) {
return Border.lerp(this, border, t);
return lerp(this, border, t);
return base.lerpTo(b, t);
}

}
if (b == null) {
return (Border) a.scale(1.0 - t);
}

case BoxShape.rectangle:
if (borderRadius != null) {
_paintUniformBorderWithRadius(canvas, rect, this.top, borderRadius);
} else {
}
else {
return;
}
}

paint.style = PaintingStyle.stroke;
paint.strokeWidth = 0.0;
canvas.drawRRect(outer, paint);
} else {
}
else {
RRect inner = outer.deflate(width);
canvas.drawDRRect(outer, inner, paint);
}

if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.top, other.top)
&& Equals(this.right, other.right)
&& Equals(this.bottom, other.bottom)

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((Border) obj);
}

if (this.top != BorderSide.none) {
arguments.Add($"top: {this.top}");
}
if (this.left != BorderSide.none) {
arguments.Add($"left: {this.left}");
}

}
}
}

27
Runtime/painting/box_decoration.cs


if (a == null) {
return this.scale(t);
}
return BoxDecoration.lerp(boxDecoration, this, t);
return lerp(boxDecoration, this, t);
}
return base.lerpFrom(a, t);

if (b == null) {
return this.scale(1.0 - t);
}
return BoxDecoration.lerp(this, boxDecoration, t);
return lerp(this, boxDecoration, t);
return base.lerpTo(b, t);
}

}
if (a == null) {
return b.scale(t);
}

}
if (t == 1.0) {
return b;
}

if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.color, other.color) && Equals(this.image, other.image) &&
Equals(this.border, other.border) && Equals(this.borderRadius, other.borderRadius) &&
Equals(this.boxShadow, other.boxShadow) && Equals(this.gradient, other.gradient) &&

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((BoxDecoration) obj);
}

RRect bounds = this.borderRadius.toRRect(Offset.zero & size);
return bounds.contains(position);
}
return true;
case BoxShape.circle:
Offset center = size.center(Offset.zero);

return false;
}

if (this._decoration.backgroundBlendMode != null) {
paint.blendMode = this._decoration.backgroundBlendMode.Value;
}
if (this._decoration.gradient != null) {
//paint.shader = this._decoration.gradient.createShader(rect);
this._rectForCachedBackgroundPaint = rect;

case BoxShape.rectangle:
if (this._decoration.borderRadius == null) {
canvas.drawRect(rect, paint);
} else {
}
else {
break;
}
}

clipPath = new Path();
clipPath.addRRect(this._decoration.borderRadius.toRRect(rect));
}
this._imagePainter.paint(canvas, rect, clipPath, configuration);
}

return $"BoxPainter for {this._decoration}";
}
}
}
}

12
Runtime/painting/box_fit.cs


if (outputSize.width / outputSize.height > sourceSize.width / sourceSize.height) {
destinationSize = new Size(sourceSize.width * outputSize.height / sourceSize.height,
outputSize.height);
} else {
}
else {
} else {
}
else {
destinationSize = outputSize;
break;
case BoxFit.fitWidth:

if (destinationSize.height > outputSize.height) {
destinationSize = new Size(outputSize.height * aspectRatio, outputSize.height);
}
break;
}

}
}

16
Runtime/painting/box_shadow.cs


public Paint toPaint() {
return new Paint {
color = this.color,
//blurSigma = this.blurSigma, TODO
maskFilter = MaskFilter.blur(BlurStyle.normal, this.blurSigma)
};
}

if (a == null && b == null) {
return null;
}
if (b == null) {
return a.scale(1.0 - t);
}

List<BoxShadow> result = new List<BoxShadow>();
int commonLength = Math.Min(a.Count, b.Count);
for (int i = 0; i < commonLength; i += 1) {
result.Add(BoxShadow.lerp(a[i], b[i], t));
result.Add(lerp(a[i], b[i], t));
return result;
}

}
return Equals(this.color, other.color)
&& Equals(this.offset, other.offset)
&& this.blurRadius.Equals(other.blurRadius)

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((BoxShadow) obj);
}

return $"BoxShadow({this.color}, {this.offset}, {this.blurRadius}, {this.spreadRadius})";
}
}
}
}

9
Runtime/painting/circle_border.cs


if (a is CircleBorder border) {
return new CircleBorder(side: BorderSide.lerp(border.side, this.side, t));
}
return base.lerpFrom(a, t);
}

}
return base.lerpTo(b, t);
}

if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.side, other.side);
}

}
return this.Equals((CircleBorder) obj);
}

return $"{this.GetType()}({this.side})";
}
}
}
}

2
Runtime/painting/clip.cs


clipBehavior, bounds, painter);
}
}
}
}

23
Runtime/painting/decoration_image.cs


public readonly Alignment alignment;
public readonly Rect centerSlice;
public readonly ImageRepeat repeat;
return Equals(this.image, other.image) && Equals(this.colorFilter, other.colorFilter) &&
this.fit == other.fit && Equals(this.alignment, other.alignment) &&
Equals(this.centerSlice, other.centerSlice) && this.repeat == other.repeat;

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((DecorationImage) obj);
}

this._imageStream = newImageStream;
this._imageStream.addListener(this._imageListener);
}
if (this._image == null) {
return;
}

if (this._image == value) {
return;
}
this._image = value;
D.assert(this._onChanged != null);

}
fit = fit ?? (centerSlice == null ? BoxFit.scaleDown : BoxFit.fill);
D.assert(centerSlice == null || (fit != BoxFit.none && fit != BoxFit.cover));
D.assert(centerSlice == null || (fit != BoxFit.none && fit != BoxFit.cover),
$"centerSlice was used with a BoxFit {fit} that is not supported.");
FittedSizes fittedSizes = FittedSizes.applyBoxFit(fit.Value, inputSize / scale, outputSize);
Size sourceSize = fittedSizes.source * scale;
Size destinationSize = fittedSizes.destination;

D.assert(sourceSize == inputSize,
"centerSlice was used with a BoxFit that does not guarantee that the image is fully visible.");
$"centerSlice was used with a BoxFit {fit} that does not guarantee that the image is fully visible.");
}
if (repeat != ImageRepeat.noRepeat && destinationSize == outputSize) {

if (colorFilter != null) {
paint.colorFilter = colorFilter;
}
paint.invertColors = invertColors;
double halfWidthDelta = (outputSize.width - destinationSize.width) / 2.0;

foreach (Rect tileRect in _generateImageTileRects(rect, destinationRect, repeat)) {
canvas.drawImageRect(image, sourceRect, tileRect, paint);
}
} else {
}
else {
foreach (Rect tileRect in _generateImageTileRects(rect, destinationRect, repeat)) {
canvas.drawImageNine(image, centerSlice, tileRect, paint);
}

}
}
}
}
}

14
Runtime/painting/edge_insets.cs


if (a == null && b == null) {
return null;
}
return EdgeInsets.fromLTRB(
return fromLTRB(
MathUtils.lerpDouble(a.left, b.left, t),
MathUtils.lerpDouble(a.top, b.top, t),
MathUtils.lerpDouble(a.right, b.right, t),

if (ReferenceEquals(null, other)) {
return false;
}
return this.left.Equals(other.left)
&& this.right.Equals(other.right)
&& this.top.Equals(other.top)

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((EdgeInsets) obj);
}

if (this.left == 0.0 && this.right == 0.0 && this.top == 0.0 && this.bottom == 0.0) {
return "EdgeInsets.zero";
}
return $"EdgeInsets({this.left:F1}, " +
$"{this.top:F1}, " +
$"{this.right:F1}, " +

}
}

2
Runtime/painting/gradient.cs


return null;
}
}
}
}

8
Runtime/painting/image_cache.cs


this._maximumSize = value;
if (this._maximumSize == 0) {
this.clear();
} else {
}
else {
this._checkCacheSize();
}
}

this._maximumSizeBytes = value;
if (this._maximumSizeBytes == 0) {
this.clear();
} else {
}
else {
this._checkCacheSize();
}
}

public int sizeBytes;
public LinkedListNode<object> node;
}
}
}

45
Runtime/painting/image_provider.cs


if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.bundle, other.bundle) && this.devicePixelRatio.Equals(other.devicePixelRatio) &&
Equals(this.locale, other.locale) && Equals(this.size, other.size) &&
this.platform == other.platform;

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((ImageConfiguration) obj);
}

if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.bundle, other.bundle) && string.Equals(this.name, other.name) &&
this.scale.Equals(other.scale);
}

return false;
}
return this.Equals((AssetBundleImageKey) obj);
}

if (result is Texture2D texture) {
return CodecUtils.getCodec(new Image(texture, isAsset: true, bundle: key.bundle));
} else if (result is TextAsset text) {
}
else if (result is TextAsset text) {
} else {
}
else {
} else {
}
else {
throw new Exception($"Unknown type for asset \"{key.name}\": \"{result.GetType()}\"");
}
});

ResourceRequest request = Resources.LoadAsync(key.name);
yield return request;
yield return request.asset;
} else {
}
else {
AssetBundleRequest request = key.bundle.LoadAssetAsync(key.name);
yield return request;
yield return request.asset;

if (ReferenceEquals(null, other)) {
return false;
}
return string.Equals(this.url, other.url) && this.scale.Equals(other.scale);
}

}
return this.Equals((NetworkImage) obj);
}

if (ReferenceEquals(null, other)) {
return false;
}
return string.Equals(this.file, other.file) && this.scale.Equals(other.scale);
}

}
return this.Equals((FileImage) obj);
}

if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.bytes, other.bytes) && this.scale.Equals(other.scale);
}

}
return this.Equals((MemoryImage) obj);
}

if (ReferenceEquals(null, other)) {
return false;
}
return string.Equals(this.assetName, other.assetName) && this.scale.Equals(other.scale) &&
Equals(this.bundle, other.bundle);
}

return false;
}
return this.Equals((ExactAssetImage) obj);
}

return $"{this.GetType()}(name: \"{this.assetName}\", scale: {this.scale}, bundle: {this.bundle})";
}
}
}
}

93
Runtime/painting/image_resolution.cs


public readonly string assetName;
public readonly AssetBundle bundle;
readonly Dictionary<ImageConfiguration, AssetBundleImageKey> _cache =
new Dictionary<ImageConfiguration, AssetBundleImageKey>();
AssetImageConfiguration assetConfig = new AssetImageConfiguration(configuration, this.assetName);
if (this._cache.TryGetValue(configuration, out key)) {
var cache = AssetBundleCache.instance.get(configuration.bundle);
if (cache.TryGetValue(assetConfig, out key)) {
return Promise<AssetBundleImageKey>.Resolved(key);
}

D.assert(result != null);
key = (AssetBundleImageKey) result;
this._cache[configuration] = key;
cache[assetConfig] = key;
return key;
});
}

ResourceRequest request = Resources.LoadAsync(assetName);
yield return request;
asset = request.asset;
} else {
}
else {
AssetBundleRequest request = bundle.LoadAssetAsync(assetName);
yield return request;
asset = request.asset;

if (bundle == null) {
Resources.UnloadAsset(asset);
} else {
}
else {
bundle.Unload(asset);
}

if (ReferenceEquals(null, other)) {
return false;
}
return string.Equals(this.assetName, other.assetName) && Equals(this.bundle, other.bundle);
}

}
return this.Equals((AssetImage) obj);
}

return $"{this.GetType()}(bundle: {this.bundle}, name: \"{this.assetName}\")";
}
}
}
public class AssetImageConfiguration: IEquatable<AssetImageConfiguration> {
public readonly ImageConfiguration configuration;
public readonly string assetName;
public AssetImageConfiguration(ImageConfiguration configuration, string assetName) {
this.configuration = configuration;
this.assetName = assetName;
}
public bool Equals(AssetImageConfiguration other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(this.configuration, other.configuration) && string.Equals(this.assetName, other.assetName);
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != this.GetType()) {
return false;
}
return this.Equals((AssetImageConfiguration) obj);
}
public override int GetHashCode() {
unchecked {
return ((this.configuration != null ? this.configuration.GetHashCode() : 0) * 397) ^ (this.assetName != null ? this.assetName.GetHashCode() : 0);
}
}
public static bool operator ==(AssetImageConfiguration left, AssetImageConfiguration right) {
return Equals(left, right);
}
public static bool operator !=(AssetImageConfiguration left, AssetImageConfiguration right) {
return !Equals(left, right);
}
}
public class AssetBundleCache {
static readonly AssetBundleCache _instance = new AssetBundleCache();
public static AssetBundleCache instance => _instance;
readonly Dictionary<int, Dictionary<AssetImageConfiguration, AssetBundleImageKey>> _bundleCaches =
new Dictionary<int, Dictionary<AssetImageConfiguration, AssetBundleImageKey>>();
public Dictionary<AssetImageConfiguration, AssetBundleImageKey> get(AssetBundle bundle) {
Dictionary<AssetImageConfiguration, AssetBundleImageKey> result;
int id = bundle == null ? 0 : bundle.GetInstanceID();
if (this._bundleCaches.TryGetValue(id, out result)) {
return result;
}
result = new Dictionary<AssetImageConfiguration, AssetBundleImageKey>();
this._bundleCaches[id] = result;
return result;
}
}
}

22
Runtime/painting/image_stream.cs


if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.image, other.image) && this.scale.Equals(other.scale);
}

}
return this.Equals((ImageInfo) obj);
}

if (this.currentImage != null) {
try {
listener(this.currentImage, true);
} catch (Exception ex) {
}
catch (Exception ex) {
this.reportError(
context: "by a synchronously-called image listener",
exception: ex

if (this.currentError != null && onError != null) {
try {
onError(this.currentError.exception);
} catch (Exception ex) {
}
catch (Exception ex) {
UIWidgetsError.reportError(
new UIWidgetsErrorDetails(
exception: ex,

foreach (var listener in localListeners) {
try {
listener(image, false);
} catch (Exception ex) {
}
catch (Exception ex) {
this.reportError(
context: "by an image listener",
exception: ex

if (localErrorListeners.isEmpty()) {
UIWidgetsError.reportError(this.currentError);
} else {
}
else {
} catch (Exception ex) {
}
catch (Exception ex) {
UIWidgetsError.reportError(
new UIWidgetsErrorDetails(
context: "by an image error listener",

}
}
}
}
}

14
Runtime/painting/matrix_utils.cs


namespace Unity.UIWidgets.painting {
public static class MatrixUtils {
if (transform == null)
if (transform == null) {
}
List<string> result = new List<string>(3);
for (int i = 0; i < 3; i++) {
result.Add($"[{i}] {transform[i * 3]}, {transform[i * 3 + 1]}, {transform[i * 3 + 2]}");

}
public class TransformProperty : DiagnosticsProperty<Matrix3> {
): base(name, value, showName: showName, defaultValue: defaultValue??Diagnostics.kNoDefaultValue, level: level) {
) : base(name, value, showName: showName, defaultValue: defaultValue ?? Diagnostics.kNoDefaultValue,
level: level) {
}
protected override string valueToString(TextTreeConfiguration parentConfiguration = null) {

return string.Join("\n", MatrixUtils.debugDescribeTransform(this.value));
}
}
}
}

36
Runtime/painting/rounded_rectangle_border.cs


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

borderRadius: BorderRadius.lerp(border.borderRadius, this.borderRadius, t)
);
}
if (a is CircleBorder circleBorder) {
return new _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(circleBorder.side, this.side, t),

}
return base.lerpFrom(a, t);
}

borderRadius: BorderRadius.lerp(this.borderRadius, border.borderRadius, t)
);
}
if (b is CircleBorder circleBorder) {
return new _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(this.side, circleBorder.side, t),

}
return base.lerpTo(b, t);
}

double width = this.side.width;
if (width == 0.0) {
canvas.drawRRect(this.borderRadius.toRRect(rect), this.side.toPaint());
} else {
}
else {
RRect outer = this.borderRadius.toRRect(rect);
RRect inner = outer.deflate(width);
Paint paint = new Paint {

}
break;
}
}

return false;
}
return Equals(this.side, other.side) && Equals(this.borderRadius, other.borderRadius);
}

}
return this.Equals((RoundedRectangleBorder) obj);
}

public static bool operator !=(RoundedRectangleBorder left, RoundedRectangleBorder right) {
return !Equals(left, right);
}
public override string ToString() {
return $"{this.GetType()}({this.side}, {this.borderRadius})";
}

circleness: this.circleness * t
);
}
if (a is CircleBorder circleBorder) {
return new _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(circleBorder.side, this.side, t),

}
if (a is _RoundedRectangleToCircleBorder border) {
return new _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(border.side, this.side, t),

}
return base.lerpFrom(a, t);
}

circleness: this.circleness * (1.0 - t)
);
}
if (b is CircleBorder circleBorder) {
return new _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(this.side, circleBorder.side, t),

}
if (b is _RoundedRectangleToCircleBorder border) {
return new _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(this.side, border.side, t),

}
return base.lerpTo(b, t);
}

rect.right,
rect.bottom - delta
);
} else {
}
else {
double delta = this.circleness * (rect.width - rect.height) / 2.0;
return Rect.fromLTRB(
rect.left + delta,

if (width == 0.0) {
canvas.drawRRect(this._adjustBorderRadius(rect).toRRect(this._adjustRect(rect)),
this.side.toPaint());
} else {
}
else {
RRect outer = this._adjustBorderRadius(rect).toRRect(this._adjustRect(rect));
RRect inner = outer.deflate(width);
Paint paint = new Paint {

}
break;
}
}

return false;
}
return Equals(this.side, other.side) && Equals(this.borderRadius, other.borderRadius) &&
this.circleness.Equals(other.circleness);
}

return false;
}
return this.Equals((_RoundedRectangleToCircleBorder) obj);
}

$"{this.circleness * 100:F1}% of the way to being a CircleBorder)";
}
}
}
}

13
Runtime/painting/text_painter.cs


if (this._textScaleFactor == value) {
return;
}
this._textScaleFactor = value;
this._paragraph = null;
this._layoutTemplate = null;

case TextBaseline.ideographic:
return this._paragraph.ideographicBaseline;
}
return 0.0;
}

if (range.end == range.start) {
break;
}
offset = range.end;
}

if (!char.IsWhiteSpace((char) (this.text.codeUnitAt(range.start) ?? 0))) {
return new TextPosition(range.start);
}
offset = Math.Max(range.start - 1, 0);
if (offset == 0) {
break;

if (prevCodeUnit == null) {
return null;
}
var box = boxes[0];
var caretEnd = box.end;
var dx = box.direction == TextDirection.rtl ? caretEnd : caretEnd - caretPrototype.width;

if (nextCodeUnit == null) {
return null;
}
var box = boxes[0];
var caretStart = box.start;
var dx = box.direction == TextDirection.rtl ? caretStart - caretPrototype.width : caretStart;

if (this.textDirection == TextDirection.rtl) {
return new Offset(this.width, 0.0);
}
return null;
}
}

}
}
}
}

15
Runtime/painting/text_span.cs


if (hasTyle) {
builder.pushStyle(this.style);
}
if (this.children != null) {
foreach (var child in this.children) {
Assert.IsNotNull(child);

return false;
}
}
if (this.children != null) {
foreach (var child in this.children) {
if (!child.visitTextSpan(visitor)) {

}
return true;
}

if (candidate > result) {
result = candidate;
}
if (result == RenderComparison.layout) {
return result;
}

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((TextSpan) obj);
}

if (ReferenceEquals(null, other)) {
return false;
}
return Equals(this.style, other.style) && string.Equals(this.text, other.text) &&
childEquals(this.children, other.children);
}

return this.children.Select((child) => {
if (child != null) {
return child.toDiagnosticsNode();
} else {
}
else {
}
}

149
Runtime/painting/text_style.cs


);
}
public TextStyle apply(
Color color = null,
TextDecoration decoration = null,
Color decorationColor = null,
TextDecorationStyle? decorationStyle = null,
string fontFamily = null,
double fontSizeFactor = 1.0,
double fontSizeDelta = 0.0,
int fontWeightDelta = 0,
double letterSpacingFactor = 1.0,
double letterSpacingDelta = 0.0,
double wordSpacingFactor = 1.0,
double wordSpacingDelta = 0.0,
double heightFactor = 1.0,
double heightDelta = 0.0
) {
D.assert(this.fontSize != null || (fontSizeFactor == 1.0 && fontSizeDelta == 0.0));
D.assert(this.fontWeight != null || fontWeightDelta == 0.0);
D.assert(this.letterSpacing != null || (letterSpacingFactor == 1.0 && letterSpacingDelta == 0.0));
D.assert(this.wordSpacing != null || (wordSpacingFactor == 1.0 && wordSpacingDelta == 0.0));
D.assert(this.height != null || (heightFactor == 1.0 && heightDelta == 0.0));
string modifiedDebugLabel = "";
D.assert(() => {
if (this.debugLabel != null) {
modifiedDebugLabel = this.debugLabel + ".apply";
}
return true;
});
return new TextStyle(
inherit: this.inherit,
color: color ?? this.color,
fontFamily: fontFamily ?? this.fontFamily,
fontSize: this.fontSize == null ? null : this.fontSize * fontSizeFactor + fontSizeDelta,
fontWeight: this.fontWeight == null ? null : this.fontWeight,
fontStyle: this.fontStyle,
letterSpacing: this.letterSpacing == null
? null
: this.letterSpacing * letterSpacingFactor + letterSpacingDelta,
wordSpacing: this.wordSpacing == null ? null : this.wordSpacing * wordSpacingFactor + wordSpacingDelta,
textBaseline: this.textBaseline,
height: this.height == null ? null : this.height * heightFactor + heightDelta,
background: this.background,
decoration: decoration ?? this.decoration,
decorationColor: decorationColor ?? this.decorationColor,
decorationStyle: decorationStyle ?? this.decorationStyle,
debugLabel: modifiedDebugLabel
);
}
public TextStyle merge(TextStyle other) {
if (other == null) {
return this;

);
}
public TextStyle copyWith(Color color,
string fontFamily,
double? fontSize,
FontWeight? fontWeight,
FontStyle? fontStyle,
double? letterSpacing,
double? wordSpacing,
public TextStyle copyWith(Color color = null,
string fontFamily = null,
double? fontSize = null,
FontWeight? fontWeight = null,
FontStyle? fontStyle = null,
double? letterSpacing = null,
double? wordSpacing = null,
TextBaseline? textBaseline = null,
double? height = null,
Paint background = null,

);
}
public static TextStyle lerp(TextStyle a, TextStyle b, double t) {
D.assert(a == null || b == null || a.inherit == b.inherit);
if (a == null && b == null) {
return null;
}
string lerpDebugLabel = "";
D.assert(() => {
lerpDebugLabel = "lerp" + (a?.debugLabel ?? _kDefaultDebugLabel) + "-" + t + "-" +
(b?.debugLabel ?? _kDefaultDebugLabel);
return true;
});
if (a == null) {
return new TextStyle(
inherit: b.inherit,
color: Color.lerp(null, b.color, t),
fontFamily: t < 0.5 ? null : b.fontFamily,
fontSize: t < 0.5 ? null : b.fontSize,
fontWeight: t < 0.5 ? null : b.fontWeight,
fontStyle: t < 0.5 ? null : b.fontStyle,
letterSpacing: t < 0.5 ? null : b.letterSpacing,
wordSpacing: t < 0.5 ? null : b.wordSpacing,
textBaseline: t < 0.5 ? null : b.textBaseline,
height: t < 0.5 ? null : b.height,
background: t < 0.5 ? null : b.background,
decoration: t < 0.5 ? null : b.decoration,
decorationColor: Color.lerp(null, b.decorationColor, t),
decorationStyle: t < 0.5 ? null : b.decorationStyle,
debugLabel: lerpDebugLabel
);
}
if (b == null) {
return new TextStyle(
inherit: a.inherit,
color: Color.lerp(a.color, null, t),
fontFamily: t < 0.5 ? a.fontFamily : null,
fontSize: t < 0.5 ? a.fontSize : null,
fontWeight: t < 0.5 ? a.fontWeight : null,
fontStyle: t < 0.5 ? a.fontStyle : null,
letterSpacing: t < 0.5 ? a.letterSpacing : null,
wordSpacing: t < 0.5 ? a.wordSpacing : null,
textBaseline: t < 0.5 ? a.textBaseline : null,
height: t < 0.5 ? a.height : null,
background: t < 0.5 ? a.background : null,
decoration: t < 0.5 ? a.decoration : null,
decorationColor: Color.lerp(a.decorationColor, null, t),
decorationStyle: t < 0.5 ? a.decorationStyle : null,
debugLabel: lerpDebugLabel
);
}
return new TextStyle(
inherit: b.inherit,
color: Color.lerp(a.color, b.color, t),
fontFamily: t < 0.5 ? a.fontFamily : b.fontFamily,
fontSize: MathUtils.lerpNullableDouble(a.fontSize ?? b.fontSize, b.fontSize ?? a.fontSize, t),
fontWeight: t < 0.5 ? a.fontWeight : b.fontWeight,
fontStyle: t < 0.5 ? a.fontStyle : b.fontStyle,
letterSpacing: MathUtils.lerpNullableDouble(a.letterSpacing ?? b.letterSpacing,
b.letterSpacing ?? a.letterSpacing, t),
wordSpacing: MathUtils.lerpNullableDouble(a.wordSpacing ?? b.wordSpacing,
b.wordSpacing ?? a.wordSpacing, t),
textBaseline: t < 0.5 ? a.textBaseline : b.textBaseline,
height: MathUtils.lerpNullableDouble(a.height ?? b.height, b.height ?? a.height, t),
background: t < 0.5 ? a.background : b.background,
decoration: t < 0.5 ? a.decoration : b.decoration,
decorationColor: Color.lerp(a.decorationColor, b.decorationColor, t),
decorationStyle: t < 0.5 ? a.decorationStyle : b.decorationStyle,
debugLabel: lerpDebugLabel
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

if (this.decoration != null) {
decorationDescription.Add("$decoration");
}
D.assert(decorationDescription.isNotEmpty);
styles.Add(new MessageProperty("decoration", string.Join(" ", decorationDescription.ToArray())));
}

if (ReferenceEquals(null, other)) {
return false;
}
return this.inherit == other.inherit && Equals(this.color, other.color) &&
this.fontSize.Equals(other.fontSize) && this.fontWeight == other.fontWeight &&
this.fontStyle == other.fontStyle && this.letterSpacing.Equals(other.letterSpacing) &&

if (ReferenceEquals(null, obj)) {
return false;
}
return this.Equals((TextStyle) obj);
}

return this.GetType().FullName;
}
}
}
}

2
Runtime/physics/clamped_simulation.cs


return this.simulation.isDone(time);
}
}
}
}

2
Runtime/physics/friction_simulation.cs


(this.x(time) - this._maxX).abs() < this.tolerance.distance;
}
}
}
}

2
Runtime/physics/gravity_simulation.cs


return this.x(time).abs() >= this._end;
}
}
}
}

2
Runtime/physics/simulation.cs


public Tolerance tolerance;
}
}
}

2
Runtime/physics/spring_simulation.cs


get { return SpringType.underDamped; }
}
}
}
}

2
Runtime/physics/tolerance.cs


return $"Tolerance(distance: ±{this.distance}, time: ±{this.time}, velocity: ±{this.velocity})";
}
}
}
}

2
Runtime/physics/utils.cs


return nearEqual(a, 0.0, epsilon);
}
}
}
}

2
Runtime/promise/EnumerableExt.cs


}
}
}
}
}

41
Runtime/promise/Promise.cs


/// Gets the id of the promise, useful for referencing the promise during runtime.
/// </summary>
int Id { get; }
bool isCompleted { get; }
/// <summary>

try {
resolver(this.Resolve, this.Reject);
} catch (Exception ex) {
}
catch (Exception ex) {
this.Reject(ex);
}
}

try {
callback(value);
} catch (Exception ex) {
}
catch (Exception ex) {
rejectable.Reject(ex);
}
}

if (this.rejectHandlers != null) {
this.rejectHandlers.Each(handler => this.InvokeHandler(handler.callback, handler.rejectable, ex));
} else {
}
else {
Promise.PropagateUnhandledException(this, ex);
}

public void Reject(Exception ex) {
if (this.IsSync) {
this.RejectSync(ex);
} else {
}
else {
Window.instance.run(() => this.RejectSync(ex));
}
}

public void Resolve(PromisedT value) {
if (this.IsSync) {
this.ResolveSync(value);
} else {
}
else {
Window.instance.run(() => this.ResolveSync(value));
}
}

try {
onRejected(ex);
resultPromise.Resolve();
} catch (Exception cbEx) {
}
catch (Exception cbEx) {
resultPromise.Reject(cbEx);
}
};

Action<Exception> rejectHandler = ex => {
try {
resultPromise.Resolve(onRejected(ex));
} catch (Exception cbEx) {
}
catch (Exception cbEx) {
resultPromise.Reject(cbEx);
}
};

chainedValue => resultPromise.Resolve(chainedValue),
callbackEx => resultPromise.Reject(callbackEx)
);
} catch (Exception callbackEx) {
}
catch (Exception callbackEx) {
resultPromise.Reject(callbackEx);
}
};

() => resultPromise.Resolve(),
ex => resultPromise.Reject(ex)
);
} else {
}
else {
resultPromise.Resolve();
}
};

Action<Exception> rejectHandler) {
if (this.CurState == PromiseState.Resolved) {
this.InvokeHandler(resolveHandler, resultPromise, this.resolveValue);
} else if (this.CurState == PromiseState.Rejected) {
}
else if (this.CurState == PromiseState.Rejected) {
} else {
}
else {
this.AddResolveHandler(resolveHandler, resultPromise);
this.AddRejectHandler(rejectHandler, resultPromise);
}

try {
onComplete();
promise.Reject(e);
} catch (Exception ne) {
}
catch (Exception ne) {
promise.Reject(ne);
}
});

if (onProgress != null) {
this.ProgressHandlers(this, onProgress);
}
}
}

2
Runtime/promise/PromiseException.cs


public PromiseException(string message, Exception inner) : base(message, inner) {
}
}
}
}

2
Runtime/promise/PromiseHelpers.cs


.Then(vals => Tuple.Create(vals.Item1.Item1, vals.Item1.Item2, vals.Item2.Item1, vals.Item2.Item2));
}
}
}
}

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存