浏览代码

Merge branch 'siyaoH/skiaBase' of https://github.com/Unity-Technologies/com.unity.uiwidgets into zxw/skiaBase

# Conflicts:
#	com.unity.uiwidgets/Runtime/rendering/editable.cs
/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
6fd6d3fa
共有 263 个文件被更改,包括 1289 次插入2219 次删除
  1. 17
      Samples/UIWidgetsSamples_2019_4/Assets/TextTest.cs
  2. 4
      com.unity.uiwidgets/Runtime/animation/animation_controller.cs
  3. 4
      com.unity.uiwidgets/Runtime/async2/future.cs
  4. 3
      com.unity.uiwidgets/Runtime/external/SplayTree.cs
  5. 1
      com.unity.uiwidgets/Runtime/foundation/binding.cs
  6. 1
      com.unity.uiwidgets/Runtime/foundation/debug.cs
  7. 70
      com.unity.uiwidgets/Runtime/material/colors.cs
  8. 71
      com.unity.uiwidgets/Runtime/painting/alignment.cs
  9. 1
      com.unity.uiwidgets/Runtime/painting/binding.cs
  10. 19
      com.unity.uiwidgets/Runtime/painting/box_decoration.cs
  11. 2
      com.unity.uiwidgets/Runtime/painting/colors.cs
  12. 6
      com.unity.uiwidgets/Runtime/painting/decoration_image.cs
  13. 59
      com.unity.uiwidgets/Runtime/painting/gradient.cs
  14. 148
      com.unity.uiwidgets/Runtime/painting/image_provider.cs
  15. 8
      com.unity.uiwidgets/Runtime/painting/image_resolution.cs
  16. 32
      com.unity.uiwidgets/Runtime/painting/image_stream.cs
  17. 36
      com.unity.uiwidgets/Runtime/painting/matrix_utils.cs
  18. 7
      com.unity.uiwidgets/Runtime/painting/shader_warmup.cs
  19. 2
      com.unity.uiwidgets/Runtime/painting/strut_style.cs
  20. 239
      com.unity.uiwidgets/Runtime/painting/text_painter.cs
  21. 190
      com.unity.uiwidgets/Runtime/painting/text_span.cs
  22. 40
      com.unity.uiwidgets/Runtime/painting/text_style.cs
  23. 6
      com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs
  24. 122
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  25. 18
      com.unity.uiwidgets/Runtime/rendering/image.cs
  26. 20
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  27. 12
      com.unity.uiwidgets/Runtime/rendering/viewport_offset.cs
  28. 12
      com.unity.uiwidgets/Runtime/service/clipboard.cs
  29. 182
      com.unity.uiwidgets/Runtime/service/text_editing.cs
  30. 4
      com.unity.uiwidgets/Runtime/service/text_input.cs
  31. 4
      com.unity.uiwidgets/Runtime/ui/painting/codec.cs
  32. 2
      com.unity.uiwidgets/Runtime/ui2/painting.cs
  33. 89
      com.unity.uiwidgets/Runtime/ui2/window.cs
  34. 1
      com.unity.uiwidgets/Runtime/widgets/animated_switcher.cs
  35. 19
      com.unity.uiwidgets/Runtime/widgets/app.cs
  36. 4
      com.unity.uiwidgets/Runtime/widgets/automatic_keep_alive.cs
  37. 1
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  38. 46
      com.unity.uiwidgets/Runtime/widgets/binding.cs
  39. 12
      com.unity.uiwidgets/Runtime/widgets/dismissible.cs
  40. 26
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs
  41. 15
      com.unity.uiwidgets/Runtime/widgets/focus_manager.cs
  42. 21
      com.unity.uiwidgets/Runtime/widgets/image.cs
  43. 11
      com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs
  44. 42
      com.unity.uiwidgets/Runtime/widgets/localizations.cs
  45. 1
      com.unity.uiwidgets/Runtime/widgets/media_query.cs
  46. 65
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  47. 10
      com.unity.uiwidgets/Runtime/widgets/nested_scroll_view.cs
  48. 9
      com.unity.uiwidgets/Runtime/widgets/overscroll_indicator.cs
  49. 8
      com.unity.uiwidgets/Runtime/widgets/page_view.cs
  50. 105
      com.unity.uiwidgets/Runtime/widgets/routes.cs
  51. 16
      com.unity.uiwidgets/Runtime/widgets/scroll_activity.cs
  52. 8
      com.unity.uiwidgets/Runtime/widgets/scroll_controller.cs
  53. 10
      com.unity.uiwidgets/Runtime/widgets/scroll_position.cs
  54. 6
      com.unity.uiwidgets/Runtime/widgets/scroll_position_with_single_context.cs
  55. 15
      com.unity.uiwidgets/Runtime/widgets/scrollable.cs
  56. 25
      com.unity.uiwidgets/Runtime/widgets/selectable_text.cs
  57. 1
      com.unity.uiwidgets/Runtime/widgets/text.cs
  58. 20
      com.unity.uiwidgets/Runtime/widgets/text_selection.cs
  59. 16
      com.unity.uiwidgets/Runtime/widgets/texture.cs
  60. 16
      com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
  61. 5
      engine/src/lib/ui/window/window.cc
  62. 206
      com.unity.uiwidgets/Runtime/painting/inline_span.cs
  63. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Editor.meta
  64. 8
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta
  65. 8
      Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample.meta
  66. 8
      Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample.meta
  67. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Resources.meta
  68. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Scenes.meta
  69. 8
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery.meta
  70. 8
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsSample.meta
  71. 8
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsTheatre.meta
  72. 204
      com.unity.uiwidgets/Runtime/material/text_selection.cs
  73. 11
      com.unity.uiwidgets/Runtime/material/text_selection.cs.meta
  74. 11
      com.unity.uiwidgets/Runtime/material/button.cs.meta
  75. 11
      com.unity.uiwidgets/Runtime/material/button_theme.cs.meta
  76. 352
      com.unity.uiwidgets/Runtime/material/color_scheme.cs
  77. 11
      com.unity.uiwidgets/Runtime/material/color_scheme.cs.meta
  78. 11
      com.unity.uiwidgets/Runtime/material/colors.cs.meta
  79. 26
      com.unity.uiwidgets/Runtime/material/constants.cs
  80. 11
      com.unity.uiwidgets/Runtime/material/constants.cs.meta
  81. 11
      com.unity.uiwidgets/Runtime/material/debug.cs.meta
  82. 11
      com.unity.uiwidgets/Runtime/material/ink_decoration.cs.meta
  83. 11
      com.unity.uiwidgets/Runtime/material/ink_highlight.cs.meta
  84. 11
      com.unity.uiwidgets/Runtime/material/ink_splash.cs.meta
  85. 11
      com.unity.uiwidgets/Runtime/material/ink_well.cs.meta
  86. 11
      com.unity.uiwidgets/Runtime/material/material.cs.meta
  87. 11
      com.unity.uiwidgets/Runtime/material/material_button.cs.meta
  88. 371
      com.unity.uiwidgets/Runtime/material/text_theme.cs
  89. 11
      com.unity.uiwidgets/Runtime/material/text_theme.cs.meta
  90. 147
      com.unity.uiwidgets/Runtime/material/theme.cs
  91. 11
      com.unity.uiwidgets/Runtime/material/theme.cs.meta

17
Samples/UIWidgetsSamples_2019_4/Assets/TextTest.cs


using Unity.UIWidgets.async2;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.ui2;
using Canvas = Unity.UIWidgets.ui2.Canvas;
using Color = Unity.UIWidgets.ui2.Color;
using Paint = Unity.UIWidgets.ui2.Paint;
using ParagraphBuilder = Unity.UIWidgets.ui2.ParagraphBuilder;
using ParagraphConstraints = Unity.UIWidgets.ui2.ParagraphConstraints;
using ParagraphStyle = Unity.UIWidgets.ui2.ParagraphStyle;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Picture = Unity.UIWidgets.ui2.Picture;
using PictureRecorder = Unity.UIWidgets.ui2.PictureRecorder;
using SceneBuilder = Unity.UIWidgets.ui2.SceneBuilder;
using TextBaseline = Unity.UIWidgets.ui2.TextBaseline;
using TextDecoration = Unity.UIWidgets.ui2.TextDecoration;
using TextDecorationStyle = Unity.UIWidgets.ui2.TextDecorationStyle;
using TextPosition = Unity.UIWidgets.ui2.TextPosition;
using Window = Unity.UIWidgets.ui2.Window;
class TextTest : UIWidgetsPanel
{

4
com.unity.uiwidgets/Runtime/animation/animation_controller.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.physics;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Ticker = Unity.UIWidgets.scheduler.Ticker;
using TickerFuture = Unity.UIWidgets.scheduler2.TickerFuture;
using TickerProvider = Unity.UIWidgets.scheduler.TickerProvider;
namespace Unity.UIWidgets.animation {
enum _AnimationDirection {

4
com.unity.uiwidgets/Runtime/async2/future.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.async2 {
public struct FutureOr {

public static implicit operator FutureOr(string v) => value(v);
public static implicit operator FutureOr(byte[] v) => value(v);
public static implicit operator FutureOr(RoutePopDisposition v) => value(v);
public static implicit operator FutureOr(Dictionary<Type, object> v) => value(v);
}
public abstract class Future {

3
com.unity.uiwidgets/Runtime/external/SplayTree.cs


/*
using System;
using System.Collections;
using System.Collections.Generic;

}
}
}
}*/
}

1
com.unity.uiwidgets/Runtime/foundation/binding.cs


using System.Collections;
using System.Collections.Generic;
using developer;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.ui;

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


using System;
using System.Diagnostics;
using System.Linq;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Canvas = Unity.UIWidgets.ui.Canvas;

70
com.unity.uiwidgets/Runtime/material/colors.cs


}
);
const long _redPrimaryValue = 0xFFF44336;
const uint _redPrimaryValue = 0xFFF44336;
public static readonly MaterialAccentColor redAccent = new MaterialAccentColor(
_redAccentValue,

}
);
const long _redAccentValue = 0xFFFF5252;
const uint _redAccentValue = 0xFFFF5252;
public static readonly MaterialColor pink = new MaterialColor(
_pinkPrimaryValue,

}
);
const long _pinkPrimaryValue = 0xFFE91E63;
const uint _pinkPrimaryValue = 0xFFE91E63;
public static readonly MaterialAccentColor pinkAccent = new MaterialAccentColor(

}
);
const long _pinkAccentPrimaryValue = 0xFFFF4081;
const uint _pinkAccentPrimaryValue = 0xFFFF4081;
public static readonly MaterialColor purple = new MaterialColor(
_purplePrimaryValue,

}
);
const long _purplePrimaryValue = 0xFF9C27B0;
const uint _purplePrimaryValue = 0xFF9C27B0;
public static readonly MaterialAccentColor purpleAccent = new MaterialAccentColor(
_purpleAccentPrimaryValue,

}
);
const long _purpleAccentPrimaryValue = 0xFFE040FB;
const uint _purpleAccentPrimaryValue = 0xFFE040FB;
public static readonly MaterialColor deepPurple = new MaterialColor(
_deepPurplePrimaryValue,

}
);
const long _deepPurplePrimaryValue = 0xFF673AB7;
const uint _deepPurplePrimaryValue = 0xFF673AB7;
public static readonly MaterialAccentColor deepPurpleAccent = new MaterialAccentColor(
_deepPurpleAccentPrimaryValue,

}
);
const long _deepPurpleAccentPrimaryValue = 0xFF7C4DFF;
const uint _deepPurpleAccentPrimaryValue = 0xFF7C4DFF;
public static readonly MaterialColor indigo = new MaterialColor(

}
);
const long _indigoPrimaryValue = 0xFF3F51B5;
const uint _indigoPrimaryValue = 0xFF3F51B5;
public static readonly MaterialAccentColor indigoAccent = new MaterialAccentColor(
_indigoAccentPrimaryValue,

}
);
const long _indigoAccentPrimaryValue = 0xFF536DFE;
const uint _indigoAccentPrimaryValue = 0xFF536DFE;
public static readonly MaterialColor blue = new MaterialColor(
_bluePrimaryValue,

}
);
const long _bluePrimaryValue = 0xFF2196F3;
const uint _bluePrimaryValue = 0xFF2196F3;
public static readonly MaterialAccentColor blueAccent = new MaterialAccentColor(
_blueAccentPrimaryValue,

}
);
const long _blueAccentPrimaryValue = 0xFF448AFF;
const uint _blueAccentPrimaryValue = 0xFF448AFF;
public static readonly MaterialColor lightBlue = new MaterialColor(
_lightBluePrimaryValue,

}
);
const long _lightBluePrimaryValue = 0xFF03A9F4;
const uint _lightBluePrimaryValue = 0xFF03A9F4;
public static readonly MaterialAccentColor lightBlueAccent = new MaterialAccentColor(
_lightBlueAccentPrimaryValue,

}
);
const long _lightBlueAccentPrimaryValue = 0xFF40C4FF;
const uint _lightBlueAccentPrimaryValue = 0xFF40C4FF;
public static readonly MaterialColor cyan = new MaterialColor(
_cyanPrimaryValue,

}
);
const long _cyanPrimaryValue = 0xFF00BCD4;
const uint _cyanPrimaryValue = 0xFF00BCD4;
public static readonly MaterialAccentColor cyanAccent = new MaterialAccentColor(
_cyanAccentPrimaryValue,

}
);
const long _cyanAccentPrimaryValue = 0xFF18FFFF;
const uint _cyanAccentPrimaryValue = 0xFF18FFFF;
public static readonly MaterialColor teal = new MaterialColor(
_tealPrimaryValue,

}
);
const long _tealPrimaryValue = 0xFF009688;
const uint _tealPrimaryValue = 0xFF009688;
public static readonly MaterialAccentColor tealAccent = new MaterialAccentColor(
_tealAccentPrimaryValue,

}
);
const long _tealAccentPrimaryValue = 0xFF64FFDA;
const uint _tealAccentPrimaryValue = 0xFF64FFDA;
public static readonly MaterialColor green = new MaterialColor(
_greenPrimaryValue,

}
);
const long _greenPrimaryValue = 0xFF4CAF50;
const uint _greenPrimaryValue = 0xFF4CAF50;
public static readonly MaterialAccentColor greenAccent = new MaterialAccentColor(
_greenAccentPrimaryValue,

}
);
const long _greenAccentPrimaryValue = 0xFF69F0AE;
const uint _greenAccentPrimaryValue = 0xFF69F0AE;
public static readonly MaterialColor lightGreen = new MaterialColor(
_lightGreenPrimaryValue,

}
);
const long _lightGreenPrimaryValue = 0xFF8BC34A;
const uint _lightGreenPrimaryValue = 0xFF8BC34A;
public static readonly MaterialAccentColor lightGreenAccent = new MaterialAccentColor(
_lightGreenAccentPrimaryValue,

}
);
const long _lightGreenAccentPrimaryValue = 0xFFB2FF59;
const uint _lightGreenAccentPrimaryValue = 0xFFB2FF59;
public static readonly MaterialColor lime = new MaterialColor(
_limePrimaryValue,

}
);
const long _limePrimaryValue = 0xFFCDDC39;
const uint _limePrimaryValue = 0xFFCDDC39;
public static readonly MaterialAccentColor limeAccent = new MaterialAccentColor(
_limeAccentPrimaryValue,

}
);
const long _limeAccentPrimaryValue = 0xFFEEFF41;
const uint _limeAccentPrimaryValue = 0xFFEEFF41;
public static readonly MaterialColor yellow = new MaterialColor(
_yellowPrimaryValue,

}
);
const long _yellowPrimaryValue = 0xFFFFEB3B;
const uint _yellowPrimaryValue = 0xFFFFEB3B;
public static readonly MaterialAccentColor yellowAccent = new MaterialAccentColor(
_yellowAccentPrimaryValue,

}
);
const long _yellowAccentPrimaryValue = 0xFFFFFF00;
const uint _yellowAccentPrimaryValue = 0xFFFFFF00;
public static readonly MaterialColor amber = new MaterialColor(
_amberPrimaryValue,

}
);
const long _amberPrimaryValue = 0xFFFFC107;
const uint _amberPrimaryValue = 0xFFFFC107;
public static readonly MaterialAccentColor amberAccent = new MaterialAccentColor(
_amberAccentPrimaryValue,

}
);
const long _amberAccentPrimaryValue = 0xFFFFD740;
const uint _amberAccentPrimaryValue = 0xFFFFD740;
public static readonly MaterialColor orange = new MaterialColor(
_orangePrimaryValue,

}
);
const long _orangePrimaryValue = 0xFFFF9800;
const uint _orangePrimaryValue = 0xFFFF9800;
public static readonly MaterialAccentColor orangeAccent = new MaterialAccentColor(
_orangeAccentPrimaryValue,

}
);
const long _orangeAccentPrimaryValue = 0xFFFFAB40;
const uint _orangeAccentPrimaryValue = 0xFFFFAB40;
public static readonly MaterialColor deepOrange = new MaterialColor(
_deepOrangePrimaryValue,

}
);
const long _deepOrangePrimaryValue = 0xFFFF5722;
const uint _deepOrangePrimaryValue = 0xFFFF5722;
public static readonly MaterialAccentColor deepOrangeAccent = new MaterialAccentColor(

}
);
const long _deepOrangeAccentPrimaryValue = 0xFFFF6E40;
const uint _deepOrangeAccentPrimaryValue = 0xFFFF6E40;
public static readonly MaterialColor brown = new MaterialColor(
_brownPrimaryValue,

}
);
const long _brownPrimaryValue = 0xFF795548;
const uint _brownPrimaryValue = 0xFF795548;
public static readonly MaterialColor grey = new MaterialColor(
_greyPrimaryValue,

}
);
const long _greyPrimaryValue = 0xFF9E9E9E;
const uint _greyPrimaryValue = 0xFF9E9E9E;
public static readonly MaterialColor blueGrey = new MaterialColor(
_blueGreyPrimaryValue,

}
);
const long _blueGreyPrimaryValue = 0xFF607D8B;
const uint _blueGreyPrimaryValue = 0xFF607D8B;
public static readonly List<MaterialColor> primaries = new List<MaterialColor> {

71
com.unity.uiwidgets/Runtime/painting/alignment.cs


using System;
using Unity.UIWidgets.foundation;
public abstract class AlignmentGeometry {
public AlignmentGeometry() {
}
float _x { get; }
float _start { get; }
float _y { get; }
// public static AlignmentGeometry add(AlignmentGeometry other) {
// return new _MixedAlignment(
// _x + other._x,
// _start + other._start,
// _y + other._y,
// );
// }
// public abstract AlignmentGeometry operator -();
//
// public abstract AlignmentGeometry operator *(double other);
//
// public abstract AlignmentGeometry operator /(double other);
//
// public abstract AlignmentGeometry operator ~/(double other);
//
// public abstract AlignmentGeometry operator %(double other);
// static AlignmentGeometry lerp(AlignmentGeometry a, AlignmentGeometry b, float t) {
// D.assert(t != null);
// if (a == null && b == null)
// return null;
// if (a == null)
// return b * t;
// if (b == null)
// return a * (1.0 - t);
// if (a is Alignment && b is Alignment)
// return Alignment.lerp(a, b, t);
// if (a is AlignmentDirectional && b is AlignmentDirectional)
// return AlignmentDirectional.lerp(a, b, t);
// return _MixedAlignment(
// ui.lerpDouble(a._x, b._x, t),
// ui.lerpDouble(a._start, b._start, t),
// ui.lerpDouble(a._y, b._y, t),
// );
// }
//
public abstract Alignment resolve(TextDirection? direction);
//
// @override
// String toString() {
// if (_start == 0.0)
// return Alignment._stringify(_x, _y);
// if (_x == 0.0)
// return AlignmentDirectional._stringify(_start, _y);
// return Alignment._stringify(_x, _y) + ' + ' + AlignmentDirectional._stringify(_start, 0.0);
// }
//
// @override
// bool operator ==(Object other) {
// return other is AlignmentGeometry
// && other._x == _x
// && other._start == _start
// && other._y == _y;
// }
//
// @override
// int get hashCode => hashValues(_x, _start, _y);
}
public class Alignment : IEquatable<Alignment> {
public Alignment(float x, float y) {
this.x = x;

1
com.unity.uiwidgets/Runtime/painting/binding.cs


using Unity.UIWidgets.gestures;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using Window = Unity.UIWidgets.ui2.Window;
namespace Unity.UIWidgets.painting {
public class PaintingBinding : GestureBinding {

19
com.unity.uiwidgets/Runtime/painting/box_decoration.cs


Rect _rectForCachedBackgroundPaint;
Paint _getBackgroundPaint(Rect rect) {
Paint _getBackgroundPaint(Rect rect, TextDirection textDirection) {
D.assert(rect != null);
D.assert(_decoration.gradient != null || _rectForCachedBackgroundPaint == null);

}
if (_decoration.gradient != null) {
paint.shader = _decoration.gradient.createShader(rect);
paint.shader = _decoration.gradient.createShader(rect, textDirection: textDirection);
_rectForCachedBackgroundPaint = rect;
}

return _cachedBackgroundPaint;
}
void _paintBox(Canvas canvas, Rect rect, Paint paint) {
void _paintBox(Canvas canvas, Rect rect, Paint paint, TextDirection textDirection) {
switch (_decoration.shape) {
case BoxShape.circle:
D.assert(_decoration.borderRadius == null);

}
}
void _paintShadows(Canvas canvas, Rect rect) {
void _paintShadows(Canvas canvas, Rect rect, TextDirection textDirection) {
if (_decoration.boxShadow == null) {
return;
}

Rect bounds = rect.shift(boxShadow.offset).inflate(boxShadow.spreadRadius);
_paintBox(canvas, bounds, paint);
_paintBox(canvas, bounds, paint, textDirection);
void _paintBackgroundColor(Canvas canvas, Rect rect) {
void _paintBackgroundColor(Canvas canvas, Rect rect, TextDirection textDirection) {
_paintBox(canvas, rect, _getBackgroundPaint(rect));
_paintBox(canvas, rect, _getBackgroundPaint(rect, textDirection), textDirection);
}
}

D.assert(configuration.size != null);
Rect rect = offset & configuration.size;
TextDirection textDirection = configuration.textDirection;
_paintShadows(canvas, rect);
_paintBackgroundColor(canvas, rect);
_paintShadows(canvas, rect, textDirection);
_paintBackgroundColor(canvas, rect, textDirection);
_paintBackgroundImage(canvas, rect, configuration);
_decoration.border?.paint(
canvas,

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


public class ColorSwatch<T> : Color {
public ColorSwatch(
long primary,
uint primary,
Dictionary<T, Color> swatch) : base(primary) {
_swatch = swatch;
}

6
com.unity.uiwidgets/Runtime/painting/decoration_image.cs


Rect centerSlice = null,
ImageRepeat repeat = ImageRepeat.noRepeat,
bool invertColors = false,
FilterMode filterMode = FilterMode.Bilinear
FilterQuality filterQuality = FilterQuality.low
) {
D.assert(canvas != null);
D.assert(rect != null);

Paint paint = new Paint();
if (colorFilter != null) {
paint.colorFilter = colorFilter;
paint.color = colorFilter.color;
paint.blendMode = colorFilter.blendMode;
paint.filterMode = filterMode;
paint.filterQuality = filterQuality;
}
paint.invertColors = invertColors;

59
com.unity.uiwidgets/Runtime/painting/gradient.cs


using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
using Shader = Unity.UIWidgets.ui.Shader;
namespace Unity.UIWidgets.painting {
class _ColorsAndStops {

int index = stops.FindLastIndex((float s) => { return s <= t; });
D.assert(index != -1);
return Color.lerp(colors[index], colors[index + 1],
return Color.lerp(colors[index], colors[index + 1],
(t - stops[index]) / (stops[index + 1] - stops[index]));
}

}
}
public abstract class GradientTransform {
public GradientTransform() {
}
public abstract Matrix4 transform(Rect bounds, TextDirection? textDirection = null);
}
public class GradientRotation : GradientTransform {
public GradientRotation(float radians) {
this.radians = radians;
}
public readonly float radians;
public override
Matrix4 transform(Rect bounds,
TextDirection? textDirection = null
) {
D.assert(bounds != null);
float sinRadians = Mathf.Sin(radians);
float oneMinusCosRadians = 1 - Mathf.Cos(radians);
Offset center = bounds.center;
float originX = sinRadians * center.dy + oneMinusCosRadians * center.dx;
float originY = -sinRadians * center.dx + oneMinusCosRadians * center.dy;
var result = new Matrix4().identity();
result.translate(originX, originY);
result.rotateZ(radians);
return result;
}
}
public abstract class Gradient {
public Gradient(

public readonly List<float> stops;
public readonly GradientTransform transform;
protected List<float> _impliedStops() {
if (stops != null) {
return stops;

return Enumerable.Range(0, colors.Count).Select(i => i * separation).ToList();
}
public abstract PaintShader createShader(Rect rect);
public abstract Shader createShader(Rect rect, TextDirection? textDirection = null);
public abstract Gradient scale(float factor);

D.assert(a != null && b != null);
return t < 0.5 ? a.scale(1.0f - (t * 2.0f)) : b.scale((t - 0.5f) * 2.0f);
}
protected float[] _resolveTransform(Rect bounds, TextDirection? textDirection) {
return transform?.transform(bounds, textDirection: textDirection)?._m4storage;
}
}

public readonly TileMode tileMode;
public override PaintShader createShader(Rect rect) {
public override Shader createShader(Rect rect, TextDirection? textDirection = null) {
tileMode
tileMode, _resolveTransform(rect, textDirection)
);
}

public readonly TileMode tileMode;
public readonly AlignmentGeometry focal;
public readonly float focalRadius;
public override PaintShader createShader(Rect rect) {
public override Shader createShader(Rect rect, TextDirection? textDirection = null) {
tileMode
tileMode,
_resolveTransform(rect, textDirection),
focal == null ? null : focal.resolve(textDirection).withinRect(rect),
focalRadius * rect.shortestSide
);
}

public readonly TileMode tileMode;
public override PaintShader createShader(Rect rect) {
public override Shader createShader(Rect rect, TextDirection? textDirection = null) {
startAngle, endAngle
startAngle, endAngle, _resolveTransform(rect, textDirection)
);
}

148
com.unity.uiwidgets/Runtime/painting/image_provider.cs


using System.Collections;
using System.Collections.Generic;
using System.Text;
using RSG;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Codec = Unity.UIWidgets.ui.Codec;
using Image = Unity.UIWidgets.ui.Image;
using Locale = Unity.UIWidgets.ui.Locale;
using Object = UnityEngine.Object;
using TextDirection = Unity.UIWidgets.ui.TextDirection;
using Window = Unity.UIWidgets.ui.Window;
namespace Unity.UIWidgets.painting {
public class ImageConfiguration : IEquatable<ImageConfiguration> {

public readonly float? devicePixelRatio;
public readonly Locale locale;
public readonly TextDirection textDirection;
public readonly Size size;

}
}
public delegate Future<ui.Codec> DecoderCallback(byte[] bytes, int cacheWidth = 0, int cacheHeight = 0);
public abstract class ImageProvider {
public abstract ImageStream resolve(ImageConfiguration configuration);
}

ImageStream stream = new ImageStream();
T obtainedKey = default;
obtainKey(configuration).Then(key => {
obtainKey(configuration).then_((T key) => {
stream.setCompleter(PaintingBinding.instance.imageCache.putIfAbsent(key, () => load(key)));
}).Catch(ex => {
// TODO : how to load
// stream.setCompleter(PaintingBinding.instance.imageCache.putIfAbsent(key, () => load(key)));
D.assert(false, () => "load image from ImageStream is not implemented yet");
}).catchError(ex => {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: ex,
library: "services library",

return stream;
}
public IPromise<bool> evict(ImageCache cache = null, ImageConfiguration configuration = null) {
public Future<bool> evict(ImageCache cache = null, ImageConfiguration configuration = null) {
return obtainKey(configuration).Then(key => cache.evict(key));
return obtainKey(configuration).then(key => cache.evict(key)).to<bool>();
protected abstract ImageStreamCompleter load(T key);
protected abstract ImageStreamCompleter load(T assetBundleImageKey, DecoderCallback decode);
protected abstract IPromise<T> obtainKey(ImageConfiguration configuration);
protected abstract Future<T> obtainKey(ImageConfiguration configuration);
}
public class AssetBundleImageKey : IEquatable<AssetBundleImageKey> {

protected AssetBundleImageProvider() {
}
protected override ImageStreamCompleter load(AssetBundleImageKey key) {
protected override ImageStreamCompleter load(AssetBundleImageKey key, DecoderCallback decode) {
codec: _loadAsync(key),
codec: _loadAsync(key, decode),
scale: key.scale,
informationCollector: information => {
information.AppendLine($"Image provider: {this}");

}
IPromise<Codec> _loadAsync(AssetBundleImageKey key) {
var coroutine = Window.instance.startCoroutine(_loadAssetAsync(key));
return coroutine.promise.Then(result => {
if (result == null) {
if (key.bundle == null) {
throw new Exception($"Unable to find asset \"{key.name}\" from Resources folder");
}
Future<Codec> _loadAsync(AssetBundleImageKey key, DecoderCallback decode) {
Object data;
// Hot reload/restart could change whether an asset bundle or key in a
// bundle are available, or if it is a network backed bundle.
try {
data = key.bundle.LoadAsset(key.name);
}
catch (Exception e) {
PaintingBinding.instance.imageCache.evict(key);
throw e;
}
throw new Exception($"Unable to find asset \"{key.name}\" from asset bundle \"{key.bundle}\"");
}
if (result is Texture2D texture) {
return CodecUtils.getCodec(new Image(texture, isAsset: true, bundle: key.bundle));
}
else if (result is TextAsset text) {
var bytes = text.bytes;
if (key.bundle == null) {
Resources.UnloadAsset(text);
}
else {
key.bundle.Unload(text);
}
return CodecUtils.getCodec(bytes);
}
else {
throw new Exception($"Unknown type for asset \"{key.name}\": \"{result.GetType()}\"");
}
});
if (data != null && data is Texture2D textureData) {
return decode(textureData.EncodeToPNG());
}
else {
PaintingBinding.instance.imageCache.evict(key);
throw new Exception("Unable to read data");
}
}
IEnumerator _loadAssetAsync(AssetBundleImageKey key) {

yield return request.asset;
} else {
}
else {
yield return request;
yield return request.asset;
}

if (request.asset) {
yield return request.asset;
} else {
}
else {
yield return request.asset;
}
}

public readonly IDictionary<string, string> headers;
protected override IPromise<NetworkImage> obtainKey(ImageConfiguration configuration) {
return Promise<NetworkImage>.Resolved(this);
protected override Future<NetworkImage> obtainKey(ImageConfiguration configuration) {
return new SynchronousFuture<NetworkImage>(this);
protected override ImageStreamCompleter load(NetworkImage key) {
protected override ImageStreamCompleter load(NetworkImage key, DecoderCallback decode) {
codec: _loadAsync(key),
codec: _loadAsync(key, decode),
scale: key.scale,
informationCollector: information => {
information.AppendLine($"Image provider: {this}");

}
IPromise<Codec> _loadAsync(NetworkImage key) {
var coroutine = Window.instance.startCoroutine(_loadBytes(key));
return coroutine.promise.Then(obj => {
if (obj is byte[] bytes) {
return CodecUtils.getCodec(bytes);
}
Future<Codec> _loadAsync(NetworkImage key, DecoderCallback decode) {
var loaded = _loadBytes(key);
if (loaded.Current is byte[] bytes) {
return decode(bytes);
}
return CodecUtils.getCodec(new Image((Texture2D) obj));
});
throw new Exception("not loaded");
}
IEnumerator _loadBytes(NetworkImage key) {

public readonly float scale;
protected override IPromise<FileImage> obtainKey(ImageConfiguration configuration) {
return Promise<FileImage>.Resolved(this);
protected override Future<FileImage> obtainKey(ImageConfiguration configuration) {
return Future<FileImage>.value(FutureOr.value(this)).to<FileImage>();
protected override ImageStreamCompleter load(FileImage key) {
return new MultiFrameImageStreamCompleter(_loadAsync(key),
protected override ImageStreamCompleter load(FileImage key, DecoderCallback decode) {
return new MultiFrameImageStreamCompleter(_loadAsync(key, decode),
IPromise<Codec> _loadAsync(FileImage key) {
var coroutine = Window.instance.startCoroutine(_loadBytes(key));
return coroutine.promise.Then(obj => {
if (obj is byte[] bytes) {
return CodecUtils.getCodec(bytes);
}
return CodecUtils.getCodec(new Image((Texture2D) obj));
});
Future<Codec> _loadAsync(FileImage key, DecoderCallback decode) {
var loaded = _loadBytes(key);
if (loaded.Current is byte[] bytes) {
return decode(bytes);
}
throw new Exception("not loaded");
}
IEnumerator _loadBytes(FileImage key) {

public readonly float scale;
protected override IPromise<MemoryImage> obtainKey(ImageConfiguration configuration) {
return Promise<MemoryImage>.Resolved(this);
protected override Future<MemoryImage> obtainKey(ImageConfiguration configuration) {
return Future<MemoryImage>.value(FutureOr.value(this)).to<MemoryImage>();
protected override ImageStreamCompleter load(MemoryImage key) {
protected override ImageStreamCompleter load(MemoryImage key, DecoderCallback decode) {
_loadAsync(key),
_loadAsync(key, decode),
IPromise<Codec> _loadAsync(MemoryImage key) {
Future<Codec> _loadAsync(MemoryImage key, DecoderCallback decode) {
return CodecUtils.getCodec(bytes);
return decode(bytes);
}
public bool Equals(MemoryImage other) {

public readonly AssetBundle bundle;
protected override IPromise<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
return Promise<AssetBundleImageKey>.Resolved(new AssetBundleImageKey(
protected override Future<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
return Future<AssetBundleImageKey>.value(FutureOr.value(new AssetBundleImageKey(
));
))).to<AssetBundleImageKey>();
}
public bool Equals(ExactAssetImage other) {

8
com.unity.uiwidgets/Runtime/painting/image_resolution.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;

public readonly string assetName;
public readonly AssetBundle bundle;
protected override IPromise<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
protected override Future<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
return Promise<AssetBundleImageKey>.Resolved(key);
return Future<AssetBundleImageKey>.value(FutureOr.value(key)).to<AssetBundleImageKey>();
}
AssetBundle chosenBundle = bundle ? bundle : configuration.bundle;

return Promise<AssetBundleImageKey>.Resolved(key);
return Future<AssetBundleImageKey>.value(FutureOr.value(key)).to<AssetBundleImageKey>();
}
AssetBundleImageKey _loadAsset(AssetBundle bundle, float devicePixelRatio) {

32
com.unity.uiwidgets/Runtime/painting/image_stream.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;

}
public class OneFrameImageStreamCompleter : ImageStreamCompleter {
public OneFrameImageStreamCompleter(IPromise<ImageInfo> image,
public OneFrameImageStreamCompleter(Future<ImageInfo> image,
image.Then(result => { setImage(result); }).Catch(err => {
image.then_(result => { setImage(result); }).catchError(err => {
reportError(
context: "resolving a single-frame image stream",
exception: err,

public class MultiFrameImageStreamCompleter : ImageStreamCompleter {
public MultiFrameImageStreamCompleter(
IPromise<Codec> codec,
Future<Codec> codec,
float scale,
InformationCollector informationCollector = null
) {

_informationCollector = informationCollector;
codec.Then((Action<Codec>) _handleCodecReady, ex => {
codec.then_((Action<Codec>) _handleCodecReady, ex => {
reportError(
context: "resolving an image codec",
exception: ex,

return FutureOr.nil;
});
}

TimeSpan delay = _frameDuration.Value - (timestamp - _shownTimestamp.Value);
delay = new TimeSpan((long) (delay.Ticks * scheduler_.timeDilation));
_timer = Window.instance.run(delay, _scheduleAppFrame);
// TODO: time dilation
_timer = Timer.create(delay , ()=> _scheduleAppFrame());
}
bool _isFirstFrame() {

return timestamp - _shownTimestamp >= _frameDuration;
}
void _decodeNextFrameAndSchedule() {
Future _decodeNextFrameAndSchedule() {
_nextFrame = frame;
if (_codec.frameCount == 1) {
_emitFrame(new ImageInfo(image: _nextFrame.image, scale: _scale));
return;
}
return frame.then_(info => {
_nextFrame = info;
if (_codec.frameCount == 1) {
_emitFrame(new ImageInfo(image: _nextFrame.image, scale: _scale));
return;
}
_scheduleAppFrame();
_scheduleAppFrame();
});
}
void _scheduleAppFrame() {

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


static float _max4(float a, float b, float c, float d) {
return Mathf.Max(a, Mathf.Max(b, Mathf.Max(c, d)));
}
public static Matrix4x4 toMatrix4x4(this Matrix3 matrix3) {
var matrix = Matrix4x4.identity;
matrix[0, 0] = matrix3[0]; // row 0
matrix[0, 1] = matrix3[1];
matrix[0, 3] = matrix3[2];
matrix[1, 0] = matrix3[3]; // row 1
matrix[1, 1] = matrix3[4];
matrix[1, 3] = matrix3[5];
matrix[3, 0] = matrix3[6]; // row 2
matrix[3, 1] = matrix3[7];
matrix[3, 3] = matrix3[8];
return matrix;
}
public static Matrix3 toMatrix3(this Matrix4 matrix4) {
var matrix = Matrix3.I();
matrix[0] = matrix4.entry(0, 0);
matrix[1] = matrix4.entry(0, 1);
matrix[2] = matrix4.entry(0, 3);
matrix[3] = matrix4.entry(1, 0);
matrix[4] = matrix4.entry(1, 1);
matrix[5] = matrix4.entry(1, 3);
matrix[6] = matrix4.entry(3, 0);
matrix[7] = matrix4.entry(3, 1);
matrix[8] = matrix4.entry(3, 3);
return matrix;
}
}
public class TransformProperty : DiagnosticsProperty<Matrix4> {

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


using System.Collections.Generic;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.ui;
using Canvas = Unity.UIWidgets.ui2.Canvas;
using Paint = Unity.UIWidgets.ui2.Paint;
using PaintingStyle = Unity.UIWidgets.ui2.PaintingStyle;
using Path = Unity.UIWidgets.ui2.Path;
using Picture = Unity.UIWidgets.ui2.Picture;
using PictureRecorder = Unity.UIWidgets.ui2.PictureRecorder;
using Color = Unity.UIWidgets.ui2.Color;
namespace Unity.UIWidgets.painting {
public abstract class ShaderWarmUp {

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


defaultValue: foundation_.kNullDefaultValue));
string weightDescription = "";
if (fontWeight != null) {
weightDescription = fontWeight.weightValue.ToString();
weightDescription = $"w${fontWeight.index + 1}00";
}
styles.Add(new DiagnosticsProperty<FontWeight>(

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


using System.Collections.Generic;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;

namespace Unity.UIWidgets.painting {
public class PlaceholderDimensions {
public PlaceholderDimensions(
Size size,
PlaceholderAlignment alignment,
TextBaseline baseline,
float baselineOffset
) {
D.assert(size != null);
D.assert(alignment != null);
this.size = size;
this.alignment = alignment;
this.baseline = baseline;
this.baselineOffset = baselineOffset;
}
public readonly Size size;
public readonly PlaceholderAlignment alignment;
public readonly float baselineOffset;
public readonly TextBaseline baseline;
public override string ToString() {
return $"PlaceholderDimensions({size}, {baseline})";
}
}
public enum TextWidthBasis {
parent,
longestLine,
}
class _CaretMetrics {
public _CaretMetrics(Offset offset, float? fullHeight) {
this.offset = offset;

}
public class TextPainter {
TextSpan _text;
InlineSpan _text;
TextAlign _textAlign;
TextDirection? _textDirection;
float _textScaleFactor;

string _ellipsis;
float _lastMinWidth;
float _lastMaxWidth;
TextWidthBasis _textWidthBasis;
TextHeightBehavior _textHeightBehavior;
public TextPainter(TextSpan text = null,
public TextPainter(InlineSpan text = null,
StrutStyle strutStyle = null) {
StrutStyle strutStyle = null,
TextWidthBasis textWidthBasis = TextWidthBasis.parent,
TextHeightBehavior textHeightBehavior = null) {
D.assert(text == null || text.debugAssertIsValid());
D.assert(maxLines == null || maxLines > 0);
_text = text;
_textAlign = textAlign;
_textDirection = textDirection;

_strutStyle = strutStyle;
_textWidthBasis = textWidthBasis;
_textHeightBehavior = textHeightBehavior;
}
void markNeedsLayout() {
_paragraph = null;
_needsLayout = true;
_previousCaretPosition = null;
_previousCaretPrototype = null;
}
public float textScaleFactor {

}
_textScaleFactor = value;
markNeedsLayout();
_needsLayout = true;
Paragraph.release(ref _paragraph);
}
}

}
_ellipsis = value;
Paragraph.release(ref _paragraph);
_needsLayout = true;
markNeedsLayout();
public TextSpan text {
public InlineSpan text {
D.assert(value == null || value.debugAssertIsValid());
if ((_text == null && value == null) || (_text != null && text.Equals(value))) {
return;
}

}
_text = value;
Paragraph.release(ref _paragraph);
_needsLayout = true;
markNeedsLayout();
}
}

}
_textDirection = value;
Paragraph.release(ref _paragraph);
markNeedsLayout();
_needsLayout = true;
}
}

}
_textAlign = value;
Paragraph.release(ref _paragraph);
_needsLayout = true;
markNeedsLayout();
}
}

return _paragraph.didExceedMaxLines;
return _paragraph.didExceedMaxLines();
}
}

}
_maxLines = value;
Paragraph.release(ref _paragraph);
_needsLayout = true;
markNeedsLayout();
}
}

}
_strutStyle = value;
_paragraph = null;
_needsLayout = true;
markNeedsLayout();
public TextWidthBasis textWidthBasis {
get { return _textWidthBasis; }
set {
D.assert(value != null);
if (_textWidthBasis == value)
return;
_textWidthBasis = value;
markNeedsLayout();
}
}
public TextHeightBehavior textHeightBehavior {
get { return textHeightBehavior; }
set {
if (_textHeightBehavior == value)
return;
_textHeightBehavior = value;
markNeedsLayout();
}
}
return _applyFloatingPointHack(_paragraph.minIntrinsicWidth);
return _applyFloatingPointHack(_paragraph.minIntrinsicWidth());
}
}

return _applyFloatingPointHack(_paragraph.maxIntrinsicWidth);
return _applyFloatingPointHack(_paragraph.maxIntrinsicWidth());
}
}

return _applyFloatingPointHack(_paragraph.height);
return _applyFloatingPointHack(_paragraph.height());
}
}

return _applyFloatingPointHack(_paragraph.width);
return _applyFloatingPointHack(_paragraph.width());
}
}

case TextBaseline.alphabetic:
return _paragraph.alphabeticBaseline;
return _paragraph.alphabeticBaseline();
return _paragraph.ideographicBaseline;
return _paragraph.ideographicBaseline();
}
return 0.0f;

public void paint(Canvas canvas, Offset offset) {
Debug.Assert(!_needsLayout);
_paragraph.paint(canvas, offset);
canvas.drawParagraph(_paragraph, offset);
}
public Offset getOffsetForCaret(TextPosition position, Rect caretPrototype) {

_caretMetrics = new _CaretMetrics(
offset: rect != null ? new Offset(rect.left, rect.top) : _emptyOffset,
fullHeight: rect != null ? (float?) (rect.bottom - rect.top) : null);
public Paragraph.LineRange getLineRange(int lineNumber) {
public List<TextBox> getBoxesForSelection(TextSelection selection,
ui.BoxHeightStyle boxHeightStyle = ui.BoxHeightStyle.tight,
ui.BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight) {
return _paragraph.getLineRange(lineNumber);
}
public Paragraph.LineRange getLineRange(TextPosition textPosition) {
return getLineRange(getLineIndex(textPosition));
}
public List<TextBox> getBoxesForSelection(TextSelection selection) {
D.assert(!_needsLayout);
var results = _paragraph.getRectsForRange(selection.start, selection.end);
var results = _paragraph.getBoxesForRange(selection.start, selection.end, boxHeightStyle: boxHeightStyle,
boxWidthStyle: boxWidthStyle);
var result = _paragraph.getGlyphPositionAtCoordinate(offset.dx, offset.dy);
return new TextPosition(result.position, result.affinity);
return _paragraph.getPositionForOffset(offset);
var range = _paragraph.getWordBoundary(position.offset);
return new TextRange(range.start, range.end);
}
public TextPosition getPositionVerticalMove(TextPosition position, int move) {
D.assert(!_needsLayout);
var offset = getOffsetForCaret(position, Rect.zero);
var lineIndex = Mathf.Min(Mathf.Max(_paragraph.getLine(position) + move, 0),
_paragraph.getLineCount() - 1);
var targetLineStart = _paragraph.getLineRange(lineIndex).start;
var newLineOffset = getOffsetForCaret(new TextPosition(targetLineStart), Rect.zero);
return getPositionForOffset(new Offset(offset.dx, newLineOffset.dy));
return _paragraph.getWordBoundary(position);
public int getLineIndex(TextPosition position) {
TextRange getLineBoundary(TextPosition position) {
return _paragraph.getLine(position);
}
public int getLineCount() {
D.assert(!_needsLayout);
return _paragraph.getLineCount();
}
public TextPosition getWordRight(TextPosition position) {
D.assert(!_needsLayout);
var offset = position.offset;
while (true) {
var range = _paragraph.getWordBoundary(offset);
if (range.end == range.start) {
break;
}
if (!char.IsWhiteSpace((char) (text.codeUnitAt(range.start) ?? 0))) {
return new TextPosition(range.end);
}
offset = range.end;
}
return new TextPosition(offset, position.affinity);
}
public TextPosition getWordLeft(TextPosition position) {
D.assert(!_needsLayout);
var offset = Mathf.Max(position.offset - 1, 0);
while (true) {
var range = _paragraph.getWordBoundary(offset);
if (!char.IsWhiteSpace((char) (text.codeUnitAt(range.start) ?? 0))) {
return new TextPosition(range.start);
}
offset = Mathf.Max(range.start - 1, 0);
if (offset == 0) {
break;
}
}
return new TextPosition(offset, position.affinity);
return _paragraph.getLineBoundary(position);
if (_text.style == null) {
return new ParagraphStyle(
textAlign: textAlign,
textDirection: textDirection ?? defaultTextDirection,
maxLines: maxLines,
ellipsis: ellipsis,
strutStyle: _strutStyle
);
}
return _text.style.getParagraphStyle(textAlign, textDirection ?? defaultTextDirection,
ellipsis, maxLines, textScaleFactor);
D.assert(textAlign != null);
D.assert(textDirection != null, () => "TextPainter.textDirection must be set to a non-null value before using the TextPainter.");
return _text.style?.getParagraphStyle(
textAlign: textAlign,
textDirection: textDirection ?? defaultTextDirection,
textScaleFactor: textScaleFactor,
maxLines: _maxLines,
// textHeightBehavior: _textHeightBehavior,
ellipsis: _ellipsis
// locale: _locale,
// strutStyle: _strutStyle,
) ?? new ui.ParagraphStyle(
textAlign: textAlign,
textDirection: textDirection ?? defaultTextDirection,
maxLines: maxLines,
textHeightBehavior: _textHeightBehavior,
ellipsis: ellipsis
// locale: locale,
);
}
public float preferredLineHeight {

); // direction doesn't matter, text is just a space
if (text != null && text.style != null) {
builder.pushStyle(text.style, textScaleFactor);
builder.pushStyle(text.style.getTextStyle(textScaleFactor: textScaleFactor));
}
builder.addText(" ");

return _layoutTemplate.height;
return _layoutTemplate.height();
}
}

List<TextBox> boxes = null;
while ((boxes == null || boxes.isEmpty()) && flattenedText != null) {
int prevRuneOffset = offset - graphemeClusterLength;
boxes = _paragraph.getRectsForRange(prevRuneOffset, offset);
boxes = _paragraph.getBoxesForRange(prevRuneOffset, offset);
if (boxes.isEmpty()) {
if (!needsSearch) {
break;

List<TextBox> boxes = null;
while ((boxes == null || boxes.isEmpty()) && flattenedText != null) {
int nextRuneOffset = offset + graphemeClusterLength;
boxes = _paragraph.getRectsForRange(offset, nextRuneOffset);
boxes = _paragraph.getBoxesForRange(offset, nextRuneOffset);
if (boxes.isEmpty()) {
if (!needsSearch) {
break;

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


using UnityEngine.Assertions;
namespace Unity.UIWidgets.painting {
public class TextSpan : DiagnosticableTree, IEquatable<TextSpan> {
public class TextSpan : InlineSpan, IEquatable<TextSpan> {
public List<string> splitedText;
public readonly string semanticsLabel;
public TextSpan(string text = "", TextStyle style = null, List<TextSpan> children = null,
GestureRecognizer recognizer = null, HoverRecognizer hoverRecognizer = null) {
public TextSpan(
string text = "",
TextStyle style = null,
List<TextSpan> children = null,
GestureRecognizer recognizer = null,
HoverRecognizer hoverRecognizer = null,
string semanticsLabel = null) : base(style) {
splitedText = !string.IsNullOrEmpty(text) ? EmojiUtils.splitByEmoji(text) : null;
this.semanticsLabel = semanticsLabel;
public void build(ParagraphBuilder builder, float textScaleFactor = 1.0f) {
var hasStyle = this.style != null;
public override void build(ParagraphBuilder builder, float textScaleFactor = 1.0f,
List<PlaceholderDimensions> dimensions = null) {
D.assert(debugAssertIsValid());
var hasStyle = style != null;
builder.pushStyle(style, textScaleFactor);
builder.pushStyle(style.getTextStyle(textScaleFactor: textScaleFactor));
if (splitedText != null) {
if (splitedText.Count == 1 && !char.IsHighSurrogate(splitedText[0][0]) &&
!EmojiUtils.isSingleCharEmoji(splitedText[0][0])) {
builder.addText(splitedText[0]);
if (text != null)
builder.addText(text);
if (children != null) {
foreach (InlineSpan child in children) {
D.assert(child != null);
child.build(
builder,
textScaleFactor: textScaleFactor,
dimensions: dimensions
);
else {
TextStyle style = this.style ?? new TextStyle();
for (int i = 0; i < splitedText.Count; i++) {
builder.pushStyle(style, textScaleFactor);
builder.addText(splitedText[i]);
builder.pop();
}
}
if (hasStyle) {
builder.pop();
}
}
public override bool visitChildren(InlineSpanVisitor visitor) {
if (text != null) {
if (!visitor(this))
return false;
}
if (children != null) {
foreach (InlineSpan child in children) {
if (!child.visitChildren(visitor))
return false;
return true;
}
protected override InlineSpan getSpanForPositionVisitor(TextPosition position, Accumulator offset) {
if (text == null) {
return null;
}
TextAffinity affinity = position.affinity;
int targetOffset = position.offset;
int endOffset = offset.value + text.Length;
if (offset.value == targetOffset && affinity == TextAffinity.downstream ||
offset.value < targetOffset && targetOffset < endOffset ||
endOffset == targetOffset && affinity == TextAffinity.upstream) {
return this;
}
offset.increment(text.Length);
return null;
}
public override void computeToPlainText(StringBuilder buffer, bool includeSemanticsLabels = true,
bool includePlaceholders = true) {
D.assert(debugAssertIsValid());
if (semanticsLabel != null && includeSemanticsLabels) {
buffer.Append(semanticsLabel);
}
else if (text != null) {
buffer.Append(text);
}
foreach (var child in children) {
Assert.IsNotNull(child);
child.build(builder, textScaleFactor);
foreach (InlineSpan child in children) {
child.computeToPlainText(buffer,
includeSemanticsLabels: includeSemanticsLabels,
includePlaceholders: includePlaceholders
);
}
if (hasStyle) {
builder.pop();
public override void computeSemanticsInformation(List<InlineSpanSemanticsInformation> collector) {
D.assert(debugAssertIsValid());
if (text != null || semanticsLabel != null) {
collector.Add(new InlineSpanSemanticsInformation(
text,
semanticsLabel: semanticsLabel,
recognizer: recognizer
));
}
if (children != null) {
foreach (InlineSpan child in children) {
child.computeSemanticsInformation(collector);
}
protected override int? codeUnitAtVisitor(int index, Accumulator offset) {
if (text == null) {
return null;
}
if (index - offset.value < text.Length) {
return text[index - offset.value];
}
offset.increment(text.Length);
return null;
}
public bool hasHoverRecognizer {
get {
bool need = false;

return result;
}
public string toPlainText() {
var sb = new StringBuilder();
visitTextSpan((span) => {
sb.Append(span.text);
return true;
});
return sb.ToString();
}
public int? codeUnitAt(int index) {
if (index < 0) {
return null;

return true;
}
public RenderComparison compareTo(TextSpan other) {
if (Equals(other)) {
public override RenderComparison compareTo(InlineSpan other) {
if (Equals(this, other))
}
if (other.text != text
|| ((children == null) != (other.children == null))
|| (children != null && other.children != null && children.Count != other.children.Count)
|| ((style == null) != (other.style != null))
) {
if (other.GetType()!= GetType())
}
RenderComparison result = Equals(recognizer, other.recognizer)
? RenderComparison.identical
: RenderComparison.metadata;
if (!Equals(hoverRecognizer, other.hoverRecognizer)) {
result = RenderComparison.function > result ? RenderComparison.function : result;
}
TextSpan textSpan = other as TextSpan;
if (textSpan.text != text ||
children?.Count != textSpan.children?.Count ||
(style == null) != (textSpan.style == null))
return RenderComparison.layout;
RenderComparison result = recognizer == textSpan.recognizer ?
RenderComparison.identical :
RenderComparison.metadata;
var candidate = style.compareTo(other.style);
if (candidate > result) {
RenderComparison candidate = style.compareTo(textSpan.style);
if (candidate > result)
}
if (result == RenderComparison.layout) {
if (result == RenderComparison.layout)
}
for (var index = 0; index < children.Count; index++) {
var candidate = children[index].compareTo(other.children[index]);
if (candidate > result) {
for (int index = 0; index < children.Count; index += 1) {
RenderComparison candidate = children[index].compareTo(textSpan.children[index]);
if (candidate > result)
}
if (result == RenderComparison.layout) {
if (result == RenderComparison.layout)
}
return result;
}

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


public ParagraphStyle getParagraphStyle(TextAlign textAlign,
TextDirection textDirection, string ellipsis, int? maxLines, float textScaleFactor = 1.0f) {
return new ParagraphStyle(
textAlign, textDirection, fontWeight, fontStyle,
maxLines, (fontSize ?? _defaultFontSize) * textScaleFactor, fontFamily, height,
ellipsis
textAlign: textAlign, textDirection: textDirection, fontWeight: fontWeight, fontStyle: fontStyle,
maxLines: maxLines, fontSize: (fontSize ?? _defaultFontSize) * textScaleFactor, fontFamily: fontFamily,
height: height,
ellipsis: ellipsis
);
}

);
}
public ui.TextStyle getTextStyle(float textScaleFactor = 1.0f ) {
var backgroundPaint = new Paint();
if (background != null) {
backgroundPaint = new Paint();
backgroundPaint.color = backgroundColor;
}
return new ui.TextStyle(
color: color,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
decorationThickness: decorationThickness,
fontWeight: fontWeight,
fontStyle: fontStyle,
textBaseline: textBaseline,
fontFamily: fontFamily,
fontFamilyFallback: fontFamilyFallback,
fontSize: fontSize == null ? null : fontSize * textScaleFactor,
letterSpacing: letterSpacing,
wordSpacing: wordSpacing,
height: height,
// locale: locale,
foreground: foreground,
background: background ?? (backgroundColor != null
? backgroundPaint : null
),
shadows: shadows.Cast<Shadow>().ToList()
// fontFeatures: fontFeatures,
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

defaultValue: foundation_.kNullDefaultValue));
string weightDescription = "";
if (fontWeight != null) {
weightDescription = fontWeight.weightValue.ToString();
weightDescription = $"{fontWeight.index + 1}00";
}
styles.Add(new DiagnosticsProperty<FontWeight>(

6
com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs


);
_labelBackgroundPaint.color = new Color(0xFFFFFFFF);
for (int i = 0; i < 4; i++) {
_indicatorLabel.Add(new TextPainter(new TextSpan(""), textDirection: TextDirection.ltr));
_indicatorLabel.Add(new TextPainter(textDirection: TextDirection.ltr));
}
}

List<_OverflowRegionData> overflowRegions = _calculateOverflowRegions(overflow, containerRect);
foreach (_OverflowRegionData region in overflowRegions) {
context.canvas.drawRect(region.rect.shift(offset), _indicatorPaint);
TextSpan textSpan = _indicatorLabel[(int) region.side].text as TextSpan;
if (_indicatorLabel[(int) region.side].text?.text != region.label) {
if (textSpan?.text != region.label) {
_indicatorLabel[(int) region.side].text = new TextSpan(
text: region.label,
style: _indicatorTextStyle

122
com.unity.uiwidgets/Runtime/rendering/editable.cs


using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
using StrutStyle = Unity.UIWidgets.ui.StrutStyle;
using TextRange = Unity.UIWidgets.ui.TextRange;
using StrutStyle = Unity.UIWidgets.painting.StrutStyle;
namespace Unity.UIWidgets.rendering {
class EditableUtils {

TextPainter _textPainter;
public TextSpan text {
get { return _textPainter.text; }
get { return _textPainter.text as TextSpan; }
set {
if (_textPainter.text == value) {
return;

return rect.shift(_getPixelPerfectCursorOffset(rect));
}
public TextPosition getPositionDown(TextPosition position) {
return _textPainter.getPositionVerticalMove(position, 1);
}
public TextPosition getPositionUp(TextPosition position) {
return _textPainter.getPositionVerticalMove(position, -1);
}
public TextPosition getLineStartPosition(TextPosition position, TextAffinity? affinity = null) {
var line = _textPainter.getLineRange(position);
return new TextPosition(offset: line.start, affinity: affinity ?? position.affinity);
}
public bool isLineEndOrStart(int offset) {
int lineCount = _textPainter.getLineCount();
for (int i = 0; i < lineCount; i++) {
var line = _textPainter.getLineRange(i);
if (line.start == offset || line.endIncludingNewLine == offset) {
return true;
}
}
return false;
}
public TextPosition getLineEndPosition(TextPosition position, TextAffinity? affinity = null) {
var line = _textPainter.getLineRange(position);
return new TextPosition(offset: line.endIncludingNewLine, affinity: affinity ?? position.affinity);
}
public TextPosition getWordRight(TextPosition position) {
return _textPainter.getWordRight(position);
}
public TextPosition getWordLeft(TextPosition position) {
return _textPainter.getWordLeft(position);
}
public TextPosition getParagraphStart(TextPosition position, TextAffinity? affinity = null) {
D.assert(!_needsLayout);
int lineIndex = _textPainter.getLineIndex(position);
while (lineIndex - 1 >= 0) {
var preLine = _textPainter.getLineRange(lineIndex - 1);
if (preLine.hardBreak) {
break;
}
lineIndex--;
}
var line = _textPainter.getLineRange(lineIndex);
return new TextPosition(offset: line.start, affinity: affinity ?? position.affinity);
}
public TextPosition getParagraphEnd(TextPosition position, TextAffinity? affinity = null) {
D.assert(!_needsLayout);
int lineIndex = _textPainter.getLineIndex(position);
int maxLine = _textPainter.getLineCount();
while (lineIndex < maxLine) {
var line = _textPainter.getLineRange(lineIndex);
if (line.hardBreak) {
break;
}
lineIndex++;
}
return new TextPosition(offset: _textPainter.getLineRange(lineIndex).endIncludingNewLine,
affinity: affinity ?? position.affinity);
}
public TextPosition getParagraphForward(TextPosition position, TextAffinity? affinity = null) {
var lineCount = _textPainter.getLineCount();
Paragraph.LineRange? line = null;
for (int i = 0; i < lineCount; ++i) {
line = _textPainter.getLineRange(i);
if (!line.Value.hardBreak) {
continue;
}
if (line.Value.end > position.offset) {
break;
}
}
if (line == null) {
return new TextPosition(position.offset, affinity ?? position.affinity);
}
return new TextPosition(line.Value.end, affinity ?? position.affinity);
}
public TextPosition getParagraphBackward(TextPosition position, TextAffinity? affinity = null) {
var lineCount = _textPainter.getLineCount();
Paragraph.LineRange? line = null;
for (int i = lineCount - 1; i >= 0; --i) {
line = _textPainter.getLineRange(i);
if (i != 0 && !_textPainter.getLineRange(i - 1).hardBreak) {
continue;
}
if (line.Value.start < position.offset) {
break;
}
}
if (line == null) {
return new TextPosition(position.offset, affinity ?? position.affinity);
}
return new TextPosition(line.Value.start, affinity ?? position.affinity);
}
protected override float computeMinIntrinsicWidth(float height) {
_layoutText(float.PositiveInfinity);
return _textPainter.minIntrinsicWidth;

}
if (!width.isFinite()) {
var text = _textPainter.text.text;
var text = _textPainter.text.toPlainText();
int lines = 1;
for (int index = 0; index < text.Length; ++index) {
if (text[index] == 0x0A) {

18
com.unity.uiwidgets/Runtime/rendering/image.cs


ImageRepeat repeat = ImageRepeat.noRepeat,
Rect centerSlice = null,
bool invertColors = false,
FilterMode filterMode = FilterMode.Bilinear
FilterQuality filterQuality = FilterQuality.low
) {
_image = image;
_width = width;

_centerSlice = centerSlice;
_alignment = alignment ?? Alignment.center;
_invertColors = invertColors;
_filterMode = filterMode;
_filterQuality = filterQuality;
_updateColorFilter();
}

}
}
FilterMode _filterMode;
FilterQuality _filterQuality;
public FilterMode filterMode {
get { return _filterMode; }
public FilterQuality filterQuality {
get { return _filterQuality; }
if (value == _filterMode) {
if (value == _filterQuality) {
_filterMode = value;
_filterQuality = value;
markNeedsPaint();
}
}

centerSlice: _centerSlice,
repeat: _repeat,
invertColors: _invertColors,
filterMode: _filterMode
filterQuality: _filterQuality
);
}

properties.add(new DiagnosticsProperty<Rect>("centerSlice", centerSlice,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<bool>("invertColors", invertColors));
properties.add(new EnumProperty<FilterMode>("filterMode", filterMode));
properties.add(new EnumProperty<FilterQuality>("filterMode", filterQuality));
}
}
}

20
com.unity.uiwidgets/Runtime/rendering/paragraph.cs


using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
using StrutStyle = Unity.UIWidgets.ui.StrutStyle;
using StrutStyle = Unity.UIWidgets.painting.StrutStyle;
namespace Unity.UIWidgets.rendering {
public enum TextOverflow {

}
}
public TextSpan text {
public InlineSpan text {
get { return _textPainter.text; }
set {

}
}
TextSpan _previousHoverSpan;
InlineSpan _previousHoverSpan;
#pragma warning disable 0414
bool _pointerHoverInside;

void _resetHoverHandler() {
_hasHoverRecognizer = _textPainter.text.hasHoverRecognizer;
_hasHoverRecognizer = (_textPainter.text as TextSpan)?.hasHoverRecognizer ?? false;
_previousHoverSpan = null;
_pointerHoverInside = false;

void _onPointerExit(PointerEvent evt) {
_pointerHoverInside = false;
_previousHoverSpan?.hoverRecognizer?.OnPointerLeave?.Invoke();
(_previousHoverSpan as TextSpan)?.hoverRecognizer?.OnPointerLeave?.Invoke();
_previousHoverSpan = null;
}

TextPosition position = _textPainter.getPositionForOffset(offset);
TextSpan span = _textPainter.text.getSpanForPosition(position);
InlineSpan span = _textPainter.text.getSpanForPosition(position);
_previousHoverSpan?.hoverRecognizer?.OnPointerLeave?.Invoke();
span?.hoverRecognizer?.OnPointerEnter?.Invoke((PointerHoverEvent) evt);
(_previousHoverSpan as TextSpan)?.hoverRecognizer?.OnPointerLeave?.Invoke();
(span as TextSpan)?.hoverRecognizer?.OnPointerEnter?.Invoke((PointerHoverEvent) evt);
_previousHoverSpan = span;
}
}

_layoutTextWithConstraints(constraints);
Offset offset = ((BoxHitTestEntry) entry).localPosition;
TextPosition position = _textPainter.getPositionForOffset(offset);
TextSpan span = _textPainter.text.getSpanForPosition(position);
span?.recognizer?.addPointer((PointerDownEvent) evt);
InlineSpan span = _textPainter.text.getSpanForPosition(position);
(span as TextSpan)?.recognizer?.addPointer((PointerDownEvent) evt);
}
protected override void performLayout() {

12
com.unity.uiwidgets/Runtime/rendering/viewport_offset.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.rendering {

public abstract void correctBy(float correction);
public abstract void jumpTo(float pixels);
public abstract IPromise animateTo(float to, TimeSpan duration, Curve curve);
public abstract Future animateTo(float to, TimeSpan duration, Curve curve);
public virtual IPromise moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
public virtual Future moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
return Promise.Resolved();
return Future.value();
} else {
return animateTo(to, duration: duration??TimeSpan.Zero , curve: curve ?? Curves.ease);
}

public override void jumpTo(float pixels) {
}
public override IPromise animateTo(float to, TimeSpan duration, Curve curve) {
return Promise.Resolved();
public override Future animateTo(float to, TimeSpan duration, Curve curve) {
return Future.value();
}
public override ScrollDirection userScrollDirection {

12
com.unity.uiwidgets/Runtime/service/clipboard.cs


public static readonly string kTextPlain = "text/plain";
public static IPromise setData(ClipboardData data) {
public static Future setData(ClipboardData data) {
public static IPromise<ClipboardData> getData(string format) {
public static Future<ClipboardData> getData(string format) {
protected abstract IPromise setClipboardData(ClipboardData data);
protected abstract IPromise<ClipboardData> getClipboardData(string format);
protected abstract Future setClipboardData(ClipboardData data);
protected abstract Future<ClipboardData> getClipboardData(string format);
protected override IPromise setClipboardData(ClipboardData data) {
protected override Future setClipboardData(ClipboardData data) {
#if UNITY_WEBGL
UIWidgetsCopyTextToClipboard(data.text);
#else

return Promise.Resolved();
}
protected override IPromise<ClipboardData> getClipboardData(string format) {
protected override Future<ClipboardData> getClipboardData(string format) {
var data = new ClipboardData(text: GUIUtility.systemCopyBuffer);
return Promise<ClipboardData>.Resolved(data);
}

182
com.unity.uiwidgets/Runtime/service/text_editing.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.service {
public class TextRange : IEquatable<TextRange> {
public readonly int start;
public readonly int end;
public static TextRange collapsed(int offset) {
D.assert(offset >= -1);
return new TextRange(offset, offset);
}
public static readonly TextRange empty = new TextRange(-1, -1);
public TextRange(int start, int end) {
D.assert(start >= -1);
D.assert(end >= -1);
this.start = start;
this.end = end;
}
public bool isValid {
get { return start >= 0 && end >= 0; }
}
public bool isCollapsed {
get { return start == end; }
}
public bool isNormalized {
get { return start <= end; }
}
public string textBefore(string text) {
D.assert(isNormalized);
return text.Substring(0, start);
}
public string textAfter(string text) {
D.assert(isNormalized);
return text.Substring(end);
}
public string textInside(string text) {
D.assert(isNormalized);
return text.Substring(start, end - start);
}
public bool Equals(TextRange other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return start == other.start && end == other.end;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((TextRange) obj);
}
public override int GetHashCode() {
unchecked {
return (start * 397) ^ end;
}
}
public static bool operator ==(TextRange left, TextRange right) {
return Equals(left, right);
}
public static bool operator !=(TextRange left, TextRange right) {
return !Equals(left, right);
}
public override string ToString() {
return $"TextRange Start: {start}, End: {end}";
}
}
// public class TextRange : IEquatable<TextRange> {
// public readonly int start;
// public readonly int end;
//
// public static TextRange collapsed(int offset) {
// D.assert(offset >= -1);
// return new TextRange(offset, offset);
// }
//
// public static readonly TextRange empty = new TextRange(-1, -1);
//
// public TextRange(int start, int end) {
// D.assert(start >= -1);
// D.assert(end >= -1);
// this.start = start;
// this.end = end;
// }
//
// public bool isValid {
// get { return start >= 0 && end >= 0; }
// }
//
// public bool isCollapsed {
// get { return start == end; }
// }
//
// public bool isNormalized {
// get { return start <= end; }
// }
//
// public string textBefore(string text) {
// D.assert(isNormalized);
// return text.Substring(0, start);
// }
//
// public string textAfter(string text) {
// D.assert(isNormalized);
// return text.Substring(end);
// }
//
// public string textInside(string text) {
// D.assert(isNormalized);
// return text.Substring(start, end - start);
// }
//
// public bool Equals(TextRange other) {
// if (ReferenceEquals(null, other)) {
// return false;
// }
//
// if (ReferenceEquals(this, other)) {
// return true;
// }
//
// return start == other.start && end == other.end;
// }
//
// public override bool Equals(object obj) {
// if (ReferenceEquals(null, obj)) {
// return false;
// }
//
// if (ReferenceEquals(this, obj)) {
// return true;
// }
//
// if (obj.GetType() != GetType()) {
// return false;
// }
//
// return Equals((TextRange) obj);
// }
//
// public override int GetHashCode() {
// unchecked {
// return (start * 397) ^ end;
// }
// }
//
// public static bool operator ==(TextRange left, TextRange right) {
// return Equals(left, right);
// }
//
// public static bool operator !=(TextRange left, TextRange right) {
// return !Equals(left, right);
// }
//
// public override string ToString() {
// return $"TextRange Start: {start}, End: {end}";
// }
// }
public class TextSelection : TextRange, IEquatable<TextSelection> {
public readonly int baseOffset;

4
com.unity.uiwidgets/Runtime/service/text_input.cs


class TextInputConfiguration {
public TextInputConfiguration(TextInputType inputType = null,
bool obscureText = false, bool autocorrect = true, TextInputAction inputAction = TextInputAction.done,
Brightness keyboardAppearance = Brightness.light,
ui.Brightness keyboardAppearance = ui.Brightness.light,
TextCapitalization textCapitalization = TextCapitalization.none,
bool unityTouchKeyboard = false) {
this.inputType = inputType ?? TextInputType.text;

public readonly bool autocorrect;
public readonly TextInputAction inputAction;
public readonly TextCapitalization textCapitalization;
public readonly Brightness keyboardAppearance;
public readonly ui.Brightness keyboardAppearance;
public readonly bool unityTouchKeyboard;
public JSONNode toJson() {

4
com.unity.uiwidgets/Runtime/ui/painting/codec.cs


public static class CodecUtils {
public static IPromise<Codec> getCodec(byte[] bytes) {
public static Future<Codec> getCodec(byte[] bytes) {
if (GifCodec.isGif(bytes)) {
return Promise<Codec>.Resolved(new GifCodec(bytes));
}

return Promise<Codec>.Resolved(new ImageCodec(new Image(texture)));
}
public static IPromise<Codec> getCodec(Image image) {
public static Future<Codec> getCodec(Image image) {
return Promise<Codec>.Resolved(new ImageCodec(image));
}
}

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


}
}
public unsafe void addPath(Path path, Offset offset, float[] matrix4) {
public unsafe void addPath(Path path, Offset offset, float[] matrix4 = null) {
D.assert(path != null); // path is checked on the engine side
D.assert(PaintingUtils._offsetIsValid(offset));

89
com.unity.uiwidgets/Runtime/ui2/window.cs


}
}
public class Locale : IEquatable<Locale> {
public Locale(string languageCode, string countryCode = null) {
D.assert(languageCode != null);

public Locale(string languageCode, string countryCode = null, string scriptCode = null) {
D.assert(languageCode != null);
_languageCode = languageCode;
_countryCode = countryCode;
_scriptCode = scriptCode;
}
public static Locale fromSubtags(
string languageCode = "und",
string scriptCode = null,
string countryCode = null
) {
D.assert(languageCode != null); // ignore: unnecessary_null_comparison
D.assert(languageCode != "");
D.assert(scriptCode != "");
D.assert(countryCode != "");
return new Locale(languageCode, countryCode, scriptCode);
}
readonly string _languageCode;
public string languageCode {

get { return _countryCode; }
}
readonly string _scriptCode;
public string scriptCode { get; }
public bool Equals(Locale other) {
if (ReferenceEquals(null, other)) {
return false;

return $"{languageCode}_{countryCode}";
}
}
public class Window {
internal IntPtr _ptr;
internal object _binding;

public VoidCallback onMetricsChanged { get; set; }
public Locale locale {
get {
if (_locales != null && _locales.isNotEmpty()) {
return _locales.first();
}
return null;
}
}
List<Locale> _locales;
public List<Locale> locales { get; }
Locale computePlatformResolvedLocale(List<Locale> supportedLocales) {
List<string> supportedLocalesData = new List<string>();
foreach (Locale locale in supportedLocales) {
supportedLocalesData.Add(locale.languageCode);
supportedLocalesData.Add(locale.countryCode);
supportedLocalesData.Add(locale.scriptCode);
}
List<string> result = _computePlatformResolvedLocale(supportedLocalesData);
if (result.isNotEmpty()) {
return Locale.fromSubtags(
languageCode: result[0],
countryCode: result[1] == "" ? null : result[1],
scriptCode: result[2] == "" ? null : result[2]);
}
return null;
}
List<string> _computePlatformResolvedLocale(List<string> supportedLocalesData) =>
Window_computePlatformResolvedLocale(supportedLocalesData);
/// A callback that is invoked whenever [locale] changes value.
///
/// The framework invokes this callback in the same zone in which the
/// callback was set.
///
/// See also:
///
/// * [WidgetsBindingObserver], for a mechanism at the widgets layer to
/// observe when this callback is invoked.
public VoidCallback onLocaleChanged {
get { return _onLocaleChanged; }
set {
_onLocaleChanged = value;
_onLocaleChangedZone = Zone.current;
}
}
VoidCallback _onLocaleChanged;
Zone _onLocaleChangedZone = Zone.root;
public string initialLifecycleState {
get {
_initialLifecycleStateAccessed = true;

[DllImport(NativeBindings.dllName)]
static extern void Window_freeDefaultRouteName(IntPtr routeNamePtr);
[DllImport(NativeBindings.dllName)]
static extern List<string> Window_computePlatformResolvedLocale(List<string> supportedLocalesData);
[MonoPInvokeCallback(typeof(Window_sendPlatformMessageCallback))]
static unsafe void _sendPlatformMessageCallback(IntPtr callbackHandle, byte* data, int dataLength) {

1
com.unity.uiwidgets/Runtime/widgets/animated_switcher.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG.Promises;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;

19
com.unity.uiwidgets/Runtime/widgets/app.cs


using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

return panel == null ? null : panel.window;
}
#if UNITY_EDITOR
public static Window of(UIWidgetsEditorWindow editorWindow) {
return editorWindow.window;
}
#endif
public override bool updateShouldNotify(InheritedWidget oldWidget) {
D.assert(window == ((WindowProvider) oldWidget).window);
return false;

class _WidgetsAppState : State<WidgetsApp>, WidgetsBindingObserver {
GlobalKey<NavigatorState> _navigator;
public IPromise<bool> didPopRoute() {
public Future<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
return Future<bool>.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
public Future<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
return Future<bool>.value(false).to<bool>();
return Promise<bool>.Resolved(true);
return Future<bool>.value(true).to<bool>();
}
public void didChangeMetrics() {

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


using System;
using System.Collections.Generic;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.ui;

}
else {
_keepingAlive = false;
Window.instance.scheduleMicrotask(() => {
async_.scheduleMicrotask(() => {
return null;
});
}
}

1
com.unity.uiwidgets/Runtime/widgets/basic.cs


using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
using StrutStyle = Unity.UIWidgets.painting.StrutStyle;
namespace Unity.UIWidgets.widgets {
public class Directionality : InheritedWidget {

46
com.unity.uiwidgets/Runtime/widgets/binding.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;

void didChangeLocales(List<Locale> locale);
IPromise<bool> didPopRoute();
Future<bool> didPopRoute();
IPromise<bool> didPushRoute(string route);
Future<bool> didPushRoute(string route);
}
public static partial class ui_ {
public static void Each<T>(this IEnumerable<T> source, Action<T> fn) {
foreach (var item in source) {
fn.Invoke(item);
}
}
public static void Each<T>(this IEnumerable<T> source, Action<T, int> fn) {
int index = 0;
foreach (T item in source) {
fn.Invoke(item, index);
index++;
}
}
/// <summary>
/// Convert a variable length argument list of items to an enumerable.
/// </summary>
public static IEnumerable<T> FromItems<T>(params T[] items) {
foreach (var item in items) {
yield return item;
}
}
}
public class WidgetsBinding : RendererBinding {

buildOwner.onBuildScheduled = _handleBuildScheduled;
Window.instance.onLocaleChanged += handleLocaleChanged;
widgetInspectorService = new WidgetInspectorService(this);
addPersistentFrameCallback((duration) => {
TextBlobMesh.tickNextFrame();
TessellationGenerator.tickNextFrame();
uiTessellationGenerator.tickNextFrame();
uiPathCacheManager.tickNextFrame();
});
// addPersistentFrameCallback((duration) => {
// TextBlobMesh.tickNextFrame();
// TessellationGenerator.tickNextFrame();
// uiTessellationGenerator.tickNextFrame();
// uiPathCacheManager.tickNextFrame();
// });
}
public BuildOwner buildOwner {

Application.Quit();
return;
}
_observers[idx].didPopRoute().Then((Action<bool>) _handlePopRouteSub);
_observers[idx].didPopRoute().then_(_handlePopRouteSub);
}
}

12
com.unity.uiwidgets/Runtime/widgets/dismissible.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

namespace Unity.UIWidgets.widgets {
public delegate void DismissDirectionCallback(DismissDirection? direction);
public delegate Promise<bool> ConfirmDismissCallback(DismissDirection? direction);
public delegate Future<bool> ConfirmDismissCallback(DismissDirection? direction);
public enum DismissDirection {
vertical,

}
_dragUnderway = false;
_confirmStartResizeAnimation().Then((value) => {
_confirmStartResizeAnimation().then_((value) => {
if (_moveController.isCompleted && value) {
_startResizeAnimation();
}

void _handleDismissStatusChanged(AnimationStatus status) {
if (status == AnimationStatus.completed && !_dragUnderway) {
_confirmStartResizeAnimation().Then((value) => {
_confirmStartResizeAnimation().then_((value) => {
if (value) {
_startResizeAnimation();
}

}
}
IPromise<bool> _confirmStartResizeAnimation() {
Future<bool> _confirmStartResizeAnimation() {
if (widget.confirmDismiss != null) {
DismissDirection? direction = _dismissDirection;
D.assert(direction != null);

return Promise<bool>.Resolved(true);
return Future<bool>.value(true).to<bool>();
}
void _startResizeAnimation() {

26
com.unity.uiwidgets/Runtime/widgets/editable_text.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;

using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using UnityEngine;
using Brightness = Unity.UIWidgets.ui.Brightness;
using StrutStyle = Unity.UIWidgets.painting.StrutStyle;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.widgets {

public void didChangeLocales(List<Locale> locale) {
}
public IPromise<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
public Future<bool> didPopRoute() {
return Future<bool>.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
public Future<bool> didPushRoute(string route) {
return Future<bool>.value(false).to<bool>();
}
void _formatAndSetValue(TextEditingValue value, bool isIMEInput = false) {

int _obscureShowCharTicksPending = 0;
int _obscureLatestCharIndex;
void _cursorTick() {
object _cursorTick(object timer) {
_targetCursorVisibility = !_unityKeyboard() && !_targetCursorVisibility;
float targetOpacity = _targetCursorVisibility ? 1.0f : 0.0f;
if (widget.cursorOpacityAnimates) {

if (_obscureShowCharTicksPending > 0) {
setState(() => { _obscureShowCharTicksPending--; });
}
return null;
void _cursorWaitForStart() {
object _cursorWaitForStart(object timer) {
_cursorTimer = Window.instance.run(_kCursorBlinkHalfPeriod, _cursorTick, periodic: true);
_cursorTimer = Timer.periodic(_kCursorBlinkHalfPeriod, _cursorTick);
return null;
}
void _startCursorTimer() {

if (widget.cursorOpacityAnimates) {
_cursorTimer =
Window.instance.run(_kCursorBlinkWaitForStart, _cursorWaitForStart, periodic: true);
Timer.periodic(_kCursorBlinkWaitForStart, _cursorWaitForStart);
_cursorTimer = Window.instance.run(_kCursorBlinkHalfPeriod, _cursorTick, periodic: true);
_cursorTimer = Timer.periodic(_kCursorBlinkHalfPeriod, _cursorTick);
}
}

15
com.unity.uiwidgets/Runtime/widgets/focus_manager.cs


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

}
}
public void requestFocus(FocusNode node) {
D.assert(node != null);
// TODO: need update
public void requestFocus(FocusNode node = null) {
// D.assert(node != null);
_focusPath.SequenceEqual(focusPath)))) {
_focusPath.SequenceEqual(focusPath)))) {
return;
}

node._hasKeyboardToken = true;
_setFocus(node);
}
public void autofocus(FocusNode node) {
D.assert(node != null);
if (_focus == null) {

}
_haveScheduledUpdate = true;
Window.instance.scheduleMicrotask(_update);
async_.scheduleMicrotask(() => {
_update();
return null;
});
}
internal FocusNode _findNextFocus() {

21
com.unity.uiwidgets/Runtime/widgets/image.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

);
}
public IPromise precacheImage(
public Future precacheImage(
ImageProvider provider,
BuildContext context,
Size size = null,

var completer = new Promise();
var completer = Completer.create();
completer.Resolve();
stream.removeListener(listener);
if (!completer.isCompleted) {
stream.removeListener(listener);
}
SchedulerBinding.instance.addPostFrameCallback(timeStamp => { stream.removeListener(listener); });
completer.Resolve();
if (!completer.isCompleted) {
completer.complete();
}
stream.removeListener(listener);
if (onError != null) {
onError(exception);

}
stream.addListener(listener, onError: errorListener);
return completer;
return completer.future;
}
}

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


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.physics;

}
}
public IPromise animateToItem(
public Future animateToItem(
return Promise.Resolved();
return null;
List<IPromise> futures = new List<IPromise>();
List<Future> futures = new List<Future>();
foreach (_FixedExtentScrollPosition position in positions) {
futures.Add(position.animateTo(
itemIndex * position.itemExtent,

}
return Promise.All(futures);
return Future.wait<object>(futures);
}
public void jumpToItem(int itemIndex) {

42
com.unity.uiwidgets/Runtime/widgets/localizations.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.async2;
public _Pending(LocalizationsDelegate del, IPromise<object> futureValue) {
public _Pending(LocalizationsDelegate del, Future<object> futureValue) {
public readonly IPromise<object> futureValue;
public readonly Future<object> futureValue;
internal static IPromise<Dictionary<Type, object>> _loadAll(Locale locale,
internal static Future<Dictionary<Type, object>> _loadAll(Locale locale,
IEnumerable<LocalizationsDelegate> allDelegates) {
Dictionary<Type, object> output = new Dictionary<Type, object>();
List<_Pending> pendingList = null;

}
foreach (LocalizationsDelegate del in delegates) {
IPromise<object> inputValue = del.load(locale);
Future<WidgetsLocalizations> inputValue = del.load(locale);
IPromise<object> futureValue = inputValue.Then(value => { return completedValue = value; });
Future<object> futureValue = inputValue.then_(value => {
completedValue = value;
return FutureOr.value(completedValue);
}).to<object>();
if (completedValue != null) {
Type type = del.type;
D.assert(!output.ContainsKey(type));

}
if (pendingList == null) {
return Promise<Dictionary<Type, object>>.Resolved(output);
return Future<Dictionary<Type, object>>.value(output).to<Dictionary<Type, object>>();
return Promise<object>.All(pendingList.Select(p => p.futureValue))
.Then(values => {
var list = values.ToList();
return Future<object>.wait<object>(pendingList.Select(p => p.futureValue))
.then(values => {
//TODO : check values is list
var list = (List<object>)values;
D.assert(list.Count == pendingList.Count);
for (int i = 0; i < list.Count; i += 1) {
Type type = pendingList[i].del.type;

return output;
});
}).to<Dictionary<Type, object>>();
}
}

public abstract bool isSupported(Locale locale);
public abstract IPromise<object> load(Locale locale);
public abstract Future<WidgetsLocalizations> load(Locale locale);
public abstract bool shouldReload(LocalizationsDelegate old);

return true;
}
public override IPromise<object> load(Locale locale) {
public override Future<WidgetsLocalizations> load(Locale locale) {
return DefaultWidgetsLocalizations.load(locale);
}

public DefaultWidgetsLocalizations() {
}
public static IPromise<object> load(Locale locale) {
return Promise<object>.Resolved(new DefaultWidgetsLocalizations());
public static Future<WidgetsLocalizations> load(Locale locale) {
return new SynchronousFuture<WidgetsLocalizations>(new DefaultWidgetsLocalizations());
}
public static readonly LocalizationsDelegate<WidgetsLocalizations> del = new _WidgetsLocalizationsDelegate();

}
Dictionary<Type, object> typeToResources = null;
IPromise<Dictionary<Type, object>> typeToResourcesFuture = _Pending._loadAll(locale, delegates)
.Then(value => { return typeToResources = value; });
Future<Dictionary<Type, object>> typeToResourcesFuture = _Pending._loadAll(locale, delegates)
.then(value => { return FutureOr.value(typeToResources = (Dictionary<Type, object>)value); }).to<Dictionary<Type, object>>();
if (typeToResources != null) {
_typeToResources = typeToResources;

// WidgetsBinding.instance.deferFirstFrameReport();
typeToResourcesFuture.Then(value => {
typeToResourcesFuture.then(value => {
// WidgetsBinding.instance.allowFirstFrameReport();
if (!mounted) {
return;

_typeToResources = value;
_typeToResources = (Dictionary<Type, object>)value;
_locale = locale;
});
});

1
com.unity.uiwidgets/Runtime/widgets/media_query.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Brightness = Unity.UIWidgets.ui.Brightness;
namespace Unity.UIWidgets.widgets {
public enum Orientation {

65
com.unity.uiwidgets/Runtime/widgets/navigator.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using RSG.Promises;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using SchedulerBinding = Unity.UIWidgets.scheduler.SchedulerBinding;
using SchedulerPhase = Unity.UIWidgets.scheduler.SchedulerPhase;
namespace Unity.UIWidgets.widgets {
public delegate Route RouteFactory(RouteSettings settings);

public delegate IPromise<bool> WillPopCallback();
public delegate Future<bool> WillPopCallback();
public enum RoutePopDisposition {
pop,

}
protected internal virtual TickerFuture didPush() {
return TickerFutureImpl.complete();
var future = TickerFuture.complete();
future.then(o => {
navigator?.focusScopeNode?.requestFocus();
});
return future;
public virtual IPromise<RoutePopDisposition> willPop() {
return Promise<RoutePopDisposition>.Resolved(isFirst
public virtual Future<RoutePopDisposition> willPop() {
return Future<RoutePopDisposition>.value(isFirst
: RoutePopDisposition.pop);
: RoutePopDisposition.pop).to<RoutePopDisposition>();
}
public virtual bool willHandlePopInternally {

get { return null; }
}
public IPromise<object> popped {
get { return _popCompleter; }
public Future popped {
get { return _popCompleter.future; }
internal readonly Promise<object> _popCompleter = new Promise<object>();
internal readonly Completer _popCompleter = Completer.create();
protected internal virtual bool didPop(object result) {
didComplete(result);

protected internal virtual void didComplete(object result) {
_popCompleter.Resolve(result);
_popCompleter.complete(FutureOr.value(result ?? currentResult));
}
protected internal virtual void didPopNext(Route nextRoute) {

public static readonly string defaultRouteName = "/";
public static IPromise<object> pushNamed(BuildContext context, string routeName, object arguments = null) {
public static Future pushNamed(BuildContext context, string routeName, object arguments = null) {
public static IPromise<object> pushReplacementNamed(BuildContext context, string routeName,
public static Future pushReplacementNamed(BuildContext context, string routeName,
public static IPromise<object> popAndPushNamed(BuildContext context, string routeName, object result = null,
public static Future popAndPushNamed(BuildContext context, string routeName, object result = null,
public static IPromise<object> pushNamedAndRemoveUntil(BuildContext context, string newRouteName,
public static Future pushNamedAndRemoveUntil(BuildContext context, string newRouteName,
public static IPromise<object> push(BuildContext context, Route route) {
public static Future push(BuildContext context, Route route) {
public static IPromise<object> pushReplacement(BuildContext context, Route newRoute, object result = null) {
public static Future pushReplacement(BuildContext context, Route newRoute, object result = null) {
public static IPromise<object> pushAndRemoveUntil(BuildContext context, Route newRoute,
public static Future pushAndRemoveUntil(BuildContext context, Route newRoute,
RoutePredicate predicate) {
return of(context).pushAndRemoveUntil(newRoute, predicate);
}

return navigator != null && navigator.canPop();
}
public static IPromise<bool> maybePop(BuildContext context, object result = null) {
public static Future<bool> maybePop(BuildContext context, object result = null) {
return of(context).maybePop(result);
}

return route;
}
public IPromise<object> pushNamed(string routeName, object arguments = null) {
public Future pushNamed(string routeName, object arguments = null) {
public IPromise<object> pushReplacementNamed(string routeName, object result = null, object arguments = null) {
public Future pushReplacementNamed(string routeName, object result = null, object arguments = null) {
public IPromise<object> popAndPushNamed(string routeName, object result = null, object arguments = null) {
public Future popAndPushNamed(string routeName, object result = null, object arguments = null) {
public IPromise<object> pushNamedAndRemoveUntil(string newRouteName, RoutePredicate predicate,
public Future pushNamedAndRemoveUntil(string newRouteName, RoutePredicate predicate,
public IPromise<object> push(Route route) {
public Future push(Route route) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

_cancelActivePointers();
}
public IPromise<object> pushReplacement(Route newRoute, object result = null) {
public Future pushReplacement(Route newRoute, object result = null) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

return newRoute.popped;
}
public IPromise<object> pushAndRemoveUntil(Route newRoute, RoutePredicate predicate) {
public Future pushAndRemoveUntil(Route newRoute, RoutePredicate predicate) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

return _history.Count > 1 || _history[0].willHandlePopInternally;
}
public IPromise<bool> maybePop(object result = null) {
public Future<bool> maybePop(object result = null) {
return route.willPop().Then(disposition => {
return route.willPop().then_(disposition => {
if (disposition != RoutePopDisposition.bubble && mounted) {
if (disposition == RoutePopDisposition.pop) {
pop(result);

}
return false;
});
}).to<bool>();
}
public bool pop(object result = null) {

10
com.unity.uiwidgets/Runtime/widgets/nested_scroll_view.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

_outerPosition.updateCanDrag(maxInnerExtent);
}
public IPromise animateTo(float to,
public Future animateTo(float to,
TimeSpan duration,
Curve curve
) {

curve
);
List<IPromise> resultFutures = new List<IPromise> {outerActivity.done};
List<Future> resultFutures = new List<Future> {outerActivity.done};
beginActivity(
outerActivity,
(_NestedScrollPosition position) => {

return innerActivity;
}
);
return Promise.All(resultFutures);
return Future.wait<object>(resultFutures);
}
public void jumpTo(float to) {

return null;
}
public override IPromise animateTo(float to,
public override Future animateTo(float to,
TimeSpan duration,
Curve curve
) {

9
com.unity.uiwidgets/Runtime/widgets/overscroll_indicator.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.physics;

}
_pullRecedeTimer =
Window.instance.run(_pullHoldTime, () => _recede(_pullDecayTime));
Timer.create(_pullHoldTime, () => {
_recede(_pullDecayTime);
return null;
});
}
public void scrollEnd() {

if (_displacementTickerLastElapsed != null) {
float? t = elapsed.Milliseconds - _displacementTickerLastElapsed?.Milliseconds;
_displacement = _displacementTarget - (_displacementTarget - _displacement) *
Mathf.Pow(2.0f, (-t ?? 0.0f) / _crossAxisHalfTime.Milliseconds);
Mathf.Pow(2.0f, (-t ?? 0.0f) / _crossAxisHalfTime.Milliseconds);
notifyListeners();
}

8
com.unity.uiwidgets/Runtime/widgets/page_view.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

}
}
public IPromise animateToPage(int page, TimeSpan duration, Curve curve) {
public Future animateToPage(int page, TimeSpan duration, Curve curve) {
_PagePosition position = (_PagePosition) this.position;
return position.animateTo(
position.getPixelsFromPage(page),

position.jumpTo(position.getPixelsFromPage(page));
}
public IPromise nextPage(TimeSpan duration, Curve curve) {
public Future nextPage(TimeSpan duration, Curve curve) {
public IPromise previousPage(TimeSpan duration, Curve curve) {
public Future previousPage(TimeSpan duration, Curve curve) {
return animateToPage(page.round() - 1, duration: duration, curve: curve);
}

105
com.unity.uiwidgets/Runtime/widgets/routes.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {

) : base(settings) {
}
public IPromise<object> completed {
get { return _transitionCompleter; }
public Future completed {
get { return _transitionCompleter.future; }
internal readonly Promise<object> _transitionCompleter = new Promise<object>();
internal readonly Completer _transitionCompleter = Completer.create();
public virtual TimeSpan transitionDuration { get; }

internal AnimationController _controller;
public virtual AnimationController createAnimationController() {
D.assert(_transitionCompleter.CurState == PromiseState.Pending,
D.assert(!_transitionCompleter.isCompleted,
() => $"Cannot reuse a {GetType()} after disposing it.");
TimeSpan duration = transitionDuration;
D.assert(duration >= TimeSpan.Zero);

}
public virtual Animation<float> createAnimation() {
D.assert(_transitionCompleter.CurState == PromiseState.Pending,
D.assert(!_transitionCompleter.isCompleted,
() => $"Cannot reuse a {GetType()} after disposing it.");
D.assert(_controller != null);
return _controller.view;

protected internal override void dispose() {
D.assert(!_transitionCompleter.isCompleted, () => $"Cannot dispose a {GetType()} twice.");
_controller?.dispose();
_transitionCompleter.Resolve(_result);
_transitionCompleter.complete(FutureOr.value(_result));
base.dispose();
}

}
}
public override IPromise<RoutePopDisposition> willPop() {
public override Future<RoutePopDisposition> willPop() {
return Promise<RoutePopDisposition>.Resolved(RoutePopDisposition.pop);
return Future<RoutePopDisposition>.value(RoutePopDisposition.pop).to<RoutePopDisposition>();
}
return base.willPop();

public override Widget build(BuildContext context) {
_page = _page ?? new RepaintBoundary(
key: widget.route._subtreeKey, // immutable
child: new Builder(
builder: (BuildContext _context) => widget.route.buildPage(
_context,
widget.route.animation,
widget.route.secondaryAnimation
))
);
key: widget.route._subtreeKey, // immutable
child: new Builder(
builder: (BuildContext _context) => widget.route.buildPage(
_context,
widget.route.animation,
widget.route.secondaryAnimation
))
);
return new _ModalScopeStatus(
route: widget.route,

}
public abstract class ModalRoute : LocalHistoryRouteTransitionRoute {
protected ModalRoute() {}
protected ModalRoute(RouteSettings settings) : base(settings) { }
protected ModalRoute() {
}
protected ModalRoute(RouteSettings settings) : base(settings) {
}
public static Color _kTransparent = new Color(0x00000000);

readonly List<WillPopCallback> _willPopCallbacks = new List<WillPopCallback>();
public override IPromise<RoutePopDisposition> willPop() {
public override Future<RoutePopDisposition> willPop() {
var callbacks = new List<WillPopCallback>(_willPopCallbacks);
Promise<RoutePopDisposition> result = new Promise<RoutePopDisposition>();
Action<int> fn = null;
fn = (int index) => {
if (index < callbacks.Count) {
callbacks[index]().Then((pop) => {
if (!pop) {
result.Resolve(RoutePopDisposition.doNotPop);
}
else {
fn(index + 1);
}
});
bool result = false;
foreach (WillPopCallback callback in _willPopCallbacks) {
callback.Invoke().then(v => result = !(bool)v);
if (result) {
return Future<RoutePopDisposition>.value(RoutePopDisposition.doNotPop).to<RoutePopDisposition>();
else {
base.willPop().Then((pop) => result.Resolve(pop));
}
};
fn(0);
return result;
}
return base.willPop();
// var callbacks = new List<WillPopCallback>(_willPopCallbacks);
// Promise<RoutePopDisposition> result = new Promise<RoutePopDisposition>();
// Action<int> fn = null;
// fn = (int index) => {
// if (index < callbacks.Count) {
// callbacks[index]().Then((pop) => {
// if (!pop) {
// result.Resolve(RoutePopDisposition.doNotPop);
// }
// else {
// fn(index + 1);
// }
// });
// }
// else {
// base.willPop().Then((pop) => result.Resolve(pop));
// }
// };
// fn(0);
// return result;
}
public void addScopedWillPopCallback(WillPopCallback callback) {

Widget _buildModalScope(BuildContext context) {
return _modalScopeCache = _modalScopeCache ?? new _ModalScope(
key: _scopeKey,
route: this
// _ModalScope calls buildTransitions() and buildChild(), defined above
);
key: _scopeKey,
route: this
// _ModalScope calls buildTransitions() and buildChild(), defined above
);
}
public override ICollection<OverlayEntry> createOverlayEntries() {

}
public static class DialogUtils {
public static IPromise<object> showGeneralDialog(
public static Future<object> showGeneralDialog(
BuildContext context = null,
RoutePageBuilder pageBuilder = null,
bool barrierDismissible = false,

barrierColor: barrierColor,
transitionDuration: transitionDuration,
transitionBuilder: transitionBuilder
));
)).to<object>();
}
}

16
com.unity.uiwidgets/Runtime/widgets/scroll_activity.cs


using System;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

);
_controller.addListener(_tick);
_controller.animateWith(simulation).Then(() => _end());
_controller.animateWith(simulation).then(o => _end());
}
public override float velocity {

D.assert(duration > TimeSpan.Zero);
D.assert(curve != null);
_completer = new Promise();
_completer = Completer.create();
_controller = AnimationController.unbounded(
value: from,
debugLabel: GetType().ToString(),

_controller.animateTo(to, duration: duration, curve: curve)
.Then(() => _end());
.then(o => _end());
readonly Promise _completer;
readonly Completer _completer;
public IPromise done {
get { return _completer; }
public Future done {
get { return _completer.future; }
}
public override float velocity {

}
public override void dispose() {
_completer.Resolve();
_completer.complete();
_controller.dispose();
base.dispose();
}

8
com.unity.uiwidgets/Runtime/widgets/scroll_controller.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;

}
public IPromise animateTo(float to,
public Future animateTo(float to,
List<IPromise> animations = CollectionUtils.CreateRepeatedList<IPromise>(null, _positions.Count);
List<Future> animations = CollectionUtils.CreateRepeatedList<Future>(null, _positions.Count);
return Promise.All(animations);
return Future.wait<object>(animations);
}
public void jumpTo(float value) {

10
com.unity.uiwidgets/Runtime/widgets/scroll_position.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

activity.applyNewDimensions();
}
public IPromise ensureVisible(RenderObject renderObject,
public Future ensureVisible(RenderObject renderObject,
float alignment = 0.0f,
TimeSpan? duration = null,
Curve curve = null

minScrollExtent, maxScrollExtent);
if (target == pixels) {
return Promise.Resolved();
return Future.value();
return Promise.Resolved();
return Future.value();
}
curve = curve ?? Curves.ease;

public readonly ValueNotifier<bool> isScrollingNotifier = new ValueNotifier<bool>(false);
public override IPromise moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
public override Future moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
if (clamp) {
to = to.clamp(minScrollExtent, maxScrollExtent);
}

6
com.unity.uiwidgets/Runtime/widgets/scroll_position_with_single_context.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

didUpdateScrollDirection(value);
}
public override IPromise animateTo(float to,
public override Future animateTo(float to,
return Promise.Resolved();
return Future.value();
}
DrivenScrollActivity activity = new DrivenScrollActivity(

15
com.unity.uiwidgets/Runtime/widgets/scrollable.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

return widget == null ? null : widget.scrollable;
}
public static IPromise ensureVisible(BuildContext context,
public static Future ensureVisible(BuildContext context,
float alignment = 0.0f,
TimeSpan? duration = null,
Curve curve = null

List<IPromise> futures = new List<IPromise>();
List<Future> futures = new List<Future>();
ScrollableState scrollable = of(context);
while (scrollable != null) {

}
if (futures.isEmpty() || duration == TimeSpan.Zero) {
return Promise.Resolved();
return Future.value();
}
if (futures.Count == 1) {

return Promise.All(futures);
return Future.wait<object>(futures);
}
}

controller.detach(oldPosition);
}
Window.instance.scheduleMicrotask(oldPosition.dispose);
async_.scheduleMicrotask(()=> {
oldPosition.dispose();
return null;
});
}
_position = controller == null

25
com.unity.uiwidgets/Runtime/widgets/selectable_text.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;

public void didChangeTextScaleFactor() {
}
public void didChangePlatformBrightness() {
}

public IPromise<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
public Future<bool> didPopRoute() {
return Future<bool>.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
public Future<bool> didPushRoute(string route) {
return Future<bool>.value(false).to<bool>();
}
void _handleTapDown(TapDownDetails details) {

}
_lastTapOffset = details.globalPosition;
_doubleTapTimer = Window.instance.run(Constants.kDoubleTapTimeout, _doubleTapTimeout);
_doubleTapTimer = Timer.create(Constants.kDoubleTapTimeout, _doubleTapTimeout);
}
_isDoubleTap = false;

void _handleDragUpdate(DragUpdateDetails details) {
_lastDragUpdateDetails = details;
_dragUpdateThrottleTimer = _dragUpdateThrottleTimer ??
Window.instance.run(TextSelectionUtils._kDragSelectionUpdateThrottle,
_handleDragUpdateThrottled);
Timer.create(TextSelectionUtils._kDragSelectionUpdateThrottle,
_handleDragUpdateThrottled);
void _handleDragUpdateThrottled() {
object _handleDragUpdateThrottled() {
D.assert(_lastDragStartDetails != null);
D.assert(_lastDragUpdateDetails != null);
if (widget.onDragSelectionUpdate != null) {

_dragUpdateThrottleTimer = null;
_lastDragUpdateDetails = null;
return null;
}
void _handleDragEnd(DragEndDetails details) {

}
}
void _doubleTapTimeout() {
object _doubleTapTimeout() {
return null;
}
bool _isWithinDoubleTapTolerance(Offset secondTapOffset) {

1
com.unity.uiwidgets/Runtime/widgets/text.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using StrutStyle = Unity.UIWidgets.painting.StrutStyle;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.widgets {

20
com.unity.uiwidgets/Runtime/widgets/text_selection.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.rendering;

using Rect = Unity.UIWidgets.ui.Rect;
using TextRange = Unity.UIWidgets.ui.TextRange;
namespace Unity.UIWidgets.widgets {
static class TextSelectionUtils {

offset: value.selection.start + data.text.Length
)
);
selectionDelegate.bringIntoView(selectionDelegate.textEditingValue.selection.extendPos);
selectionDelegate.hideToolbar();
}

void _handleDragStart(DragStartDetails details) {
_dragPosition = details.globalPosition +
new Offset(0.0f, -widget.selectionControls.handleSize.height);
new Offset(0.0f, -widget.selectionControls.handleSize.height);
}
void _handleDragUpdate(DragUpdateDetails details) {

}
_lastTapOffset = details.globalPosition;
_doubleTapTimer = Window.instance.run(Constants.kDoubleTapTimeout, _doubleTapTimeout);
_doubleTapTimer = Timer.create(Constants.kDoubleTapTimeout, _doubleTapTimeout);
}
_isDoubleTap = false;

void _handleDragUpdate(DragUpdateDetails details) {
_lastDragUpdateDetails = details;
_dragUpdateThrottleTimer = _dragUpdateThrottleTimer ??
Window.instance.run(TextSelectionUtils._kDragSelectionUpdateThrottle,
_handleDragUpdateThrottled);
_dragUpdateThrottleTimer =
_dragUpdateThrottleTimer ?? Timer.create(TextSelectionUtils._kDragSelectionUpdateThrottle, _handleDragUpdateThrottled);
void _handleDragUpdateThrottled() {
object _handleDragUpdateThrottled() {
D.assert(_lastDragStartDetails != null);
D.assert(_lastDragUpdateDetails != null);
if (widget.onDragSelectionUpdate != null) {

_dragUpdateThrottleTimer = null;
_lastDragUpdateDetails = null;
return null;
}
void _handleDragEnd(DragEndDetails details) {

_isDoubleTap = false;
}
void _doubleTapTimeout() {
object _doubleTapTimeout() {
return null;
}
bool _isWithinDoubleTapTolerance(Offset secondTapOffset) {

16
com.unity.uiwidgets/Runtime/widgets/texture.cs


using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;

public static void textureFrameAvailable(Window instance = null) {
if (instance == null) {
WindowAdapter.windowAdapters.ForEach(w => w.scheduleFrame(false));
} else {
instance.scheduleFrame(false);
}
}
// TODO: check whether following is needed
// public static void textureFrameAvailable(Window instance = null) {
// if (instance == null) {
// WindowAdapter.windowAdapters.ForEach(w => w.scheduleFrame(false));
// } else {
// instance.scheduleFrame(false);
// }
// }
public Texture(Key key = null, UnityEngine.Texture texture = null) : base(key: key) {
D.assert(texture != null);

16
com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

public void didChangeLocales(List<Locale> locale) {
}
public IPromise<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
public Future<bool> didPopRoute() {
return Future.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
public Future<bool> didPushRoute(string route) {
return Future.value(false).to<bool>();
}
void _selectionChangedCallback() {

Picture _buildPicture(_InspectorOverlayRenderState state) {
PictureRecorder recorder = new PictureRecorder();
Canvas canvas = new RecorderCanvas(recorder);
Canvas canvas = new Canvas(recorder, state.overlayRect);
Size size = state.overlayRect.size;
var fillPaint = new Paint() {color = _kHighlightedRenderObjectFillColor};

};
Rect selectedPaintRect = state.selected.rect.deflate(0.5f);
canvas.save();
canvas.setMatrix(state.selected.transform.toMatrix3());
canvas.transform(state.selected.transform._m4storage);
canvas.drawRect(selectedPaintRect, fillPaint);
canvas.drawRect(selectedPaintRect, borderPaint);
canvas.restore();

canvas.setMatrix(transformedRect.transform.toMatrix3());
canvas.transform(transformedRect.transform._m4storage);
canvas.drawRect(transformedRect.rect.deflate(0.5f), borderPaint);
canvas.restore();
}

5
engine/src/lib/ui/window/window.cc


ptr->client()->Render(scene);
}
// TODO: ComputePlatformResolvedLocale
UIWIDGETS_API(void) Window_computePlatformResolvedLocale(Window* ptr, Scene* scene) {
ptr->client()->Render(scene);
}
} // namespace
WindowClient::~WindowClient() {}

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


using System;
using System.Collections.Generic;
using System.Text;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.painting {
public class Accumulator {
public Accumulator(int _value = 0) {
this._value = _value;
}
public int value {
get { return _value; }
}
int _value;
public void increment(int addend) {
D.assert(addend >= 0);
_value += addend;
}
}
public delegate bool InlineSpanVisitor(InlineSpan span);
public delegate bool TextSpanVisitor(TextSpan span);
public class InlineSpanSemanticsInformation : IEquatable<InlineSpanSemanticsInformation> {
public InlineSpanSemanticsInformation(
string text,
bool isPlaceholder = false,
string semanticsLabel = null,
GestureRecognizer recognizer = null
) {
D.assert(text != null);
D.assert(isPlaceholder != null);
D.assert(isPlaceholder == false || (text == "\uFFFC" && semanticsLabel == null && recognizer == null));
requiresOwnNode = isPlaceholder || recognizer != null;
}
public static readonly InlineSpanSemanticsInformation placeholder =
new InlineSpanSemanticsInformation("\uFFFC", isPlaceholder: true);
public readonly string text;
public readonly string semanticsLabel;
public readonly GestureRecognizer recognizer;
public readonly bool isPlaceholder;
public readonly bool requiresOwnNode;
public override string ToString() =>
$"{foundation_.objectRuntimeType(this, "InlineSpanSemanticsInformation")}" +
$"{text: $text, semanticsLabel: $semanticsLabel, recognizer: $recognizer}";
public bool Equals(InlineSpanSemanticsInformation other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return text == other.text && semanticsLabel == other.semanticsLabel &&
Equals(recognizer, other.recognizer) && isPlaceholder == other.isPlaceholder;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((InlineSpanSemanticsInformation) obj);
}
public override int GetHashCode() {
unchecked {
var hashCode = (text != null ? text.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (semanticsLabel != null ? semanticsLabel.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (recognizer != null ? recognizer.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ isPlaceholder.GetHashCode();
return hashCode;
}
}
}
public abstract class InlineSpan : DiagnosticableTree, IEquatable<InlineSpan> {
public InlineSpan(
TextStyle style = null
) {
this.style = style;
}
public readonly TextStyle style;
public abstract void build(ParagraphBuilder builder,
float textScaleFactor = 1, List<PlaceholderDimensions> dimensions = null
);
public abstract bool visitChildren(InlineSpanVisitor visitor);
public InlineSpan getSpanForPosition(TextPosition position) {
D.assert(debugAssertIsValid());
Accumulator offset = new Accumulator();
InlineSpan result = null;
visitChildren((InlineSpan span) => {
result = span.getSpanForPositionVisitor(position, offset);
return result == null;
});
return result;
}
protected abstract InlineSpan getSpanForPositionVisitor(TextPosition position, Accumulator offset);
public string toPlainText(
bool includeSemanticsLabels = true, bool includePlaceholders = true) {
StringBuilder buffer = new StringBuilder();
computeToPlainText(buffer, includeSemanticsLabels: includeSemanticsLabels,
includePlaceholders: includePlaceholders);
return buffer.ToString();
}
List<InlineSpanSemanticsInformation> getSemanticsInformation() {
List<InlineSpanSemanticsInformation> collector = new List<InlineSpanSemanticsInformation>();
computeSemanticsInformation(collector);
return collector;
}
public abstract void computeSemanticsInformation(List<InlineSpanSemanticsInformation> collector);
public abstract void computeToPlainText(StringBuilder buffer,
bool includeSemanticsLabels = true, bool includePlaceholders = true);
public int? codeUnitAt(int index) {
if (index < 0)
return null;
Accumulator offset = new Accumulator();
int? result = null;
visitChildren((InlineSpan span) => {
result = span.codeUnitAtVisitor(index, offset);
return result == null;
});
return result;
}
protected abstract int? codeUnitAtVisitor(int index, Accumulator offset);
public bool debugAssertIsValid() => true;
public abstract RenderComparison compareTo(InlineSpan other);
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.defaultDiagnosticsTreeStyle = DiagnosticsTreeStyle.whitespace;
if (style != null) {
style.debugFillProperties(properties);
}
}
public bool Equals(InlineSpan other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(style, other.style);
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((InlineSpan) obj);
}
public override int GetHashCode() {
return (style != null ? style.GetHashCode() : 0);
}
}
}

8
Samples/UIWidgetsSamples_2019_4/Assets/Editor.meta


fileFormatVersion: 2
guid: 0ae90c343ee0e4f7daf768fe6383340f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta


fileFormatVersion: 2
guid: 611706478d8aa410983272ad601895d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample.meta


fileFormatVersion: 2
guid: 4e70bfdbd732446138a5acef1423b347
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample.meta


fileFormatVersion: 2
guid: 5d9b41f3c48f94f93b5aaf521adbe0bf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/Resources.meta


fileFormatVersion: 2
guid: 77196fe8699ab4d4ebcdcd40d51ad725
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/Scenes.meta


fileFormatVersion: 2
guid: 1bcee10b13adf455985ead00596cf877
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery.meta


fileFormatVersion: 2
guid: d5570637d1b25467596ae3c19ff7f0b2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsSample.meta


fileFormatVersion: 2
guid: 3663814d042c44976a72d5fb8a41cdf9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsTheatre.meta


fileFormatVersion: 2
guid: b54f053c2c5d34691b30237abaf17e14
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

204
com.unity.uiwidgets/Runtime/material/text_selection.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
using Transform = Unity.UIWidgets.widgets.Transform;
namespace Unity.UIWidgets.material {
public static class MaterialUtils {
public static readonly TextSelectionControls materialTextSelectionControls =
new _MaterialTextSelectionControls();
internal const float _kHandleSize = 22.0f;
internal const float _kToolbarScreenPadding = 8.0f;
}
class _TextSelectionToolbar : StatelessWidget {
public _TextSelectionToolbar(Key key = null, VoidCallback handleCut = null,
VoidCallback handleCopy = null, VoidCallback handlePaste = null, VoidCallback handleSelectAll = null) : base(key: key) {
this.handleCut = handleCut;
this.handleCopy = handleCopy;
this.handlePaste = handlePaste;
this.handleSelectAll = handleSelectAll;
}
public readonly VoidCallback handleCut;
public readonly VoidCallback handleCopy;
public readonly VoidCallback handlePaste;
public readonly VoidCallback handleSelectAll;
public override Widget build(BuildContext context) {
List<Widget> items = new List<Widget>();
MaterialLocalizations localizations = MaterialLocalizations.of(context);
if (handleCut != null) {
items.Add(new FlatButton(child: new Text(localizations.cutButtonLabel), onPressed: handleCut));
}
if (handleCopy != null) {
items.Add(new FlatButton(child: new Text(localizations.copyButtonLabel), onPressed: handleCopy));
}
if (handlePaste != null) {
items.Add(new FlatButton(child: new Text(localizations.pasteButtonLabel), onPressed: handlePaste));
}
if (handleSelectAll != null) {
items.Add(new FlatButton(child: new Text(localizations.selectAllButtonLabel),
onPressed: handleSelectAll));
}
return new Material(
elevation: 1.0f,
child: new Container(
color: new Color(0xFFEFEFEF),
height: 44.0f, child: new Row(mainAxisSize: MainAxisSize.min, children: items))
);
}
}
class _TextSelectionToolbarLayout : SingleChildLayoutDelegate {
internal _TextSelectionToolbarLayout(Size screenSize = null, Rect globalEditableRegion = null,
Offset position = null) {
this.screenSize = screenSize;
this.globalEditableRegion = globalEditableRegion;
this.position = position;
}
public readonly Size screenSize;
public readonly Rect globalEditableRegion;
public readonly Offset position;
public override BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
return constraints.loosen();
}
public override Offset getPositionForChild(Size size, Size childSize) {
Offset globalPosition = globalEditableRegion.topLeft + position;
float x = globalPosition.dx - childSize.width / 2.0f;
float y = globalPosition.dy - childSize.height;
if (x < MaterialUtils._kToolbarScreenPadding) {
x = MaterialUtils._kToolbarScreenPadding;
}
else if (x + childSize.width > screenSize.width - MaterialUtils._kToolbarScreenPadding) {
x = screenSize.width - childSize.width - MaterialUtils._kToolbarScreenPadding;
}
if (y < MaterialUtils._kToolbarScreenPadding) {
y = MaterialUtils._kToolbarScreenPadding;
}
else if (y + childSize.height > screenSize.height - MaterialUtils._kToolbarScreenPadding) {
y = screenSize.height - childSize.height - MaterialUtils._kToolbarScreenPadding;
}
return new Offset(x, y);
}
public override bool shouldRelayout(SingleChildLayoutDelegate oldDelegate) {
return position != ((_TextSelectionToolbarLayout) oldDelegate).position;
}
}
class _TextSelectionHandlePainter : AbstractCustomPainter {
internal _TextSelectionHandlePainter(Color color) {
this.color = color;
}
public readonly Color color;
public override void paint(Canvas canvas, Size size) {
Paint paint = new Paint();
paint.color = color;
float radius = size.width / 2.0f;
canvas.drawCircle(new Offset(radius, radius), radius, paint);
canvas.drawRect(Rect.fromLTWH(0.0f, 0.0f, radius, radius), paint);
}
public override bool shouldRepaint(CustomPainter oldPainter) {
return color != ((_TextSelectionHandlePainter) oldPainter).color;
}
}
class _MaterialTextSelectionControls : TextSelectionControls {
public override Size handleSize {
get {
return new Size(MaterialUtils._kHandleSize,
MaterialUtils._kHandleSize);
}
}
public override Widget buildToolbar(BuildContext context, Rect globalEditableRegion, Offset position,
TextSelectionDelegate selectionDelegate) {
return new ConstrainedBox(
constraints: BoxConstraints.tight(globalEditableRegion.size),
child: new CustomSingleChildLayout(
layoutDelegate: new _TextSelectionToolbarLayout(
MediaQuery.of(context).size,
globalEditableRegion,
position
),
child: new _TextSelectionToolbar(
handleCut: canCut(selectionDelegate)
? () => handleCut(selectionDelegate)
: (VoidCallback) null,
handleCopy: canCopy(selectionDelegate)
? () => handleCopy(selectionDelegate)
: (VoidCallback) null,
handlePaste: canPaste(selectionDelegate)
? () => handlePaste(selectionDelegate)
: (VoidCallback) null,
handleSelectAll: canSelectAll(selectionDelegate)
? () => handleSelectAll(selectionDelegate)
: (VoidCallback) null
)
)
);
}
public override Widget buildHandle(BuildContext context, TextSelectionHandleType type, float textLineHeight) {
Widget handle = new Padding(
padding: EdgeInsets.only(right: 26.0f, bottom: 26.0f),
child: new SizedBox(
width: MaterialUtils._kHandleSize,
height: MaterialUtils._kHandleSize,
child: new CustomPaint(
painter: new _TextSelectionHandlePainter(
color: Theme.of(context).textSelectionHandleColor
)
)
)
);
switch (type) {
case TextSelectionHandleType.left: // points up-right
return new Transform(
transform: new Matrix4().rotationZ(Mathf.PI / 2),
child: handle
);
case TextSelectionHandleType.right: // points up-left
return handle;
case TextSelectionHandleType.collapsed: // points up
return new Transform(
transform: new Matrix4().rotationZ(Mathf.PI / 4),
child: handle
);
}
return null;
}
}
}

11
com.unity.uiwidgets/Runtime/material/text_selection.cs.meta


fileFormatVersion: 2
guid: 33685d6edaab14322aa1b854fdd7c3e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/button.cs.meta


fileFormatVersion: 2
guid: 5452e0dd1a19646fda9cc8dc0b388ee4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/button_theme.cs.meta


fileFormatVersion: 2
guid: c00e9535ad31f481cbe2b83d490d714d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

352
com.unity.uiwidgets/Runtime/material/color_scheme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.material {
public class ColorScheme : Diagnosticable, IEquatable<ColorScheme> {
public ColorScheme(
Color primary,
Color primaryVariant,
Color secondary,
Color secondaryVariant,
Color surface,
Color background,
Color error,
Color onPrimary,
Color onSecondary,
Color onSurface,
Color onBackground,
Color onError,
Brightness brightness) {
D.assert(primary != null);
D.assert(primaryVariant != null);
D.assert(secondary != null);
D.assert(secondaryVariant != null);
D.assert(surface != null);
D.assert(background != null);
D.assert(error != null);
D.assert(onPrimary != null);
D.assert(onSecondary != null);
D.assert(onSurface != null);
D.assert(onBackground != null);
D.assert(onError != null);
this.primary = primary;
this.primaryVariant = primaryVariant;
this.secondary = secondary;
this.secondaryVariant = secondaryVariant;
this.surface = surface;
this.background = background;
this.error = error;
this.onPrimary = onPrimary;
this.onSecondary = onSecondary;
this.onSurface = onSurface;
this.onBackground = onBackground;
this.onError = onError;
this.brightness = brightness;
}
public static ColorScheme light(
Color primary = null,
Color primaryVariant = null,
Color secondary = null,
Color secondaryVariant = null,
Color surface = null,
Color background = null,
Color error = null,
Color onPrimary = null,
Color onSecondary = null,
Color onSurface = null,
Color onBackground = null,
Color onError = null,
Brightness brightness = Brightness.light
) {
primary = primary ?? new Color(0xFF6200EE);
primaryVariant = primaryVariant ?? new Color(0xFF3700B3);
secondary = secondary ?? new Color(0xFF03DAC6);
secondaryVariant = secondaryVariant ?? new Color(0xFF018786);
surface = surface ?? Colors.white;
background = background ?? Colors.white;
error = error ?? new Color(0xFFB00020);
onPrimary = onPrimary ?? Colors.white;
onSecondary = onSecondary ?? Colors.black;
onSurface = onSurface ?? Colors.black;
onBackground = onBackground ?? Colors.black;
onError = onError ?? Colors.white;
return new ColorScheme(
primary: primary,
primaryVariant: primaryVariant,
secondary: secondary,
secondaryVariant: secondaryVariant,
surface: surface,
background: background,
error: error,
onPrimary: onPrimary,
onSecondary: onSecondary,
onSurface: onSurface,
onBackground: onBackground,
onError: onError,
brightness: brightness
);
}
public static ColorScheme dark(
Color primary = null,
Color primaryVariant = null,
Color secondary = null,
Color secondaryVariant = null,
Color surface = null,
Color background = null,
Color error = null,
Color onPrimary = null,
Color onSecondary = null,
Color onSurface = null,
Color onBackground = null,
Color onError = null,
Brightness brightness = Brightness.dark
) {
primary = primary ?? new Color(0xFFBB86FC);
primaryVariant = primaryVariant ?? new Color(0xFF4B01D0);
secondary = secondary ?? new Color(0xFF03DAC6);
secondaryVariant = secondaryVariant ?? new Color(0xFF03DAC6);
surface = surface ?? Colors.black;
background = background ?? Colors.black;
error = error ?? new Color(0xFFB00020);
onPrimary = onPrimary ?? Colors.black;
onSecondary = onSecondary ?? Colors.black;
onSurface = onSurface ?? Colors.white;
onBackground = onBackground ?? Colors.white;
onError = onError ?? Colors.black;
return new ColorScheme(
primary: primary,
primaryVariant: primaryVariant,
secondary: secondary,
secondaryVariant: secondaryVariant,
surface: surface,
background: background,
error: error,
onPrimary: onPrimary,
onSecondary: onSecondary,
onSurface: onSurface,
onBackground: onBackground,
onError: onError,
brightness: brightness
);
}
public static ColorScheme fromSwatch(
MaterialColor primarySwatch = null,
Color primaryColorDark = null,
Color accentColor = null,
Color cardColor = null,
Color backgroundColor = null,
Color errorColor = null,
Brightness? brightness = Brightness.light) {
D.assert(brightness != null);
primarySwatch = primarySwatch ?? Colors.blue;
bool isDark = brightness == Brightness.dark;
bool primaryIsDark = _brightnessFor(primarySwatch) == Brightness.dark;
Color secondary = accentColor ?? (isDark ? Colors.tealAccent[200] : primarySwatch);
bool secondaryIsDark = _brightnessFor(secondary) == Brightness.dark;
return new ColorScheme(
primary: primarySwatch,
primaryVariant: primaryColorDark ?? (isDark ? Colors.black : primarySwatch[700]),
secondary: secondary,
secondaryVariant: isDark ? Colors.tealAccent[700] : primarySwatch[700],
surface: cardColor ?? (isDark ? Colors.grey[800] : Colors.white),
background: backgroundColor ?? (isDark ? Colors.grey[700] : primarySwatch[200]),
error: errorColor ?? Colors.red[700],
onPrimary: primaryIsDark ? Colors.white : Colors.black,
onSecondary: secondaryIsDark ? Colors.white : Colors.black,
onSurface: isDark ? Colors.white : Colors.black,
onBackground: primaryIsDark ? Colors.white : Colors.black,
onError: isDark ? Colors.black : Colors.white,
brightness: brightness ?? Brightness.light
);
}
static Brightness _brightnessFor(Color color) {
return ThemeData.estimateBrightnessForColor(color);
}
public readonly Color primary;
public readonly Color primaryVariant;
public readonly Color secondary;
public readonly Color secondaryVariant;
public readonly Color surface;
public readonly Color background;
public readonly Color error;
public readonly Color onPrimary;
public readonly Color onSecondary;
public readonly Color onSurface;
public readonly Color onBackground;
public readonly Color onError;
public readonly Brightness brightness;
public ColorScheme copyWith(
Color primary = null,
Color primaryVariant = null,
Color secondary = null,
Color secondaryVariant = null,
Color surface = null,
Color background = null,
Color error = null,
Color onPrimary = null,
Color onSecondary = null,
Color onSurface = null,
Color onBackground = null,
Color onError = null,
Brightness? brightness = null) {
return new ColorScheme(
primary: primary ?? this.primary,
primaryVariant: primaryVariant ?? this.primaryVariant,
secondary: secondary ?? this.secondary,
secondaryVariant: secondaryVariant ?? this.secondaryVariant,
surface: surface ?? this.surface,
background: background ?? this.background,
error: error ?? this.error,
onPrimary: onPrimary ?? this.onPrimary,
onSecondary: onSecondary ?? this.onSecondary,
onSurface: onSurface ?? this.onSurface,
onBackground: onBackground ?? this.onBackground,
onError: onError ?? this.onError,
brightness: brightness ?? this.brightness
);
}
public static ColorScheme lerp(ColorScheme a, ColorScheme b, float t) {
return new ColorScheme(
primary: Color.lerp(a.primary, b.primary, t),
primaryVariant: Color.lerp(a.primaryVariant, b.primaryVariant, t),
secondary: Color.lerp(a.secondary, b.secondary, t),
secondaryVariant: Color.lerp(a.secondaryVariant, b.secondaryVariant, t),
surface: Color.lerp(a.surface, b.surface, t),
background: Color.lerp(a.background, b.background, t),
error: Color.lerp(a.error, b.error, t),
onPrimary: Color.lerp(a.onPrimary, b.onPrimary, t),
onSecondary: Color.lerp(a.onSecondary, b.onSecondary, t),
onSurface: Color.lerp(a.onSurface, b.onSurface, t),
onBackground: Color.lerp(a.onBackground, b.onBackground, t),
onError: Color.lerp(a.onError, b.onError, t),
brightness: t < 0.5 ? a.brightness : b.brightness
);
}
public bool Equals(ColorScheme other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return other.primary == primary
&& other.primaryVariant == primaryVariant
&& other.secondary == secondary
&& other.secondaryVariant == secondaryVariant
&& other.surface == surface
&& other.background == background
&& other.error == error
&& other.onPrimary == onPrimary
&& other.onSecondary == onSecondary
&& other.onSurface == onSurface
&& other.onBackground == onBackground
&& other.onError == onError
&& other.brightness == brightness;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((ColorScheme) obj);
}
public static bool operator ==(ColorScheme left, ColorScheme right) {
return Equals(left, right);
}
public static bool operator !=(ColorScheme left, ColorScheme right) {
return !Equals(left, right);
}
public override int GetHashCode() {
unchecked {
var hashCode = primary.GetHashCode();
hashCode = (hashCode * 397) ^ primaryVariant.GetHashCode();
hashCode = (hashCode * 397) ^ secondary.GetHashCode();
hashCode = (hashCode * 397) ^ secondaryVariant.GetHashCode();
hashCode = (hashCode * 397) ^ surface.GetHashCode();
hashCode = (hashCode * 397) ^ background.GetHashCode();
hashCode = (hashCode * 397) ^ error.GetHashCode();
hashCode = (hashCode * 397) ^ onPrimary.GetHashCode();
hashCode = (hashCode * 397) ^ onSecondary.GetHashCode();
hashCode = (hashCode * 397) ^ onSurface.GetHashCode();
hashCode = (hashCode * 397) ^ onBackground.GetHashCode();
hashCode = (hashCode * 397) ^ onError.GetHashCode();
hashCode = (hashCode * 397) ^ brightness.GetHashCode();
return hashCode;
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
ColorScheme defaultScheme = light();
properties.add(new DiagnosticsProperty<Color>("primary", primary,
defaultValue: defaultScheme.primary));
properties.add(new DiagnosticsProperty<Color>("primaryVariant", primaryVariant,
defaultValue: defaultScheme.primaryVariant));
properties.add(new DiagnosticsProperty<Color>("secondary", secondary,
defaultValue: defaultScheme.secondary));
properties.add(new DiagnosticsProperty<Color>("secondaryVariant", secondaryVariant,
defaultValue: defaultScheme.secondaryVariant));
properties.add(new DiagnosticsProperty<Color>("surface", surface,
defaultValue: defaultScheme.surface));
properties.add(new DiagnosticsProperty<Color>("background", background,
defaultValue: defaultScheme.background));
properties.add(new DiagnosticsProperty<Color>("error", error, defaultValue: defaultScheme.error));
properties.add(new DiagnosticsProperty<Color>("onPrimary", onPrimary,
defaultValue: defaultScheme.onPrimary));
properties.add(new DiagnosticsProperty<Color>("onSecondary", onSecondary,
defaultValue: defaultScheme.onSecondary));
properties.add(new DiagnosticsProperty<Color>("onSurface", onSurface,
defaultValue: defaultScheme.onSurface));
properties.add(new DiagnosticsProperty<Color>("onBackground", onBackground,
defaultValue: defaultScheme.onBackground));
properties.add(new DiagnosticsProperty<Color>("onError", onError,
defaultValue: defaultScheme.onError));
properties.add(new DiagnosticsProperty<Brightness>("brightness", brightness,
defaultValue: defaultScheme.brightness));
}
}
}

11
com.unity.uiwidgets/Runtime/material/color_scheme.cs.meta


fileFormatVersion: 2
guid: a610420b7a8ec44bfa84e81a1e5ff449
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/colors.cs.meta


fileFormatVersion: 2
guid: dfc0e036c07e1441d8dbd3158bb6f923
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

26
com.unity.uiwidgets/Runtime/material/constants.cs


using System;
using Unity.UIWidgets.painting;
namespace Unity.UIWidgets.material {
public static class Constants {
public const float kToolbarHeight = 56.0f;
public const float kBottomNavigationBarHeight = 56.0f;
public const float kTextTabBarHeight = 48.0f;
public static readonly TimeSpan kThemeChangeDuration = new TimeSpan(0, 0, 0, 0, 200);
public const float kRadialReactionRadius = 20.0f;
public static readonly TimeSpan kRadialReactionDuration = new TimeSpan(0, 0, 0, 0, 100);
public const int kRadialReactionAlpha = 0x1F;
public static readonly TimeSpan kTabScrollDuration = new TimeSpan(0, 0, 0, 0, 300);
public static readonly EdgeInsets kTabLabelPadding = EdgeInsets.symmetric(horizontal: 16.0f);
public static readonly EdgeInsets kMaterialListPadding = EdgeInsets.symmetric(vertical: 8.0f);
}
}

11
com.unity.uiwidgets/Runtime/material/constants.cs.meta


fileFormatVersion: 2
guid: 0364fdae877454fb1babca8f67c2561e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/debug.cs.meta


fileFormatVersion: 2
guid: 353f6a1d0791640349fe94187f15ad33
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/ink_decoration.cs.meta


fileFormatVersion: 2
guid: 2aa14ff76c10f4d459b55674f0a2b57f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/ink_highlight.cs.meta


fileFormatVersion: 2
guid: 96f34a8540bb74c7687149b4b2514998
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/ink_splash.cs.meta


fileFormatVersion: 2
guid: 068260026dcf947b0af4c9d7f706ab97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/ink_well.cs.meta


fileFormatVersion: 2
guid: 9a7302f1a187741b88618822daf7a657
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/material.cs.meta


fileFormatVersion: 2
guid: 7c1f7bd49df00452d9a3be75a9e7b213
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/material_button.cs.meta


fileFormatVersion: 2
guid: ea3964e7af24d4b059ac6e10ec862a3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

371
com.unity.uiwidgets/Runtime/material/text_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class TextTheme : Diagnosticable, IEquatable<TextTheme> {
public TextTheme(
TextStyle display4 = null,
TextStyle display3 = null,
TextStyle display2 = null,
TextStyle display1 = null,
TextStyle headline = null,
TextStyle title = null,
TextStyle subhead = null,
TextStyle body2 = null,
TextStyle body1 = null,
TextStyle caption = null,
TextStyle button = null,
TextStyle subtitle = null,
TextStyle overline = null
) {
this.display4 = display4;
this.display3 = display3;
this.display2 = display2;
this.display1 = display1;
this.headline = headline;
this.title = title;
this.subhead = subhead;
this.body2 = body2;
this.body1 = body1;
this.caption = caption;
this.button = button;
this.subtitle = subtitle;
this.overline = overline;
}
public readonly TextStyle display4;
public readonly TextStyle display3;
public readonly TextStyle display2;
public readonly TextStyle display1;
public readonly TextStyle headline;
public readonly TextStyle title;
public readonly TextStyle subhead;
public readonly TextStyle body2;
public readonly TextStyle body1;
public readonly TextStyle caption;
public readonly TextStyle button;
public readonly TextStyle subtitle;
public readonly TextStyle overline;
public TextTheme copyWith(
TextStyle display4 = null,
TextStyle display3 = null,
TextStyle display2 = null,
TextStyle display1 = null,
TextStyle headline = null,
TextStyle title = null,
TextStyle subhead = null,
TextStyle body2 = null,
TextStyle body1 = null,
TextStyle caption = null,
TextStyle button = null,
TextStyle subtitle = null,
TextStyle overline = null
) {
return new TextTheme(
display4: display4 ?? this.display4,
display3: display3 ?? this.display3,
display2: display2 ?? this.display2,
display1: display1 ?? this.display1,
headline: headline ?? this.headline,
title: title ?? this.title,
subhead: subhead ?? this.subhead,
body2: body2 ?? this.body2,
body1: body1 ?? this.body1,
caption: caption ?? this.caption,
button: button ?? this.button,
subtitle: subtitle ?? this.subtitle,
overline: overline ?? this.overline
);
}
public TextTheme merge(TextTheme other) {
if (other == null) {
return this;
}
return copyWith(
display4: display4?.merge(other.display4) ?? other.display4,
display3: display3?.merge(other.display3) ?? other.display3,
display2: display2?.merge(other.display2) ?? other.display2,
display1: display1?.merge(other.display1) ?? other.display1,
headline: headline?.merge(other.headline) ?? other.headline,
title: title?.merge(other.title) ?? other.title,
subhead: subhead?.merge(other.subhead) ?? other.subhead,
body2: body2?.merge(other.body2) ?? other.body2,
body1: body1?.merge(other.body1) ?? other.body1,
caption: caption?.merge(other.caption) ?? other.caption,
button: button?.merge(other.button) ?? other.button,
subtitle: subtitle?.merge(other.subtitle) ?? other.subtitle,
overline: overline?.merge(other.overline) ?? other.overline
);
}
public TextTheme apply(
string fontFamily = null,
float fontSizeFactor = 1.0f,
float fontSizeDelta = 0.0f,
Color displayColor = null,
Color bodyColor = null,
TextDecoration decoration = null,
Color decorationColor = null,
TextDecorationStyle? decorationStyle = null
) {
return new TextTheme(
display4: display4?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
display3: display3?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
display2: display2?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
display1: display1?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
headline: headline?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
title: title?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
subhead: subhead?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
body2: body2?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
body1: body1?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
caption: caption?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
button: button?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
subtitle: subtitle?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
overline: overline?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
)
);
}
public static TextTheme lerp(TextTheme a, TextTheme b, float t) {
return new TextTheme(
display4: TextStyle.lerp(a?.display4, b?.display4, t),
display3: TextStyle.lerp(a?.display3, b?.display3, t),
display2: TextStyle.lerp(a?.display2, b?.display2, t),
display1: TextStyle.lerp(a?.display1, b?.display1, t),
headline: TextStyle.lerp(a?.headline, b?.headline, t),
title: TextStyle.lerp(a?.title, b?.title, t),
subhead: TextStyle.lerp(a?.subhead, b?.subhead, t),
body2: TextStyle.lerp(a?.body2, b?.body2, t),
body1: TextStyle.lerp(a?.body1, b?.body1, t),
caption: TextStyle.lerp(a?.caption, b?.caption, t),
button: TextStyle.lerp(a?.button, b?.button, t),
subtitle: TextStyle.lerp(a?.subtitle, b?.subtitle, t),
overline: TextStyle.lerp(a?.overline, b?.overline, t)
);
}
public bool Equals(TextTheme other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return display4 == other.display4
&& display3 == other.display3
&& display2 == other.display2
&& display1 == other.display1
&& headline == other.headline
&& title == other.title
&& subhead == other.subhead
&& body2 == other.body2
&& body1 == other.body1
&& caption == other.caption
&& button == other.button
&& subtitle == other.subtitle
&& overline == other.overline;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((TextTheme) obj);
}
public static bool operator ==(TextTheme left, TextTheme right) {
return Equals(left, right);
}
public static bool operator !=(TextTheme left, TextTheme right) {
return !Equals(left, right);
}
int? _cachedHashCode = null;
public override int GetHashCode() {
if (_cachedHashCode != null) {
return _cachedHashCode.Value;
}
unchecked {
var hashCode = display4?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ display3?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ display2?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ display1?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ headline?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ title?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ subhead?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ body2?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ body1?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ caption?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ button?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ subtitle?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ overline?.GetHashCode() ?? 0;
_cachedHashCode = hashCode;
return hashCode;
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
TextTheme defaultTheme = new Typography().black;
properties.add(new DiagnosticsProperty<TextStyle>("display4", display4,
defaultValue: defaultTheme.display4));
properties.add(new DiagnosticsProperty<TextStyle>("display3", display3,
defaultValue: defaultTheme.display3));
properties.add(new DiagnosticsProperty<TextStyle>("display2", display2,
defaultValue: defaultTheme.display2));
properties.add(new DiagnosticsProperty<TextStyle>("display1", display1,
defaultValue: defaultTheme.display1));
properties.add(new DiagnosticsProperty<TextStyle>("headline", headline,
defaultValue: defaultTheme.headline));
properties.add(new DiagnosticsProperty<TextStyle>("title", title, defaultValue: defaultTheme.title));
properties.add(
new DiagnosticsProperty<TextStyle>("subhead", subhead, defaultValue: defaultTheme.subhead));
properties.add(new DiagnosticsProperty<TextStyle>("body2", body2, defaultValue: defaultTheme.body2));
properties.add(new DiagnosticsProperty<TextStyle>("body1", body1, defaultValue: defaultTheme.body1));
properties.add(
new DiagnosticsProperty<TextStyle>("caption", caption, defaultValue: defaultTheme.caption));
properties.add(
new DiagnosticsProperty<TextStyle>("button", button, defaultValue: defaultTheme.button));
properties.add(new DiagnosticsProperty<TextStyle>("subtitle)", subtitle,
defaultValue: defaultTheme.subtitle));
properties.add(new DiagnosticsProperty<TextStyle>("overline", overline,
defaultValue: defaultTheme.overline));
}
}
}

11
com.unity.uiwidgets/Runtime/material/text_theme.cs.meta


fileFormatVersion: 2
guid: 48eff72daf6ec48e5805ff0698990499
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

147
com.unity.uiwidgets/Runtime/material/theme.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public static class ThemeUtils {
public static readonly TimeSpan kThemeAnimationDuration = new TimeSpan(0, 0, 0, 0, 200);
}
public class Theme : StatelessWidget {
public Theme(
Key key = null,
ThemeData data = null,
bool isMaterialAppTheme = false,
Widget child = null
) : base(key: key) {
D.assert(child != null);
D.assert(data != null);
this.data = data;
this.isMaterialAppTheme = isMaterialAppTheme;
this.child = child;
}
public readonly ThemeData data;
public readonly bool isMaterialAppTheme;
readonly Widget child;
static readonly ThemeData _kFallbackTheme = ThemeData.fallback();
public static ThemeData of(BuildContext context, bool shadowThemeOnly = false) {
_InheritedTheme inheritedTheme =
(_InheritedTheme) context.inheritFromWidgetOfExactType(typeof(_InheritedTheme));
if (shadowThemeOnly) {
if (inheritedTheme == null || inheritedTheme.theme.isMaterialAppTheme) {
return null;
}
return inheritedTheme.theme.data;
}
MaterialLocalizations localizations = MaterialLocalizations.of(context);
ScriptCategory category = ScriptCategory.englishLike;
ThemeData theme = inheritedTheme?.theme?.data ?? _kFallbackTheme;
return ThemeData.localize(theme, theme.typography.geometryThemeFor(category));
}
public override Widget build(BuildContext context) {
return new _InheritedTheme(
theme: this,
child: new IconTheme(
data: data.iconTheme,
child: child
)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ThemeData>("data", data, showName: false));
}
}
class _InheritedTheme : InheritedWidget {
public _InheritedTheme(
Key key = null,
Theme theme = null,
Widget child = null) : base(key: key, child: child) {
D.assert(theme != null);
D.assert(child != null);
this.theme = theme;
}
public readonly Theme theme;
public override bool updateShouldNotify(InheritedWidget old) {
return theme.data != ((_InheritedTheme) old).theme.data;
}
}
class ThemeDataTween : Tween<ThemeData> {
public ThemeDataTween(
ThemeData begin = null,
ThemeData end = null
) : base(begin: begin, end: end) {
}
public override ThemeData lerp(float t) {
return ThemeData.lerp(begin, end, t);
}
}
class AnimatedTheme : ImplicitlyAnimatedWidget {
public AnimatedTheme(
Key key = null,
ThemeData data = null,
bool isMaterialAppTheme = false,
Curve curve = null,
TimeSpan? duration = null,
Widget child = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration ?? ThemeUtils.kThemeAnimationDuration) {
D.assert(child != null);
D.assert(data != null);
this.data = data;
this.isMaterialAppTheme = isMaterialAppTheme;
this.child = child;
}
public readonly ThemeData data;
public readonly bool isMaterialAppTheme;
public readonly Widget child;
public override State createState() {
return new _AnimatedThemeState();
}
}
class _AnimatedThemeState : AnimatedWidgetBaseState<AnimatedTheme> {
ThemeDataTween _data;
protected override void forEachTween(TweenVisitor visitor) {
_data = (ThemeDataTween) visitor.visit(this, _data, widget.data,
(ThemeData value) => new ThemeDataTween(begin: value));
}
public override Widget build(BuildContext context) {
return new Theme(
isMaterialAppTheme: widget.isMaterialAppTheme,
child: widget.child,
data: _data.evaluate(animation)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(
new DiagnosticsProperty<ThemeDataTween>("data", _data, showName: false, defaultValue: null));
}
}
}

11
com.unity.uiwidgets/Runtime/material/theme.cs.meta


fileFormatVersion: 2
guid: 8aeba6b651be2405387572671ac527f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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

正在加载...
取消
保存