浏览代码

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

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
b76f1f4b
共有 126 个文件被更改,包括 4944 次插入3892 次删除
  1. 10
      com.unity.uiwidgets/Runtime/animation/tween.cs
  2. 858
      com.unity.uiwidgets/Runtime/cupertino/context_menu.cs
  3. 995
      com.unity.uiwidgets/Runtime/cupertino/date_picker.cs
  4. 275
      com.unity.uiwidgets/Runtime/cupertino/dialog.cs
  5. 5
      com.unity.uiwidgets/Runtime/cupertino/icon_theme_data.cs
  6. 5
      com.unity.uiwidgets/Runtime/cupertino/icons.cs
  7. 17
      com.unity.uiwidgets/Runtime/cupertino/interface_level.cs
  8. 6
      com.unity.uiwidgets/Runtime/cupertino/localization.cs
  9. 201
      com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs
  10. 317
      com.unity.uiwidgets/Runtime/cupertino/picker.cs
  11. 2
      com.unity.uiwidgets/Runtime/cupertino/text_field.cs
  12. 4
      com.unity.uiwidgets/Runtime/cupertino/text_selection.cs
  13. 25
      com.unity.uiwidgets/Runtime/cupertino/text_theme.cs
  14. 4
      com.unity.uiwidgets/Runtime/gestures/force_press.cs
  15. 5
      com.unity.uiwidgets/Runtime/material/dropdown.cs
  16. 7
      com.unity.uiwidgets/Runtime/material/text_field.cs
  17. 7
      com.unity.uiwidgets/Runtime/material/text_selection.cs
  18. 2
      com.unity.uiwidgets/Runtime/material/user_accounts_drawer_header.cs
  19. 2
      com.unity.uiwidgets/Runtime/painting/alignment.cs
  20. 34
      com.unity.uiwidgets/Runtime/painting/basic_types.cs
  21. 10
      com.unity.uiwidgets/Runtime/painting/edge_insets.cs
  22. 2
      com.unity.uiwidgets/Runtime/painting/image_cache.cs
  23. 2
      com.unity.uiwidgets/Runtime/painting/image_provider.cs
  24. 39
      com.unity.uiwidgets/Runtime/painting/text_painter.cs
  25. 4
      com.unity.uiwidgets/Runtime/painting/text_style.cs
  26. 10
      com.unity.uiwidgets/Runtime/rendering/animated_size.cs
  27. 33
      com.unity.uiwidgets/Runtime/rendering/binding.cs
  28. 10
      com.unity.uiwidgets/Runtime/rendering/box.cs
  29. 4
      com.unity.uiwidgets/Runtime/rendering/custom_layout.cs
  30. 3
      com.unity.uiwidgets/Runtime/rendering/custom_paint.cs
  31. 5
      com.unity.uiwidgets/Runtime/rendering/debug.cs
  32. 32
      com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs
  33. 679
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  34. 94
      com.unity.uiwidgets/Runtime/rendering/flex.cs
  35. 65
      com.unity.uiwidgets/Runtime/rendering/image.cs
  36. 132
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  37. 46
      com.unity.uiwidgets/Runtime/rendering/list_body.cs
  38. 87
      com.unity.uiwidgets/Runtime/rendering/list_wheel_viewport.cs
  39. 262
      com.unity.uiwidgets/Runtime/rendering/object.cs
  40. 414
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  41. 89
      com.unity.uiwidgets/Runtime/rendering/performance_overlay.cs
  42. 80
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  43. 50
      com.unity.uiwidgets/Runtime/rendering/proxy_sliver.cs
  44. 227
      com.unity.uiwidgets/Runtime/rendering/shifted_box.cs
  45. 8
      com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs
  46. 176
      com.unity.uiwidgets/Runtime/rendering/stack.cs
  47. 12
      com.unity.uiwidgets/Runtime/rendering/tweens.cs
  48. 8
      com.unity.uiwidgets/Runtime/rendering/view.cs
  49. 2
      com.unity.uiwidgets/Runtime/scheduler2/ticker.cs
  50. 4
      com.unity.uiwidgets/Runtime/services/text_editing.cs
  51. 18
      com.unity.uiwidgets/Runtime/ui2/compositing.cs
  52. 13
      com.unity.uiwidgets/Runtime/widgets/actions.cs
  53. 9
      com.unity.uiwidgets/Runtime/widgets/animated_cross_fade.cs
  54. 9
      com.unity.uiwidgets/Runtime/widgets/animated_size.cs
  55. 24
      com.unity.uiwidgets/Runtime/widgets/animated_switcher.cs
  56. 6
      com.unity.uiwidgets/Runtime/widgets/annotated_region.cs
  57. 178
      com.unity.uiwidgets/Runtime/widgets/app.cs
  58. 5
      com.unity.uiwidgets/Runtime/widgets/automatic_keep_alive.cs
  59. 112
      com.unity.uiwidgets/Runtime/widgets/banner.cs
  60. 926
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  61. 2
      com.unity.uiwidgets/Runtime/widgets/binding.cs
  62. 59
      com.unity.uiwidgets/Runtime/widgets/color_filter.cs
  63. 32
      com.unity.uiwidgets/Runtime/widgets/container.cs
  64. 43
      com.unity.uiwidgets/Runtime/widgets/debug.cs
  65. 7
      com.unity.uiwidgets/Runtime/widgets/dismissible.cs
  66. 33
      com.unity.uiwidgets/Runtime/widgets/disposable_build_context.cs
  67. 32
      com.unity.uiwidgets/Runtime/widgets/drag_target.cs
  68. 490
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs
  69. 181
      com.unity.uiwidgets/Runtime/widgets/fade_in_image.cs
  70. 50
      com.unity.uiwidgets/Runtime/widgets/focus_manager.cs
  71. 24
      com.unity.uiwidgets/Runtime/widgets/focus_scope.cs
  72. 29
      com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs
  73. 10
      com.unity.uiwidgets/Runtime/widgets/form.cs
  74. 258
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  75. 33
      com.unity.uiwidgets/Runtime/widgets/gesture_detector.cs
  76. 30
      com.unity.uiwidgets/Runtime/widgets/heroes.cs
  77. 30
      com.unity.uiwidgets/Runtime/widgets/icon.cs
  78. 39
      com.unity.uiwidgets/Runtime/widgets/icon_data.cs
  79. 25
      com.unity.uiwidgets/Runtime/widgets/icon_theme.cs
  80. 4
      com.unity.uiwidgets/Runtime/widgets/icon_theme_data.cs
  81. 124
      com.unity.uiwidgets/Runtime/widgets/image.cs
  82. 17
      com.unity.uiwidgets/Runtime/widgets/image_filter.cs
  83. 114
      com.unity.uiwidgets/Runtime/widgets/implicit_animations.cs
  84. 2
      com.unity.uiwidgets/Runtime/widgets/inherited_theme.cs
  85. 148
      com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs
  86. 42
      com.unity.uiwidgets/Runtime/widgets/localizations.cs
  87. 22
      com.unity.uiwidgets/Runtime/widgets/media_query.cs
  88. 22
      com.unity.uiwidgets/Runtime/widgets/modal_barrier.cs
  89. 17
      com.unity.uiwidgets/Runtime/widgets/navigation_toolbar.cs
  90. 4
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  91. 28
      com.unity.uiwidgets/Runtime/widgets/nested_scroll_view.cs
  92. 24
      com.unity.uiwidgets/Runtime/widgets/overlay.cs
  93. 2
      com.unity.uiwidgets/Runtime/widgets/page_storage.cs
  94. 131
      com.unity.uiwidgets/Runtime/widgets/page_view.cs
  95. 11
      com.unity.uiwidgets/Runtime/widgets/pages.cs
  96. 34
      com.unity.uiwidgets/Runtime/widgets/performance_overlay.cs
  97. 2
      com.unity.uiwidgets/Runtime/widgets/placeholder.cs
  98. 6
      com.unity.uiwidgets/Runtime/widgets/preferred_size.cs
  99. 2
      com.unity.uiwidgets/Runtime/widgets/primary_scroll_controller.cs
  100. 3
      com.unity.uiwidgets/Runtime/widgets/routes.cs

10
com.unity.uiwidgets/Runtime/animation/tween.cs


}
}
public abstract class Tween<T> : Animatable<T>, IEquatable<Tween<T>> {
public class Tween<T> : Animatable<T>, IEquatable<Tween<T>> {
public Tween(T begin, T end) {
this.begin = begin;
this.end = end;

public virtual T end { get; set; }
public abstract T lerp(float t);
public virtual T lerp(float t) {
D.assert(begin != null);
D.assert(end != null);
return default; //begin + (end - begin) * t as T;
}
public override T transform(float t) {
if (t == 0.0)
return begin;

858
com.unity.uiwidgets/Runtime/cupertino/context_menu.cs


)
);
}
public override Widget build(BuildContext context) {
List<Widget> widgets = new List<Widget>();
widgets.Add(new AnimatedBuilder(
builder: _buildAnimation,
animation: widget.controller
));
return new Stack(
children: widgets
);
public override Widget build(BuildContext context) {
List<Widget> widgets = new List<Widget>();
widgets.Add(new AnimatedBuilder(
builder: _buildAnimation,
animation: widget.controller)
);
return new Stack(
children: widgets
);
public class _ContextMenuRoute : PopupRoute {
public _ContextMenuRoute(
List<Widget> actions = null,
_ContextMenuLocation contextMenuLocation = default,
string barrierLabel = null,
_ContextMenuPreviewBuilderChildless builder = null,
ImageFilter filter = null,
Rect previousChildRect = null,
RouteSettings settings = null
) : base(
filter: filter,
settings: settings
){
D.assert(actions != null && actions.isNotEmpty());
D.assert(contextMenuLocation != null);
this.barrierLabel = barrierLabel;
_actions = actions;
_builder = builder;
_contextMenuLocation = contextMenuLocation;
_previousChildRect = previousChildRect;
}
public readonly static Color _kModalBarrierColor = new Color(0x6604040F);
public readonly TimeSpan _kModalPopupTransitionDuration =new TimeSpan(0, 0, 0, 0, 335);
public readonly List<Widget> _actions;
public readonly _ContextMenuPreviewBuilderChildless _builder;
public readonly GlobalKey _childGlobalKey = new LabeledGlobalKey<State<StatefulWidget>>();
public readonly _ContextMenuLocation _contextMenuLocation;
public bool _externalOffstage = false;
public bool _internalOffstage = false;
public Orientation _lastOrientation;
public readonly Rect _previousChildRect;
public float _scale = 1.0f;
public readonly GlobalKey _sheetGlobalKey = new LabeledGlobalKey<State<StatefulWidget>>();//GlobalKey();
public readonly static CurveTween _curve = new CurveTween(
curve: Curves.easeOutBack
);
public readonly static CurveTween _curveReverse = new CurveTween(
curve: Curves.easeInBack
);
public readonly static RectTween _rectTween = new RectTween();
public readonly static Animatable<Rect> _rectAnimatable = _rectTween.chain(_curve);
public readonly static RectTween _rectTweenReverse = new RectTween();
public readonly static Animatable<Rect> _rectAnimatableReverse = _rectTweenReverse.chain(_curveReverse);
public class _ContextMenuRoute : PopupRoute {
public _ContextMenuRoute(
List<Widget> actions = null,
_ContextMenuLocation contextMenuLocation = default,
string barrierLabel = null,
_ContextMenuPreviewBuilderChildless builder = null,
ImageFilter filter = null,
Rect previousChildRect = null,
RouteSettings settings = null
) : base(filter: filter, settings: settings){
D.assert(actions != null && actions.isNotEmpty());
D.assert(contextMenuLocation != null);
this.barrierLabel = barrierLabel;
_actions = actions;
_builder = builder;
_contextMenuLocation = contextMenuLocation;
_previousChildRect = previousChildRect;
}
public readonly static Color _kModalBarrierColor = new Color(0x6604040F);
public readonly TimeSpan _kModalPopupTransitionDuration =new TimeSpan(0, 0, 0, 0, 335);
public readonly List<Widget> _actions;
public readonly _ContextMenuPreviewBuilderChildless _builder;
public readonly GlobalKey _childGlobalKey = new LabeledGlobalKey<State<StatefulWidget>>();
public readonly _ContextMenuLocation _contextMenuLocation;
public bool _externalOffstage = false;
public bool _internalOffstage = false;
public Orientation _lastOrientation;
public readonly Rect _previousChildRect;
public float _scale = 1.0f;
public readonly GlobalKey _sheetGlobalKey = new LabeledGlobalKey<State<StatefulWidget>>();//GlobalKey();
public readonly static CurveTween _curve = new CurveTween(
curve: Curves.easeOutBack
);
public readonly static CurveTween _curveReverse = new CurveTween(
curve: Curves.easeInBack
);
public readonly static RectTween _rectTween = new RectTween();
public readonly static Animatable<Rect> _rectAnimatable = _rectTween.chain(_curve);
public readonly static RectTween _rectTweenReverse = new RectTween();
public readonly static Animatable<Rect> _rectAnimatableReverse = _rectTweenReverse.chain(_curveReverse);
public readonly static RectTween _sheetRectTween = new RectTween();
public readonly Animatable<Rect> _sheetRectAnimatable = _sheetRectTween.chain(_curve);
public readonly Animatable<Rect> _sheetRectAnimatableReverse = _sheetRectTween.chain(_curveReverse);
public readonly static Tween< float> _sheetScaleTween = new FloatTween(0.0f,0.0f);
public readonly static Animatable< float> _sheetScaleAnimatable = _sheetScaleTween.chain(_curve);
public readonly static Animatable< float> _sheetScaleAnimatableReverse = _sheetScaleTween.chain(_curveReverse);
public readonly Tween< float> _opacityTween = new FloatTween(begin: 0.0f, end: 1.0f);
public Animation< float> _sheetOpacity;
public readonly static RectTween _sheetRectTween = new RectTween();
public readonly Animatable<Rect> _sheetRectAnimatable = _sheetRectTween.chain(_curve);
public readonly Animatable<Rect> _sheetRectAnimatableReverse = _sheetRectTween.chain(_curveReverse);
public readonly static Tween< float> _sheetScaleTween = new FloatTween(0.0f,0.0f);
public readonly static Animatable< float> _sheetScaleAnimatable = _sheetScaleTween.chain(_curve);
public readonly static Animatable< float> _sheetScaleAnimatableReverse = _sheetScaleTween.chain(_curveReverse);
public readonly Tween< float> _opacityTween = new FloatTween(begin: 0.0f, end: 1.0f);
public Animation< float> _sheetOpacity;
public readonly string barrierLabel;
public readonly string barrierLabel;
public Color barrierColor {
get { return _kModalBarrierColor; }
}
public bool barrierDismissible{
get { return false; }
}
public Color barrierColor {
get { return _kModalBarrierColor; }
}
public bool barrierDismissible{
get { return false; }
}
public bool semanticsDismissible {
get { return true; }
}
public bool semanticsDismissible {
get { return true; }
}
public TimeSpan transitionDuration {
get {
return _kModalPopupTransitionDuration;
public TimeSpan transitionDuration {
get {
return _kModalPopupTransitionDuration;
}
}
/*public static AlignmentDirectional getSheetAlignment(_ContextMenuLocation contextMenuLocation) {
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
return AlignmentDirectional.topCenter;
case _ContextMenuLocation.right:
return AlignmentDirectional.topEnd;
default:
return AlignmentDirectional.topStart;
}
}*/
public static Rect _getScaledRect(GlobalKey globalKey, float scale) {
Rect childRect = CupertinoContextMenuUtils._getRect(globalKey);
Size sizeScaled = childRect.size * scale;
Offset offsetScaled = new Offset(
childRect.left + (childRect.size.width - sizeScaled.width) / 2,
childRect.top + (childRect.size.height - sizeScaled.height) / 2
);
return offsetScaled & sizeScaled;
}
public static Rect _getSheetRectBegin(Orientation orientation, _ContextMenuLocation contextMenuLocation, Rect childRect, Rect sheetRect) {
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
Offset target1 = (orientation == Orientation.portrait)
? childRect.bottomCenter
: childRect.topCenter;
Offset centered = target1 - new Offset(sheetRect.width / 2, 0.0f);
return centered & sheetRect.size;
case _ContextMenuLocation.right:
Offset target2 = ((orientation == Orientation.portrait)
? childRect.bottomRight
: childRect.topRight);
return (target2 - new Offset(sheetRect.width, 0.0f)) & sheetRect.size;
default:
Offset target3 = orientation == Orientation.portrait
? childRect.bottomLeft
: childRect.topLeft;
return target3 & sheetRect.size;
}
}
public void _onDismiss(BuildContext context, float scale, float opacity) {
_scale = scale;
_opacityTween.end = opacity;
_sheetOpacity = _opacityTween.animate(
new CurvedAnimation(
parent: animation,
curve: new Interval(0.9f, 1.0f)
));
Navigator.of(context).pop<object>();
}
public void _updateTweenRects() {
Rect childRect = _scale == null
? CupertinoContextMenuUtils._getRect(_childGlobalKey)
: _getScaledRect(_childGlobalKey, _scale);
_rectTween.begin = _previousChildRect;
_rectTween.end = childRect;
Rect childRectOriginal = CupertinoContextMenuUtils.fromCenter(
center: _previousChildRect.center,
width: _previousChildRect.width / CupertinoContextMenuUtils._kOpenScale,
height: _previousChildRect.height / CupertinoContextMenuUtils._kOpenScale
);
Rect sheetRect = CupertinoContextMenuUtils._getRect(_sheetGlobalKey);
Rect sheetRectBegin = _getSheetRectBegin(
_lastOrientation,
_contextMenuLocation,
childRectOriginal,
sheetRect
);
_sheetRectTween.begin = sheetRectBegin;
_sheetRectTween.end = sheetRect;
_sheetScaleTween.begin = 0.0f;
_sheetScaleTween.end = _scale;
_rectTweenReverse.begin = childRectOriginal;
_rectTweenReverse.end = childRect;
}
public static Rect _getScaledRect(GlobalKey globalKey, float scale) {
Rect childRect = CupertinoContextMenuUtils._getRect(globalKey);
Size sizeScaled = childRect.size * scale;
Offset offsetScaled = new Offset(
childRect.left + (childRect.size.width - sizeScaled.width) / 2,
childRect.top + (childRect.size.height - sizeScaled.height) / 2
);
return offsetScaled & sizeScaled;
}
/*public static AlignmentDirectional getSheetAlignment(_ContextMenuLocation contextMenuLocation) {
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
return AlignmentDirectional.topCenter;
case _ContextMenuLocation.right:
return AlignmentDirectional.topEnd;
default:
return AlignmentDirectional.topStart;
public void _setOffstageInternally() {
base.offstage = _externalOffstage || _internalOffstage;
changedInternalState();
}*/
public static Rect _getSheetRectBegin(Orientation orientation, _ContextMenuLocation contextMenuLocation, Rect childRect, Rect sheetRect) {
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
Offset target1 = (orientation == Orientation.portrait)
? childRect.bottomCenter
: childRect.topCenter;
Offset centered = target1 - new Offset(sheetRect.width / 2, 0.0f);
return centered & sheetRect.size;
case _ContextMenuLocation.right:
Offset target2 = ((orientation == Orientation.portrait)
? childRect.bottomRight
: childRect.topRight);
return (target2 - new Offset(sheetRect.width, 0.0f)) & sheetRect.size;
default:
Offset target3 = orientation == Orientation.portrait
? childRect.bottomLeft
: childRect.topLeft;
return target3 & sheetRect.size;
public bool didPop(object result) {
_updateTweenRects();
return base.didPop(result);
}
public void _onDismiss(BuildContext context, float scale, float opacity) {
_scale = scale;
_opacityTween.end = opacity;
_sheetOpacity = _opacityTween.animate(
new CurvedAnimation(
parent: animation,
curve: new Interval(0.9f, 1.0f)
));
Navigator.of(context).pop<object>();
}
public void _updateTweenRects() {
Rect childRect = _scale == null
? CupertinoContextMenuUtils._getRect(_childGlobalKey)
: _getScaledRect(_childGlobalKey, _scale);
_rectTween.begin = _previousChildRect;
_rectTween.end = childRect;
Rect childRectOriginal = CupertinoContextMenuUtils.fromCenter(
center: _previousChildRect.center,
width: _previousChildRect.width / CupertinoContextMenuUtils._kOpenScale,
height: _previousChildRect.height / CupertinoContextMenuUtils._kOpenScale
);
Rect sheetRect = CupertinoContextMenuUtils._getRect(_sheetGlobalKey);
Rect sheetRectBegin = _getSheetRectBegin(
_lastOrientation,
_contextMenuLocation,
childRectOriginal,
sheetRect
);
_sheetRectTween.begin = sheetRectBegin;
_sheetRectTween.end = sheetRect;
_sheetScaleTween.begin = 0.0f;
_sheetScaleTween.end = _scale;
_rectTweenReverse.begin = childRectOriginal;
_rectTweenReverse.end = childRect;
}
public void _setOffstageInternally() {
base.offstage = _externalOffstage || _internalOffstage;
changedInternalState();
}
public bool didPop(object result) {
_updateTweenRects();
return base.didPop(result);
}
public bool offstage{
set{

}
public TickerFuture didPush() {
_internalOffstage = true;
_setOffstageInternally();
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timeSpan)=>{
_updateTweenRects();
_internalOffstage = false;
_setOffstageInternally();
});
return base.didPush();
}
public Animation<float> createAnimation() {
Animation< float> animation = base.createAnimation();
_sheetOpacity = _opacityTween.animate(new CurvedAnimation(
parent: animation,
curve: Curves.linear
));
return animation;
}
public override Widget buildPage(BuildContext context, Animation< float> animation, Animation< float> secondaryAnimation) {
return null;
}
public override Widget buildTransitions(BuildContext context1, Animation< float> animation, Animation< float> secondaryAnimation, Widget child) {
return new OrientationBuilder(
builder: (BuildContext context2, Orientation orientation)=>{
_lastOrientation = orientation;
if (!animation.isCompleted) {
bool reverse = animation.status == AnimationStatus.reverse;
Rect rect = reverse
? _rectAnimatableReverse.evaluate(animation)
: _rectAnimatable.evaluate(animation);
Rect sheetRect = reverse
? _sheetRectAnimatableReverse.evaluate(animation)
: _sheetRectAnimatable.evaluate(animation);
float sheetScale = reverse
? _sheetScaleAnimatableReverse.evaluate(animation)
: _sheetScaleAnimatable.evaluate(animation);
List<Widget> widgets = new List<Widget>();
widgets.Add(
Positioned.fromRect(
rect: sheetRect,
child: new Opacity(
opacity: _sheetOpacity.value,
child: Transform.scale(
//alignment: getSheetAlignment(_contextMenuLocation),
scale: sheetScale,
child: new _ContextMenuSheet(
key: _sheetGlobalKey,
public TickerFuture didPush() {
_internalOffstage = true;
_setOffstageInternally();
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timeSpan)=>{
_updateTweenRects();
_internalOffstage = false;
_setOffstageInternally();
});
return base.didPush();
}
public Animation<float> createAnimation() {
Animation< float> animation = base.createAnimation();
_sheetOpacity = _opacityTween.animate(new CurvedAnimation(
parent: animation,
curve: Curves.linear
));
return animation;
}
public override Widget buildPage(BuildContext context, Animation< float> animation, Animation< float> secondaryAnimation) {
return null;
}
public override Widget buildTransitions(BuildContext context1, Animation< float> animation, Animation< float> secondaryAnimation, Widget child) {
return new OrientationBuilder(
builder: (BuildContext context2, Orientation orientation)=>{
_lastOrientation = orientation;
if (!animation.isCompleted) {
bool reverse = animation.status == AnimationStatus.reverse;
Rect rect = reverse
? _rectAnimatableReverse.evaluate(animation)
: _rectAnimatable.evaluate(animation);
Rect sheetRect = reverse
? _sheetRectAnimatableReverse.evaluate(animation)
: _sheetRectAnimatable.evaluate(animation);
float sheetScale = reverse
? _sheetScaleAnimatableReverse.evaluate(animation)
: _sheetScaleAnimatable.evaluate(animation);
List<Widget> widgets = new List<Widget>();
widgets.Add(
Positioned.fromRect(
rect: sheetRect,
child: new Opacity(
opacity: _sheetOpacity.value,
child: Transform.scale(
//alignment: getSheetAlignment(_contextMenuLocation),
scale: sheetScale,
child: new _ContextMenuSheet(
key: _sheetGlobalKey,
actions: _actions,
contextMenuLocation: _contextMenuLocation,
orientation: orientation
)
)
)
)
);
widgets.Add(
Positioned.fromRect(
key: _childGlobalKey,
rect: rect,
child: _builder(context2, animation)
));
return new Stack(
children: widgets
);
}
return new _ContextMenuRouteStatic(
child: _builder(context1, animation),
childGlobalKey: _childGlobalKey,
orientation: orientation
)
)
)
)
);
widgets.Add(
Positioned.fromRect(
key: _childGlobalKey,
rect: rect,
child: _builder(context2, animation)
)
);
return new Stack(
children: widgets
);
}
return new _ContextMenuRouteStatic(
actions: _actions,
child: _builder(context1, animation),
childGlobalKey: _childGlobalKey,
contextMenuLocation: _contextMenuLocation,
onDismiss: _onDismiss,
orientation: orientation,
sheetGlobalKey: _sheetGlobalKey
);
onDismiss: _onDismiss,
orientation: orientation,
sheetGlobalKey: _sheetGlobalKey
);
}
);
);
}
public class _ContextMenuRouteStatic : StatefulWidget {
public _ContextMenuRouteStatic(
Key key = null,
List<Widget> actions = null,
Widget child = null,
GlobalKey childGlobalKey = null,
_ContextMenuLocation contextMenuLocation = default,
_DismissCallback onDismiss =default,
Orientation orientation = default,
GlobalKey sheetGlobalKey = null
) : base(key: key) {
D.assert(contextMenuLocation != null);
D.assert(orientation != null);
this.actions = actions;
this.child = child;
this.childGlobalKey = childGlobalKey;
this.contextMenuLocation = contextMenuLocation;
this.onDismiss = onDismiss;
this.orientation = orientation;
this.sheetGlobalKey = sheetGlobalKey;
}
public readonly List<Widget> actions;
public readonly Widget child;
public readonly GlobalKey childGlobalKey;
public readonly _ContextMenuLocation contextMenuLocation;
public readonly _DismissCallback onDismiss;
public readonly Orientation orientation;
public readonly GlobalKey sheetGlobalKey;
public class _ContextMenuRouteStatic : StatefulWidget {
public _ContextMenuRouteStatic(
Key key = null,
List<Widget> actions = null,
Widget child = null,
GlobalKey childGlobalKey = null,
_ContextMenuLocation contextMenuLocation = default,
_DismissCallback onDismiss =default,
Orientation orientation = default,
GlobalKey sheetGlobalKey = null
) : base(key: key) {
D.assert(contextMenuLocation != default);
D.assert(orientation != default);
this.actions = actions;
this.child = child;
this.childGlobalKey = childGlobalKey;
this.contextMenuLocation = contextMenuLocation;
this.onDismiss = onDismiss;
this.orientation = orientation;
this.sheetGlobalKey = sheetGlobalKey;
}
public readonly List<Widget> actions;
public readonly Widget child;
public readonly GlobalKey childGlobalKey;
public readonly _ContextMenuLocation contextMenuLocation;
public readonly _DismissCallback onDismiss;
public readonly Orientation orientation;
public readonly GlobalKey sheetGlobalKey;
public override State createState() {
return new _ContextMenuRouteStaticState();
public override State createState() {
return new _ContextMenuRouteStaticState();
}
}
public class _ContextMenuRouteStaticState : TickerProviderStateMixin<_ContextMenuRouteStatic> {
public readonly static float _kMinScale = 0.8f;
public readonly static float _kSheetScaleThreshold = 0.9f;
public readonly static float _kPadding = 20.0f;
public readonly static float _kDamping = 400.0f;
public readonly static TimeSpan _kMoveControllerDuration = new TimeSpan(0,0,0,600);
public Offset _dragOffset;
public float _lastScale = 1.0f;
public AnimationController _moveController;
public AnimationController _sheetController;
public Animation<Offset> _moveAnimation;
public Animation< float> _sheetScaleAnimation;
public Animation< float> _sheetOpacityAnimation;
public static float _getScale(Orientation orientation, float maxDragDistance, float dy) {
float dyDirectional = dy <= 0.0 ? dy : -dy;
return Mathf.Max(
_kMinScale,
(maxDragDistance + dyDirectional) / maxDragDistance
);
}
void _onPanStart(DragStartDetails details) {
_moveController.setValue(1.0f) ;
_setDragOffset(Offset.zero);
}
void _onPanUpdate(DragUpdateDetails details) {
_setDragOffset(_dragOffset + details.delta);
}
void _onPanEnd(DragEndDetails details) {
if (details.velocity.pixelsPerSecond.dy.abs() >= CupertinoContextMenuUtils.kMinFlingVelocity) {
bool flingIsAway = details.velocity.pixelsPerSecond.dy > 0;
float finalPosition = flingIsAway
? _moveAnimation.value.dy + 100.0f
: 0.0f;
if (flingIsAway && _sheetController.status != AnimationStatus.forward) {
_sheetController.forward();
} else if (!flingIsAway && _sheetController.status != AnimationStatus.reverse) {
_sheetController.reverse();
}
public class _ContextMenuRouteStaticState : TickerProviderStateMixin<_ContextMenuRouteStatic> {
public readonly static float _kMinScale = 0.8f;
public readonly static float _kSheetScaleThreshold = 0.9f;
public readonly static float _kPadding = 20.0f;
public readonly static float _kDamping = 400.0f;
public readonly static TimeSpan _kMoveControllerDuration = TimeSpan.FromMilliseconds(600);
Offset _dragOffset;
public float _lastScale = 1.0f;
public AnimationController _moveController;
public AnimationController _sheetController;
public Animation<Offset> _moveAnimation;
public Animation< float> _sheetScaleAnimation;
public Animation< float> _sheetOpacityAnimation;
public static float _getScale(Orientation orientation, float maxDragDistance, float dy) {
float dyDirectional = dy <= 0.0f ? dy : -dy;
return Mathf.Max(
_kMinScale,
(maxDragDistance + dyDirectional) / maxDragDistance
);
}
void _onPanStart(DragStartDetails details) {
_moveController.setValue(1.0f) ;
_setDragOffset(Offset.zero);
}
void _onPanUpdate(DragUpdateDetails details) {
_setDragOffset(_dragOffset + details.delta);
}
void _onPanEnd(DragEndDetails details) {
if (details.velocity.pixelsPerSecond.dy.abs() >= CupertinoContextMenuUtils.kMinFlingVelocity) {
bool flingIsAway = details.velocity.pixelsPerSecond.dy > 0;
float finalPosition = flingIsAway
? _moveAnimation.value.dy + 100.0f
: 0.0f;
if (flingIsAway && _sheetController.status != AnimationStatus.forward) {
_sheetController.forward();
} else if (!flingIsAway && _sheetController.status != AnimationStatus.reverse) {
_sheetController.reverse();
}
_moveAnimation = new OffsetTween(
begin: new Offset(0.0f, _moveAnimation.value.dy),
end:new Offset(0.0f, finalPosition)
).animate(_moveController);
_moveController.reset();
_moveController.duration = new TimeSpan(0,0,0,64);
_moveController.forward();
_moveController.addStatusListener(_flingStatusListener);
return;
}
if (_lastScale == _kMinScale) {
widget.onDismiss(context, _lastScale, _sheetOpacityAnimation.value);
return;
}
// Otherwise animate back home.
_moveController.addListener(_moveListener);
_moveController.reverse();
_moveAnimation = new OffsetTween(
begin: new Offset(0.0f, _moveAnimation.value.dy),
end:new Offset(0.0f, finalPosition)
).animate(_moveController);
_moveController.reset();
_moveController.duration = TimeSpan.FromMilliseconds(64);
_moveController.forward();
_moveController.addStatusListener(_flingStatusListener);
return;
}
if (_lastScale == _kMinScale) {
widget.onDismiss(context, _lastScale, _sheetOpacityAnimation.value);
return;
}
_moveController.addListener(_moveListener);
_moveController.reverse();
void _moveListener() {
if (_lastScale > _kSheetScaleThreshold) {
_moveController.removeListener(_moveListener);
if (_sheetController.status != AnimationStatus.dismissed) {
_sheetController.reverse();
void _moveListener() {
if (_lastScale > _kSheetScaleThreshold) {
_moveController.removeListener(_moveListener);
if (_sheetController.status != AnimationStatus.dismissed) {
_sheetController.reverse();
}
}
void _flingStatusListener(AnimationStatus status) {
if (status != AnimationStatus.completed) {
return;
}
_moveController.duration = _kMoveControllerDuration;
_moveController.removeStatusListener(_flingStatusListener);
if (_moveAnimation.value.dy == 0.0) {
return;
}
widget.onDismiss(context, _lastScale, _sheetOpacityAnimation.value);
void _flingStatusListener(AnimationStatus status) {
if (status != AnimationStatus.completed) {
return;
}
_moveController.duration = _kMoveControllerDuration;
_moveController.removeStatusListener(_flingStatusListener);
if (_moveAnimation.value.dy == 0.0) {
return;
}
widget.onDismiss(context, _lastScale, _sheetOpacityAnimation.value);
Alignment _getChildAlignment(Orientation orientation, _ContextMenuLocation contextMenuLocation) {
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
return orientation == Orientation.portrait
? Alignment.bottomCenter
: Alignment.topRight;
case _ContextMenuLocation.right:
return orientation == Orientation.portrait
? Alignment.bottomCenter
: Alignment.topLeft;
default:
return orientation == Orientation.portrait
? Alignment.bottomCenter
: Alignment.topRight;
}
Alignment _getChildAlignment(Orientation orientation, _ContextMenuLocation contextMenuLocation) {
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
return orientation == Orientation.portrait
? Alignment.bottomCenter
: Alignment.topRight;
case _ContextMenuLocation.right:
return orientation == Orientation.portrait
? Alignment.bottomCenter
: Alignment.topLeft;
default:
return orientation == Orientation.portrait
? Alignment.bottomCenter
: Alignment.topRight;
}
// Allow horizontal and negative vertical movement, but damp it.
float endX = _kPadding * dragOffset.dx / _kDamping;
float endY = dragOffset.dy >= 0.0
? dragOffset.dy
: _kPadding * dragOffset.dy / _kDamping;
setState(() =>{
_dragOffset = dragOffset;
_moveAnimation = new OffsetTween(
begin: Offset.zero,
end: new Offset(
endX.clamp(-_kPadding, _kPadding) ,
endY
)
).animate(
new CurvedAnimation(
parent: _moveController,
curve: Curves.elasticIn
)
float endX = _kPadding * dragOffset.dx / _kDamping;
float endY = dragOffset.dy >= 0.0
? dragOffset.dy
: _kPadding * dragOffset.dy / _kDamping;
setState(() =>{
_dragOffset = dragOffset;
_moveAnimation = new OffsetTween(
begin: Offset.zero,
end: new Offset(
endX.clamp(-_kPadding, _kPadding) ,
endY
)).animate(
new CurvedAnimation(
parent: _moveController,
curve: Curves.elasticIn
)
if (_lastScale <= _kSheetScaleThreshold
&& _sheetController.status != AnimationStatus.forward
&& _sheetScaleAnimation.value != 0.0f) {
_sheetController.forward();
} else if (_lastScale > _kSheetScaleThreshold
&& _sheetController.status != AnimationStatus.reverse
&& _sheetScaleAnimation.value != 1.0f) {
_sheetController.reverse();
}
});
if (_lastScale <= _kSheetScaleThreshold && _sheetController.status != AnimationStatus.forward
&& _sheetScaleAnimation.value != 0.0f) {
_sheetController.forward();
} else if (_lastScale > _kSheetScaleThreshold && _sheetController.status != AnimationStatus.reverse
&& _sheetScaleAnimation.value != 1.0f) {
_sheetController.reverse();
}
});
List<Widget> _getChildren(Orientation orientation, _ContextMenuLocation contextMenuLocation) {
Expanded child = new Expanded(
child: new Align(
alignment: _getChildAlignment(
widget.orientation,
widget.contextMenuLocation
),
child: new AnimatedBuilder(
animation: _moveController,
builder: _buildChildAnimation,
child: widget.child
)
)
);
Container spacer = new Container(
width: _kPadding,
height: _kPadding
);
Expanded sheet = new Expanded(
child: new AnimatedBuilder(
animation: _sheetController,
builder: _buildSheetAnimation,
child: new _ContextMenuSheet(
key: widget.sheetGlobalKey,
actions: widget.actions,
contextMenuLocation: widget.contextMenuLocation,
orientation: widget.orientation
)
)
);
List<Widget> centerWidgets = new List<Widget>();
centerWidgets.Add(child);
centerWidgets.Add(spacer);
centerWidgets.Add(sheet);
List<Widget> rightWidgets = new List<Widget>();
rightWidgets.Add(sheet);
rightWidgets.Add(spacer);
rightWidgets.Add(child);
List<Widget> _getChildren(Orientation orientation, _ContextMenuLocation contextMenuLocation) {
Expanded child = new Expanded(
child: new Align(
alignment: _getChildAlignment(
widget.orientation,
widget.contextMenuLocation
),
child: new AnimatedBuilder(
animation: _moveController,
builder: _buildChildAnimation,
child: widget.child
)
)
);
Container spacer = new Container(
width: _kPadding,
height: _kPadding
);
Expanded sheet = new Expanded(
child: new AnimatedBuilder(
animation: _sheetController,
builder: _buildSheetAnimation,
child: new _ContextMenuSheet(
key: widget.sheetGlobalKey,
actions: widget.actions,
contextMenuLocation: widget.contextMenuLocation,
orientation: widget.orientation
)
)
);
List<Widget> centerWidgets = new List<Widget>();
centerWidgets.Add(child);
centerWidgets.Add(spacer);
centerWidgets.Add(sheet);
List<Widget> rightWidgets = new List<Widget>();
rightWidgets.Add(sheet);
rightWidgets.Add(spacer);
rightWidgets.Add(child);
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
return new List<Widget>{child, spacer, sheet};

vsync: this
);
_sheetController = new AnimationController(
duration: new TimeSpan(0,0,0,100),
//reverseDuration: new TimeSpan(0,0,0,300),/// TBC ???
duration: TimeSpan.FromMilliseconds(100),
reverseDuration: TimeSpan.FromMilliseconds(300),/// TBC ???
vsync: this
);
_sheetScaleAnimation = new FloatTween(

T offValue = default,
float? intervalOn = null,
float? intervalOff = null
) /*: super(
first: new Tween<T>(begin: offValue, end: onValue).animate(
new CurvedAnimation(
parent: controller,
curve: new Interval(intervalOn, intervalOn)
)
),
next: new Tween<T>(begin: onValue, end: offValue).animate(
new CurvedAnimation(
parent: controller,
curve: new Interval(intervalOff, intervalOff)
)
)
)*////?????
) : base(
first: new Tween<T>(begin: offValue, end: onValue).animate(
new CurvedAnimation(
parent: controller,
curve: new Interval(intervalOn == null ? 0.0f : (float)intervalOn, intervalOn == null ? 0.0f : (float)intervalOn)
)
),
next: new Tween<T>(begin: onValue, end: offValue).animate(
new CurvedAnimation(
parent: controller,
curve: new Interval(intervalOff == null ? 0.0f : (float)intervalOff, intervalOff == null ? 0.0f : (float)intervalOff)
)
)
)
{
D.assert(intervalOn != null && intervalOn >= 0.0 && intervalOn <= 1.0);
D.assert(intervalOff !=null && intervalOff >= 0.0 && intervalOff <= 1.0);

public override T value {
get {
return next.value; // == _offValue ? next.value : first.value; ????/
return next.value.Equals( _offValue) ? next.value : first.value;
}
}

995
com.unity.uiwidgets/Runtime/cupertino/date_picker.cs
文件差异内容过多而无法显示
查看文件

275
com.unity.uiwidgets/Runtime/cupertino/dialog.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

inherit:false,
fontSize: 13.4f,
fontWeight: FontWeight.w400,
//color: CupertinoColors.black,
height: 1.036f,
letterSpacing: -0.25f,
textBaseline: TextBaseline.alphabetic

public const float _kMinButtonFontSize = 10.0f;
public const float _kDialogCornerRadius = 12.0f;
public const float _kDividerThickness = 1.0f;
public const float _kMaxRegularTextScaleFactor = 1.4f;
//public static readonly Color _kDialogColor = new Color(0xC0FFFFFF);
//public static readonly Color _kDialogPressedColor = new Color(0x90FFFFFF);
public static readonly Color _kButtonDividerColor = new Color(0x40FFFFFF);
public static readonly Color _kDialogColor = CupertinoDynamicColor.withBrightness(

color: new Color(0xFFE1E1E1),
darkColor: new Color(0xFF2E2E2E)
);
public const float _kMaxRegularTextScaleFactor = 1.4f;
public static bool _isInAccessibilityMode(BuildContext context) {
MediaQueryData data = MediaQuery.of(context, nullOk: true);

Widget content = null,
List<Widget> actions = null,
ScrollController scrollController = null,
ScrollController actionScrollController = null
ScrollController actionScrollController = null,
TimeSpan? insetAnimationDuration = null,
Curve insetAnimationCurve = null
this.insetAnimationDuration = insetAnimationDuration ?? TimeSpan.FromMilliseconds(100);
this.insetAnimationCurve = insetAnimationCurve ?? Curves.decelerate;
}
public readonly Widget title;

public readonly ScrollController actionScrollController;
readonly TimeSpan? m_InsetAnimationDuration;
public readonly TimeSpan insetAnimationDuration;
public readonly Curve insetAnimationCurve;
Widget _buildContent() {
Widget _buildContent(BuildContext context) {
List<Widget> children = new List<Widget>();
if (title != null || content != null) {
Widget titleSection = new _CupertinoDialogAlertContentSection(

}
return new Container(
color: CupertinoDialogUtils._kDialogColor,
color: CupertinoDynamicColor.resolve(CupertinoDialogUtils._kDialogColor, context),
child: new Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,

bool isInAccessibilityMode = CupertinoDialogUtils._isInAccessibilityMode(context);
float textScaleFactor = MediaQuery.of(context).textScaleFactor;
return new MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: Mathf.Max(textScaleFactor, 1.0f)
),
return new CupertinoUserInterfaceLevel(
data: CupertinoUserInterfaceLevelData.elevatedlayer,
child: new MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: Mathf.Max(textScaleFactor, 1.0f)
),
return new Center(
child: new Container(
margin: EdgeInsets.symmetric(vertical: CupertinoDialogUtils._kEdgePadding),
width: isInAccessibilityMode
? CupertinoDialogUtils._kAccessibilityCupertinoDialogWidth
: CupertinoDialogUtils._kCupertinoDialogWidth,
child: new CupertinoPopupSurface(
isSurfacePainted: false,
child: new _CupertinoDialogRenderWidget(
contentSection: _buildContent(),
actionsSection: _buildActions()
return new AnimatedPadding(
padding: MediaQuery.of(_context).viewInsets + EdgeInsets.symmetric(horizontal: 40.0f, vertical: 24.0f),
duration: insetAnimationDuration,
curve: insetAnimationCurve,
child: MediaQuery.removeViewInsets(
removeLeft: true,
removeTop: true,
removeRight: true,
removeBottom: true,
context: _context,
child: new Center(
child: new Container(
margin: EdgeInsets.symmetric(vertical: CupertinoDialogUtils._kEdgePadding),
width: isInAccessibilityMode
? CupertinoDialogUtils._kAccessibilityCupertinoDialogWidth
: CupertinoDialogUtils._kCupertinoDialogWidth,
child: new CupertinoPopupSurface(
isSurfacePainted: false,
child: new _CupertinoDialogRenderWidget(
contentSection: _buildContent(_context),
actionsSection: _buildActions()
)
)
);
)
);
}
}

child: new Container(
decoration: CupertinoDialogUtils._kCupertinoDialogBlurOverlayDecoration,
child: new Container(
color: isSurfacePainted ? CupertinoDialogUtils._kDialogColor : null,
color: isSurfacePainted ? CupertinoDynamicColor.resolve(CupertinoDialogUtils._kDialogColor, context) : null,
child: child
)
)

class _CupertinoDialogRenderWidget : RenderObjectWidget {
public _CupertinoDialogRenderWidget(
Widget contentSection,
Widget actionsSection,
Key key = null
Key key = null,
Widget contentSection = null,
Widget actionsSection = null
) : base(key: key) {
this.contentSection = contentSection;
this.actionsSection = actionsSection;

public override RenderObject createRenderObject(BuildContext context) {
return new _RenderCupertinoDialog(
dividerThickness: CupertinoDialogUtils._kDividerThickness / MediaQuery.of(context).devicePixelRatio,
isInAccessibilityMode: CupertinoDialogUtils._isInAccessibilityMode(context)
isInAccessibilityMode: CupertinoDialogUtils._isInAccessibilityMode(context),
dividerColor: CupertinoDynamicColor.resolve(CupertinoColors.separator, context)
);
}

((_RenderCupertinoDialog) renderObject).dividerColor =
CupertinoDynamicColor.resolve(CupertinoColors.separator, context);
}
public override Element createElement() {

Element _contentElement;
Element _actionsElement;
public new _CupertinoDialogRenderWidget widget {
get { return base.widget as _CupertinoDialogRenderWidget; }

D.assert(_actionsElement == child);
_actionsElement = null;
}
base.forgetChild(child);
}
protected override void removeChildRenderObject(RenderObject child) {

RenderBox contentSection = null,
RenderBox actionsSection = null,
float dividerThickness = 0.0f,
bool isInAccessibilityMode = false
bool isInAccessibilityMode = false,
Color dividerColor = null
_dividerPaint = new Paint() {
color = dividerColor,
style = PaintingStyle.fill
};
}
public RenderBox contentSection {

readonly float _dividerThickness;
readonly Paint _dividerPaint = new Paint() {
color = CupertinoDialogUtils._kButtonDividerColor,
style = PaintingStyle.fill
};
public readonly Paint _dividerPaint;
public Color dividerColor {
get {
return _dividerPaint.color;
}
set {
if (dividerColor == value) {
return;
}
_dividerPaint.color = value;
markNeedsPaint();
}
}
public override void attach(object owner) {
base.attach(owner);
if (null != contentSection) {

);
}
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null
) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
BoxParentData contentSectionParentData = contentSection.parentData as BoxParentData;
BoxParentData actionsSectionParentData = actionsSection.parentData as BoxParentData;
return result.addWithPaintOffset(

public readonly ScrollController scrollController;
public override Widget build(BuildContext context) {
if (title == null && content == null) {
return new SingleChildScrollView(
controller: scrollController,
child: new Container(width: 0.0f, height: 0.0f)
);
}
float textScaleFactor = MediaQuery.of(context).textScaleFactor;
List<Widget> titleContentGroup = new List<Widget>();
if (title != null) {

top: CupertinoDialogUtils._kEdgePadding * textScaleFactor
),
child: new DefaultTextStyle(
style: CupertinoDialogUtils._kCupertinoDialogTitleStyle,
style: CupertinoDialogUtils._kCupertinoDialogTitleStyle.copyWith(
color: CupertinoDynamicColor.resolve(CupertinoColors.label, context)
),
textAlign: TextAlign.center,
child: title
)

top: title == null ? CupertinoDialogUtils._kEdgePadding : 1.0f
),
child: new DefaultTextStyle(
style: CupertinoDialogUtils._kCupertinoDialogContentStyle,
style: CupertinoDialogUtils._kCupertinoDialogContentStyle.copyWith(
color: CupertinoDynamicColor.resolve(CupertinoColors.label, context)
),
textAlign: TextAlign.center,
child: content
)

//ParentDataWidget<_DialogActionButtonParentData>
class _DialogActionButtonParentDataWidget : ParentDataWidget<_ActionButtonParentData> {
public _DialogActionButtonParentDataWidget(
Widget child,
Key key = null,
Key key = null
Widget child = null
) : base(key: key, child: child) {
this.isPressed = isPressed;
}

}
}
}
public override Type debugTypicalAncestorWidgetClass {
get {
return typeof(_CupertinoDialogActionsRenderWidget);
}
}
}
class _DialogActionButtonParentData : MultiChildLayoutParentData {

public class CupertinoDialogAction : StatelessWidget {
public CupertinoDialogAction(
Widget child,
Key key = null,
TextStyle textStyle = null
) {
TextStyle textStyle = null,
Widget child = null
):base(key:key) {
D.assert(child != null);
this.onPressed = onPressed;
this.isDefaultAction = isDefaultAction;

}
public override Widget build(BuildContext context) {
TextStyle style = CupertinoDialogUtils._kCupertinoDialogActionStyle;
TextStyle style = CupertinoDialogUtils._kCupertinoDialogActionStyle.copyWith(
color: CupertinoDynamicColor.resolve(
isDestructiveAction ? CupertinoColors.systemRed : CupertinoColors.systemBlue,
context
)
);
if (isDestructiveAction) {
style = style.copyWith(color: CupertinoColors.destructiveRed);
if (isDefaultAction) {
style = style.copyWith(fontWeight: FontWeight.w600);
if (!enabled) {
style = style.copyWith(color: style.color.withOpacity(0.5f));

dialogWidth: CupertinoDialogUtils._isInAccessibilityMode(context)
? CupertinoDialogUtils._kAccessibilityCupertinoDialogWidth
: CupertinoDialogUtils._kCupertinoDialogWidth,
dividerThickness: _dividerThickness
dividerThickness: _dividerThickness,
dialogColor: CupertinoDynamicColor.resolve(CupertinoDialogUtils._kDialogColor, context),
dialogPressedColor: CupertinoDynamicColor.resolve(CupertinoDialogUtils._kDialogPressedColor, context),
dividerColor: CupertinoDynamicColor.resolve(CupertinoColors.separator, context)
);
}

? CupertinoDialogUtils._kAccessibilityCupertinoDialogWidth
: CupertinoDialogUtils._kCupertinoDialogWidth;
(renderObject as _RenderCupertinoDialogActions).dividerThickness = _dividerThickness;
(renderObject as _RenderCupertinoDialogActions).dialogColor =
CupertinoDynamicColor.resolve( CupertinoDialogUtils._kDialogColor, context);
(renderObject as _RenderCupertinoDialogActions).dialogPressedColor =
CupertinoDynamicColor.resolve( CupertinoDialogUtils._kDialogPressedColor, context);
(renderObject as _RenderCupertinoDialogActions).dividerColor =
CupertinoDynamicColor.resolve(CupertinoColors.separator, context);
}
}

float dialogWidth,
float dividerThickness = 0.0f
float? dialogWidth = null,
float dividerThickness = 0.0f,
Color dialogColor = null,
Color dialogPressedColor = null,
Color dividerColor = null
_buttonBackgroundPaint = new Paint() {
color = dialogColor,
style = PaintingStyle.fill
};
_pressedButtonBackgroundPaint = new Paint(){
color = dialogPressedColor,
style = PaintingStyle.fill
};
_dividerPaint = new Paint(){
color = dividerColor,
style = PaintingStyle.fill
};
public float dialogWidth {
public float? dialogWidth {
get { return _dialogWidth; }
set {
if (value != _dialogWidth) {

}
}
float _dialogWidth;
float? _dialogWidth;
public float dividerThickness {

}
}
}
float _dividerThickness;
public readonly Paint _buttonBackgroundPaint;
public Color dialogColor {
set{
if (value == _buttonBackgroundPaint.color)
return;
_buttonBackgroundPaint.color = value;
markNeedsPaint();
}
}
float _dividerThickness;
public readonly Paint _pressedButtonBackgroundPaint;
readonly Paint _buttonBackgroundPaint = new Paint() {
color = CupertinoDialogUtils._kDialogColor,
style = PaintingStyle.fill
};
public Color dialogPressedColor {
set{
if (value == _pressedButtonBackgroundPaint.color)
return;
readonly Paint _pressedButtonBackgroundPaint = new Paint() {
color = CupertinoDialogUtils._kDialogPressedColor,
style = PaintingStyle.fill
};
_pressedButtonBackgroundPaint.color = value;
markNeedsPaint();
}
}
public readonly Paint _dividerPaint;
readonly Paint _dividerPaint = new Paint() {
color = CupertinoDialogUtils._kButtonDividerColor,
style = PaintingStyle.fill
};
public Color dividerColor{
set {
if (value == _dividerPaint.color)
return;
_dividerPaint.color = value;
markNeedsPaint();
}
}
List<RenderBox> _pressedButtons {
get {

}
protected internal override float computeMinIntrinsicWidth(float height) {
return dialogWidth;
return dialogWidth ?? 0.0f;
return dialogWidth;
return dialogWidth ?? 0.0f;
}
protected internal override float computeMinIntrinsicHeight(float width) {

}
else {
float perButtonWidth = (width - dividerThickness) / 2.0f;
minHeight = Mathf.Max(firstChild.getMinIntrinsicHeight(perButtonWidth),
minHeight = Mathf.Max(
firstChild.getMinIntrinsicHeight(perButtonWidth),
lastChild.getMinIntrinsicHeight(perButtonWidth)
);
}

else if (childCount == 2) {
if (_isSingleButtonRow(width)) {
float perButtonWidth = (width - dividerThickness) / 2.0f;
maxHeight = Mathf.Max(firstChild.getMaxIntrinsicHeight(perButtonWidth),
maxHeight = Mathf.Max(
firstChild.getMaxIntrinsicHeight(perButtonWidth),
lastChild.getMaxIntrinsicHeight(perButtonWidth)
);
}

heightAccumulation += button.getMaxIntrinsicHeight(width);
button = childAfter(button);
}
return heightAccumulation;
}

}
protected override void performLayout() {
if (_isSingleButtonRow(dialogWidth)) {
BoxConstraints constraints = this.constraints;
if (_isSingleButtonRow(dialogWidth ?? 0.0f)) {
if (childCount == 1) {
firstChild.layout(
constraints,

new Size(dialogWidth, firstChild.size.height)
new Size(dialogWidth ?? 0.0f, firstChild.size.height)
);
}
else {

secondButtonParentData.offset =
new Offset(firstChild.size.width + dividerThickness, 0.0f);
size = constraints.constrain(
new Size(dialogWidth,
Mathf.Max(firstChild.size.height, lastChild.size.height
new Size(
dialogWidth ?? 0.0f,
Mathf.Max(
firstChild.size.height,
lastChild.size.height
)
)
);

}
size = constraints.constrain(
new Size(dialogWidth, verticalOffset)
new Size(dialogWidth ?? 0.0f, verticalOffset)
);
}
}

}
Path backgroundFillPath = new Path();
// backgroundFillPath.fillType = PathFillType.evenOdd;
backgroundFillPath.fillType = PathFillType.evenOdd;
backgroundFillPath.addRect(Rect.fromLTWH(0.0f, 0.0f, size.width, size.height));
backgroundFillPath.addRect(verticalDivider);

}
canvas.drawPath(
pressedBackgroundFillPath, _pressedButtonBackgroundPaint
pressedBackgroundFillPath,
_pressedButtonBackgroundPaint
);
Path dividersPath = new Path();
dividersPath.addRect(verticalDivider);

void _drawButtonBackgroundsAndDividersStacked(Canvas canvas, Offset offset) {
Offset dividerOffset = new Offset(0.0f, dividerThickness);
Path backgroundFillPath = new Path();
// ..fillType = PathFillType.evenOdd
backgroundFillPath.fillType = PathFillType.evenOdd;
backgroundFillPath.addRect(Rect.fromLTWH(0.0f, 0.0f, size.width, size.height));
Path pressedBackgroundFillPath = new Path();
Path dividersPath = new Path();

}
}
protected override bool hitTestChildren(BoxHitTestResult result,
protected override bool hitTestChildren(
BoxHitTestResult result,
Offset position = null
) {
return defaultHitTestChildren(result, position: position);

5
com.unity.uiwidgets/Runtime/cupertino/icon_theme_data.cs


Color resolvedColor = CupertinoDynamicColor.resolve(color, context);
return resolvedColor == color ? this : copyWith(color: resolvedColor);
}
public new CupertinoIconThemeData copyWith(Color color = null , float? opacity = null, float? size = null)
public new CupertinoIconThemeData copyWith(
Color color = null ,
float? opacity = null,
float? size = null)
{
return new CupertinoIconThemeData(
color: color ?? this.color,

5
com.unity.uiwidgets/Runtime/cupertino/icons.cs


public static readonly IconData reply_all = new IconData(0xf21d, fontFamily: iconFont);
public static readonly IconData reply_thick_solid = new IconData(0xf21e, fontFamily: iconFont);
public static readonly IconData share_up = new IconData(0xf220, fontFamily: iconFont);
public static readonly IconData shuffle = new IconData(0xf4a9, fontFamily: iconFont);
public static readonly IconData shuffle_medium = new IconData(0xf4a8, fontFamily: iconFont);
public static readonly IconData shuffle_thick = new IconData(0xf221, fontFamily: iconFont);
public static readonly IconData photo_camera = new IconData(0xf3f5, fontFamily: iconFont);
public static readonly IconData photo_camera_solid = new IconData(0xf3f6, fontFamily: iconFont);

public static readonly IconData bell_solid = new IconData(0xf3e2, fontFamily: iconFont);
public static readonly IconData news = new IconData(0xf471, fontFamily: iconFont);
public static readonly IconData news_solid = new IconData(0xf472, fontFamily: iconFont);
public static readonly IconData brightness = new IconData(0xf4B6, fontFamily: iconFont);
public static readonly IconData brightness_solid = new IconData(0xf4B7, fontFamily: iconFont);
}
}

17
com.unity.uiwidgets/Runtime/cupertino/interface_level.cs


public static CupertinoUserInterfaceLevelData? of(BuildContext context, bool nullOk = false ) {
D.assert(context != null);
D.assert(nullOk != null);
//if (nullOk)
// return ;
if (nullOk)
return null;
throw new UIWidgetsError(
"CupertinoUserInterfaceLevel.of() called with a context that does not contain a CupertinoUserInterfaceLevel.\n" +
"No CupertinoUserInterfaceLevel ancestor could be found starting from the context that was passed "+

}
public override bool updateShouldNotify(InheritedWidget oldWidget) {
//throw new System.NotImplementedException();
//oldWidget._data != _data;
/// ?????
if (oldWidget.GetType() == typeof(CupertinoUserInterfaceLevel)) {
return updateShouldNotify(oldWidget);
}
return false;
oldWidget = (CupertinoUserInterfaceLevel) oldWidget;
return ((CupertinoUserInterfaceLevel) oldWidget)._data != _data;
public bool updateShouldNotify(CupertinoUserInterfaceLevel oldWidget) => oldWidget._data != _data;
}
}

6
com.unity.uiwidgets/Runtime/cupertino/localization.cs


public abstract string postMeridiemAbbreviation { get; }
public abstract string todayLabel { get; }
public abstract string alertDialogLabel { get; }
public abstract string timerPickerHour(int hour);

public override string postMeridiemAbbreviation {
get { return "PM"; }
}
public override string todayLabel {
get { return "Today"; }
}
public override string alertDialogLabel {

201
com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs


using Rect = Unity.UIWidgets.ui.Rect;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using Brightness = Unity.UIWidgets.ui.Brightness;
using Transform = Unity.UIWidgets.widgets.Transform;
namespace Unity.UIWidgets.cupertino {

public const float _kNavBarBackButtonTapWidth = 50.0f;
public static readonly TimeSpan _kNavBarTitleFadeDuration = new TimeSpan(0, 0, 0, 0, 150);
public static readonly TimeSpan _kNavBarTitleFadeDuration = TimeSpan.FromMilliseconds(150);
public static readonly Color _kDefaultNavBarBorderColor = new Color(0x4C000000);

) {
Widget result = child;
if (updateSystemUiOverlay) {
/*bool darkBackground = backgroundColor.computeLuminance() < 0.179f;
SystemUiOverlayStyle overlayStyle = darkBackground
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark;*/
bool isDark = backgroundColor.computeLuminance() < 0.179;
Brightness newBrightness = brightness ?? (isDark ? Brightness.dark : Brightness.light);
SystemUiOverlayStyle overlayStyle;

BuildContext toHeroContext
) => {
D.assert(animation != null);
D.assert(
fromNavBar.componentsKeys.navBarBoxKey.currentContext.owner != null,
() => "The from nav bar to Hero must have been mounted in the previous frame"

topNavBar: fromNavBar
);
}
throw new UIWidgetsError($"Unknown flight direction: {flightDirection}");
};
public static CreateRectTween _linearTranslateWithLargestRectSizeTween = (Rect begin, Rect end) => {

end: end.topLeft & largestSize
);
};
//TransitionBuilder
public static HeroPlaceholderBuilder _navBarHeroLaunchPadBuilder = (
BuildContext context,
Size heroSize,

this.trailing = trailing;
this.border = border ?? NavBarUtils._kDefaultNavBarBorder;
this.backgroundColor = backgroundColor;
this.brightness = brightness ?? Brightness.dark; //todo ????
this.brightness = brightness;
this.padding = padding;
this.actionsForegroundColor = actionsForegroundColor;
this.transitionBetweenRoutes = transitionBetweenRoutes;

public readonly Widget middle;
public readonly Widget trailing;
public readonly Brightness brightness;
public readonly Brightness? brightness;
public readonly Color backgroundColor;
public readonly EdgeInsets padding;

?? CupertinoTheme.of(context).barBackgroundColor;
return backgroundColor.alpha == 0xFF;
}
/*public override bool? fullObstruction {
get { return backgroundColor == null ? null : (bool?) (backgroundColor.alpha == 0xFF); }
}*/
public override Size preferredSize {
get { return Size.fromHeight(NavBarUtils._kNavBarPersistentHeight); }
}

}
public override Widget build(BuildContext context) {
//Color backgroundColor = widget.backgroundColor ?? CupertinoTheme.of(context).barBackgroundColor;
Color backgroundColor =
CupertinoDynamicColor.resolve(widget.backgroundColor, context) ?? CupertinoTheme.of(context).barBackgroundColor;

);
if (!widget.transitionBetweenRoutes || !NavBarUtils._isTransitionable(context)) {
//return NavBarUtils._wrapActiveColor(widget.actionsForegroundColor, context, navBar); // ignore: deprecated_member_use_from_same_package
//widget.actionsForegroundColor, // ignore: deprecated_member_use_from_same_package
actionsForegroundColor,
context,
new Builder(

this.trailing = trailing;
this.border = border ?? NavBarUtils._kDefaultNavBarBorder;
this.backgroundColor = backgroundColor;
this.brightness = brightness ?? Brightness.dark;
this.brightness = brightness;
this.padding = padding;
this.actionsForegroundColor = actionsForegroundColor;
this.transitionBetweenRoutes = transitionBetweenRoutes;

public readonly Color backgroundColor;
public readonly Brightness brightness;
public readonly Brightness? brightness;
public readonly EdgeInsets padding;

}
public override Widget build(BuildContext context) {
//Color actionsForegroundColor = widget.actionsForegroundColor ?? CupertinoTheme.of(context).primaryColor; // ignore: deprecated_member_use_from_same_package
Color actionsForegroundColor = CupertinoDynamicColor.resolve(widget.actionsForegroundColor, context) // ignore: deprecated_member_use_from_same_package
?? CupertinoTheme.of(context).primaryColor;
_NavigationBarStaticComponents components = new _NavigationBarStaticComponents(

);
return NavBarUtils._wrapActiveColor(
widget.actionsForegroundColor, // ignore: deprecated_member_use_from_same_package
actionsForegroundColor,
//new SliverPersistentHeader(
new MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1),
child: new SliverPersistentHeader(

components: components,
userMiddle: widget.middle,
//backgroundColor: widget.backgroundColor ?? CupertinoTheme.of(context).barBackgroundColor,
backgroundColor:CupertinoDynamicColor.resolve(widget.backgroundColor, context) ?? CupertinoTheme.of(context).barBackgroundColor,
backgroundColor: CupertinoDynamicColor.resolve(widget.backgroundColor, context) ?? CupertinoTheme.of(context).barBackgroundColor,
brightness: widget.brightness,
border: widget.border,
padding: widget.padding,

}
}
class _LargeTitleNavigationBarSliverDelegate
: SliverPersistentHeaderDelegate {
class _LargeTitleNavigationBarSliverDelegate : SliverPersistentHeaderDelegate {
public _LargeTitleNavigationBarSliverDelegate(
_NavigationBarStaticComponentsKeys keys = null,
_NavigationBarStaticComponents components = null,

float persistentHeight = 0.0f,
bool alwaysShowMiddle =false
) {
D.assert(persistentHeight != null);
D.assert(alwaysShowMiddle != null);
D.assert(transitionBetweenRoutes != null);
this.brightness = brightness ?? Brightness.dark;
this.brightness = brightness;
this.padding = padding;
this.actionsForegroundColor = actionsForegroundColor;
this.transitionBetweenRoutes = transitionBetweenRoutes;

public readonly Widget userMiddle;
public readonly Color backgroundColor;
public readonly Border border;
public Brightness brightness;
public readonly Brightness? brightness;
public readonly EdgeInsets padding;
public readonly Color actionsForegroundColor;
public readonly bool transitionBetweenRoutes;

Widget navBar = NavBarUtils._wrapWithBackground(
border: border,
//backgroundColor: backgroundColor,
backgroundColor: CupertinoDynamicColor.resolve(backgroundColor, context),
brightness: brightness,
child: new DefaultTextStyle(

child: new OverflowBox(
minHeight: 0.0f,
maxHeight: float.PositiveInfinity,
alignment: Alignment.bottomLeft,
alignment: AlignmentDirectional.bottomStart,
child: new Padding(
padding: EdgeInsets.only(
left: NavBarUtils._kNavBarEdgePadding,

transitionOnUserGestures: true,
child: new _TransitionableNavigationBar(
componentsKeys: keys,
//backgroundColor: backgroundColor,
backgroundColor: CupertinoDynamicColor.resolve(backgroundColor, context),
backButtonTextStyle: CupertinoTheme.of(context).textTheme.navActionTextStyle,
titleTextStyle: CupertinoTheme.of(context).textTheme.navTitleTextStyle,

}
public readonly _NavigationBarStaticComponents components;
public readonly EdgeInsets padding;
public readonly bool middleVisible;

style: CupertinoTheme.of(context).textTheme.navTitleTextStyle,
child: middle
);
middle = new AnimatedOpacity(
opacity: middleVisible ? 1.0f : 0.0f,
duration: NavBarUtils._kNavBarTitleFadeDuration,
child: middle
);
middle = middleVisible == null
? middle
: new AnimatedOpacity(
opacity: middleVisible ? 1.0f : 0.0f,
duration: NavBarUtils._kNavBarTitleFadeDuration,
child: middle
);
}
Widget leading = components.leading;

class _NavigationBarStaticComponents {
public _NavigationBarStaticComponents(
_NavigationBarStaticComponentsKeys keys,
ModalRoute route,
Widget userLeading,
string previousPageTitle,
Widget userMiddle,
Widget userTrailing,
Widget userLargeTitle,
EdgeInsets padding,
bool large
bool large,
_NavigationBarStaticComponentsKeys keys = null,
ModalRoute route = null,
Widget userLeading = null,
string previousPageTitle = null,
Widget userMiddle = null,
Widget userTrailing = null,
Widget userLargeTitle = null,
EdgeInsets padding = null
) {
leading = createLeading(
leadingKey: keys.leadingKey,

}
static Widget _derivedTitle(
bool automaticallyImplyTitle,
ModalRoute currentRoute
bool automaticallyImplyTitle ,
ModalRoute currentRoute = null
route.title != null) {
((CupertinoPageRoute)route).title != null) {
return new Text(route.title);
}

public readonly KeyedSubtree leading;
static KeyedSubtree createLeading(
GlobalKey leadingKey,
Widget userLeading,
ModalRoute route,
EdgeInsets padding
GlobalKey leadingKey = null,
Widget userLeading = null,
ModalRoute route = null,
EdgeInsets padding = null
) {
Widget leadingContent = null;

public readonly KeyedSubtree backChevron;
static KeyedSubtree createBackChevron(
GlobalKey backChevronKey,
Widget userLeading,
ModalRoute route,
bool automaticallyImplyLeading
bool automaticallyImplyLeading,
GlobalKey backChevronKey = null,
Widget userLeading = null,
ModalRoute route = null
) {
if (
userLeading != null ||

public readonly KeyedSubtree backLabel;
static KeyedSubtree createBackLabel(
GlobalKey backLabelKey,
Widget userLeading,
ModalRoute route,
string previousPageTitle
GlobalKey backLabelKey = null,
Widget userLeading = null,
ModalRoute route = null,
string previousPageTitle = null
) {
if (
userLeading != null ||

public readonly KeyedSubtree middle;
static KeyedSubtree createMiddle(
GlobalKey middleKey,
Widget userMiddle,
Widget userLargeTitle,
ModalRoute route
GlobalKey middleKey = null,
Widget userMiddle = null,
Widget userLargeTitle = null,
ModalRoute route = null
) {
Widget middleContent = userMiddle;

middleContent = middleContent ?? _derivedTitle(
automaticallyImplyTitle: automaticallyImplyTitle,
currentRoute: route
);
middleContent = middleContent ?? _derivedTitle(automaticallyImplyTitle: automaticallyImplyTitle, currentRoute: route);
if (middleContent == null) {
return null;

public readonly KeyedSubtree trailing;
static KeyedSubtree createTrailing(
GlobalKey trailingKey,
Widget userTrailing,
EdgeInsets padding
GlobalKey trailingKey = null,
Widget userTrailing = null,
EdgeInsets padding = null
) {
if (userTrailing == null) {
return null;

public readonly KeyedSubtree largeTitle;
static KeyedSubtree createLargeTitle(
GlobalKey largeTitleKey,
Widget userLargeTitle,
ModalRoute route
GlobalKey largeTitleKey = null,
Widget userLargeTitle = null,
ModalRoute route = null
) {
if (!large) {
return null;

automaticallyImplyTitle: automaticImplyTitle,
currentRoute: route
);
currentRoute: route);
return new KeyedSubtree(
key: largeTitleKey,
child: largeTitleContent

Color color = null,
string previousPageTitle = null,
VoidCallback onPressed = null
):base(key:key) {
_backChevron = null;
_backLabel = null;

Widget _backChevron,
Widget _backLabel
) {
);
);
}
public readonly Color color;

() => "CupertinoNavigationBarBackButton should only be used in routes that can be popped"
);
}
// actionTextStyle = actionTextStyle.copyWith(color: color);
actionTextStyle = actionTextStyle.copyWith(color: CupertinoDynamicColor.resolve(color, context));
}

),
padding: EdgeInsets.zero,
onPressed: () => {
//Navigator.maybePop(context);
if (onPressed != null) {
onPressed();
} else {

public _BackChevron(Key key = null) : base(key: key) { }
public override Widget build(BuildContext context) {
TextDirection textDirection = Directionality.of(context);
text: char.ConvertFromUtf32(CupertinoIcons.back.codePoint),
text:new string(new[] {(char) CupertinoIcons.back.codePoint}),
//package: CupertinoIcons.back.fontPackage
var matrix = Matrix4.identity();
matrix.scale(-1.0f, 1.0f, 1.0f);
switch (textDirection) {
case TextDirection.rtl:
iconWidget = new Transform(
transform: matrix,
alignment: Alignment.center,
transformHitTests: false,
child: iconWidget
) as Widget;
break;
case TextDirection.ltr:
break;
}
return iconWidget;
}

string specifiedPreviousTitle = null,
ModalRoute route = null
) : base(key: key) {
//D.assert(route != null);
this.specifiedPreviousTitle = specifiedPreviousTitle;
this.route = route;
}

}
return new Align(
alignment: Alignment.centerLeft,
alignment: AlignmentDirectional.centerStart,
widthFactor: 1.0f,
child: textWidget
);

if (specifiedPreviousTitle != null) {
return _buildPreviousTitleWidget(context, specifiedPreviousTitle, null);
}
//else if (route is CupertinoPageRoute cupertinoRoute) {
else if (route is CupertinoPageRoute && !route.isFirst) {
CupertinoPageRoute cupertinoRoute = route as CupertinoPageRoute;
return new ValueListenableBuilder<string>(

bool? largeExpanded = null,
Widget child = null
) : base(key: componentsKeys.navBarBoxKey) {
this.componentsKeys = componentsKeys;
this.backgroundColor = backgroundColor;
this.backButtonTextStyle = backButtonTextStyle;

public RenderBox renderBox {
get {
// RenderBox box = (RenderBox) componentsKeys.navBarBoxKey.currentContext.findRenderObject();
RenderBox box = componentsKeys.navBarBoxKey.currentContext.findRenderObject() as RenderBox;
RenderBox box = componentsKeys.navBarBoxKey.currentContext.findRenderObject() as RenderBox;
D.assert(
box.attached,
() => "_TransitionableNavigationBar.renderBox should be called when building " +

class _NavigationBarTransition : StatelessWidget {
public _NavigationBarTransition(
Animation<float> animation,
_TransitionableNavigationBar topNavBar,
_TransitionableNavigationBar bottomNavBar
Animation<float> animation = null,
_TransitionableNavigationBar topNavBar = null,
_TransitionableNavigationBar bottomNavBar = null
begin: this.bottomNavBar.renderBox.size.height,
end: this.topNavBar.renderBox.size.height
begin: bottomNavBar.renderBox.size.height,
end: topNavBar.renderBox.size.height
begin: this.bottomNavBar.backgroundColor,
end: this.topNavBar.backgroundColor
begin: bottomNavBar.backgroundColor,
end: topNavBar.backgroundColor
begin: this.bottomNavBar.border,
end: this.topNavBar.border
begin: bottomNavBar.border,
end: topNavBar.border
);
}

317
com.unity.uiwidgets/Runtime/cupertino/picker.cs


public const float _kDefaultDiameterRatio = 1.35f;
public const float _kDefaultPerspective = 0.004f;
public const float _kForegroundScreenOpacityFraction = 0.7f;
public const float _kOverAndUnderCenterOpacity = 0.447f;
float itemExtent,
ValueChanged<int> onSelectedItemChanged,
List<Widget> children = null,
float diameterRatio = CupertinoPickerUtils._kDefaultDiameterRatio,
float? diameterRatio = null,
bool looping = false,
ListWheelChildDelegate childDelegate = null
float? squeeze = null,
float? itemExtent = null,
ValueChanged<int> onSelectedItemChanged = null,
List<Widget> children = null,
bool looping = false
D.assert(children != null || childDelegate != null);
D.assert(diameterRatio > 0.0, () => RenderListWheelViewport.diameterRatioZeroMessage);
diameterRatio = diameterRatio == null ? CupertinoPickerUtils._kDefaultDiameterRatio : diameterRatio;
squeeze = squeeze == null ? CupertinoDatePickerUtils._kSqueeze : squeeze;
D.assert(children != null);
D.assert(diameterRatio > 0.0f, ()=>RenderListWheelViewport.diameterRatioZeroMessage);
D.assert(itemExtent != null);
this.childDelegate = childDelegate ?? (looping
? (ListWheelChildDelegate) new ListWheelChildLoopingListDelegate(
children: children)
: (ListWheelChildDelegate) new ListWheelChildListDelegate(children: children));
this.itemExtent = itemExtent;
this.onSelectedItemChanged = onSelectedItemChanged;
D.assert(squeeze > 0);
this.backgroundColor = backgroundColor ?? CupertinoPickerUtils._kDefaultBackground;
this.backgroundColor = backgroundColor;
this.squeeze = squeeze;
this.itemExtent = itemExtent;
this.onSelectedItemChanged = onSelectedItemChanged;
childDelegate = looping
? (ListWheelChildDelegate) new ListWheelChildLoopingListDelegate(children: children)
: new ListWheelChildListDelegate(children: children);
float itemExtent,
ValueChanged<int> onSelectedItemChanged,
IndexedWidgetBuilder itemBuilder,
float diameterRatio = CupertinoPickerUtils._kDefaultDiameterRatio,
float? diameterRatio = null,
float? squeeze = null,
float? itemExtent = null,
ValueChanged<int> onSelectedItemChanged = null,
IndexedWidgetBuilder itemBuilder = null,
diameterRatio = diameterRatio == null ? CupertinoPickerUtils._kDefaultDiameterRatio : diameterRatio;
squeeze = squeeze == null ? CupertinoDatePickerUtils._kSqueeze : squeeze;
D.assert(diameterRatio > 0.0f, () => RenderListWheelViewport.diameterRatioZeroMessage);
D.assert(diameterRatio > 0.0f,()=> RenderListWheelViewport.diameterRatioZeroMessage);
D.assert(itemExtent != null);
return new CupertinoPicker(
itemExtent: itemExtent,
onSelectedItemChanged: onSelectedItemChanged,
key: key,
diameterRatio: diameterRatio,
backgroundColor: backgroundColor,
offAxisFraction: offAxisFraction,
useMagnifier: useMagnifier,
magnification: magnification,
scrollController: scrollController,
childDelegate: new ListWheelChildBuilderDelegate(builder: itemBuilder, childCount: childCount)
);
D.assert(squeeze > 0);
CupertinoPicker picker = new CupertinoPicker(
key,
diameterRatio ,
backgroundColor,
offAxisFraction ,
useMagnifier ,
magnification ,
scrollController,
squeeze ,
itemExtent,
onSelectedItemChanged);
picker.childDelegate = new ListWheelChildBuilderDelegate(builder: itemBuilder, childCount: childCount);
return picker;
public readonly float diameterRatio;
public readonly float? diameterRatio;
public readonly float itemExtent;
public readonly float? itemExtent;
public readonly ListWheelChildDelegate childDelegate;
public ListWheelChildDelegate childDelegate;
public readonly float? squeeze;
public override State createState() {
return new _CupertinoPickerState();

class _CupertinoPickerState : State<CupertinoPicker> {
FixedExtentScrollController _controller;
int _lastHapticIndex;
public override void initState() {
base.initState();
if (widget.scrollController == null) {

}
void _handleSelectedItemChanged(int index) {
//bool hasSuitableHapticHardware;
/*switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
hasSuitableHapticHardware = true;
break;
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
hasSuitableHapticHardware = false;
break;
}*/
/*D.assert(hasSuitableHapticHardware != null);
if (hasSuitableHapticHardware && index != _lastHapticIndex) {
_lastHapticIndex = index;
HapticFeedback.selectionClick();
}*/
Widget _buildGradientScreen() {
if (widget.backgroundColor != null && widget.backgroundColor.alpha < 255) {
return new Container();
}
Widget _buildMagnifierScreen() {
Color resolvedBorderColor = CupertinoDynamicColor.resolve(CupertinoPickerUtils._kHighlighterBorder, context);
Color widgetBackgroundColor = widget.backgroundColor ?? new Color(0xFFFFFFFF);
return Positioned.fill(
child: new IgnorePointer(
return new IgnorePointer(
child: new Center(
gradient: new LinearGradient(
colors: new List<Color> {
widgetBackgroundColor,
widgetBackgroundColor.withAlpha(0xF2),
widgetBackgroundColor.withAlpha(0xDD),
widgetBackgroundColor.withAlpha(0),
widgetBackgroundColor.withAlpha(0),
widgetBackgroundColor.withAlpha(0xDD),
widgetBackgroundColor.withAlpha(0xF2),
widgetBackgroundColor,
},
stops: new List<float> {
0.0f, 0.05f, 0.09f, 0.22f, 0.78f, 0.91f, 0.95f, 1.0f
},
begin: Alignment.topCenter,
end: Alignment.bottomCenter
)
)
)
)
);
}
Widget _buildMagnifierScreen() {
Color foreground = widget.backgroundColor?.withAlpha(
(int) (widget.backgroundColor.alpha * CupertinoPickerUtils._kForegroundScreenOpacityFraction)
);
return new IgnorePointer(
child: new Column(
children: new List<Widget> {
new Expanded(
child: new Container(
color: foreground
border: new Border(
top: new BorderSide(width: 0.0f, color: resolvedBorderColor),
bottom: new BorderSide(width: 0.0f, color: resolvedBorderColor)
new Container(
decoration: new BoxDecoration(
border: new Border(
top: new BorderSide(width: 0.0f, color: CupertinoPickerUtils._kHighlighterBorder),
bottom: new BorderSide(width: 0.0f, color: CupertinoPickerUtils._kHighlighterBorder)
)
),
constraints: BoxConstraints.expand(
height: widget.itemExtent * widget.magnification
)
),
new Expanded(
child: new Container(
color: foreground
)
),
}
)
);
}
Widget _buildUnderMagnifierScreen() {
Color foreground = widget.backgroundColor?.withAlpha(
(int) (widget.backgroundColor.alpha * CupertinoPickerUtils._kForegroundScreenOpacityFraction)
);
return new Column(
children: new List<Widget> {
new Expanded(child: new Container()),
new Container(
color: foreground,
),
new Expanded(child: new Container())
}
)
)
public override Widget build(BuildContext context) {
Color resolvedBackgroundColor = CupertinoDynamicColor.resolve(widget.backgroundColor, context);
Widget _addBackgroundToChild(Widget child) {
return new DecoratedBox(
decoration: new BoxDecoration(
color: widget.backgroundColor
),
child: child
);
}
public override Widget build(BuildContext context) {
Widget result = new Stack(
children: new List<Widget> {
Positioned.fill(
Widget result = new DefaultTextStyle(
style: CupertinoTheme.of(context).textTheme.pickerTextStyle,
child: new Stack(
children: new List<Widget>{
Positioned.fill(
child: new _CupertinoPickerSemantics(
scrollController: widget.scrollController ?? _controller,
physics: new FixedExtentScrollPhysics(),
diameterRatio: widget.diameterRatio,
physics: new FixedExtentScrollPhysics(),
diameterRatio: (float)widget.diameterRatio,
itemExtent: widget.itemExtent,
overAndUnderCenterOpacity: CupertinoPickerUtils._kOverAndUnderCenterOpacity,
itemExtent: (float)widget.itemExtent,
squeeze: (float)widget.squeeze,
)
),
_buildGradientScreen(),
_buildMagnifierScreen()
}
);
if (widget.backgroundColor != null && widget.backgroundColor.alpha < 255) {
result = new Stack(
children: new List<Widget> {
_buildUnderMagnifierScreen(), _addBackgroundToChild(result),
),
_buildMagnifierScreen(),
)
return new DecoratedBox(
decoration: new BoxDecoration(color: resolvedBackgroundColor),
child: result
);
}
}
public class _CupertinoPickerSemantics : SingleChildRenderObjectWidget {
public _CupertinoPickerSemantics(
Key key = null,
Widget child = null,
FixedExtentScrollController scrollController = null
) : base(key: key, child: child) {
this.scrollController = scrollController;
}
public readonly FixedExtentScrollController scrollController;
public override RenderObject createRenderObject(BuildContext context) {
return new _RenderCupertinoPickerSemantics(scrollController, Directionality.of(context));
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (_RenderCupertinoPickerSemantics) renderObject;
((_RenderCupertinoPickerSemantics)renderObject).textDirection = Directionality.of(context);
((_RenderCupertinoPickerSemantics) renderObject).controller = scrollController;
}
}
public class _RenderCupertinoPickerSemantics : RenderProxyBox {
public _RenderCupertinoPickerSemantics(FixedExtentScrollController controller, TextDirection textDirection) {
this.controller = controller;
_textDirection = textDirection;
}
public FixedExtentScrollController controller {
get { return _controller; }
set {
if (value == _controller)
return;
if (_controller != null)
_controller.removeListener(_handleScrollUpdate);
else
_currentIndex = value.initialItem == 0 ? 0 : value.initialItem ;
value.addListener(_handleScrollUpdate);
_controller = value;
else {
result = _addBackgroundToChild(result);
}
FixedExtentScrollController _controller;
public TextDirection textDirection {
get { return _textDirection; }
set {
if (textDirection == value)
return;
_textDirection = value;
//markNeedsSemanticsUpdate();
}
TextDirection _textDirection;
return result;
int _currentIndex = 0;
void _handleIncrease() {
controller.jumpToItem(_currentIndex + 1);
}
void _handleDecrease() {
if (_currentIndex == 0)
return;
controller.jumpToItem(_currentIndex - 1);
void _handleScrollUpdate() {
if (controller.selectedItem == _currentIndex)
return;
_currentIndex = controller.selectedItem;
//markNeedsSemanticsUpdate();
}
}

2
com.unity.uiwidgets/Runtime/cupertino/text_field.cs


padding: widget.padding,
child: new RepaintBoundary(
child: new EditableText(
smartDashesType: SmartDashesType.disabled,
smartQuotesType:SmartQuotesType.disabled,
key: _editableTextKey,
controller: controller,
focusNode: _effectiveFocusNode,

4
com.unity.uiwidgets/Runtime/cupertino/text_selection.cs


);
}
public override Size handleSize {
get { return CupertinoTextSelectionUtils._kSelectionOffset; }
}
public override Offset getHandleAnchor(TextSelectionHandleType type, float textLineHeight) {
Size handleSize = getHandleSize(textLineHeight);
switch (type) {

25
com.unity.uiwidgets/Runtime/cupertino/text_theme.cs


TextStyle pickerTextStyle = null,
TextStyle dateTimePickerTextStyle = null
) {
_defaults = defaults ?? new _TextThemeDefaultsBuilder(CupertinoColors.label, CupertinoColors.inactiveGray);
D.assert((_navActionTextStyle != null && _actionTextStyle != null) || _primaryColor != null);
_textStyle = textStyle;
_actionTextStyle = actionTextStyle;
_tabLabelTextStyle = tabLabelTextStyle;

_pickerTextStyle = pickerTextStyle;
_dateTimePickerTextStyle = dateTimePickerTextStyle;
_defaults = defaults ??
//new _TextThemeDefaultsBuilder(Color.white,Color.white);
new _TextThemeDefaultsBuilder(CupertinoColors.label, CupertinoColors.inactiveGray);
D.assert((_navActionTextStyle != null && _actionTextStyle != null) || _primaryColor != null);
}
/*public static CupertinoTextThemeData _raw(
_TextThemeDefaultsBuilder _defaults,

public new CupertinoTextThemeData copyWith(
Color primaryColor,
TextStyle textStyle,
TextStyle actionTextStyle,
TextStyle tabLabelTextStyle,
TextStyle navTitleTextStyle,
TextStyle navLargeTitleTextStyle,
TextStyle navActionTextStyle,
TextStyle pickerTextStyle,
TextStyle dateTimePickerTextStyle
Color primaryColor = null,
TextStyle textStyle = null,
TextStyle actionTextStyle = null,
TextStyle tabLabelTextStyle = null,
TextStyle navTitleTextStyle = null,
TextStyle navLargeTitleTextStyle = null,
TextStyle navActionTextStyle = null,
TextStyle pickerTextStyle = null,
TextStyle dateTimePickerTextStyle = null
) {
return new CupertinoTextThemeData(
_defaults,

4
com.unity.uiwidgets/Runtime/gestures/force_press.cs


}
public GestureForcePressStartCallback onStart;
GestureForcePressUpdateCallback onUpdate;
GestureForcePressPeakCallback onPeak;
public GestureForcePressUpdateCallback onUpdate;
public GestureForcePressPeakCallback onPeak;
public GestureForcePressEndCallback onEnd;
public readonly float startPressure;
public readonly float peakPressure;

5
com.unity.uiwidgets/Runtime/material/dropdown.cs


return Future.value(false).to<bool>();
}
public void didChangeAccessibilityFeatures() {
//FIX ME!!!!
throw new NotImplementedException();
}
public void didChangePlatformBrightness() {
}

7
com.unity.uiwidgets/Runtime/material/text_field.cs


autofocus: widget.autofocus,
obscureText: widget.obscureText,
autocorrect: widget.autocorrect,
//TODO: update this
// smartDashesType: widget.smartDashesType,
// smartQuotesType: widget.smartQuotesType,
smartDashesType: widget.smartDashesType,
smartQuotesType: widget.smartQuotesType,
enableSuggestions: widget.enableSuggestions,
maxLines: widget.maxLines,
minLines: widget.minLines,

onSelectionHandleTapped: _handleSelectionHandleTapped,
inputFormatters: formatters,
rendererIgnoresPointer: true,
cursorWidth: widget.cursorWidth,
cursorWidth: widget.cursorWidth.Value,
cursorRadius: cursorRadius,
cursorColor: cursorColor,
selectionHeightStyle: widget.selectionHeightStyle,

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


MaterialUtils._kHandleSize);
}
public override Size handleSize {
get {
return new Size(MaterialUtils._kHandleSize,
MaterialUtils._kHandleSize);
}
}
public override Widget buildToolbar(BuildContext context, Rect globalEditableRegion, float textLineHeight,
Offset selectionMidpoint, List<TextSelectionPoint> endpoints, TextSelectionDelegate selectionDelegate) {
D.assert(WidgetsD.debugCheckHasMediaQuery(context));

2
com.unity.uiwidgets/Runtime/material/user_accounts_drawer_header.cs


width: UserAccountsDrawerHeaderUtils._kAccountDetailsHeight,
child: new Center(
child: Transform.rotate(
degree: _animation.value * Mathf.PI,
angle: _animation.value * Mathf.PI,
child: new Icon(
Icons.arrow_drop_down,
color: widget.arrowColor

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


}
public override Alignment resolve(TextDirection? direction) {
D.assert(direction != null);
direction = direction ?? TextDirection.ltr;
switch (direction) {
case TextDirection.rtl:
return new Alignment(_x - _start, _y);

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


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

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

10
com.unity.uiwidgets/Runtime/painting/edge_insets.cs


}
float horizontal {
public float horizontal {
float vertical {
public float vertical {
get { return _top + _bottom; }
}

public static EdgeInsetsDirectional fromSTEB(float start, float top, float end, float bottom) {
return new EdgeInsetsDirectional(start, top, end, bottom);
}
public static EdgeInsetsDirectional only(float start = 0, float top = 0, float end = 0, float bottom = 0) {
return new EdgeInsetsDirectional(start, top, end, bottom);
public static EdgeInsetsDirectional only( float start = 0.0f, float top = 0.0f,float end = 0.0f,float bottom = 0.0f) {
return new EdgeInsetsDirectional(start,top,end,bottom);
}
static EdgeInsetsDirectional zero = only();

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


);
}
bool containsKey(Object key) {
public bool containsKey(Object key) {
return _pendingImages[key] != null || _cache[key] != null;
}

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


return new ImageStream();
}
void resolveStreamForKey(ImageConfiguration configuration, ImageStream stream, T key,
public virtual void resolveStreamForKey(ImageConfiguration configuration, ImageStream stream, T key,
ImageErrorListener handleError) {
if (stream.completer != null) {
ImageStreamCompleter completerEdge = PaintingBinding.instance.imageCache.putIfAbsent(

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


public class TextPainter {
InlineSpan _text;
TextAlign _textAlign;
TextAlign? _textAlign;
TextDirection? _textDirection;
float _textScaleFactor;
Paragraph _layoutTemplate;

_textHeightBehavior = textHeightBehavior;
}
void markNeedsLayout() {
public void markNeedsLayout() {
_paragraph = null;
_needsLayout = true;
_previousCaretPosition = null;

}
}
public TextAlign textAlign {
public TextAlign? textAlign {
get { return _textAlign; }
set {
if (_textAlign == value) {

}
}
public List<TextBox> inlinePlaceholderBoxes {
get {
return _inlinePlaceholderBoxes;
}
}
List<float> inlinePlaceholderScales {
get { return _inlinePlaceholderScales; }
public List<float> inlinePlaceholderScales {
get {
return _inlinePlaceholderScales;
}
}
List<float> _inlinePlaceholderScales;

}
}
void setPlaceholderDimensions(List<PlaceholderDimensions> value) {
public void setPlaceholderDimensions(List<PlaceholderDimensions> value) {
if (value == null || value.isEmpty() || value.equalsList(_placeholderDimensions)) {
return;
}

return _paragraph.getWordBoundary(position);
}
TextRange getLineBoundary(TextPosition position) {
public TextRange getLineBoundary(TextPosition position) {
D.assert(!_needsLayout);
return _paragraph.getLineBoundary(position);
}

bool _isUnicodeDirectionality(int? value) {
return value == 0x200F || value == 0x200E;
}
public int getOffsetAfter(int offset) {
int? nextCodeUnit = _text.codeUnitAt(offset);
if (nextCodeUnit == null)
return 0;
// TODO(goderbauer): doesn't handle extended grapheme clusters with more than one Unicode scalar value (https://github.com/flutter/flutter/issues/13404).
return _isUtf16Surrogate(nextCodeUnit.Value) ? offset + 2 : offset + 1;
}
public int getOffsetBefore(int offset) {
int? prevCodeUnit = _text.codeUnitAt(offset - 1);
if (prevCodeUnit == null)
return 0;
// TODO(goderbauer): doesn't handle extended grapheme clusters with more than one Unicode scalar value (https://github.com/flutter/flutter/issues/13404).
return _isUtf16Surrogate(prevCodeUnit.Value) ? offset - 2 : offset - 1;
}
}
}

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


}
public ParagraphStyle getParagraphStyle(
TextAlign textAlign,
TextDirection textDirection,
TextAlign? textAlign = null,
TextDirection? textDirection = null,
float? textScaleFactor = 1.0f,
string ellipsis = null,
int? maxLines = null,

10
com.unity.uiwidgets/Runtime/rendering/animated_size.cs


TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
Curve curve = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,
) : base(child: child, alignment: alignment ?? Alignment.center) {
) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection) {
curve = curve ?? Curves.linear;
curve = curve ?? Curves.linear;
_vsync = vsync;
_controller = new AnimationController(
vsync: this.vsync,

}
child.layout(constraints, parentUsesSize: true);
switch (_state) {
case RenderAnimatedSizeState.start:
_layoutStart();

33
com.unity.uiwidgets/Runtime/rendering/binding.cs


public void initRenderView() {
D.assert(renderView == null);
renderView = new RenderView(configuration: createViewConfiguration());
renderView.scheduleInitialFrame();
renderView.prepareInitialFrame();
}
public MouseTracker mouseTracker {

}
protected virtual void handleMetricsChanged() {
D.assert(renderView != null);
renderView.configuration = createViewConfiguration();
scheduleForcedFrame();
}

_mouseTracker.schedulePostFrameCheck();
}
int _firstFrameDeferredCount = 0;
bool _firstFrameSent = false;
bool sendFramesToEngine {
get {
return _firstFrameSent || _firstFrameDeferredCount == 0;
}
}
void deferFirstFrame() {
D.assert(_firstFrameDeferredCount >= 0);
_firstFrameDeferredCount += 1;
}
void allowFirstFrame() {
D.assert(_firstFrameDeferredCount > 0);
_firstFrameDeferredCount -= 1;
if (!_firstFrameSent)
scheduleWarmUpFrame();
}
void resetFirstFrameSent() {
_firstFrameSent = false;
}
readonly protected bool inEditorWindow;

}*/
protected virtual void drawFrame() {
D.assert(renderView != null);
renderView.compositeFrame();
if (sendFramesToEngine) {
renderView.compositeFrame();
_firstFrameSent = true;
}
}
public override void hitTest(HitTestResult result, Offset position) {

10
com.unity.uiwidgets/Runtime/rendering/box.cs


float maxWidth = float.PositiveInfinity,
float minHeight = 0.0f,
float maxHeight = float.PositiveInfinity) {
D.assert(minWidth != null);
D.assert(maxWidth != null);
D.assert(minHeight != null);
D.assert (maxHeight != null);
this.minWidth = minWidth;
this.maxWidth = maxWidth;
this.minHeight = minHeight;

}
public bool addWithRawTransform(
Matrix4 transform,
Offset position,
BoxHitTest hitTest
Matrix4 transform = null,
Offset position = null,
BoxHitTest hitTest = null
) {
D.assert(hitTest != null);
Offset transformedPosition = position == null || transform == null

4
com.unity.uiwidgets/Runtime/rendering/custom_layout.cs


MultiChildLayoutDelegate _delegate;
/*public override void attach(PipelineOwner owner) {
public override void attach(object owner) {
base.attach(owner);
_delegate?._relayout?.addListener(markNeedsLayout);
}

base.detach();
}*/
}
Size _getSize(BoxConstraints constraints) {
D.assert(constraints.debugAssertIsValid());

3
com.unity.uiwidgets/Runtime/rendering/custom_paint.cs


if (debugNewCanvasSaveCount < debugPreviousCanvasSaveCount) {
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary($"The {painter} custom painter called canvas.restore() " +
new ErrorSummary(
$"The {painter} custom painter called canvas.restore() " +
$"{debugPreviousCanvasSaveCount - debugNewCanvasSaveCount} more " +
"times than it called canvas.save() or canvas.saveLayer()."
),

5
com.unity.uiwidgets/Runtime/rendering/debug.cs


using Unity.UIWidgets.painting;
public static bool debugRepaintTextRainbowEnabled = false;
static readonly HSVColor _kDebugDefaultRepaintColor = HSVColor.fromAHSV(0.4f, 60.0f, 1.0f, 1.0f);
public static HSVColor debugCurrentRepaintColor = _kDebugDefaultRepaintColor;
}
}

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


TileMode.repeated
);
_labelBackgroundPaint.color = new Color(0xFFFFFFFF);
for (int i = 0; i < 4; i++) {
_OverflowSide e = new _OverflowSide();
var len = Enum.GetNames(e.GetType()).Length;
for (int i = 0; i < len; i++) {
_indicatorLabel.Add(new TextPainter(textDirection: TextDirection.ltr));
}
}

);
regions.Add(new _OverflowRegionData(
rect: markerRect,
label: "LEFT OVERFLOWED BY ${_formatPixels(overflow.left)} PIXELS",
label: $"LEFT OVERFLOWED BY {_formatPixels(overflow.left)} PIXELS",
labelOffset: markerRect.centerLeft +
new Offset(_indicatorFontSizePixels + _indicatorLabelPaddingPixels, 0.0f),
rotation: Mathf.PI / 2.0f,

static void _reportOverflow(RenderObject renderObject, RelativeRect overflow, List<DiagnosticsNode> overflowHints) {
overflowHints = overflowHints ?? new List<DiagnosticsNode>();
if (overflowHints.isEmpty()) {
overflowHints.Add(new ErrorDescription($"The edge of the {renderObject.GetType()} that is " +
"overflowing has been marked in the rendering with a yellow and black " +
"striped pattern. This is usually caused by the contents being too big " +
$"for the {renderObject.GetType()}."));
overflowHints.Add(
new ErrorDescription(
$"The edge of the {renderObject.GetType()} that is " +
"overflowing has been marked in the rendering with a yellow and black " +
"striped pattern. This is usually caused by the contents being too big " +
$"for the {renderObject.GetType()}."));
overflowHints.Add(new ErrorHint("This is considered an error condition because it indicates that there " +
"is content that cannot be seen. If the content is legitimately bigger " +
"than the available space, consider clipping it with a ClipRect widget " +
$"before putting it in the {renderObject.GetType()}, or using a scrollable " +
"container, like a ListView."));
overflowHints.Add(
new ErrorHint(
"This is considered an error condition because it indicates that there " +
"is content that cannot be seen. If the content is legitimately bigger " +
"than the available space, consider clipping it with a ClipRect widget " +
$"before putting it in the {renderObject.GetType()}, or using a scrollable " +
"container, like a ListView."));
List<string> overflows = new List<string> { };
List<string> overflows = new List<string>();
if (overflow.left > 0.0f) {
overflows.Add($"{_formatPixels(overflow.left)} pixels on the left");
}

}
yield return DiagnosticsNode.message($"The specific {renderObject.GetType()} in question is: {renderObject.toStringShallow(joiner: "\n ")}");
yield return DiagnosticsNode.message(string.Concat(Enumerable.Repeat("◢◤", 32)));
yield return DiagnosticsNode.message(string.Concat(Enumerable.Repeat("◢◤", 32)),allowWrap: false);
}
UIWidgetsError.reportError(

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


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.services;
using Unity.UIWidgets.ui;
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;

public static readonly float _kCaretHeightOffset = 2.0f;
public static readonly Offset _kFloatingCaretSizeIncrease = new Offset(0.5f, 1.0f);
public static readonly float _kFloatingCaretRadius = 1.0f;
public static bool _isWhitespace(int codeUnit) {
switch (codeUnit) {
case 0x9: // horizontal tab
case 0xA: // line feed
case 0xB: // vertical tab
case 0xC: // form feed
case 0xD: // carriage return
case 0x1C: // file separator
case 0x1D: // group separator
case 0x1E: // record separator
case 0x1F: // unit separator
case 0x20: // space
case 0xA0: // no-break space
case 0x1680: // ogham space mark
case 0x2000: // en quad
case 0x2001: // em quad
case 0x2002: // en space
case 0x2003: // em space
case 0x2004: // three-per-em space
case 0x2005: // four-er-em space
case 0x2006: // six-per-em space
case 0x2007: // figure space
case 0x2008: // punctuation space
case 0x2009: // thin space
case 0x200A: // hair space
case 0x202F: // narrow no-break space
case 0x205F: // medium mathematical space
case 0x3000: // ideographic space
break;
default:
return false;
}
return true;
}
}
public delegate void SelectionChangedHandler(TextSelection selection, RenderEditable renderObject,

}
public override string ToString() {
return $"Point: {point}, Direction: {direction}";
switch (direction) {
case TextDirection.ltr:
return $"{point}-ltr";
case TextDirection.rtl:
return $"{point}-rtl";
}
return $"{point}";
public class RenderEditable : RenderBox {
public class RenderEditable : RenderBox, RelayoutWhenSystemFontsChangeMixin {
TextSpan text,
TextDirection textDirection,
TextAlign textAlign = TextAlign.left,
TextSpan text = null,
TextDirection? textDirection = null,
TextAlign textAlign = TextAlign.start,
LayerLink startHandleLayerLink = null,
LayerLink endHandleLayerLink = null,
int? maxLines = 1,
int? minLines = null,
bool expands = false,

SelectionChangedHandler onSelectionChanged = null,
CaretChangedHandler onCaretChanged = null,
bool ignorePointer = false,
bool readOnly = false,
bool forceLine = true,
TextWidthBasis textWidthBasis = TextWidthBasis.parent,
Locale locale = null,
ui.BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
ui.BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
TextSelectionDelegate textSelectionDelegate = null,
GlobalKeyEventHandlerDelegate globalKeyEventHandler = null) {
TextSelectionDelegate textSelectionDelegate = null)
{
D.assert(textSelectionDelegate != null);
D.assert(textDirection != null, () => "RenderEditable created without a textDirection.");
D.assert(maxLines == null || maxLines > 0);
D.assert(maxLines == null || maxLines > 0);
D.assert((maxLines == null) || (minLines == null) || maxLines >= minLines,
() => "minLines can't be greater than maxLines");
D.assert(startHandleLayerLink != null);
D.assert(endHandleLayerLink != null);
D.assert(
(maxLines == null) || (minLines == null) || (maxLines >= minLines), ()=>
"minLines can't be greater than maxLines"
);
D.assert(
!expands || (maxLines == null && minLines == null),()=>
"minLines and maxLines must be null when expands is true."
);
D.assert(cursorWidth >= 0.0f);
D.assert(textSelectionDelegate != null);
D.assert( cursorWidth >= 0.0);
textDirection: textDirection,
textDirection: textDirection ?? TextDirection.ltr,
strutStyle: strutStyle);
locale: locale,
strutStyle: strutStyle,
textWidthBasis: textWidthBasis
);
_hasFocus = hasFocus ?? false;
_obscureText = obscureText;
_paintCursorOnTop = paintCursorAboveText;
_cursorOffset = cursorOffset;
_floatingCursorAddedMargin = floatingCursorAddedMargin;
_devicePixelRatio = devicePixelRatio;
_selectionHeightStyle = selectionHeightStyle;
_selectionWidthStyle = selectionWidthStyle;
_startHandleLayerLink = startHandleLayerLink;
_endHandleLayerLink = endHandleLayerLink;
_obscureText = obscureText;
_readOnly = readOnly;
_forceLine = forceLine;
D.assert(_showCursor != null);
D.assert(!_showCursor.value || cursorColor != null);
this.hasFocus = hasFocus ?? false;
this.globalKeyEventHandler = globalKeyEventHandler;
_tap = new TapGestureRecognizer(this);
_tap.onTapDown = _handleTapDown;
_tap.onTap = _handleTap;
_longPress = new LongPressGestureRecognizer(debugOwner: this);
_longPress.onLongPress = _handleLongPress;
_paintCursorOnTop = paintCursorAboveText;
_cursorOffset = cursorOffset;
_floatingCursorAddedMargin = floatingCursorAddedMargin;
_devicePixelRatio = devicePixelRatio;
float? _textLayoutLastWidth;
float? _textLayoutLastMaxWidth;
float? _textLayoutLastMinWidth;
public TextWidthBasis textWidthBasis {
get {
return _textPainter.textWidthBasis;
}
set {
D.assert(value != null);
if (_textPainter.textWidthBasis == value)
return;
_textPainter.textWidthBasis = value;
markNeedsTextLayout();
}
}
public ui.BoxHeightStyle selectionHeightStyle {
get {
return _selectionHeightStyle;
}
set {
D.assert(value != null);
if (_selectionHeightStyle == value)
return;
_selectionHeightStyle = value;
markNeedsPaint();
}
}
ui.BoxHeightStyle _selectionHeightStyle;
public ui.BoxWidthStyle selectionWidthStyle {
get {
return _selectionWidthStyle;
}
set {
D.assert(value != null);
if (_selectionWidthStyle == value)
return;
_selectionWidthStyle = value;
markNeedsPaint();
}
}
ui.BoxWidthStyle _selectionWidthStyle;
public LayerLink startHandleLayerLink {
get {
return _startHandleLayerLink;
}
set {
if (_startHandleLayerLink == value)
return;
_startHandleLayerLink = value;
markNeedsPaint();
}
}
LayerLink _startHandleLayerLink;
public LayerLink endHandleLayerLink {
get {
return _endHandleLayerLink;
}
set {
if (_endHandleLayerLink == value)
return;
_endHandleLayerLink = value;
markNeedsPaint();
}
}
LayerLink _endHandleLayerLink;
public bool forceLine {
get {
return _forceLine;
}
set {
D.assert(value != null);
if (_forceLine == value)
return;
_forceLine = value;
markNeedsLayout();
}
}
bool _forceLine = false;
public bool readOnly {
get {
return _readOnly;
}
set {
D.assert(value != null);
if (_readOnly == value)
return;
_readOnly = value;
}
}
bool _readOnly = false;
float _devicePixelRatio;
public float devicePixelRatio {

}
_obscureText = value;
markNeedsSemanticsUpdate();
}
}

Rect visibleRegion = Offset.zero & size;
Offset startOffset = _textPainter.getOffsetForCaret(
new TextPosition(offset: _selection.start, affinity: _selection.affinity),
Rect.zero
_caretPrototype
);
float visibleRegionSlop = 0.5f;

Offset endOffset = _textPainter.getOffsetForCaret(
new TextPosition(offset: _selection.end, affinity: _selection.affinity),
Rect.zero
_caretPrototype
);
_selectionEndInViewport.value = visibleRegion
.inflate(visibleRegionSlop)

bool _resetCursor = false;
void _handleSelectionChange(
TextSelection nextSelection,
SelectionChangedCause cause
) {
bool focusingEmpty = nextSelection.baseOffset == 0
&& nextSelection.extentOffset == 0
&& !hasFocus;
if (nextSelection == selection
&& cause != SelectionChangedCause.keyboard
&& !focusingEmpty) {
return;
}
onSelectionChanged?.Invoke(nextSelection, this, cause);
}
void _handleKeyEvent(RawKeyEvent keyEvent) {
if (keyEvent is RawKeyUpEvent) {
return;

return newOffset;
}
int _handleShift(bool rightArrow, bool leftArrow, bool shift, int newOffset) {
if (onSelectionChanged == null) {

}
protected void markNeedsTextLayout() {
_textLayoutLastWidth = null;
_textLayoutLastMaxWidth = null;
_textLayoutLastMinWidth = null;
public void systemFontsDidChange() {
_textPainter.markNeedsLayout();
_textLayoutLastMaxWidth = null;
_textLayoutLastMinWidth = null;
}
void _handleSetSelection(TextSelection selection) {
_handleSelectionChange(selection, SelectionChangedCause.keyboard);
}
void _handleMoveCursorForwardByCharacter(bool extentSelection) {
int extentOffset = _textPainter.getOffsetAfter(_selection.extentOffset);
if (extentOffset == null)
return;
int baseOffset = !extentSelection ? extentOffset : _selection.baseOffset;
_handleSelectionChange(
new TextSelection(baseOffset: baseOffset, extentOffset: extentOffset), SelectionChangedCause.keyboard
);
}
void _handleMoveCursorBackwardByCharacter(bool extentSelection) {
int extentOffset = _textPainter.getOffsetBefore(_selection.extentOffset);
if (extentOffset == null)
return;
int baseOffset = !extentSelection ? extentOffset : _selection.baseOffset;
_handleSelectionChange(
new TextSelection(baseOffset: baseOffset, extentOffset: extentOffset), SelectionChangedCause.keyboard
);
}
void _handleMoveCursorForwardByWord(bool extentSelection) {
TextRange currentWord = _textPainter.getWordBoundary(_selection.extent);
if (currentWord == null)
return;
TextRange nextWord = _getNextWord(currentWord.end);
if (nextWord == null)
return;
int baseOffset = extentSelection ? _selection.baseOffset : nextWord.start;
_handleSelectionChange(
new TextSelection(
baseOffset: baseOffset,
extentOffset: nextWord.start
),
SelectionChangedCause.keyboard
);
}
void _handleMoveCursorBackwardByWord(bool extentSelection) {
TextRange currentWord = _textPainter.getWordBoundary(_selection.extent);
if (currentWord == null)
return;
TextRange previousWord = _getPreviousWord(currentWord.start - 1);
if (previousWord == null)
return;
int baseOffset = extentSelection ? _selection.baseOffset : previousWord.start;
_handleSelectionChange(
new TextSelection(
baseOffset: baseOffset,
extentOffset: previousWord.start
),
SelectionChangedCause.keyboard
);
}
TextRange _getNextWord(int offset) {
while (true) {
TextRange range = _textPainter.getWordBoundary(new TextPosition(offset: offset));
if (range == null || !range.isValid || range.isCollapsed)
return null;
if (!_onlyWhitespace(range))
return range;
offset = range.end;
}
}
TextRange _getPreviousWord(int offset) {
while (offset >= 0) {
TextRange range = _textPainter.getWordBoundary(new TextPosition(offset: offset));
if (range == null || !range.isValid || range.isCollapsed)
return null;
if (!_onlyWhitespace(range))
return range;
offset = range.start - 1;
}
return null;
}
bool _onlyWhitespace(TextRange range) {
for (int i = range.start; i < range.end; i++) {
int codeUnit = text.codeUnitAt(i).Value;
if (!EditableUtils._isWhitespace(codeUnit)) {
return false;
}
}
return true;
}
public void attach(PipelineOwner owner) {
_tap = new TapGestureRecognizer(debugOwner: this);
_tap.onTapDown = _handleTapDown;
_tap.onTap = _handleTap;
_longPress = new LongPressGestureRecognizer(debugOwner: this);
_longPress.onLongPress = _handleLongPress;
_offset.addListener(markNeedsLayout);
_showCursor.addListener(markNeedsPaint);
}
string _cachedPlainText;
string _plainText {
get {
_cachedPlainText = _cachedPlainText ?? _textPainter.text.toPlainText();
return _cachedPlainText;
}
}
TextPainter _textPainter;
public TextSpan text {

}
_textPainter.text = value;
_cachedPlainText = null;
markNeedsSemanticsUpdate();
public TextAlign textAlign {
public TextAlign? textAlign {
get { return _textPainter.textAlign; }
set {
if (_textPainter.textAlign == value) {

_textPainter.textAlign = value;
markNeedsPaint();
markNeedsTextLayout();
}
}

_textPainter.textDirection = value;
markNeedsTextLayout();
markNeedsSemanticsUpdate();
}
}

}
}
public Locale locale {
get { return _textPainter.locale;
}
set {
if (_textPainter.locale == value)
return;
_textPainter.locale = value;
markNeedsTextLayout();
}
}
Color _backgroundCursorColor;
public Color backgroundCursorColor {

RawKeyboard.instance.removeListener(_handleKeyEvent);
_listenerAttached = false;
}
markNeedsSemanticsUpdate();
int? _maxLines;
public int? maxLines {

_selection = value;
_selectionRects = null;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}

_enableInteractiveSelection = value;
markNeedsTextLayout();
markNeedsSemanticsUpdate();
}
}

attach((PipelineOwner)ownerObject);
/*_tap = new TapGestureRecognizer(debugOwner: this);
_tap.onTapDown = _handleTapDown;
_tap.onTap = _handleTap;
_longPress = new LongPressGestureRecognizer(debugOwner: this);
_longPress.onLongPress = _handleLongPress;
_showCursor.addListener(markNeedsPaint);
_showCursor.addListener(markNeedsPaint);*/
_tap.dispose();
_longPress.dispose();
_offset.removeListener(markNeedsLayout);
_showCursor.removeListener(markNeedsPaint);
if (_listenerAttached) {

return 0.0f;
}
float _maxScrollExtent = 0;
float _caretMargin {
get {
return EditableUtils._kCaretGap + cursorWidth;
}
}
public float maxScrollExtent {
get { return _maxScrollExtent; }
}
float _maxScrollExtent = 0;
/// Returns the local coordinates of the endpoints of the given selection.
///
/// If the selection is collapsed (and therefore occupies a single point), the
/// returned list is of length one. Otherwise, the selection is not collapsed
/// and the returned list is of length two. In this case, however, the two
/// points might actually be co-located (e.g., because of a bidirectional
/// selection that contains some text but whose ends meet in the middle).
///
_layoutText(constraints.maxWidth);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
var paintOffset = _paintOffset;
if (selection.isCollapsed) {
var caretOffset = _textPainter.getOffsetForCaret(selection.extendPos, _caretPrototype);

}
public TextPosition getPositionForPoint(Offset globalPosition) {
_layoutText(constraints.maxWidth);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
_layoutText(constraints.maxWidth);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
var caretOffset = _textPainter.getOffsetForCaret(caretPosition, _caretPrototype);
Rect rect = Rect.fromLTWH(0.0f, 0.0f, cursorWidth, preferredLineHeight)
.shift(caretOffset + _paintOffset);

}
protected internal override float computeMinIntrinsicWidth(float height) {
_layoutText(float.PositiveInfinity);
_layoutText(maxWidth: float.PositiveInfinity);
_layoutText(float.PositiveInfinity);
_layoutText(maxWidth: float.PositiveInfinity);
return _textPainter.maxIntrinsicWidth + cursorWidth;
}

bool minLimited = minLines != null && minLines > 1;
bool maxLimited = maxLines != null;
if (minLimited || maxLimited) {
_layoutText(width);
_layoutText(maxWidth: width);
if (minLimited && _textPainter.height < preferredLineHeight * minLines.Value) {
return preferredLineHeight * minLines.Value;
}

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

return preferredLineHeight * lines;
}
_layoutText(width);
_layoutText(maxWidth: width);
return Mathf.Max(preferredLineHeight, _textPainter.height);
}

}
public override float? computeDistanceToActualBaseline(TextBaseline baseline) {
_layoutText(constraints.maxWidth);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
return _textPainter.computeDistanceToActualBaseline(baseline);
}

D.assert(cause != null);
D.assert(from != null);
_layoutText(constraints.maxWidth);
if (onSelectionChanged != null) {
TextPosition fromPosition =
_textPainter.getPositionForOffset(globalToLocal(from - _paintOffset));
TextPosition toPosition = to == null
? null
: _textPainter.getPositionForOffset(globalToLocal(to - _paintOffset));
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
if (onSelectionChanged == null) {
return;
}
TextPosition fromPosition =
_textPainter.getPositionForOffset(globalToLocal(from - _paintOffset));
TextPosition toPosition = to == null
? null
: _textPainter.getPositionForOffset(globalToLocal(to - _paintOffset));
int baseOffset = fromPosition.offset;
int extentOffset = fromPosition.offset;
if (toPosition != null) {
baseOffset = Mathf.Min(fromPosition.offset, toPosition.offset);
extentOffset = Mathf.Max(fromPosition.offset, toPosition.offset);
}
int baseOffset = fromPosition.offset;
int extentOffset = fromPosition.offset;
if (toPosition != null) {
baseOffset = Mathf.Min(fromPosition.offset, toPosition.offset);
extentOffset = Mathf.Max(fromPosition.offset, toPosition.offset);
}
TextSelection newSelection = new TextSelection(
baseOffset: baseOffset,
extentOffset: extentOffset,
affinity: fromPosition.affinity);
TextSelection newSelection = new TextSelection(
baseOffset: baseOffset,
extentOffset: extentOffset,
affinity: fromPosition.affinity);
onSelectionChanged(newSelection, this, cause.Value);
}
_handleSelectionChange(newSelection, cause.Value);
}
public void selectPosition(SelectionChangedCause? cause = null) {

public void selectWordsInRange(Offset from = null, Offset to = null, SelectionChangedCause? cause = null) {
D.assert(cause != null);
D.assert(from != null);
_layoutText(constraints.maxWidth);
if (onSelectionChanged != null) {
TextPosition firstPosition =
_textPainter.getPositionForOffset(globalToLocal(from - _paintOffset));
TextSelection firstWord = _selectWordAtOffset(firstPosition);
TextSelection lastWord = to == null
? firstWord
: _selectWordAtOffset(
_textPainter.getPositionForOffset(globalToLocal(to - _paintOffset)));
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
if (onSelectionChanged == null) {
return;
}
TextPosition firstPosition =
_textPainter.getPositionForOffset(globalToLocal(from - _paintOffset));
TextSelection firstWord = _selectWordAtOffset(firstPosition);
TextSelection lastWord = to == null
? firstWord
: _selectWordAtOffset(
_textPainter.getPositionForOffset(globalToLocal(to - _paintOffset)));
onSelectionChanged(
new TextSelection(
baseOffset: firstWord.baseOffset,
extentOffset: lastWord.extentOffset,
affinity: firstWord.affinity),
this,
cause.Value);
}
_handleSelectionChange(
new TextSelection(
baseOffset: firstWord.baseOffset,
extentOffset: lastWord.extentOffset,
affinity: firstWord.affinity),
cause.Value);
_layoutText(constraints.maxWidth);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
if (onSelectionChanged != null) {
TextPosition position =
_textPainter.getPositionForOffset(
globalToLocal(_lastTapDownPosition - _paintOffset));
TextRange word = _textPainter.getWordBoundary(position);
if (position.offset - word.start <= 1) {
onSelectionChanged(
TextSelection.collapsed(offset: word.start, affinity: TextAffinity.downstream),
this,
cause
);
}
else {
onSelectionChanged(
TextSelection.collapsed(offset: word.end, affinity: TextAffinity.upstream),
this,
cause
);
}
if (onSelectionChanged == null) {
return;
}
TextPosition position =
_textPainter.getPositionForOffset(
globalToLocal(_lastTapDownPosition - _paintOffset));
TextRange word = _textPainter.getWordBoundary(position);
if (position.offset - word.start <= 1) {
_handleSelectionChange(
TextSelection.collapsed(offset: word.start, affinity: TextAffinity.downstream),
cause
);
}
else {
_handleSelectionChange(
TextSelection.collapsed(offset: word.end, affinity: TextAffinity.upstream),
cause
);
D.assert(_textLayoutLastWidth == constraints.maxWidth);
D.assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
_textLayoutLastMinWidth == constraints.minWidth,
() => $"Last width ({_textLayoutLastMinWidth}, {_textLayoutLastMaxWidth}) not the same as max width constraint ({constraints.minWidth}, {constraints.maxWidth}).");
if (obscureText) {
return new TextSelection(baseOffset: 0, extentOffset: _plainText.Length);
}
TextSelection _selectLineAtOffset(TextPosition position) {
D.assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
_textLayoutLastMinWidth == constraints.minWidth,
() => $"Last width ({_textLayoutLastMinWidth}, {_textLayoutLastMaxWidth}) not the same as max width constraint ({constraints.minWidth}, {constraints.maxWidth}).");
TextRange line = _textPainter.getLineBoundary(position);
if (position.offset >= line.end)
return TextSelection.fromPosition(position);
// If text is obscured, the entire string should be treated as one line.
if (obscureText) {
return new TextSelection(baseOffset: 0, extentOffset: _plainText.Length);
}
return new TextSelection(baseOffset: line.start, extentOffset: line.end);
}
void _layoutText(float constraintWidth) {
if (_textLayoutLastWidth == constraintWidth) {
void _layoutText( float minWidth = 0.0f, float maxWidth = float.PositiveInfinity ) {
D.assert(maxWidth != null && minWidth != null);
if (_textLayoutLastMaxWidth == maxWidth && _textLayoutLastMinWidth == minWidth)
}
var caretMargin = EditableUtils._kCaretGap + cursorWidth;
var avialableWidth = Mathf.Max(0.0f, constraintWidth - caretMargin);
var maxWidth = _isMultiline ? avialableWidth : float.PositiveInfinity;
_textPainter.layout(minWidth: avialableWidth, maxWidth: maxWidth);
_textLayoutLastWidth = constraintWidth;
float availableMaxWidth = Mathf.Max(0.0f, maxWidth - _caretMargin);
float availableMinWidth = Mathf.Min(minWidth, availableMaxWidth);
float textMaxWidth = _isMultiline ? availableMaxWidth : float.PositiveInfinity;
float textMinWidth = forceLine ? availableMaxWidth : availableMinWidth;
_textPainter.layout(
minWidth: textMinWidth,
maxWidth: textMaxWidth
);
_textLayoutLastMinWidth = minWidth;
_textLayoutLastMaxWidth = maxWidth;
}
Rect _getCaretPrototype {

return Rect.fromLTWH(0.0f, EditableUtils._kCaretHeightOffset, cursorWidth,
preferredLineHeight - 2.0f * EditableUtils._kCaretHeightOffset);
}
return null;
_layoutText(constraints.maxWidth);
BoxConstraints constraints = this.constraints;
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
size = new Size(constraints.maxWidth,
constraints.constrainHeight(_preferredHeight(constraints.maxWidth)));
var contentSize = new Size(textPainterSize.width + EditableUtils._kCaretGap + cursorWidth,
textPainterSize.height);
float width = forceLine ? constraints.maxWidth : constraints
.constrainWidth(_textPainter.size.width + _caretMargin);
size = new Size(width, constraints.constrainHeight(_preferredHeight(constraints.maxWidth)));
Size contentSize = new Size(textPainterSize.width + _caretMargin, textPainterSize.height);
_maxScrollExtent = _getMaxScrollExtent(contentSize);
offset.applyViewportDimension(_viewportExtent);
offset.applyContentDimensions(0.0f, _maxScrollExtent);

}
void _paintCaret(Canvas canvas, Offset effectiveOffset, TextPosition textPosition) {
D.assert(_textLayoutLastWidth == constraints.maxWidth);
D.assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
_textLayoutLastMinWidth == constraints.minWidth,
() => $"Last width ({_textLayoutLastMinWidth}, {_textLayoutLastMaxWidth}) not the same as max width constraint ({constraints.minWidth}, {constraints.maxWidth}).");
var paint = new Paint() {color = _floatingCursorOn ? backgroundCursorColor : _cursorColor};
var caretOffset = _textPainter.getOffsetForCaret(textPosition, _caretPrototype) + effectiveOffset;
Rect caretRect = _caretPrototype.shift(caretOffset);

if (caretHeight != null) {
switch (Application.platform) {
case RuntimePlatform.IPhonePlayer:
float heightDiff = caretHeight.Value - caretRect.height;
float? heightDiff = caretHeight - caretRect.height;
caretRect.top + heightDiff / 2f,
(caretRect.top + heightDiff / 2).Value,
caretRect.width,
caretRect.height
);

// describeSemanticsConfiguration todo
void _paintFloatingCaret(Canvas canvas, Offset effectiveOffset) {
D.assert(_textLayoutLastWidth == constraints.maxWidth);
D.assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
_textLayoutLastMinWidth == constraints.minWidth,
() => $"Last width ({_textLayoutLastMinWidth}, {_textLayoutLastMaxWidth}) not the same as max width constraint ({constraints.minWidth}, {constraints.maxWidth}).");
D.assert(_floatingCursorOn);
Paint paint = new Paint() {color = _cursorColor.withOpacity(0.75f)};

}
void _paintSelection(Canvas canvas, Offset effectiveOffset) {
D.assert(_textLayoutLastWidth == constraints.maxWidth);
D.assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
_textLayoutLastMinWidth == constraints.minWidth,
() => $"Last width ({_textLayoutLastMinWidth}, {_textLayoutLastMaxWidth}) not the same as max width constraint ({constraints.minWidth}, {constraints.maxWidth}).");
D.assert(_selectionRects != null);
var paint = new Paint() {color = _selectionColor};

}
void _paintContents(PaintingContext context, Offset offset) {
D.assert(_textLayoutLastWidth == constraints.maxWidth);
D.assert(_textLayoutLastMaxWidth == constraints.maxWidth &&
_textLayoutLastMinWidth == constraints.minWidth,
() => $"Last width ({_textLayoutLastMinWidth}, {_textLayoutLastMaxWidth}) not the same as max width constraint ({constraints.minWidth}, {constraints.maxWidth}).");
var effectiveOffset = offset + _paintOffset;
bool showSelection = false;

}
if (showSelection) {
_selectionRects = _selectionRects ?? _textPainter.getBoxesForSelection(_selection);
_selectionRects = _selectionRects ?? _textPainter.getBoxesForSelection(_selection, boxHeightStyle: _selectionHeightStyle, boxWidthStyle: _selectionWidthStyle);
_paintSelection(context.canvas, effectiveOffset);
}

}
}
void markNeedsSemanticsUpdate() {
// todo
void _paintHandleLayers(PaintingContext context, List<TextSelectionPoint> endpoints) {
Offset startPoint = endpoints[0].point;
startPoint = new Offset(
startPoint.dx.clamp(0.0f, size.width),
startPoint.dy.clamp(0.0f, size.height)
);
context.pushLayer(
new LeaderLayer(link: startHandleLayerLink, offset: startPoint),
base.paint,
Offset.zero
);
if (endpoints.Count == 2) {
Offset endPoint = endpoints[1].point;
endPoint = new Offset(
endPoint.dx.clamp(0.0f, size.width),
endPoint.dy.clamp(0.0f, size.height)
);
context.pushLayer(
new LeaderLayer(link: endHandleLayerLink, offset: endPoint),
base.paint,
Offset.zero
);
}
_layoutText(constraints.maxWidth);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
_paintHandleLayers(context, getEndpointsForSelection(selection));
properties.add(new DiagnosticsProperty<Color>("cursorColor", cursorColor));
properties.add(new ColorProperty("cursorColor", cursorColor));
properties.add(new DiagnosticsProperty<Color>("selectionColor", selectionColor));
properties.add(new ColorProperty("selectionColor", selectionColor));
properties.add(new DiagnosticsProperty<Locale>("locale", locale, defaultValue: null));
}
public override List<DiagnosticsNode> debugDescribeChildren() {

94
com.unity.uiwidgets/Runtime/rendering/flex.cs


public int flex;
public FlexFit fit;
public override string ToString() => $"{base.ToString()}; flex={flex}; fit={fit}";
}
public enum MainAxisSize {

public TextBaseline _textBaseline;
bool _debugHasNecessaryDirections {
get {
if (firstChild != null && lastChild != firstChild) {
// i.e. there's more than one child
switch (direction) {
case Axis.horizontal:
D.assert(textDirection != null, () => "Horizontal $runtimeType with multiple children has a null textDirection, so the layout order is undefined.");
break;
case Axis.vertical:
D.assert(verticalDirection != null, () => "Vertical $runtimeType with multiple children has a null verticalDirection, so the layout order is undefined.");
break;
}
}
if (mainAxisAlignment == MainAxisAlignment.start ||
mainAxisAlignment == MainAxisAlignment.end) {
switch (direction) {
case Axis.horizontal:
D.assert(textDirection != null, () => "Horizontal $runtimeType with $mainAxisAlignment has a null textDirection, so the alignment cannot be resolved.");
break;
case Axis.vertical:
D.assert(verticalDirection != null, () => "Vertical $runtimeType with $mainAxisAlignment has a null verticalDirection, so the alignment cannot be resolved.");
break;
}
}
if (crossAxisAlignment == CrossAxisAlignment.start ||
crossAxisAlignment == CrossAxisAlignment.end) {
switch (direction) {
case Axis.horizontal:
D.assert(verticalDirection != null, () => "Horizontal $runtimeType with $crossAxisAlignment has a null verticalDirection, so the alignment cannot be resolved.");
break;
case Axis.vertical:
D.assert(textDirection != null, () => "Vertical $runtimeType with $crossAxisAlignment has a null textDirection, so the alignment cannot be resolved.");
break;
}
}
return true;
}
}
public float _overflow;
bool _hasOverflow {

}
public float _getIntrinsicSize(
Axis sizingDirection,
float extent,
_ChildSizingFunction childSize
Axis? sizingDirection = null,
float? extent = null,
_ChildSizingFunction childSize = null
) {
if (_direction == sizingDirection) {
float totalFlex = 0.0f;

int flex = _getFlex(child);
totalFlex += flex;
if (flex > 0) {
float flexFraction = childSize(child, extent) / _getFlex(child);
float flexFraction = childSize(child, extent.Value) / _getFlex(child);
inflexibleSpace += childSize(child, extent);
inflexibleSpace += childSize(child, extent.Value);
}
var childParentData = (FlexParentData) child.parentData;

return maxFlexFractionSoFar * totalFlex + inflexibleSpace;
}
else {
float availableMainSpace = extent;
float? availableMainSpace = extent;
int totalFlex = 0;
float inflexibleSpace = 0.0f;
float maxCrossSize = 0.0f;

child = childParentData.nextSibling;
}
float spacePerFlex = Mathf.Max(0.0f, (availableMainSpace - inflexibleSpace) / totalFlex);
float spacePerFlex = Mathf.Max(0.0f, ((availableMainSpace - inflexibleSpace) / totalFlex).Value);
child = firstChild;
while (child != null) {

}
protected override void performLayout() {
D.assert(_debugHasNecessaryDirections);
BoxConstraints constraints = this.constraints;
D.assert(constraints != null);
float maxMainSize = _direction == Axis.horizontal
? constraints.maxWidth
: constraints.maxHeight;

allocatedSize += _getMainSize(child);
crossSize = Mathf.Max(crossSize, _getCrossSize(child));
}
D.assert(child.parentData == childParentData);
child = childParentData.nextSibling;
}

),
new ErrorDescription(
$"The edge of the {GetType()} that is overflowing has been marked " +
"in the rendering with a yellow and black striped pattern. This is " +
"usually caused by the contents being too big for the $runtimeType."
),
"in the rendering with a yellow and black striped pattern. This is " +
"usually caused by the contents being too big for the $runtimeType."
),
),
),
new ErrorHint(
"This is considered an error condition because it indicates that there " +
"is content that cannot be seen. If the content is legitimately bigger " +

)
};
)};
Rect overflowChildRect;
switch (_direction) {

protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
return defaultHitTestChildren(result, position: position);
}
public override Rect describeApproximatePaintClip(RenderObject child) => _hasOverflow ? Offset.zero & size : null;
public override string toStringShort() {
String header = base.toStringShort();
if (_overflow is float && _hasOverflow)
header += " OVERFLOWING";
return header;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new EnumProperty<Axis>("direction", direction));
properties.add(new EnumProperty<MainAxisAlignment>("mainAxisAlignment", mainAxisAlignment));
properties.add(new EnumProperty<MainAxisSize>("mainAxisSize", mainAxisSize));
properties.add(new EnumProperty<CrossAxisAlignment>("crossAxisAlignment", crossAxisAlignment));
properties.add(new EnumProperty<TextDirection>("textDirection", textDirection, defaultValue: null));
properties.add(new EnumProperty<VerticalDirection>("verticalDirection", verticalDirection, defaultValue: null));
properties.add(new EnumProperty<TextBaseline>("textBaseline", textBaseline, defaultValue: null));
}
}
}

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


Color color = null,
BlendMode colorBlendMode = BlendMode.srcIn,
BoxFit? fit = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
bool matchTextDirection = false,
TextDirection? textDirection = null,
D.assert(alignment != null);
_image = image;
_width = width;
_height = height;

_alignment = alignment ?? Alignment.center;
_invertColors = invertColors;
_filterQuality = filterQuality;
_textDirection = textDirection;
_matchTextDirection = matchTextDirection;
}
Alignment _resolvedAlignment;
bool _flipHorizontally;
void _resolve() {
if (_resolvedAlignment != null)
return;
_resolvedAlignment = alignment.resolve(textDirection);
_flipHorizontally = matchTextDirection && textDirection == TextDirection.rtl;
}
void _markNeedResolution() {
_resolvedAlignment = null;
_flipHorizontally = false;
markNeedsPaint();
}
Image _image;

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

}
}
public bool matchTextDirection {
get { return _matchTextDirection; }
set {
D.assert(value != null);
if (value == _matchTextDirection)
return;
_matchTextDirection = value;
_markNeedResolution();
}
}
bool _matchTextDirection;
public TextDirection? textDirection {
get { return _textDirection; }
set {
if (_textDirection == value)
return;
_textDirection = value;
_markNeedResolution();
}
}
TextDirection? _textDirection;
Size _sizeForConstraints(BoxConstraints constraints) {
constraints = BoxConstraints.tightFor(
_width,

if (_image == null) {
return;
}
_resolve();
D.assert(_resolvedAlignment != null);
D.assert(_flipHorizontally != null);
painting_.paintImage(
canvas: context.canvas,
rect: offset & size,

fit: _fit,
alignment: _alignment,
alignment: _resolvedAlignment,
invertColors: _invertColors,
flipHorizontally: _flipHorizontally,
invertColors: invertColors,
filterQuality: _filterQuality
);
}

properties.add(new EnumProperty<BlendMode>("colorBlendMode", colorBlendMode,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new EnumProperty<BoxFit?>("fit", fit, defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment,
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new EnumProperty<ImageRepeat>("repeat", repeat, defaultValue: ImageRepeat.noRepeat));
properties.add(new DiagnosticsProperty<Rect>("centerSlice", centerSlice,

properties.add(new FlagProperty("matchTextDirection", value: matchTextDirection, ifTrue: "match text direction"));
properties.add(new EnumProperty<TextDirection?>("textDirection", textDirection, defaultValue: null));
}
}
}

132
com.unity.uiwidgets/Runtime/rendering/layer.cs


using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Object = System.Object;
using Rect = Unity.UIWidgets.ui.Rect;
using Shader = Unity.UIWidgets.ui.Shader;
namespace Unity.UIWidgets.rendering {

protected void markNeedsAddToScene() {
D.assert(
!alwaysNeedsAddToScene,()=>
GetType().ToString() +" with alwaysNeedsAddToScene set called markNeedsAddToScene.\n" +
GetType() +" with alwaysNeedsAddToScene set called markNeedsAddToScene.\n" +
"The layer's alwaysNeedsAddToScene is set to true, and therefore it should not call markNeedsAddToScene."
);
if (_needsAddToScene) {

}
public virtual void remove() {
if (parent != null) {
parent._removeChild(this);
}
parent?._removeChild(this);
}
public virtual bool findAnnotations<S>(

S find<S>(Offset localPosition) {
AnnotationResult<S> result = new AnnotationResult<S>();
findAnnotations<S>(result, localPosition, onlyFirst: true);
return result.entries.Count() == 0 ? default : result.entries.First().annotation;
return !result.entries.Any() ? default : result.entries.First().annotation;
}
AnnotationResult<S> findAllAnnotations<S>(Offset localPosition) {

defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<object>("creator", debugCreator,
defaultValue: foundation_.kNullDefaultValue, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<string>("engine layer", foundation_.describeIdentity(_engineLayer)));
}
public void replaceWith(Layer newLayer) {
D.assert(parent != null);

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Rect>("paint bounds", canvasBounds));
properties.add(new DiagnosticsProperty<string>("picture", _picture.GetType().ToString));
properties.add(new DiagnosticsProperty<string>("picture", foundation_.describeIdentity(_picture)));
"isComplex =" + isComplexHint + "willChange ="+ willChangeHint)
$"isComplex = {isComplexHint} willChange = {willChangeHint}")
);
}

public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
Rect shiftedRect = rect.shift(layerOffset);
Rect shiftedRect = layerOffset == Offset.zero ? rect : rect.shift(layerOffset);
builder.addTexture(
textureId,
offset: shiftedRect.topLeft,

get { return _lastChild; }
}
internal Layer _lastChild;
internal bool hasChildren {
get { return _firstChild != null; }
}
public ui.Scene buildScene(ui.SceneBuilder builder) {
List<PictureLayer> temporaryLayers = new List<PictureLayer>();
D.assert(()=> {

UIWidgetsError.reportError(new UIWidgetsErrorDetails(
exception: new UIWidgetsError("Painting order is out of order with respect to elevation.\n" +
"See https://api.flutter.dev/flutter/rendering/debugCheckElevations.html " +
"See https://api.flutter.dev/flutter/rendering/debugCheckElevationsEnabled.html " +
"for more details."),
library: "rendering library",
context: new ErrorDescription("during compositing"),

bool isAbsorbed = child.findAnnotations<S>(result, localPosition, onlyFirst: onlyFirst);
if (isAbsorbed)
return true;
if (onlyFirst && result.entries.Count() != 0)
if (onlyFirst && result.entries.Any())
return isAbsorbed;
}
return false;

}
public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
addChildrenToScene(builder, layerOffset);
}

properties.add(new DiagnosticsProperty<Offset>("offset", offset));
}
public Scene buildScene(SceneBuilder builder) {
/*public Scene buildScene(SceneBuilder builder) {
List<PictureLayer> temporaryLayers = null;
D.assert(() => {
if (RenderingDebugUtils.debugCheckElevationsEnabled) {

return true;
});
return scene;
}
}*/
D.assert(pixelRatio != null);
ui.SceneBuilder builder = new SceneBuilder();
Matrix4 transform = Matrix4.translationValues(
(-bounds.left - offset.dx) * pixelRatio,

public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
D.assert(clipRect != null);
D.assert(clipBehavior != null);
bool enabled = true;
D.assert(() => {

public class ClipRRectLayer : ContainerLayer {
public ClipRRectLayer(
RRect clipRRect = null,
Clip clipBehavior = Clip.hardEdge
Clip clipBehavior = Clip.antiAlias
) {
D.assert(clipRRect != null);
D.assert(clipBehavior != Clip.none);

public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
D.assert(clipRRect != null);
D.assert(clipBehavior != null);
bool enabled = true;
D.assert(() => {
enabled = !D.debugDisableClipLayers;

public class ClipPathLayer : ContainerLayer {
public ClipPathLayer(
Path clipPath = null,
Clip clipBehavior = Clip.hardEdge
Clip clipBehavior = Clip.antiAlias
) {
D.assert(clipPath != null);
D.assert(clipBehavior != Clip.none);

public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
D.assert(clipPath != null);
D.assert(clipBehavior != null);
bool enabled = true;
D.assert(() => {

ColorFilter _colorFilter;
//[!!!]builder.pushColorFilter?
/*public override void addToScene(ui.SceneBuilder builder, Offset layerOffset = null ) {
public override void addToScene(ui.SceneBuilder builder, Offset layerOffset = null ) {
D.assert(colorFilter != null);
engineLayer = builder.pushColorFilter(
colorFilter,

builder.pop();
}*/
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

ui.ImageFilter _imageFilter;
//[!!!] builder.pushImageFilter?
/*public override void addToScene(ui.SceneBuilder builder, Offset layerOffset = null) {
public override void addToScene(ui.SceneBuilder builder, Offset layerOffset = null) {
D.assert(imageFilter != null);
engineLayer = builder.pushImageFilter(
imageFilter,

builder.pop();
}*/
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

public class TransformLayer : OffsetLayer {
public TransformLayer(Matrix4 transform = null, Offset offset = null) : base(offset) {
offset = offset ?? Offset.zero;
_transform = transform ?? Matrix4.identity();
}

D.assert(value != null);
//D.assert(value.storage.Each((float component) => ));
bool componentIsFinite = true;
foreach (var component in value.storage) {
if (!component.isFinite()) {
componentIsFinite = false;
break;
}
}
D.assert(componentIsFinite);
if (value == _transform)
return;
_transform = value;

}
engineLayer = builder.pushTransform(
_lastEffectiveTransform._m4storage,
_lastEffectiveTransform.storage,
oldLayer: engineLayer as TransformEngineLayer);
addChildrenToScene(builder);

public int alpha {
get { return _alpha; }
set {
D.assert(value != null);
if (value != _alpha) {
_alpha = value;
markNeedsAddToScene();

}
public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
D.assert(filter != null);
engineLayer = builder.pushBackdropFilter(
filter: filter,

D.assert(value != null);
_link = value;
}
}
LayerLink _link;

public override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
D.assert(link != null);
D.assert(showWhenUnlinked != null);
D.assert(link != null);
if (link.leader == null && !showWhenUnlinked) {
_lastTransform = null;

defaultValue: foundation_.kNullDefaultValue));
}
}
/*public class PlatformViewLayer : Layer {
public PlatformViewLayer(
Rect rect = null,
int viewId = default,
MouseTrackerAnnotation hoverAnnotation = null
) {
D.assert(rect != null);
}
public readonly Rect rect;
public readonly int viewId;
public readonly MouseTrackerAnnotation hoverAnnotation;
public override void addToScene(ui.SceneBuilder builder, Offset layerOffset = null) {
Rect shiftedRect = layerOffset == Offset.zero ? rect : rect.shift(layerOffset);
builder.addPlatformView(
viewId,
offset: shiftedRect.topLeft,
width: shiftedRect.width,
height: shiftedRect.height
);
}
public override bool findAnnotations<S>(AnnotationResult<S> result, Offset localPosition, bool onlyFirst ) {
if (hoverAnnotation == null || !rect.contains(localPosition)) {
return false;
}
if (typeof(S) == typeof(MouseTrackerAnnotation)) {
Object untypedValue = hoverAnnotation;
S typedValue = (S)untypedValue;
result.add(new AnnotationEntry<S>(
annotation: typedValue,
localPosition: localPosition
));
return true;
}
return false;
}
}*/
int? optionsMask = null,
int? rasterizerThreshold = null,
bool? checkerboardRasterCacheImages = null,
bool? checkerboardOffscreenLayers = null
int optionsMask = default,
int rasterizerThreshold = default,
bool checkerboardRasterCacheImages = default,
bool checkerboardOffscreenLayers = default
) {
_overlayRect = overlayRect;

}
Rect _overlayRect;
public readonly int? optionsMask;
public readonly int? rasterizerThreshold;
public readonly bool? checkerboardRasterCacheImages;
public readonly bool? checkerboardOffscreenLayers;
public readonly int optionsMask;
public readonly int rasterizerThreshold;
public readonly bool checkerboardRasterCacheImages;
public readonly bool checkerboardOffscreenLayers;
public override bool findAnnotations<S>(AnnotationResult<S> result, Offset localPosition, bool onlyFirst ) {
return false;

layerOffset = layerOffset ?? Offset.zero;
var shiftedOverlayRect = layerOffset == Offset.zero ? overlayRect : overlayRect.shift(layerOffset);
builder.addPerformanceOverlay((int)optionsMask, shiftedOverlayRect);
builder.addPerformanceOverlay(optionsMask, shiftedOverlayRect);
//TODO: add implementations
//builder.setRasterizerTracingThreshold(rasterizerThreshold);
//builder.setCheckerboardRasterCacheImages(checkerboardRasterCacheImages);

) {
offset = offset ?? Offset.zero;
D.assert(value != null);
D.assert(opaque != null);
this.value = value;
this.size = size;
this.offset = offset;

public override bool findAnnotations<S>(AnnotationResult<S> result, Offset localPosition, bool onlyFirst ) {
bool isAbsorbed = base.findAnnotations(result, localPosition, onlyFirst: onlyFirst);
if (result.entries.Count() != 0 && onlyFirst)
if (result.entries.Any() && onlyFirst)
return isAbsorbed;
if (size != null && !(offset & size).contains(localPosition)) {
return isAbsorbed;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("elevation", elevation));
properties.add(new DiagnosticsProperty<Color>("color", color));
properties.add(new ColorProperty("color", color));
}
}
}

46
com.unity.uiwidgets/Runtime/rendering/list_body.cs


}
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
D.assert(() => {
switch (mainAxis) {
case Axis.horizontal:

break;
}
throw new UIWidgetsError(
"RenderListBody must have unlimited space along its main axis.\n" +
"RenderListBody does not clip or resize its children, so it must be " +
"placed in a parent that does not constrain the main " +
"axis. You probably want to put the RenderListBody inside a " +
"RenderViewport with a matching main axis.");
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary("RenderListBody must have unlimited space along its main axis."),
new ErrorDescription(
"RenderListBody does not clip or resize its children, so it must be " +
"placed in a parent that does not constrain the main axis."
),
new ErrorHint(
"You probably want to put the RenderListBody inside a " +
"RenderViewport with a matching main axis."
)
});
});
D.assert(() => {

break;
}
throw new UIWidgetsError(
"RenderListBody must have a bounded constraint for its cross axis.\n" +
"RenderListBody forces its children to expand to fit the RenderListBody\"s container, " +
"so it must be placed in a parent that constrains the cross " +
"axis to a finite dimension. If you are attempting to nest a RenderListBody with " +
"one direction inside one of another direction, you will want to " +
"wrap the inner one inside a box that fixes the dimension in that direction, " +
"for example, a RenderIntrinsicWidth or RenderIntrinsicHeight object. " +
"This is relatively expensive, however."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary("RenderListBody must have a bounded constraint for its cross axis."),
new ErrorDescription(
"RenderListBody forces its children to expand to fit the RenderListBody's container, " +
"so it must be placed in a parent that constrains the cross " +
"axis to a finite dimension."
),
// TODO(jacobr): this hint is a great candidate to promote to being an
// automated quick fix in the future.
new ErrorHint(
"If you are attempting to nest a RenderListBody with " +
"one direction inside one of another direction, you will want to " +
"wrap the inner one inside a box that fixes the dimension in that direction, " +
"for example, a RenderIntrinsicWidth or RenderIntrinsicHeight object. " +
"This is relatively expensive, however." // (that's why we don't do it automatically)
)
});
});
float mainAxisExtent = 0.0f;

case Axis.vertical:
return _getIntrinsicCrossAxis((RenderBox child) => child.getMinIntrinsicWidth(height));
}
D.assert(false);
return 0.0f;
}

87
com.unity.uiwidgets/Runtime/rendering/list_wheel_viewport.cs


public interface IListWheelChildManager {
int? childCount { get; }
bool childExistsAt(int index);
void createChild(int index, RenderBox after);
void createChild(int index, RenderBox after = null);
void removeChild(RenderBox child);
}

D.assert(perspective > 0);
D.assert(perspective <= 0.01f, () => perspectiveTooHighMessage);
D.assert(magnification > 0);
D.assert(overAndUnderCenterOpacity != null);
D.assert(squeeze != null);
D.assert(squeeze > 0);
D.assert(
!renderChildrenOutsideViewport || !clipToSize,

return _overAndUnderCenterOpacity;
}
set {
D.assert(value != null);
D.assert(value >= 0 && value <= 1);
if (value == _overAndUnderCenterOpacity)
return;

return _squeeze;
}
set {
D.assert(value != null);
D.assert(value > 0);
if (value == _squeeze)
return;

minWidth: 0.0f
);
float visibleHeight = size.height;
float visibleHeight = size.height * _squeeze;
if (renderChildrenOutsideViewport) {
visibleHeight *= 2;
}

float fractionalY = (untransformedPaintingCoordinates.dy + _itemExtent / 2.0f) / size.height;
float angle = -(fractionalY - 0.5f) * 2.0f * _maxVisibleRadian;
float angle = -(fractionalY - 0.5f) * 2.0f * _maxVisibleRadian / squeeze;
if (angle > Mathf.PI / 2.0f || angle < -Mathf.PI / 2.0f) {
return;
}

Offset offsetToCenter =
new Offset(untransformedPaintingCoordinates.dx, -deltaY - _topScrollMarginExtent);
if (!useMagnifier) {
bool shouldApplyOffCenterDim = overAndUnderCenterOpacity < 1;
if (useMagnifier || shouldApplyOffCenterDim) {
_paintChildWithMagnifier(context, offset, child, transform, offsetToCenter, untransformedPaintingCoordinates);
} else {
else {
_paintChildWithMagnifier(
context,
offset,
child,
transform,
offsetToCenter,
untransformedPaintingCoordinates
);
}
}
void _paintChildWithMagnifier(

// Matrix4x4 cylindricalTransform,
Matrix4 cylindricalTransform,
Offset offsetToCenter,
Offset untransformedPaintingCoordinates

if (isAfterMagnifierTopLine && isBeforeMagnifierBottomLine) {
Rect centerRect = Rect.fromLTWH(
0.0f,
magnifierTopLinePosition, size.width, _itemExtent * _magnification);
magnifierTopLinePosition,
size.width,
_itemExtent * _magnification);
Rect topHalfRect = Rect.fromLTWH(
0.0f,
0.0f, size.width,

magnifierBottomLinePosition, size.width,
magnifierBottomLinePosition,
size.width,
false,
needsCompositing,
false,
needsCompositing,
context2.paintChild(
child,
offset2 + untransformedPaintingCoordinates);
context2.paintChild(child, offset2 + untransformedPaintingCoordinates);
false,
needsCompositing,
offset,
untransformedPaintingCoordinates.dy <= magnifierTopLinePosition
? topHalfRect

PaintingContext context,
Offset offset,
RenderBox child,
// Matrix4x4 cylindricalTransform,
PaintingContextCallback painter = (PaintingContext _context, Offset _offset) => {
_context.paintChild(
child,
_offset + offsetToCenter
);
};
PaintingContextCallback opacityPainter = (PaintingContext context2, Offset offset2) =>{
context2.pushOpacity(offset2, (overAndUnderCenterOpacity * 255).round(), painter);
};
false,
needsCompositing,
cylindricalTransform,
// this._centerOriginTransform(cylindricalTransform),
(PaintingContext _context, Offset _offset) => { _context.paintChild(child, _offset + offsetToCenter); }
_centerOriginTransform(cylindricalTransform),
// Pre-transform painting function.
overAndUnderCenterOpacity == 1 ? painter : opacityPainter
Matrix4 _centerOriginTransform(Matrix4 originalMatrix) {
Matrix4 result = Matrix4.identity();
Offset centerOriginTranslation = Alignment.center.alongSize(size);
result.translate(centerOriginTranslation.dx * (-_offAxisFraction * 2 + 1),
centerOriginTranslation.dy);
result.multiply(originalMatrix);
result.translate(-centerOriginTranslation.dx * (-_offAxisFraction * 2 + 1),
-centerOriginTranslation.dy);
return result;
}
Matrix4 _magnifyTransform() {
Matrix4 magnify = Matrix4.identity();
magnify.translate(size.width * (-_offAxisFraction + 0.5), size.height / 2);
magnify.scale(_magnification, _magnification, _magnification);
magnify.translate(-size.width * (-_offAxisFraction + 0.5), -size.height / 2);
return magnify;
}
public override Rect describeApproximatePaintClip(RenderObject child) {
if (child != null && _shouldClipAtCurrentOffset()) {
return Offset.zero & size;

}
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null
) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
return false;
}

ListWheelParentData parentData = (ListWheelParentData) child.parentData;
float targetOffset = parentData.offset.dy;
Matrix4 transform = target.getTransformTo(this);
Matrix4 transform = target.getTransformTo(child);
Rect bounds = MatrixUtils.transformRect(transform, rect);
Rect targetRect = bounds.translate(0.0f, (size.height - itemExtent) / 2);

262
com.unity.uiwidgets/Runtime/rendering/object.cs


using System;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.rendering {

D.assert(debugAlsoPaintedParent || child._layer.attached);
child._layer.removeAllChildren();
}
D.assert(child._layer is OffsetLayer);
D.assert(() => {
child._layer.debugCreator = child.debugCreator ?? child.GetType().ToString();
return true;

public void pushLayer(ContainerLayer childLayer, PaintingContextCallback painter, Offset offset,
Rect childPaintBounds = null) {
D.assert(!childLayer.attached);
D.assert(childLayer.parent == null);
if (childLayer.hasChildren) {
childLayer.removeAllChildren();
}
stopRecordingIfNeeded();
appendLayer(childLayer);

return new PaintingContext(childLayer, bounds);
}
public void pushClipRect(bool needsCompositing, Offset offset, Rect clipRect, PaintingContextCallback painter,
Clip clipBehavior = Clip.hardEdge) {
public ClipRectLayer pushClipRect(
bool needsCompositing,
Offset offset,
Rect clipRect,
PaintingContextCallback painter,
Clip clipBehavior = Clip.hardEdge,
ClipRectLayer oldLayer = null) {
pushLayer(new ClipRectLayer(offsetClipRect, clipBehavior: clipBehavior),
painter, offset, childPaintBounds: offsetClipRect);
ClipRectLayer layer = oldLayer ?? new ClipRectLayer();
layer.clipRect = offsetClipRect;
layer.clipBehavior = clipBehavior;
pushLayer(layer, painter, offset, childPaintBounds: offsetClipRect);
return layer;
return null;
public void pushClipRRect(bool needsCompositing, Offset offset, Rect bounds, RRect clipRRect,
PaintingContextCallback painter, Clip clipBehavior = Clip.antiAlias) {
public ClipRRectLayer pushClipRRect(
bool needsCompositing,
Offset offset,
Rect bounds,
RRect clipRRect,
PaintingContextCallback painter,
Clip clipBehavior = Clip.antiAlias,
ClipRRectLayer oldLayer = null) {
pushLayer(new ClipRRectLayer(offsetClipRRect, clipBehavior: clipBehavior),
painter, offset, childPaintBounds: offsetBounds);
ClipRRectLayer layer = oldLayer ?? new ClipRRectLayer();
layer.clipRRect = offsetClipRRect;
layer.clipBehavior = clipBehavior;
pushLayer(layer, painter, offset, childPaintBounds: offsetBounds);
return layer;
return null;
public void pushClipPath(bool needsCompositing, Offset offset, Rect bounds, Path clipPath,
PaintingContextCallback painter, Clip clipBehavior = Clip.antiAlias) {
public ClipPathLayer pushClipPath(
bool needsCompositing,
Offset offset,
Rect bounds,
Path clipPath,
PaintingContextCallback painter,
Clip clipBehavior = Clip.antiAlias,
ClipPathLayer oldLayer = null) {
pushLayer(new ClipPathLayer(clipPath: offsetClipPath, clipBehavior: clipBehavior), painter, offset,
childPaintBounds: offsetBounds);
ClipPathLayer layer = oldLayer ?? new ClipPathLayer();
layer.clipPath = offsetClipPath;
layer.clipBehavior = clipBehavior;
pushLayer(layer, painter, offset, childPaintBounds: offsetBounds);
return layer;
return null;
public ColorFilterLayer pushColorFilter(Offset offset, ColorFilter colorFilter, PaintingContextCallback painter, ColorFilterLayer oldLayer = null) {
D.assert(colorFilter != null);
ColorFilterLayer layer = oldLayer ?? new ColorFilterLayer();
layer.colorFilter = colorFilter;
pushLayer(layer, painter, offset);
return layer;
}
public void pushTransform(bool needsCompositing, Offset offset, Matrix4 transform,
PaintingContextCallback painter) {
public TransformLayer pushTransform(
bool needsCompositing,
Offset offset,
Matrix4 transform,
PaintingContextCallback painter,
TransformLayer oldLayer = null) {
Matrix4 effectiveTransform;
if (offset == null || offset == Offset.zero) {
effectiveTransform = transform;

}
if (needsCompositing) {
// it could just be "scale == 0", ignore the assertion.
// D.assert(invertible);
TransformLayer layer = oldLayer ?? new TransformLayer();
layer.transform = effectiveTransform;
new TransformLayer(effectiveTransform),
layer,
return layer;
}
else {
canvas.save();

return null;
public void pushOpacity(Offset offset, int alpha, PaintingContextCallback painter) {
pushLayer(new OpacityLayer(alpha: alpha), painter, offset);
}
public OpacityLayer pushOpacity(Offset offset, int alpha, PaintingContextCallback painter, OpacityLayer oldLayer = null) {
OpacityLayer layer = oldLayer ?? new OpacityLayer();
layer.alpha = alpha;

$"{GetType()}#{GetHashCode()}(layer: {_containerLayer}, canvas bounds: {estimatedBounds}";
}
public ColorFilterLayer pushColorFilter(Offset offset, ColorFilter colorFilter, PaintingContextCallback painter, ColorFilterLayer oldLayer = null) {
D.assert(colorFilter != null);
ColorFilterLayer layer = oldLayer ?? new ColorFilterLayer();
layer.colorFilter = colorFilter;
pushLayer(layer, painter, offset);
return layer;
}
protected Constraints(){}
public abstract bool isTight { get; }
public abstract bool isNormalized { get; }

_needsCompositing = isRepaintBoundary || alwaysNeedsCompositing;
}
void reassemble() {
markNeedsLayout();
markNeedsCompositingBitsUpdate();
markNeedsPaint();
visitChildren((RenderObject child) =>{
child.reassemble();
});
}
public ParentData parentData;
public virtual void setupParentData(RenderObject child) {

D.assert(node._relayoutBoundary == node);
return true;
}
// TODO
/*void markNeedsSemanticsUpdate() {
D.assert(!attached || !owner._debugDoingSemantics);
if (!attached || owner._semanticsOwner == null) {
_cachedSemanticsConfiguration = null;
return;
}
bool wasSemanticsBoundary = _semantics != null && _cachedSemanticsConfiguration?.isSemanticBoundary == true;
_cachedSemanticsConfiguration = null;
bool isEffectiveSemanticsBoundary = _semanticsConfiguration.isSemanticBoundary && wasSemanticsBoundary;
RenderObject node = this;
while (!isEffectiveSemanticsBoundary && node.parent is RenderObject) {
if (node != this && node._needsSemanticsUpdate)
break;
node._needsSemanticsUpdate = true;
node = node.parent as RenderObject;
isEffectiveSemanticsBoundary = node._semanticsConfiguration.isSemanticBoundary;
if (isEffectiveSemanticsBoundary && node._semantics == null) {
return;
}
}
if (node != this && _semantics != null && _needsSemanticsUpdate) {
owner._nodesNeedingSemantics.remove(this);
}
if (!node._needsSemanticsUpdate) {
node._needsSemanticsUpdate = true;
if (owner != null) {
D.assert(node._semanticsConfiguration.isSemanticBoundary || node.parent is! RenderObject);
owner._nodesNeedingSemantics.add(node);
owner.requestVisualUpdate();
}
}
}*/
public virtual void markNeedsLayout() {
D.assert(_debugCanPerformMutations);
if (_needsLayout) {

if (_relayoutBoundary != this) {
_relayoutBoundary = null;
_needsLayout = true;
visitChildren(child => { child._cleanRelayoutBoundary(); });
visitChildren(_cleanChildRelayoutBoundary);
}
static void _cleanChildRelayoutBoundary(RenderObject child) {
child._cleanRelayoutBoundary();
}
public void scheduleInitialLayout() {

D.assert(!_debugDoingThisLayout);
RenderObject relayoutBoundary;
if (!parentUsesSize || sizedByParent || constraints.isTight || !(this.parent is RenderObject)) {
if (!parentUsesSize || sizedByParent || constraints.isTight || !(parent is RenderObject)) {
RenderObject parent = (RenderObject) this.parent;
relayoutBoundary = parent._relayoutBoundary;
relayoutBoundary = (parent as RenderObject)._relayoutBoundary;
}
D.assert(() => {

}
_constraints = constraints;
if (_relayoutBoundary != null && relayoutBoundary != _relayoutBoundary) {
visitChildren(_cleanChildRelayoutBoundary);
}
_relayoutBoundary = relayoutBoundary;
D.assert(!_debugMutationsLocked);

}
}
/// Rotate this render object (not yet implemented).
void rotate(
int oldAngle, // 0..3
int newAngle, // 0..3
TimeSpan time
) { }
public bool debugDoingThisPaint {
get { return _debugDoingThisPaint; }
}

return _layer;
}
set {
D.assert(!isRepaintBoundary);
D.assert(
!isRepaintBoundary,
() => "Attempted to set a layer to a repaint boundary render object.\n" +
"The framework creates and assigns an OffsetLayer to a repaint " +
"boundary automatically."
);
public void setLayer(ContainerLayer newLayer) {
D.assert(
!isRepaintBoundary,()=>
"Attempted to set a layer to a repaint boundary render object.\n" +
"The framework creates and assigns an OffsetLayer to a repaint "+
"boundary automatically.");
_layer = newLayer;
}
public ContainerLayer debugLayer {
get {
ContainerLayer result = null;

return true;
});
D.assert(_layer != null);
D.assert(_layer is OffsetLayer);
if (owner != null) {
owner._nodesNeedingPaint.Add(this);

else if (this.parent is RenderObject) {
D.assert(_layer == null);
var parent = (RenderObject) this.parent;
RenderObject parent = this.parent as RenderObject;
D.assert(parent == this.parent);
}
else {
D.assert(() => {

internal void _paintWithContext(PaintingContext context, Offset offset) {
D.assert(() => {
if (_debugDoingThisPaint) {
throw new UIWidgetsError(
"Tried to paint a RenderObject reentrantly.\n" +
"The following RenderObject was already being painted when it was " +
"painted again:\n" +
" " + toStringShallow(joiner: "\n ") + "\n" +
"Since this typically indicates an infinite recursion, it is " +
"disallowed."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary("Tried to paint a RenderObject reentrantly."),
describeForError(
"The following RenderObject was already being painted when it was " +
"painted again"
),
new ErrorDescription(
"Since this typically indicates an infinite recursion, it is " +
"disallowed."
)
});
}
return true;

D.assert(() => {
if (_needsCompositingBitsUpdate) {
throw new UIWidgetsError(
"Tried to paint a RenderObject before its compositing bits were " +
"updated.\n" +
"The following RenderObject was marked as having dirty compositing " +
"bits at the time that it was painted:\n" +
" " + toStringShallow(joiner: "\n ") + "\n" +
"A RenderObject that still has dirty compositing bits cannot be " +
"painted because this indicates that the tree has not yet been " +
"properly configured for creating the layer tree.\n" +
"This usually indicates an error in the Flutter framework itself."
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary(
"Tried to paint a RenderObject before its compositing bits were " +
"updated."
),
describeForError(
"The following RenderObject was marked as having dirty compositing " +
"bits at the time that it was painted"
),
new ErrorDescription(
"A RenderObject that still has dirty compositing bits cannot be " +
"painted because this indicates that the tree has not yet been " +
"properly configured for creating the layer tree."
),
new ErrorHint(
"This usually indicates an error in the Flutter framework itself."
)
});
}
return true;

}
public Matrix4 getTransformTo(RenderObject ancestor) {
bool ancestorSpecified = ancestor != null;
D.assert(attached);
if (ancestor == null) {

D.assert(renderer != null);
renderers.Add(renderer);
}
if (ancestorSpecified)
renderers.Add(ancestor);
var transform = Matrix4.identity();
for (int index = renderers.Count - 1; index > 0; index -= 1) {
renderers[index].applyPaintTransform(renderers[index - 1], transform);

header += " NEEDS-PAINT";
}
if (_needsCompositingBitsUpdate)
header += " NEEDS-COMPOSITING-BITS-UPDATE";
if (!attached) {
header += " DETACHED";
}

public override string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug) {
public override string toString(DiagnosticLevel minLevel = DiagnosticLevel.info) {
return toStringShort();
}

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FlagProperty("needsCompositing", value: _needsCompositing, ifTrue: "needs compositing"));
properties.add(new DiagnosticsProperty<object>(
"creator", debugCreator, defaultValue: foundation_.kNullDefaultValue,
level: DiagnosticLevel.debug));

defaultValue: foundation_.kNullDefaultValue));
}
public override List<DiagnosticsNode> debugDescribeChildren() => new List<DiagnosticsNode>();
public virtual void showOnScreen(
RenderObject descendant = null,
Rect rect = null,

);
}
}
public DiagnosticsNode describeForError(String name, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.shallow) {
public DiagnosticsNode describeForError(string name, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.shallow) {
return toDiagnosticsNode(name: name, style: style);
}
}

RenderObject childAfter(RenderObject child);
}
public interface RelayoutWhenSystemFontsChangeMixin {
void systemFontsDidChange();
void attach(PipelineOwner owner);
void detach();
}
StackTrace stack = null,
string library = null,
DiagnosticsNode context = null,
RenderObject renderObject = null,

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


namespace Unity.UIWidgets.rendering {
public enum TextOverflow {
/// Clip the overflowing text to fix its container.
/// Fade the overflowing text to transparent.
/// Use an ellipsis to indicate that the text has overflowed.
/// Render overflowing text outside of its container.
visible,
visible
public class RenderParagraph : RenderBox{
// ContainerRenderObjectMixin<RenderBox, TextParentData>,
//RenderBoxContainerDefaultsMixin<RenderBox, TextParentData>,
//RelayoutWhenSystemFontsChangeMixin
public class TextParentData : ContainerBoxParentData<RenderBox> {
public float scale;
public override string ToString() {
List<string> values = new List<string>();
if (offset != null) values.Add("offset=$offset");
if (scale != null) values.Add("scale=$scale");
values.Add(base.ToString());
return string.Join("; ", values);
}
}
public class RenderParagraph : RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<RenderBox, TextParentData> {
static readonly string _kEllipsis = "\u2026";
bool _softWrap;

public RenderParagraph(
InlineSpan text = null,
TextAlign textAlign = TextAlign.left,
TextAlign textAlign = TextAlign.start,
TextDirection textDirection = TextDirection.ltr,
bool softWrap = true,
TextOverflow overflow = TextOverflow.clip,

TextWidthBasis textWidthBasis = TextWidthBasis.parent,
ui.TextHeightBehavior textHeightBehavior = null,
List<RenderBox> children = null
//Action onSelectionChanged = null,
//Color selectionColor = null
D.assert(textAlign != null);
D.assert(textDirection != null);
D.assert(softWrap != null);
D.assert(overflow != null);
D.assert(textScaleFactor != null);
D.assert(textWidthBasis != null);
_softWrap = softWrap;
_overflow = overflow;
_textPainter = new TextPainter(

textWidthBasis: textWidthBasis,
textHeightBehavior: textHeightBehavior
);
_selection = null;
this.onSelectionChanged = onSelectionChanged;
this.selectionColor = selectionColor;
//addAll(children);
//addAll(children);[!!!]?
//_resetHoverHandler();
public override void setupParentData(RenderObject child) {
if (!(child.parentData is TextParentData))
child.parentData = new TextParentData();
}
public Action onSelectionChanged;
public Color selectionColor;

_textPainter.text = value;
_extractPlaceholderSpans(value);
markNeedsPaint();
//markNeedsSemanticsUpdate();
break;
case RenderComparison.layout:
_textPainter.text = value;

break;
/*case RenderComparison.function:
_textPainter.text = value;
markNeedsPaint();
break;
case RenderComparison.paint:
_textPainter.text = value;
markNeedsPaint();
break;
case RenderComparison.layout:
_textPainter.text = value;
markNeedsLayout();
break;*/
}

}
public TextAlign textAlign {
get { return _textPainter.textAlign; }
get { return _textPainter.textAlign.Value; }
set {
if (_textPainter.textAlign == value) {
return;

return;
}
_textPainter.textDirection = textDirection;
_textPainter.textDirection = value;
markNeedsLayout();
}
}

return _textPainter.getOffsetForCaret(position, caretPrototype);
}
List<ui.TextBox> getBoxesForSelection(TextSelection selection) {
D.assert(!debugNeedsLayout);
_layoutTextWithConstraints(constraints);
return _textPainter.getBoxesForSelection(selection);
}
TextPosition getPositionForOffset(Offset offset) {
D.assert(!debugNeedsLayout);
_layoutTextWithConstraints(constraints);
return _textPainter.getPositionForOffset(offset);
}
TextRange getWordBoundary(TextPosition position) {
D.assert(!debugNeedsLayout);
_layoutTextWithConstraints(constraints);
return _textPainter.getWordBoundary(position);
}
public bool softWrap {
get { return _softWrap; }

_overflow = value;
_textPainter.ellipsis = value == TextOverflow.ellipsis ? _kEllipsis : null;
// _textPainter.e
markNeedsLayout();
}
}

}
_textPainter.textScaleFactor = value;
_overflowShader = null;
markNeedsLayout();
}
}

}
_textPainter.maxLines = value;
_overflowShader = null;
markNeedsLayout();
}
}

public TextWidthBasis textWidthBasis {
get { return _textPainter.textWidthBasis; }
set {
D.assert(value != null);
if (_textPainter.textWidthBasis == value)
return;
_textPainter.textWidthBasis = value;

}
protected internal override float computeMinIntrinsicWidth(float height) {
_layoutText();
if (!_canComputeIntrinsics()) {
return 0.0f;
}
_computeChildrenWidthWithMinIntrinsics(height);
_layoutText(); // layout with infinite width.
_layoutText();
if (!_canComputeIntrinsics()) {
return 0.0f;
}
_computeChildrenWidthWithMaxIntrinsics(height);
_layoutText(); // layout with infinite width.
if (!_canComputeIntrinsics()) {
return 0.0f;
}
_computeChildrenHeightWithMinIntrinsics(width);
_layoutText(minWidth: width, maxWidth: width);
return _textPainter.height;
}

}
public override float? computeDistanceToActualBaseline(TextBaseline baseline) {
D.assert(!debugNeedsLayout);
D.assert(constraints != null);
D.assert(constraints.debugAssertIsValid());
return _textPainter.computeDistanceToActualBaseline(baseline);
return _textPainter.computeDistanceToActualBaseline(TextBaseline.alphabetic);
}
bool _canComputeIntrinsics() {
foreach (PlaceholderSpan span in _placeholderSpans) {
switch (span.alignment) {
case ui.PlaceholderAlignment.baseline:
case ui.PlaceholderAlignment.aboveBaseline:
case ui.PlaceholderAlignment.belowBaseline: {
D.assert(RenderObject.debugCheckingIntrinsics,
() => "Intrinsics are not available for PlaceholderAlignment.baseline, " +
"PlaceholderAlignment.aboveBaseline, or PlaceholderAlignment.belowBaseline,");
return false;
}
case ui.PlaceholderAlignment.top:
case ui.PlaceholderAlignment.middle:
case ui.PlaceholderAlignment.bottom: {
continue;
}
}
}
return true;
}
void _computeChildrenWidthWithMaxIntrinsics(float height) {
RenderBox child = firstChild;
List<PlaceholderDimensions> placeholderDimensions = new List<PlaceholderDimensions>(childCount);
int childIndex = 0;
while (child != null) {
placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(child.getMaxIntrinsicWidth(height), height),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baselineOffset:0.0f
);
child = childAfter(child);
childIndex += 1;
}
_textPainter.setPlaceholderDimensions(placeholderDimensions);
}
void _computeChildrenWidthWithMinIntrinsics(float height) {
RenderBox child = firstChild;
List<PlaceholderDimensions> placeholderDimensions = new List<PlaceholderDimensions>(childCount);
int childIndex = 0;
while (child != null) {
float intrinsicWidth = child.getMinIntrinsicWidth(height);
float intrinsicHeight = child.getMinIntrinsicHeight(intrinsicWidth);
placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(intrinsicWidth, intrinsicHeight),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baselineOffset:0.0f
);
child = childAfter(child);
childIndex += 1;
}
_textPainter.setPlaceholderDimensions(placeholderDimensions);
void _computeChildrenHeightWithMinIntrinsics(float width) {
RenderBox child = firstChild;
List<PlaceholderDimensions> placeholderDimensions = new List<PlaceholderDimensions>(childCount);
int childIndex = 0;
while (child != null) {
float intrinsicHeight = child.getMinIntrinsicHeight(width);
float intrinsicWidth = child.getMinIntrinsicWidth(intrinsicHeight);
placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: new Size(intrinsicWidth, intrinsicHeight),
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baselineOffset:0.0f
);
child = childAfter(child);
childIndex += 1;
}
_textPainter.setPlaceholderDimensions(placeholderDimensions);
}
protected override bool hitTestChildren(BoxHitTestResult boxHitTestResult, Offset position = null) {
RenderBox child = firstChild;
while (child != null) {
TextParentData textParentData = child.parentData as TextParentData;
Matrix4 transform = Matrix4.translationValues(
textParentData.offset.dx,
textParentData.offset.dy,
0.0f
);
transform.scale(
textParentData.scale,
textParentData.scale,
textParentData.scale
);
bool isHit = boxHitTestResult.addWithPaintTransform(
transform: transform,
position: position,
hitTest: (BoxHitTestResult result, Offset transformed) => {
D.assert(() => {
Offset manualPosition = (position - textParentData.offset) / textParentData.scale;
return (transformed.dx - manualPosition.dx).abs() < foundation_.precisionErrorTolerance
&& (transformed.dy - manualPosition.dy).abs() < foundation_.precisionErrorTolerance;
});
return child.hitTest(result, position: transformed);
}
);
if (isHit) {
return true;
}
child = childAfter(child);
}
return false;
}
bool _hasFocus = false;
bool _listenerAttached = false;

Offset offset = ((BoxHitTestEntry) entry).localPosition;
TextPosition position = _textPainter.getPositionForOffset(offset);
InlineSpan span = _textPainter.text.getSpanForPosition(position);
(span as TextSpan)?.recognizer?.addPointer((PointerDownEvent) evt);
if (span == null) {
return;
}
if (span is TextSpan) {
TextSpan textSpan = (TextSpan)span;
textSpan.recognizer?.addPointer(evt as PointerDownEvent);
}
}
bool debugHasOverflowShader {
get { return _overflowShader != null; }
void _layoutChildren(BoxConstraints constraints) {
if (childCount == 0) {
return;
}
RenderBox child = firstChild;
_placeholderDimensions = new List<PlaceholderDimensions>(childCount);
int childIndex = 0;
while (child != null) {
child.layout(
new BoxConstraints(
maxWidth: constraints.maxWidth
),
parentUsesSize: true
);
float baselineOffset;
switch (_placeholderSpans[childIndex].alignment) {
case ui.PlaceholderAlignment.baseline: {
baselineOffset = child.getDistanceToBaseline(
_placeholderSpans[childIndex].baseline.Value
).Value;
break;
}
default: {
baselineOffset = 0.0f;
break;
}
}
_placeholderDimensions[childIndex] = new PlaceholderDimensions(
size: child.size,
alignment: _placeholderSpans[childIndex].alignment,
baseline: _placeholderSpans[childIndex].baseline.Value,
baselineOffset: baselineOffset
);
child = childAfter(child);
childIndex += 1;
}
}
void _setParentData() {
RenderBox child = firstChild;
int childIndex = 0;
while (child != null && childIndex < _textPainter.inlinePlaceholderBoxes.Count) {
TextParentData textParentData = child.parentData as TextParentData;
textParentData.offset = new Offset(
_textPainter.inlinePlaceholderBoxes[childIndex].left,
_textPainter.inlinePlaceholderBoxes[childIndex].top
);
textParentData.scale = _textPainter.inlinePlaceholderScales[childIndex];
child = childAfter(child);
childIndex += 1;
}
}
BoxConstraints constraints = this.constraints;
_layoutChildren(constraints);
_setParentData();
var textSize = _textPainter.size;
var textDidExceedMaxLines = _textPainter.didExceedMaxLines;
size = constraints.constrain(textSize);

var hasVisualOverflow = didOverflowWidth || didOverflowHeight;
if (hasVisualOverflow) {
/*switch (_overflow) {
case TextOverflow.visible:
_needsClipping = false;
break;
case TextOverflow.clip:
case TextOverflow.ellipsis:
case TextOverflow.fade:
_needsClipping = true;
break;
}*/
case TextOverflow.visible:
_needsClipping = false;
break;
case TextOverflow.clip:
case TextOverflow.ellipsis:
case TextOverflow.fade:
_needsClipping = true;
break;
case TextOverflow.visible:
_needsClipping = false;
_overflowShader = null;
break;
case TextOverflow.clip:
case TextOverflow.ellipsis:
_needsClipping = true;
_overflowShader = null;
break;
case TextOverflow.fade:
D.assert(textDirection != null);
_needsClipping = true;
TextPainter fadeSizePainter = new TextPainter(
text: new TextSpan(style: _textPainter.text.style, text: "\u2026"),
textDirection: textDirection.Value,
textScaleFactor: textScaleFactor,
locale: locale
);
fadeSizePainter.layout();
if (didOverflowWidth) {
float fadeEnd = 0, fadeStart = 0;
switch (textDirection) {
case TextDirection.rtl:
fadeEnd = 0.0f;
fadeStart = fadeSizePainter.width;
break;
case TextDirection.ltr:
fadeEnd = size.width;
fadeStart = fadeEnd - fadeSizePainter.width;
break;
}
_overflowShader = ui.Gradient.linear(
new Offset(fadeStart, 0.0f),
new Offset(fadeEnd, 0.0f),
new List<Color>{new Color(0xFFFFFFFF), new Color(0x00FFFFFF)}
);
} else {
float fadeEnd = size.height;
float fadeStart = fadeEnd - fadeSizePainter.height / 2.0f;
_overflowShader = ui.Gradient.linear(
new Offset(0.0f, fadeStart),
new Offset(0.0f, fadeEnd),
new List<Color> {new Color(0xFFFFFFFF), new Color(0x00FFFFFF)}
);
}
break;
_overflowShader = null;
_selectionRects = null;
void paintParagraph(PaintingContext context, Offset offset) {
/*void paintParagraph(PaintingContext context, Offset offset) {
_layoutTextWithConstraints(constraints);
var canvas = context.canvas;

else {
paintParagraph(context, offset);
}
} */
public override void paint(PaintingContext context2, Offset offset2) {
_layoutTextWithConstraints(constraints);
D.assert(() => {
if (RenderingDebugUtils.debugRepaintTextRainbowEnabled) {
Paint paint = new Paint();
paint.color = RenderingDebugUtils.debugCurrentRepaintColor.toColor();
context2.canvas.drawRect(offset2 & size, paint);
}
return true;
});
if (_needsClipping) {
Rect bounds = offset2 & size;
if (_overflowShader != null) {
context2.canvas.saveLayer(bounds, new Paint());
} else {
context2.canvas.save();
}
context2.canvas.clipRect(bounds);
}
_textPainter.paint(context2.canvas, offset2);
RenderBox child = firstChild;
int childIndex = 0;
while (child != null && childIndex < _textPainter.inlinePlaceholderBoxes.Count) {
TextParentData textParentData = child.parentData as TextParentData;
float scale = textParentData.scale;
context2.pushTransform(
needsCompositing,
offset2 + textParentData.offset,
Matrix4.diagonal3Values(scale, scale, scale),
(PaintingContext context, Offset offset) => {
context.paintChild(
child,
offset
);
}
);
child = childAfter(child);
childIndex += 1;
}
if (_needsClipping) {
if (_overflowShader != null) {
context2.canvas.translate(offset2.dx, offset2.dy);
Paint paint = new Paint();
paint.blendMode = BlendMode.modulate;
paint.shader = _overflowShader;
context2.canvas.drawRect(Offset.zero & size, paint);
}
context2.canvas.restore();
}
}

_textPainter.layout(minWidth, widthMatters ? maxWidth : float.PositiveInfinity);
}
List<PlaceholderDimensions> _placeholderDimensions;
_textPainter.setPlaceholderDimensions(_placeholderDimensions);
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
}

ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextOverflow>("overflow", overflow));
properties.add(new FloatProperty("textScaleFactor", textScaleFactor, defaultValue: 1.0f));
properties.add(new DiagnosticsProperty<Locale>("locale", locale, defaultValue: null));
properties.add(new IntProperty("maxLines", maxLines, ifNull: "unlimited"));
}
}

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


namespace Unity.UIWidgets.rendering {
public enum PerformanceOverlayOption {
drawFPS, //default
drawFrameCost
displayRasterizerStatistics,
visualizeRasterizerStatistics,
displayEngineStatistics,
visualizeEngineStatistics,
int optionsMask = 0
int optionsMask = 0,
int rasterizerThreshold = 0,
bool checkerboardRasterCacheImages = false,
bool checkerboardOffscreenLayers = false
_optionMask = optionsMask;
D.assert(optionsMask != null);
D.assert(rasterizerThreshold != null);
D.assert(checkerboardRasterCacheImages != null);
D.assert(checkerboardOffscreenLayers != null);
_optionsMask = optionsMask;
_rasterizerThreshold = rasterizerThreshold;
_checkerboardRasterCacheImages = checkerboardRasterCacheImages;
_checkerboardOffscreenLayers = checkerboardOffscreenLayers;
get { return _optionMask; }
get { return _optionsMask; }
if (value == _optionMask) {
if (value == _optionsMask) {
_optionMask = value;
_optionsMask = value;
markNeedsPaint();
}
}
int _optionsMask;
public int rasterizerThreshold {
get {
return _rasterizerThreshold;
}
set {
D.assert(value != null);
if (value == _rasterizerThreshold)
return;
_rasterizerThreshold = value;
markNeedsPaint();
}
}
int _rasterizerThreshold;
public bool checkerboardRasterCacheImages {
get {
return _checkerboardRasterCacheImages;
}
set {
D.assert(value != null);
if (value == _checkerboardRasterCacheImages)
return;
_checkerboardRasterCacheImages = value;
bool _checkerboardRasterCacheImages;
int _optionMask;
public bool checkerboardOffscreenLayers {
get { return _checkerboardOffscreenLayers; }
set {
D.assert(value != null);
if (value == _checkerboardOffscreenLayers)
return;
_checkerboardOffscreenLayers = value;
markNeedsPaint();
}
}
bool _checkerboardOffscreenLayers;
protected override bool sizedByParent {
get { return true; }

float _intrinsicHeight {
get {
const float kDefaultGraphHeight = 80.0f;
float result = 20f;
if ((optionsMask | (1 << (int) PerformanceOverlayOption.drawFrameCost)) > 0) {
float result = 0.0f;
if (
((optionsMask | (1 << (int) PerformanceOverlayOption.displayRasterizerStatistics)) > 0) ||
((optionsMask | (1 << (int) PerformanceOverlayOption.visualizeRasterizerStatistics)) > 0)
)
}
if (((optionsMask | (1 << (int) PerformanceOverlayOption.displayEngineStatistics)) > 0) ||
((optionsMask | (1 << (int) PerformanceOverlayOption.visualizeEngineStatistics)) > 0))
result += kDefaultGraphHeight;
return result;
return result;
}

D.assert(needsCompositing);
context.addLayer(new PerformanceOverlayLayer(
overlayRect: Rect.fromLTWH(offset.dx, offset.dy, size.width, size.height),
optionsMask: optionsMask
optionsMask: optionsMask,
rasterizerThreshold: rasterizerThreshold,
checkerboardRasterCacheImages: checkerboardRasterCacheImages,
checkerboardOffscreenLayers: checkerboardOffscreenLayers
));
}
}

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


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

public class ShapeBorderClipper : CustomClipper<Path> {
public ShapeBorderClipper(
ShapeBorder shape = null) {
ShapeBorder shape = null,
TextDirection? textDirection = null
) {
this.textDirection = textDirection;
public readonly TextDirection? textDirection;
return shape.getOuterPath(Offset.zero & size);
return shape.getOuterPath(Offset.zero & size, textDirection: textDirection);
if (oldClipper.GetType() != GetType()) {
if (oldClipper.GetType() != typeof(ShapeBorderClipper))
}
ShapeBorderClipper typedOldClipper = (ShapeBorderClipper) oldClipper;
return typedOldClipper.shape != shape;
ShapeBorderClipper typedOldClipper = oldClipper as ShapeBorderClipper;
return typedOldClipper.shape != shape
|| typedOldClipper.textDirection != textDirection;
}
}

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

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

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

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

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

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

Alignment alignment = null,
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,
_textDirection = textDirection;
}
Alignment _resolvedAlignment;

return;
}
_resolvedAlignment = alignment;
_resolvedAlignment = alignment.resolve(textDirection);
}
void _markNeedResolution() {

BoxFit _fit;
public Alignment alignment {
public AlignmentGeometry alignment {
get { return _alignment; }
set {
D.assert(value != null);

_markNeedResolution();
}
}
AlignmentGeometry _alignment;
Alignment _alignment;
public TextDirection? textDirection {
get {
return _textDirection;
}
set {
if (_textDirection == value)
return;
_textDirection = value;
_clearPaintData();
_markNeedResolution();
}
}
TextDirection? _textDirection;
protected override void performLayout() {
if (child != null) {

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new EnumProperty<BoxFit>("fit", fit));
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
}
}

50
com.unity.uiwidgets/Runtime/rendering/proxy_sliver.cs


public class RenderSliverAnimatedOpacity :RenderAnimatedOpacityMixinRenderSliver<RenderSliver>{
public RenderSliverAnimatedOpacity(
Animation<float> opacity ,
RenderSliver sliver = null,
bool alwaysIncludeSemantics = false
RenderSliver sliver = null
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
child = sliver;
}
}

float opacity = 1.0f,
bool alwaysIncludeSemantics = false
float opacity = 1.0f
D.assert(alwaysIncludeSemantics != null);
_alwaysIncludeSemantics = alwaysIncludeSemantics;
_alpha = ui.Color.getAlphaFromOpacity(opacity);
child = sliver;
}

}
}
float _opacity;
public bool alwaysIncludeSemantics {
get { return _alwaysIncludeSemantics;}
set {
if (value == _alwaysIncludeSemantics)
return;
_alwaysIncludeSemantics = value;
// markNeedsSemanticsUpdate();
}
}
bool _alwaysIncludeSemantics;
setLayer(null);
layer = null;
setLayer(null);
layer = null;
context.paintChild(child, offset);
return;
}

base.paint,
oldLayer: layer as OpacityLayer
);
setLayer(opacity);
layer = opacity;
}
}
/*public override void visitChildrenForSemantics(RenderObject visitor) {

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("opacity", opacity));
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
}
}

child = sliver;
D.assert(ignoring != null);
_ignoring = ignoring;
_ignoringSemantics = ignoringSemantics;
}

}
bool _ignoring;
public bool? ignoringSemantics {
get { return _ignoringSemantics; }
set {
if (value == _ignoringSemantics)
return ;
bool oldEffectiveValue = _effectiveIgnoringSemantics;
_ignoringSemantics = value;
//if (oldEffectiveValue != _effectiveIgnoringSemantics)
// markNeedsSemanticsUpdate();
}
}
bool? _ignoringSemantics;
bool _effectiveIgnoringSemantics {
get { return ignoringSemantics ?? ignoring; }
}
public override bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
return !ignoring && base.hitTest(
result,

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("ignoring", ignoring));
properties.add(new DiagnosticsProperty<bool>("ignoringSemantics", _effectiveIgnoringSemantics, description: ignoringSemantics == null ? $"implicitly {_effectiveIgnoringSemantics}" : null));
}
}
public class RenderSliverOffstage : RenderProxySliver {

227
com.unity.uiwidgets/Runtime/rendering/shifted_box.cs


public class RenderPadding : RenderShiftedBox {
public RenderPadding(
EdgeInsets padding = null,
EdgeInsetsGeometry padding = null,
TextDirection? textDirection = null,
_textDirection = textDirection;
EdgeInsets _resolvedPadding;
void _resolve() {
if (_resolvedPadding != null)
return;
_resolvedPadding = padding.resolve(textDirection);
D.assert(_resolvedPadding.isNonNegative);
}
public EdgeInsets padding {
void _markNeedResolution() {
_resolvedPadding = null;
markNeedsLayout();
}
public EdgeInsetsGeometry padding {
get { return _padding; }
set {
D.assert(value != null);

markNeedsLayout();
}
}
EdgeInsetsGeometry _padding;
EdgeInsets _padding;
public TextDirection? textDirection {
get { return _textDirection; }
set {if (_textDirection == value)
return;
_textDirection = value;
_markNeedResolution(); }
}
TextDirection? _textDirection;
if (child != null) {
return child.getMinIntrinsicWidth(Mathf.Max(0.0f, height - _padding.vertical)) +
_padding.horizontal;
}
return _padding.horizontal;
_resolve();
float totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
float totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom;
if (child != null) // next line relies on double.infinity absorption
return child.getMinIntrinsicWidth(Mathf.Max(0.0f, height - totalVerticalPadding)) + totalHorizontalPadding;
return totalHorizontalPadding;
if (child != null) {
return child.getMaxIntrinsicWidth(Mathf.Max(0.0f, height - _padding.vertical)) +
_padding.horizontal;
}
return _padding.horizontal;
_resolve();
float totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
float totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom;
if (child != null) // next line relies on double.infinity absorption
return child.getMaxIntrinsicWidth(Mathf.Max(0.0f, height - totalVerticalPadding)) + totalHorizontalPadding;
return totalHorizontalPadding;
if (child != null) {
return child.getMinIntrinsicHeight(Mathf.Max(0.0f, width - _padding.horizontal)) +
_padding.vertical;
}
return _padding.vertical;
_resolve();
float totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
float totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom;
if (child != null) // next line relies on double.infinity absorption
return child.getMinIntrinsicHeight(Mathf.Max(0.0f, width - totalHorizontalPadding)) + totalVerticalPadding;
return totalVerticalPadding;
if (child != null) {
return child.getMaxIntrinsicHeight(Mathf.Max(0.0f, width - _padding.horizontal)) +
_padding.vertical;
}
return _padding.vertical;
_resolve();
float totalHorizontalPadding = _resolvedPadding.left + _resolvedPadding.right;
float totalVerticalPadding = _resolvedPadding.top + _resolvedPadding.bottom;
if (child != null) // next line relies on double.infinity absorption
return child.getMaxIntrinsicHeight(Mathf.Max(0.0f, width - totalHorizontalPadding)) + totalVerticalPadding;
return totalVerticalPadding;
BoxConstraints constraints = this.constraints;
_resolve();
D.assert(_resolvedPadding != null);
size = constraints.constrain(_padding.inflateSize(Size.zero));
size = constraints.constrain(new Size(
_resolvedPadding.left + _resolvedPadding.right,
_resolvedPadding.top + _resolvedPadding.bottom
));
var innerConstraints = constraints.deflate(_padding);
BoxConstraints innerConstraints = constraints.deflate(_resolvedPadding);
var childParentData = (BoxParentData) child.parentData;
childParentData.offset = _padding.topLeft;
size = constraints.constrain(_padding.inflateSize(child.size));
BoxParentData childParentData = child.parentData as BoxParentData;
childParentData.offset = new Offset(_resolvedPadding.left, _resolvedPadding.top);
size = constraints.constrain(new Size(
_resolvedPadding.left + child.size.width + _resolvedPadding.right,
_resolvedPadding.top + child.size.height + _resolvedPadding.bottom
));
D.assert(() => {
D.assert(()=> {
D.debugPaintPadding(context.canvas, outerRect,
child != null ? _padding.deflateRect(outerRect) : null);
D.debugPaintPadding(context.canvas, outerRect, child != null ? _resolvedPadding.deflateRect(outerRect) : null);
return true;
});
}

properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding));
properties.add(new DiagnosticsProperty<EdgeInsetsGeometry>("padding", padding));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
Alignment alignment = null,
RenderBox child = null,
//TODO : update textdirection
TextDirection? textDirection = null
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,
RenderBox child = null
_textDirection = textDirection;
}
Alignment _resolvedAlignment;
void _resolve() {
if (_resolvedAlignment != null)
return;
_resolvedAlignment = alignment.resolve(textDirection);
public Alignment alignment {
void _markNeedResolution() {
_resolvedAlignment = null;
markNeedsLayout();
}
public AlignmentGeometry alignment {
get { return _alignment; }
set {
D.assert(value != null);

}
}
Alignment _alignment;
TextDirection _textDirection;
public TextDirection textDirection {
get { return _textDirection; }
AlignmentGeometry _alignment;
public TextDirection? textDirection {
get { return _textDirection;}
//TODO: complete _markNeedResolution
// _markNeedResolution();
_markNeedResolution();
TextDirection? _textDirection;
_resolve();
D.assert(_resolvedAlignment != null);
childParentData.offset = _alignment.alongOffset(size - child.size);
childParentData.offset = _resolvedAlignment.alongOffset(size - child.size);
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
}
}

float? widthFactor = null,
float? heightFactor = null,
Alignment alignment = null
) : base(alignment, child) {
AlignmentGeometry alignment = null,
TextDirection? textDirection = null
) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection){
_widthFactor = widthFactor;
_heightFactor = heightFactor;
}

float? _heightFactor;
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
bool shrinkWrapWidth = _widthFactor != null || float.IsPositiveInfinity(constraints.maxWidth);
bool shrinkWrapHeight = _heightFactor != null || float.IsPositiveInfinity(constraints.maxHeight);

float? maxWidth = null,
float? minHeight = null,
float? maxHeight = null,
Alignment alignment = null
) : base(alignment, child) {
AlignmentGeometry alignment = null,
TextDirection? textDirection = null
) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection){
_minWidth = minWidth;
_maxWidth = maxWidth;
_minHeight = minHeight;

alignChild();
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("minWidth", minWidth, ifNull: "use parent minWidth constraint"));
properties.add(new FloatProperty("maxWidth", maxWidth, ifNull: "use parent maxWidth constraint"));
properties.add(new FloatProperty("minHeight", minHeight, ifNull: "use parent minHeight constraint"));
properties.add(new FloatProperty("maxHeight", maxHeight, ifNull: "use parent maxHeight constraint"));
}
public class RenderUnconstrainedBox : RenderAligningShiftedBox {
public class RenderUnconstrainedBox : RenderAligningShiftedBox {//, DebugOverflowIndicatorMixin
Alignment alignment = null,
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,
) : base(alignment, child) {
) : base(alignment , textDirection ,child) {
D.assert(alignment != null);
_constrainedAxis = constrainedAxis;
}

markNeedsLayout();
}
}
public Axis? _constrainedAxis;
public Rect _overflowContainerRect = Rect.zero;

protected override void performLayout() {
BoxConstraints constraints = this.constraints;
if (child != null) {
BoxConstraints childConstraints = null;
if (constrainedAxis != null) {

return true;
});
}
public override Rect describeApproximatePaintClip(RenderObject child) {
return _isOverflowing ? Offset.zero & size : null;
}
public override string toStringShort() {
string header = base.toStringShort();
if (_isOverflowing)
header += "OVERFLOWING";
return header;
}
}
public class RenderSizedOverflowBox : RenderAligningShiftedBox {

Alignment alignment = null
) : base(alignment, child) {
AlignmentGeometry alignment = null,
TextDirection? textDirection = null
) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection) {
D.assert(requestedSize != null);
_requestedSize = requestedSize;
}

RenderBox child = null,
float? widthFactor = null,
float? heightFactor = null,
Alignment alignment = null
) : base(alignment, child) {
AlignmentGeometry alignment = null,
TextDirection? textDirection = null
) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection){
D.assert(_widthFactor == null || _widthFactor >= 0.0);
D.assert(_heightFactor == null || _heightFactor >= 0.0);
D.assert(value == null || value >= 0.0f);
if (_widthFactor == value) {
return;
}

public float? heightFactor {
get { return _heightFactor; }
set {
D.assert(value == null || value >= 0.0);
if (_heightFactor == value) {
return;
}

size = constraints.constrain(
_getInnerConstraints(constraints).constrain(Size.zero));
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("widthFactor", _widthFactor, ifNull: "pass-through"));
properties.add(new FloatProperty("heightFactor", _heightFactor, ifNull: "pass-through"));
}
}

}
public class RenderCustomSingleChildLayoutBox : RenderShiftedBox {
public RenderCustomSingleChildLayoutBox(RenderBox child = null,
SingleChildLayoutDelegate layoutDelegate = null) : base(child) {
public RenderCustomSingleChildLayoutBox(
RenderBox child = null,
SingleChildLayoutDelegate layoutDelegate = null
) : base(child) {
D.assert(layoutDelegate != null);
_delegate = layoutDelegate;
}

public float baseline {
get { return _baseline; }
set {
D.assert(value != null);
_baseline = value;
markNeedsLayout();
}

public TextBaseline baselineType {
get { return _baselineType; }
set {
D.assert(value != null);
if (_baselineType == value) {
return;
}

else {
performResize();
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("baseline", baseline));
properties.add(new EnumProperty<TextBaseline>("baselineType", baselineType));
}
}
}

8
com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs


public bool debugChildIntegrityEnabled {
get { return _debugChildIntegrityEnabled;}
set {
D.assert(value != null);
D.assert(() =>{
_debugChildIntegrityEnabled = value;
return _debugVerifyChildOrder() &&
(!_debugChildIntegrityEnabled || _debugDanglingKeepAlives.isEmpty());
});
}
}
public void setDebugChildIntegrityEnabled(bool enabled) {
D.assert(enabled != null);

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


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

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

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

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

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

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

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

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

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

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


return Alignment.lerp(begin, end, t);
}
}
public class AlignmentGeometryTween : Tween<AlignmentGeometry> {
public AlignmentGeometryTween(
AlignmentGeometry begin = null,
AlignmentGeometry end = null
) : base(begin: begin, end: end) {
}
public override AlignmentGeometry lerp(float t) {
return AlignmentGeometry.lerp(begin, end, t);
}
}
}

8
com.unity.uiwidgets/Runtime/rendering/view.cs


owner.requestVisualUpdate();
}
public void prepareInitialFrame() {
D.assert(owner != null);
D.assert(_rootTransform == null);
scheduleInitialLayout();
scheduleInitialPaint((OffsetLayer)_updateMatricesAndCreateNewRootLayer());
D.assert(_rootTransform != null);
}
Matrix4 _rootTransform;
public Layer _updateMatricesAndCreateNewRootLayer() {

2
com.unity.uiwidgets/Runtime/scheduler2/ticker.cs


return _future;
}
DiagnosticsNode describeForError(string name) {
public DiagnosticsNode describeForError(string name) {
return new DiagnosticsProperty<Ticker>(name, this, description: toString(debugIncludeStack: true));
}

4
com.unity.uiwidgets/Runtime/services/text_editing.cs


public TextPosition endPos {
get { return new TextPosition(offset: end, affinity: affinity); }
}
public TextPosition extent {
get { return new TextPosition(offset: extentOffset, affinity: affinity); }
}
public bool Equals(TextSelection other) {
if (ReferenceEquals(null, other)) {

18
com.unity.uiwidgets/Runtime/ui2/compositing.cs


return layer;
}
public ColorFilterEngineLayer pushColorFilter(ColorFilter colorFilter, ColorFilterEngineLayer oldLayer = null) {
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "pushColorFilter"));
ColorFilterEngineLayer layer = new ColorFilterEngineLayer(SceneBuilder_pushColorFilter(_ptr, colorFilter._toNativeColorFilter()._ptr));
return layer;
}
public ImageFilterEngineLayer pushImageFilter(ImageFilter imageFilter, ImageFilterEngineLayer oldLayer = null) {
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "pushImageFilter"));
ImageFilterEngineLayer layer = new ImageFilterEngineLayer(SceneBuilder_pushImageFilter(_ptr, imageFilter._toNativeImageFilter()._ptr));
return layer;
}
public BackdropFilterEngineLayer pushBackdropFilter(
ImageFilter filter,
BackdropFilterEngineLayer oldLayer = null) {

[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushOpacity(IntPtr ptr, int alpha, float dx, float dy);
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushColorFilter(IntPtr ptr, IntPtr filter);
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushImageFilter(IntPtr ptr, IntPtr filter);
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushBackdropFilter(IntPtr ptr, IntPtr filter);

13
com.unity.uiwidgets/Runtime/widgets/actions.cs


public delegate void OnInvokeCallback(FocusNode node, Intent tag);
public class Intent : Diagnosticable {
public Intent(LocalKey key) : base() {
this.key = key;
this.key = key;
}
public static readonly Intent doNothing = new Intent(DoNothingAction.key);

public abstract class UiWidgetAction : Diagnosticable {
public UiWidgetAction(LocalKey intentKey) {
this.intentKey = intentKey;
this.intentKey = intentKey;
}
public readonly LocalKey intentKey;

class CallbackAction : UiWidgetAction {
public CallbackAction(LocalKey intentKey, OnInvokeCallback onInvoke) : base(intentKey: intentKey) {
D.assert(onInvoke != null);
this.onInvoke = onInvoke;
}
protected readonly OnInvokeCallback onInvoke;

}
class Actions : InheritedWidget {
public Actions(
Key key = null,
ActionDispatcher dispatcher = null,

if (nullOk) {
return true;
}
if (inherited == null) {
throw new UIWidgetsError("Unable to find an $Actions widget in the context.\n" +
"Actions.of() was called with a context that does not contain an " +

if (!(element.widget is Actions)) {
return true;
}
actionsElement = element;
Actions actions = element.widget as Actions;
action = actions.actions[intent.key]?.Invoke();

return _findDispatcher(actionsElement).invokeAction(action, intent, focusNode: focusNode);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ActionDispatcher>("dispatcher", dispatcher));

}
public override void didUpdateWidget(StatefulWidget oldWidget) {
//oldWidget =(FocusableActionDetector) oldWidget;
oldWidget =(FocusableActionDetector) oldWidget;
base.didUpdateWidget(oldWidget);
if (widget.enabled != ((FocusableActionDetector)oldWidget).enabled) {
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timespan)=> {

}
public abstract class ActivateAction : UiWidgetAction {
public ActivateAction() : base(key) {
}
public readonly static LocalKey key = new ValueKey<Type>(typeof(ActivateAction));

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


showSecond
}
public delegate Widget AnimatedCrossFadeBuilder(Widget topChild, Key topChildKey, Widget bottomChild,
Key bottomChildKey);
public delegate Widget AnimatedCrossFadeBuilder(Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey);
public class AnimatedCrossFade : StatefulWidget {

public class _AnimatedCrossFadeState : TickerProviderStateMixin<AnimatedCrossFade> {
public override void initState() {
base.initState();

public override Widget build(BuildContext context) {
Key kFirstChildKey = new ValueKey<CrossFadeState>(CrossFadeState.showFirst);
Key kSecondChildKey = new ValueKey<CrossFadeState>(CrossFadeState.showSecond);
bool transitioningForwards = _controller.status == AnimationStatus.completed ||
_controller.status == AnimationStatus.forward;
bool transitioningForwards = _controller.status == AnimationStatus.completed || _controller.status == AnimationStatus.forward;
Key topKey;
Widget topChild;

Animation<float> bottomAnimation;
if (transitioningForwards) {
topKey = kSecondChildKey;
topChild = widget.secondChild;

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


public AnimatedSize(
Key key = null,
Widget child = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
Curve curve = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,

this.vsync = vsync;
}
public readonly Alignment alignment;
public readonly AlignmentGeometry alignment;
public readonly Curve curve;

duration: duration,
reverseDuration: reverseDuration,
curve: curve,
vsync: vsync);
vsync: vsync,
textDirection: Directionality.of(context)
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {

_renderObject.reverseDuration = reverseDuration;
_renderObject.curve = curve;
_renderObject.vsync = vsync;
_renderObject.textDirection = Directionality.of(context);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

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


namespace Unity.UIWidgets.widgets {
class _ChildEntry {
public _ChildEntry(
AnimationController controller,
Animation<float> animation,
Widget transition,
Widget widgetChild
AnimationController controller = null,
Animation<float> animation = null,
Widget transition = null,
Widget widgetChild = null
) {
D.assert(animation != null);
D.assert(transition != null);

public Widget widgetChild;
public override string ToString() {
return "Entry#${shortHash(this)}($widgetChild)";
return $"Entry#{foundation_.shortHash(this)}({widgetChild})";
}
}

AnimatedSwitcherLayoutBuilder layoutBuilder = null
) : base(key: key) {
D.assert(duration != null);
this.child = child;
this.duration = duration;
this.reverseDuration = reverseDuration;
this.child = child;
this.duration = duration;
this.reverseDuration = reverseDuration;
}
public readonly Widget child;

}
_ChildEntry _newEntry(
Widget child,
AnimatedSwitcherTransitionBuilder builder,
AnimationController controller,
Animation<float> animation
Widget child = null,
AnimatedSwitcherTransitionBuilder builder = null,
AnimationController controller = null,
Animation<float> animation = null
) {
_ChildEntry entry = new _ChildEntry(
widgetChild: child,

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


using Unity.UIWidgets.rendering;
namespace Unity.UIWidgets.widgets {
public class AnnotatedRegion<T> : SingleChildRenderObjectWidget
where T : class {
public class AnnotatedRegion<T> : SingleChildRenderObjectWidget where T : class
{
T value = null,
T value = default,
bool sized = true
) : base(key: key, child: child) {
D.assert(value != null);

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


"will know what kind of PageRoute transition to build."
);
}
// [!!!]too many errors here
/*public static readonly Dictionary<LogicalKeySet, Intent> _defaultShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
{new LogicalKeySet(LogicalKeyboardKey.enter), new Intent(ActivateAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.gameButtonA), new Intent(ActivateAction.key)},
public static readonly Dictionary<LogicalKeySet, Intent> _defaultShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
{new LogicalKeySet(LogicalKeyboardKey.enter), new Intent(ActivateAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.gameButtonA), new Intent(ActivateAction.key)},
// Keyboard traversal.
{new widgets.LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab), new Intent(PreviousFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowLeft), new DirectionalFocusIntent(TraversalDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowRight), new DirectionalFocusIntent(TraversalDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowDown), new DirectionalFocusIntent(TraversalDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowUp), new DirectionalFocusIntent(TraversalDirection.up)},
// Keyboard traversal.
{new widgets.LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab), new Intent(PreviousFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowLeft), new DirectionalFocusIntent(TraversalDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowRight), new DirectionalFocusIntent(TraversalDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowDown), new DirectionalFocusIntent(TraversalDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowUp), new DirectionalFocusIntent(TraversalDirection.up)},
// Scrolling
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
// Scrolling
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
// Default shortcuts for the web platform.
public static readonly Dictionary<LogicalKeySet, Intent> _defaultWebShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
{new widgets.LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key)},
// Default shortcuts for the web platform.
public static readonly Dictionary<LogicalKeySet, Intent> _defaultWebShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
{new widgets.LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key)},
// Keyboard traversal.
{new widgets.LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab),new Intent(PreviousFocusAction.key)},
// Keyboard traversal.
{new widgets.LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab),new Intent(PreviousFocusAction.key)},
// Scrolling
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
// Scrolling
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
// Default shortcuts for the macOS platform.
public static readonly Dictionary<LogicalKeySet, Intent> _defaultMacOsShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
new LogicalKeySet(LogicalKeyboardKey.enter), new Intent(ActivateAction.key),
new LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key),
// Default shortcuts for the macOS platform.
public static readonly Dictionary<LogicalKeySet, Intent> _defaultMacOsShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
{new LogicalKeySet(LogicalKeyboardKey.enter), new Intent(ActivateAction.key)},
{new LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key)},
// Keyboard traversal
{new LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab), new Intent(PreviousFocusAction.key)},
{new LogicalKeySet(LogicalKeyboardKey.arrowLeft), new DirectionalFocusIntent(TraversalDirection.left)},
{new LogicalKeySet(LogicalKeyboardKey.arrowRight), new DirectionalFocusIntent(TraversalDirection.right)},
{new LogicalKeySet(LogicalKeyboardKey.arrowDown), new DirectionalFocusIntent(TraversalDirection.down)},
{new LogicalKeySet(LogicalKeyboardKey.arrowUp), new DirectionalFocusIntent(TraversalDirection.up)},
// Keyboard traversal
{new LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab), new Intent(PreviousFocusAction.key)},
{new LogicalKeySet(LogicalKeyboardKey.arrowLeft), new DirectionalFocusIntent(TraversalDirection.left)},
{new LogicalKeySet(LogicalKeyboardKey.arrowRight), new DirectionalFocusIntent(TraversalDirection.right)},
{new LogicalKeySet(LogicalKeyboardKey.arrowDown), new DirectionalFocusIntent(TraversalDirection.down)},
{new LogicalKeySet(LogicalKeyboardKey.arrowUp), new DirectionalFocusIntent(TraversalDirection.up)},
// Scrolling
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
// Scrolling
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
/// Generates the default shortcut key bindings based on the
/// [defaultTargetPlatform].
///
/// Used by [WidgetsApp] to assign a default value to [WidgetsApp.shortcuts].
public static Dictionary<LogicalKeySet, Intent> defaultShortcuts {
get {
if (kIsWeb) {
return _defaultWebShortcuts;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
return _defaultShortcuts;
case TargetPlatform.macOS:
return _defaultMacOsShortcuts;
case TargetPlatform.iOS:
// No keyboard support on iOS yet.
break;
}
return new Dictionary<LogicalKeySet, Intent>();
}
}
public static Dictionary<LogicalKeySet, Intent> defaultShortcuts {
get {
if (foundation_.kIsWeb) {
return _defaultWebShortcuts;
}
switch (Application.platform) {
case RuntimePlatform.Android:
//case TargetPlatform.fuchsia:
case RuntimePlatform.LinuxPlayer:
case RuntimePlatform.WindowsPlayer:
return _defaultShortcuts;
case RuntimePlatform.OSXPlayer:
return _defaultMacOsShortcuts;
case RuntimePlatform.IPhonePlayer:
// No keyboard support on iOS yet.
break;
}
return new Dictionary<LogicalKeySet, Intent>();
}
}
/// The default value of [WidgetsApp.actions].
public static readonly Dictionary<LocalKey, ActionFactory> defaultActions = new Dictionary<LocalKey, ActionFactory>(){
{DoNothingAction.key, () => new DoNothingAction()},
{RequestFocusAction.key, () => new RequestFocusAction()},
{NextFocusAction.key, () => new NextFocusAction()},
{PreviousFocusAction.key, () => new PreviousFocusAction()},
{DirectionalFocusAction.key, () => new DirectionalFocusAction()},
{ScrollAction.key, () => new ScrollAction()},
};*/
/// The default value of [WidgetsApp.actions].
public static readonly Dictionary<LocalKey, ActionFactory> defaultActions = new Dictionary<LocalKey, ActionFactory>(){
{DoNothingAction.key, () => new DoNothingAction()},
{RequestFocusAction.key, () => new RequestFocusAction()},
{NextFocusAction.key, () => new NextFocusAction()},
{PreviousFocusAction.key, () => new PreviousFocusAction()},
{DirectionalFocusAction.key, () => new DirectionalFocusAction()},
{ScrollAction.key, () => new ScrollAction()},
};
public override State createState() {
return new _WidgetsAppState();

navigator.pushNamed<bool>(route);
return Future.value(true).to<bool>();
}
public void didChangeAccessibilityFeatures() {}
Route<object> _onUnknownRoute(RouteSettings settings) {
D.assert(() => {

public class _MediaQueryFromWindow : StatefulWidget {
public _MediaQueryFromWindow(Key key = null, Widget child = null) : base(key: key) {
this.child = child;
}
public readonly Widget child;

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


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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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


Future<bool> didPopRoute();
Future<bool> didPushRoute(string route);
void didChangeAccessibilityFeatures();
}
public static partial class ui_ {

59
com.unity.uiwidgets/Runtime/widgets/color_filter.cs


namespace Unity.UIWidgets.widgets {
public class ColorFiltered : SingleChildRenderObjectWidget {
protected ColorFiltered(ColorFilter colorFilter = null, Widget child = null, Key key = null)
protected ColorFiltered(
ColorFilter colorFilter = null,
Widget child = null,
Key key = null)
this.colorFilter = colorFilter;
public override RenderObject createRenderObject(BuildContext context) => new _ColorFilterRenderObject(colorFilter);
public override RenderObject createRenderObject(BuildContext context) {
return new _ColorFilterRenderObject(colorFilter);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
((_ColorFilterRenderObject)renderObject).colorFilter = colorFilter;
}

properties.add(new DiagnosticsProperty<ColorFilter>("colorFilter", colorFilter));
}
}
public class _ColorFilterRenderObject : RenderProxyBox {
public _ColorFilterRenderObject(ColorFilter _colorFilter) {
this._colorFilter = _colorFilter;
}
public class _ColorFilterRenderObject : RenderProxyBox {
public _ColorFilterRenderObject(ColorFilter _colorFilter) {
this._colorFilter = _colorFilter;
}
public ColorFilter colorFilter {
get { return _colorFilter; }
set {
D.assert(value != null);
if (value != _colorFilter) {
_colorFilter = value;
markNeedsPaint();
}
}
}
public ColorFilter colorFilter {
get { return _colorFilter; }
set {
D.assert(value != null);
if (value != _colorFilter) {
_colorFilter = value;
markNeedsPaint();
ColorFilter _colorFilter;
public bool alwaysNeedsCompositing {
get { return child != null; }
}
public override void paint(PaintingContext context, Offset offset) {
layer = context.pushColorFilter(offset, colorFilter, base.paint, oldLayer: layer as ColorFilterLayer);
}
ColorFilter _colorFilter;
public bool alwaysNeedsCompositing {
get { return child != null; }
}
public override void paint(PaintingContext context, Offset offset) {
layer = context.pushColorFilter(offset, colorFilter, base.paint, oldLayer: layer as ColorFilterLayer);
}
}
}

32
com.unity.uiwidgets/Runtime/widgets/container.cs


public class Container : StatelessWidget {
public Container(
Key key = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
Decoration forgroundDecoration = null,
Decoration foregroundDecoration = null,
Matrix4 transfrom = null,
Matrix4 transform = null,
Widget child = null,
Clip clipBehavior = Clip.none
) : base(key: key) {

this.alignment = alignment;
this.padding = padding;
foregroundDecoration = forgroundDecoration;
this.margin = margin;
transform = transfrom;
this.child = child;
this.foregroundDecoration = foregroundDecoration;
this.decoration = decoration ?? (color != null ? new BoxDecoration(color) : null);
this.decoration = decoration;// ?? (color != null ? new BoxDecoration(color) : null);
this.margin = margin;
this.transform = transform;
this.child = child;
this.clipBehavior = clipBehavior ;
this.clipBehavior = clipBehavior;
public readonly Alignment alignment;
public readonly AlignmentGeometry alignment;
public readonly EdgeInsets padding;
public readonly Decoration decoration;
public readonly Decoration foregroundDecoration;

if (decoration == null || decoration.padding == null) {
return padding;
}
Debug.LogError("EdgeInsets needs to be update to EdgeInsetsGeometry");
//Debug.LogError("EdgeInsets needs to be update to EdgeInsetsGeometry");
return padding.add(decorationPadding);
}
}

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Alignment>("alignment",
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment",
alignment, showName: false, defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding",
padding, defaultValue: foundation_.kNullDefaultValue));

/// A clipper that uses [Decoration.getClipPath] to clip.
public class _DecorationClipper : CustomClipper<Path> {
public _DecorationClipper(
TextDirection textDirection = TextDirection.rtl,
TextDirection? textDirection = null,
textDirection = TextDirection.ltr;
this.textDirection = textDirection ?? TextDirection.ltr;
this.decoration = decoration;
}
public readonly TextDirection textDirection;

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


public static bool debugPrintGlobalKeyedWidgetLifecycle = false;
public static bool debugPrintScheduleBuildForStacks = false;
public static bool debugProfileBuildsEnabled = false;
public static bool debugHighlightDeprecatedWidgets = false;
static Key _firstNonUniqueKey(IEnumerable<Widget> widgets) {
var keySet = new HashSet<Key>();

throw new UIWidgetsError(
"Duplicate keys found.\n" +
"If multiple keyed nodes exist as children of another node, they must have unique keys.\n" +
parent + " has multiple children with key " + children + "."
parent + " has multiple children with key " + nonUniqueKey + "."
);
}

if (widget == built) {
throw new UIWidgetsError(
"A build function returned context.widget.\n" +
"The offending widget is: $widget\n" +
$"The offending widget is: {widget}\n" +
"Build functions must never return their BuildContext parameter\'s widget or a child that contains 'context.widget'. " +
"Doing so introduces a loop in the widget tree that can cause the app to crash."
);

context.findAncestorWidgetOfExactType<Directionality>() == null) {
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary("No Directionality widget found."),
new ErrorDescription("${context.widget.runtimeType} widgets require a Directionality widget ancestor.\n"),
new ErrorDescription($"{context.widget.GetType()} widgets require a Directionality widget ancestor.\n"),
context.describeWidget("The specific widget that could not find a Directionality ancestor was"),
context.describeOwnershipChain("The ownership chain for the affected widget is"),
new ErrorHint(

}
internal static UIWidgetsErrorDetails _debugReportException(
DiagnosticsNode context,
Exception exception,
InformationCollector informationCollector = null
) {
var details = new UIWidgetsErrorDetails(
exception: exception,
library: "widgets library",
context: context,
informationCollector: informationCollector
);
UIWidgetsError.reportError(details);
return details;
}
internal static UIWidgetsErrorDetails _debugReportException(
string context,
Exception exception,
InformationCollector informationCollector = null

UIWidgetsError.reportError(details);
return details;
}
/// See [the widgets library](widgets/widgets-library.html) for a complete list.
public static bool debugAssertAllWidgetVarsUnset(string reason) {
D.assert(()=> {
if (debugPrintRebuildDirtyWidgets ||
debugPrintBuildScope ||
debugPrintScheduleBuildForStacks ||
debugPrintGlobalKeyedWidgetLifecycle ||
debugProfileBuildsEnabled ||
debugHighlightDeprecatedWidgets) {
throw new UIWidgetsError(reason);
}
return true;
});
return true;
}
}
}

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


Axis axis,
Animation<Offset> moveAnimation
) : base(reclip: moveAnimation) {
D.assert(moveAnimation != null);
this.axis = axis;
this.moveAnimation = moveAnimation;
}

}
public override bool shouldReclip(CustomClipper<Rect> oldClipper) {
D.assert(oldClipper is _DismissibleClipper);
//D.assert(oldClipper is _DismissibleClipper);
_DismissibleClipper clipper = oldClipper as _DismissibleClipper;
return clipper.axis != axis
|| clipper.moveAnimation.value != moveAnimation.value;

}
_FlingGestureKind _describeFlingGesture(Velocity velocity) {
D.assert(widget.direction != null);
if (_dragExtent == 0.0f) {
return _FlingGestureKind.none;
}

);
if (background != null) {
List<Widget> children = new List<Widget> { };
List<Widget> children = new List<Widget>();
if (!_moveAnimation.isDismissed) {
children.Add(Positioned.fill(

children.Add(content);
content = new Stack(children: children);
}
return new GestureDetector(

33
com.unity.uiwidgets/Runtime/widgets/disposable_build_context.cs


using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.widgets {
public class DisposableBuildContext<T> where T : State{
public DisposableBuildContext(T _state) {
D.assert(_state != null);
D.assert(_state.mounted, () => "A DisposableBuildContext was given a BuildContext for an Element that is not mounted.");
this._state = _state;
}
T _state;
public class DisposableBuildContext {
State _state;
public BuildContext context {
get {
D.assert(_debugValidate());

public bool _debugValidate() {
D.assert(
_state == null || _state.mounted,() =>
"A DisposableBuildContext tried to access the BuildContext of a disposed " +
"State object. This can happen when the creator of this " +
"DisposableBuildContext fails to call dispose when it is disposed."
);
"A DisposableBuildContext tried to access the BuildContext of a disposed " +
"State object. This can happen when the creator of this " +
"DisposableBuildContext fails to call dispose when it is disposed."
);
return true;
}

}
public class DisposableBuildContext<T> : DisposableBuildContext where T : State{
public DisposableBuildContext(T _state) {
D.assert(_state != null);
D.assert(_state.mounted, () => "A DisposableBuildContext was given a BuildContext for an Element that is not mounted.");
this._state = _state;
}
T _state;
}
}

32
com.unity.uiwidgets/Runtime/widgets/drag_target.cs


public class Draggable<T> : StatefulWidget {
public Draggable(
T data,
T data = default,
Axis? axis = null,
Widget childWhenDragging = null,
Offset feedbackOffset = null,

VoidCallback onDragStarted = null,
DraggableCanceledCallback onDraggableCanceled = null,
DragEndCallback onDragEnd = null,
VoidCallback onDragCompleted = null) : base(key) {
VoidCallback onDragCompleted = null
) : base(key) {
D.assert(child != null);
D.assert(feedback != null);
D.assert(maxSimultaneousDrags == null || maxSimultaneousDrags >= 0);

this.data = data;
this.axis = axis;
this.childWhenDragging = childWhenDragging;
if (feedbackOffset == null) {
feedbackOffset = Offset.zero;
}
this.feedbackOffset = feedbackOffset;
this.feedbackOffset = feedbackOffset ?? Offset.zero;
this.dragAnchor = dragAnchor;
this.affinity = affinity;
this.maxSimultaneousDrags = maxSimultaneousDrags;

public class LongPressDraggable<T> : Draggable<T> {
public LongPressDraggable(
T data,
T data = default,
Axis? axis = null,
Widget childWhenDragging = null,
Offset feedbackOffset = null,

if (_activeCount > 0) {
return;
}
_recognizer.dispose();
_recognizer = null;
}

public class _DragAvatar<T> : Drag {
public _DragAvatar(
T data,
T data = default,
Axis? axis = null,
Offset initialPosition = null,
Offset dragStartPoint = null,

) {
if (initialPosition == null) {
initialPosition = Offset.zero;
}
if (dragStartPoint == null) {
dragStartPoint = Offset.zero;
}
if (feedbackOffset == null) {
feedbackOffset = Offset.zero;
}

this.data = data;
this.axis = axis;
this.dragStartPoint = dragStartPoint;
this.dragStartPoint = dragStartPoint ?? Offset.zero;
this.feedbackOffset = feedbackOffset;
this.feedbackOffset = feedbackOffset ?? Offset.zero;
_position = initialPosition;
_position = initialPosition ?? Offset.zero;
updateDrag(initialPosition);
}

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


public void clearComposing() {
value = value.copyWith(composing: TextRange.empty);
}
public bool isSelectionWithinTextBounds(TextSelection selection) {
return selection.start <= text.Length && selection.end <= text.Length;
}
}
public class ToolbarOptions {

bool paste = false,
bool selectAll = false
) {
D.assert(copy != null);
D.assert(cut != null);
D.assert(paste != null);
D.assert(selectAll != null);
this.copy = copy;
this.cut = cut;
this.paste = paste;

public class EditableText : StatefulWidget {
public EditableText(
SmartDashesType smartDashesType,
SmartQuotesType smartQuotesType,
Key key = null,
TextEditingController controller = null,
FocusNode focusNode = null,

//SmartDashesType smartDashesType,
//SmartQuotesType smartQuotesType,
TextAlign textAlign = TextAlign.left,
TextAlign textAlign = TextAlign.start,
TextDirection? textDirection = null,
Locale locale = null,
float? textScaleFactor = null,

bool forceLine = false,
bool forceLine = true,
TextWidthBasis textWidthBasis = TextWidthBasis.parent,
bool autofocus = false,
bool? showCursor = null,

VoidCallback onSelectionHandleTapped = null,
List<TextInputFormatter> inputFormatters = null,
bool rendererIgnoresPointer = false,
float? cursorWidth = 2.0f,
float cursorWidth = 2.0f,
Radius cursorRadius = null,
bool cursorOpacityAnimates = false,
Offset cursorOffset = null,

ToolbarOptions toolbarOptions = null,
bool unityTouchKeyboard = false
) : base(key) {
toolbarOptions = toolbarOptions ?? new ToolbarOptions(
copy: true,
cut: true,
paste: true,
selectAll: true
);
D.assert(obscureText != null);
D.assert(autocorrect != null);
//smartDashesType = smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled),
//smartQuotesType = smartQuotesType ?? (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled),
D.assert(enableSuggestions != null);
D.assert(showSelectionHandles != null);
smartDashesType = (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled);
smartQuotesType = (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled);
D.assert(readOnly != null);
D.assert(forceLine != null);
D.assert(cursorOpacityAnimates != null);
D.assert(paintCursorAboveText != null);
D.assert(selectionHeightStyle != null);
D.assert(selectionWidthStyle != null);
D.assert(textAlign != null);
D.assert(maxLines == null || maxLines > 0);
D.assert(minLines == null || minLines > 0);
D.assert(

D.assert(expands != null);
D.assert(autofocus != null);
D.assert(rendererIgnoresPointer != null);
D.assert(dragStartBehavior != null);
D.assert(toolbarOptions != null);
_strutStyle = strutStyle;
toolbarOptions = toolbarOptions ?? new ToolbarOptions(
copy: true,
cut: true,
paste: true,
selectAll: true
);
inputFormatters = inputFormatters ?? new List<TextInputFormatter>();
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline);
List<TextInputFormatter> formatters = new List<TextInputFormatter>();

}
}
this.readOnly = readOnly;
this.showCursor = showCursor ?? !readOnly;
this.showCursor = !readOnly;
this.keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline);
this.locale = locale;
this.scrollPadding = scrollPadding ?? EdgeInsets.all(20.0f);

this.autocorrect = autocorrect;
this.style = style;
this.smartDashesType = smartDashesType;
this.smartQuotesType = smartQuotesType;
this.showCursor = showCursor;
this.textWidthBasis = textWidthBasis;
this.onSelectionHandleTapped = onSelectionHandleTapped;
this.scrollController = scrollController;

this.keyboardAppearance = keyboardAppearance;
this.enableInteractiveSelection = enableInteractiveSelection;
this.dragStartBehavior = dragStartBehavior;
this.scrollPhysics = scrollPhysics;
// this.globalKeyEventHandler = globalKeyEventHandler;
this.scrollPhysics = scrollPhysics;
}
public readonly bool readOnly;

public readonly bool obscureText;
public readonly bool autocorrect;
public readonly SmartDashesType smartDashesType;
public readonly SmartQuotesType smartQuotesType;
public readonly bool showCursor;
public readonly bool? showCursor;
public readonly ui.BoxHeightStyle selectionHeightStyle;
public readonly ui.BoxWidthStyle selectionWidthStyle;
public readonly bool forceLine;

if (_strutStyle == null) {
return style != null
? StrutStyle.fromTextStyle(style, forceStrutHeight: true)
: StrutStyle.disabled;
: new StrutStyle();
}
return _strutStyle.inheritFromTextStyle(style);

properties.add( new DiagnosticsProperty<FocusNode>("focusNode", focusNode));
properties.add( new DiagnosticsProperty<bool>("obscureText", obscureText, defaultValue: false));
properties.add( new DiagnosticsProperty<bool>("autocorrect", autocorrect, defaultValue: true));
// properties.add( new EnumProperty<SmartDashesType>("smartDashesType", smartDashesType, defaultValue: obscureText ? SmartDashesType.disabled : SmartDashesType.enabled));
// properties.add( new EnumProperty<SmartQuotesType>("smartQuotesType", smartQuotesType, defaultValue: obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled));
properties.add( new EnumProperty<SmartDashesType>("smartDashesType", smartDashesType, defaultValue: obscureText ? SmartDashesType.disabled : SmartDashesType.enabled));
properties.add( new EnumProperty<SmartQuotesType>("smartQuotesType", smartQuotesType, defaultValue: obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled));
properties.add( new DiagnosticsProperty<bool>("enableSuggestions", enableSuggestions, defaultValue: true));
style?.debugFillProperties(properties);
properties.add( new EnumProperty<TextAlign>("textAlign", textAlign, defaultValue: null));

public class EditableTextState : AutomaticKeepAliveClientWithTickerProviderStateMixin<EditableText>,
WidgetsBindingObserver, TextInputClient,
TextSelectionDelegate {
TextSelectionDelegate
{
const float kMinInteractiveDimension = 48.0f;
public readonly LayerLink _toolbarLayerLink = new LayerLink();
public readonly LayerLink _startHandleLayerLink = new LayerLink();
public readonly LayerLink _endHandleLayerLink = new LayerLink();
GlobalKey _editableKey = GlobalKey.key();
TextInputConnection _textInputConnection;

AnimationController _cursorBlinkOpacityController;
LayerLink _layerLink = new LayerLink();
bool _didAutoFocus = false;
FocusAttachment _focusAttachment;

widget.controller.addListener(_didChangeTextEditingValue);
_focusAttachment = widget.focusNode.attach(context);
widget.focusNode.addListener(_handleFocusChanged);
_scrollController = widget.scrollController ?? new ScrollController();
_cursorVisibilityNotifier.value = widget.showCursor ?? false;
FocusScope.of(context).autofocus(widget.focusNode);
SchedulerBinding.instance.addPostFrameCallback((_) => {
if (mounted) {
FocusScope.of(context).autofocus(widget.focusNode);
}
});
}
}

oldWidget.controller.removeListener(_didChangeTextEditingValue);
widget.controller.addListener(_didChangeTextEditingValue);
_updateRemoteEditingValueIfNeeded();
//_updateImePosIfNeed();
}
if (widget.controller.selection != oldWidget.controller.selection) {
_selectionOverlay?.update(_value);
_selectionOverlay.handlesVisible = widget.showSelectionHandles;
if (widget.focusNode != oldWidget.focusNode) {
oldWidget.focusNode.removeListener(_handleFocusChanged);
_focusAttachment?.detach();

}
if (widget.readOnly) {
_closeInputConnectionIfNeeded();
} else {
if (oldWidget.readOnly && _hasFocus)
_openInputConnection();
}
if (widget.style != oldWidget.style) {
TextStyle style = widget.style;
if (_textInputConnection != null && _textInputConnection.attached) {
_textInputConnection.setStyle(
fontFamily: style.fontFamily,
fontSize: style.fontSize,
fontWeight: style.fontWeight,
textDirection: (TextDirection)_textDirection,
textAlign: widget.textAlign
);
}
}
}
public override void dispose() {

widget.focusNode.removeListener(_handleFocusChanged);
base.dispose();
}
if (widget.readOnly) {
return;
}
_receivedRemoteTextEditingValue = value;
_hideSelectionOverlayIfNeeded();
hideToolbar();
_showCaretOnScreen();
if (widget.obscureText && value.text.Length == _value.text.Length + 1) {
_obscureShowCharTicksPending = !_unityKeyboard() ? _kObscureShowLatestCharCursorTicks : 0;

_lastKnownRemoteTextEditingValue = value;
_stopCursorTimer(resetCharTicks: false);
_startCursorTimer();
}

break;
case FloatingCursorDragState.End:
_floatingCursorResetController.setValue(0.0f);
_floatingCursorResetController.animateTo(1.0f, duration: _floatingCursorResetTime,
curve: Curves.decelerate);
if (_lastTextPosition != null && _lastBoundedOffset != null) {
_floatingCursorResetController.setValue(0.0f);
_floatingCursorResetController.animateTo(1.0f, duration: _floatingCursorResetTime,
curve: Curves.decelerate);
}
break;
}
}

}
var localValue = _value;
if (localValue == _lastKnownRemoteTextEditingValue) {
if (localValue == _receivedRemoteTextEditingValue) {
_lastKnownRemoteTextEditingValue = localValue;
_textInputConnection.setEditingState(localValue);
}

float caretStart;
float caretEnd;
if (_isMultiline) {
// The caret is vertically centered within the line. Expand the caret's
// height so that it spans the line because we're going to ensure that the entire
// expanded caret is scrolled into view.
float lineHeight = renderEditable.preferredLineHeight;
float caretOffset = (lineHeight - caretRect.height) / 2;
caretStart = caretRect.top - caretOffset;

else if (caretEnd >= viewportExtent) {
scrollOffset += caretEnd - viewportExtent;
}
if (_isMultiline) {
scrollOffset = scrollOffset.clamp(0.0f, renderEditable.maxScrollExtent);
}
return scrollOffset;
}

inputType: widget.keyboardType,
obscureText: widget.obscureText,
autocorrect: widget.autocorrect,
//smartDashesType: widget.smartDashesType ?? (widget.obscureText ? SmartDashesType.disabled : SmartDashesType.enabled),
//smartQuotesType: widget.smartQuotesType ?? (widget.obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled),
smartDashesType: widget.obscureText ? SmartDashesType.disabled : SmartDashesType.enabled,
smartQuotesType: widget.obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled,
enableSuggestions: widget.enableSuggestions,
inputAction: widget.textInputAction ?? (widget.keyboardType == TextInputType.multiline
? TextInputAction.newline

if (_hasInputConnection) {
_textInputConnection.close();
_textInputConnection = null;
_lastKnownRemoteTextEditingValue = null;
_lastFormattedUnmodifiedTextEditingValue = null;
_receivedRemoteTextEditingValue = null;
}
}

widget.controller.clearComposing();
}
}
public void requestKeyboard() {
if (_hasFocus) {
_openInputConnection();

void _handleSelectionChanged(TextSelection selection, RenderEditable renderObject,
SelectionChangedCause cause) {
if (!widget.controller.isSelectionWithinTextBounds(selection))
return;
_hideSelectionOverlayIfNeeded();
_selectionOverlay?.hide();
_selectionOverlay = null;
if (widget.selectionControls != null && Application.isMobilePlatform && !_unityKeyboard()) {
_selectionOverlay = new TextSelectionOverlay(

layerLink: _layerLink,
toolbarLayerLink: _toolbarLayerLink,
startHandleLayerLink: _startHandleLayerLink,
endHandleLayerLink: _endHandleLayerLink,
dragStartBehavior: widget.dragStartBehavior
dragStartBehavior: widget.dragStartBehavior,
onSelectionHandleTapped: widget.onSelectionHandleTapped
bool longPress = cause == SelectionChangedCause.longPress;
if (cause != SelectionChangedCause.keyboard && (_value.text.isNotEmpty() || longPress)) {
_selectionOverlay.showHandles();
_selectionOverlay.handlesVisible = widget.showSelectionHandles;
_selectionOverlay.showHandles();
if (widget.onSelectionChanged != null) {
widget.onSelectionChanged(selection, cause);
if (longPress || cause == SelectionChangedCause.doubleTap) {
_selectionOverlay.showToolbar();
}
}
if (widget.onSelectionChanged != null) {
widget.onSelectionChanged(selection, cause);
}
}

curve: _caretAnimationCurve);
Rect newCaretRect = _getCaretRectAtScrollOffset(_currentCaretRect, scrollOffsetForCaret);
// Enlarge newCaretRect by scrollPadding to ensure that caret is not positioned directly at the edge after scrolling.
float bottomSpacing = widget.scrollPadding.bottom;
if (_selectionOverlay?.selectionControls != null) {
float handleHeight = _selectionOverlay.selectionControls
.getHandleSize(renderEditable.preferredLineHeight).height;
float interactiveHandleHeight = Mathf.Max(
handleHeight,
kMinInteractiveDimension
);
Offset anchor = _selectionOverlay.selectionControls
.getHandleAnchor(
TextSelectionHandleType.collapsed,
renderEditable.preferredLineHeight
);
float handleCenter = handleHeight / 2 - anchor.dy;
bottomSpacing = Mathf.Max(
handleCenter + interactiveHandleHeight / 2,
bottomSpacing
);
}
newCaretRect.bottom + widget.scrollPadding.bottom
newCaretRect.bottom + bottomSpacing
);
_editableKey.currentContext.findRenderObject().showOnScreen(
rect: inflatedRect,

return Future.value(false).to<bool>();
}
public void didChangeAccessibilityFeatures() {}
//_WhitespaceDirectionalityFormatter _whitespaceFormatter;
//whitespaceFormatter ??= new _WhitespaceDirectionalityFormatter(textDirection: _textDirection);
bool textChanged = _value?.text != value?.text;
bool isRepeatText = value?.text == _lastFormattedUnmodifiedTextEditingValue?.text;
bool isRepeatSelection = value?.selection == _lastFormattedUnmodifiedTextEditingValue?.selection;
bool isRepeatComposing = value?.composing == _lastFormattedUnmodifiedTextEditingValue?.composing;
if (!isRepeatText && textChanged && widget.inputFormatters != null && widget.inputFormatters.isNotEmpty()) {
foreach (TextInputFormatter formatter in widget.inputFormatters) {
value = formatter.formatEditUpdate(_value, value);
}
//value = _whitespaceFormatter.formatEditUpdate(_value, value);
_lastFormattedValue = value;
}
_value = value;
if (isRepeatText && isRepeatSelection && isRepeatComposing && textChanged && _lastFormattedValue != null) {
_value = _lastFormattedValue;
}
_updateRemoteEditingValueIfNeeded();
if (textChanged && widget.onChanged != null)
widget.onChanged(value.text);
_lastFormattedUnmodifiedTextEditingValue = _receivedRemoteTextEditingValue;
/*
var textChanged = _value?.text != value?.text || isIMEInput;
if (textChanged && widget.inputFormatters != null && widget.inputFormatters.isNotEmpty()) {
foreach (var formatter in widget.inputFormatters) {

if (textChanged && widget.onChanged != null) {
widget.onChanged(value.text);
}
}*/
_cursorVisibilityNotifier.value = _cursorBlinkOpacityController.value > 0;
_cursorVisibilityNotifier.value = widget.showCursor.Value && _cursorBlinkOpacityController.value > 0;
}
public bool cursorCurrentlyVisible {

updateKeepAlive();
}
TextDirection? _textDirection {
get {
TextDirection? result = widget.textDirection ?? Directionality.of(context);

}
}
public bool showToolbar() {
if (_selectionOverlay == null) {
if (foundation_.kIsWeb) {
return false;
}
if (_selectionOverlay == null || _selectionOverlay.toolbarIsVisible) {
return false;
}

public override Widget build(BuildContext context) {
D.assert(WidgetsD.debugCheckHasMediaQuery(context));
_focusAttachment.reparent();
//FocusScope.of(context).reparentIfNeeded(widget.focusNode);
base.build(context); // See AutomaticKeepAliveClientMixin.
base.build(context);
return new Scrollable(
axisDirection: _isMultiline ? AxisDirection.down : AxisDirection.right,

viewportBuilder: (BuildContext _context, ViewportOffset offset) =>
new CompositedTransformTarget(
link: _layerLink,
link: _toolbarLayerLink,
textSpan: buildTextSpan(),
value: _value,
cursorColor: _cursorColor,
backgroundCursorColor: widget.backgroundCursorColor,
showCursor: EditableText.debugDeterministicCursor
? new ValueNotifier<bool>(true)
: _cursorVisibilityNotifier,
hasFocus: _hasFocus,
maxLines: widget.maxLines,
minLines: widget.minLines,
expands: widget.expands,
strutStyle: widget.strutStyle,
selectionColor: widget.selectionColor,
textScaleFactor: widget.textScaleFactor ?? MediaQuery.textScaleFactorOf(context),
textAlign: widget.textAlign,
textDirection: _textDirection,
obscureText: widget.obscureText,
autocorrect: widget.autocorrect,
offset: offset,
onSelectionChanged: _handleSelectionChanged,
onCaretChanged: _handleCaretChanged,
rendererIgnoresPointer: widget.rendererIgnoresPointer,
cursorWidth: widget.cursorWidth,
cursorRadius: widget.cursorRadius,
cursorOffset: widget.cursorOffset,
paintCursorAboveText: widget.paintCursorAboveText,
enableInteractiveSelection: widget.enableInteractiveSelection == true,
textSelectionDelegate: this,
devicePixelRatio: _devicePixelRatio,
globalKeyEventHandler : widget.globalKeyEventHandler
startHandleLayerLink: _startHandleLayerLink,
endHandleLayerLink: _endHandleLayerLink,
textSpan: buildTextSpan(),
value: _value,
cursorColor: _cursorColor,
backgroundCursorColor: widget.backgroundCursorColor,
showCursor: EditableText.debugDeterministicCursor
? new ValueNotifier<bool>(widget.showCursor ?? false)
: _cursorVisibilityNotifier,
forceLine: widget.forceLine,
readOnly: widget.readOnly,
hasFocus: _hasFocus,
maxLines: widget.maxLines,
minLines: widget.minLines,
expands: widget.expands,
strutStyle: widget.strutStyle,
selectionColor: widget.selectionColor,
textScaleFactor: widget.textScaleFactor ?? MediaQuery.textScaleFactorOf(context),
textAlign: widget.textAlign,
textDirection: _textDirection,
locale: widget.locale,
textWidthBasis: widget.textWidthBasis,
obscureText: widget.obscureText,
autocorrect: widget.autocorrect,
smartDashesType: widget.smartDashesType,
smartQuotesType: widget.smartQuotesType,
enableSuggestions: widget.enableSuggestions,
offset: offset,
onSelectionChanged: _handleSelectionChanged,
onCaretChanged: _handleCaretChanged,
rendererIgnoresPointer: widget.rendererIgnoresPointer,
cursorWidth: widget.cursorWidth,
cursorRadius: widget.cursorRadius,
cursorOffset: widget.cursorOffset,
selectionHeightStyle: widget.selectionHeightStyle,
selectionWidthStyle: widget.selectionWidthStyle,
paintCursorAboveText: widget.paintCursorAboveText,
enableInteractiveSelection: widget.enableInteractiveSelection ?? true,
textSelectionDelegate: this,
devicePixelRatio: _devicePixelRatio
)
)
);

if (!widget.obscureText && _value.composing.isValid) {
TextStyle composingStyle = widget.style.merge(
new TextStyle(decoration: TextDecoration.underline)
);
return new TextSpan(
style: widget.style,
children: new List<InlineSpan> {
new TextSpan(text: _value.composing.textBefore(_value.text)),
new TextSpan(
style: composingStyle,
text: _value.composing.textInside(_value.text)
),
new TextSpan(text: _value.composing.textAfter(_value.text)),
});
}
var text = _value.text;
text = new string(RenderEditable.obscuringCharacter, text.Length);
int o = _obscureShowCharTicksPending > 0 ? _obscureLatestCharIndex : -1;
if (o >= 0 && o < text.Length) {
text = text.Substring(0, o) + _value.text.Substring(o, 1) + text.Substring(o + 1);
var text = _value.text;
if (widget.obscureText) {
text = new string(RenderEditable.obscuringCharacter, text.Length);
int o = _obscureShowCharTicksPending > 0 ? _obscureLatestCharIndex : -1;
if (o >= 0 && o < text.Length) {
text = text.Substring(0, o) + _value.text.Substring(o, 1) + text.Substring(o + 1);
}
return new TextSpan(style: widget.style, text: text);
return new TextSpan(style: widget.style, text: text);
return widget.controller.buildTextSpan(
style: widget.style,
withComposing: !widget.readOnly
);
// unity keyboard has a preview view with editing function, text selection & cursor function of this widget is disable
// in the case
/*Offset _getImePos() {
if (_hasInputConnection && _textInputConnection.imeRequired()) {
var localPos = renderEditable.getLocalRectForCaret(_value.selection.basePos).bottomLeft;
return renderEditable.localToGlobal(localPos);
}
return null;
}*/
/*void _updateImePosIfNeed() {
if (!_hasInputConnection || !_textInputConnection.imeRequired()) {
return;
}
if (_imePosUpdateScheduled) {
return;
}
_imePosUpdateScheduled = true;
SchedulerBinding.instance.addPostFrameCallback(_ => {
_imePosUpdateScheduled = false;
if (!_hasInputConnection) {
return;
}
_textInputConnection.setIMEPos(_getImePos());
});
}*/
public readonly LayerLink startHandleLayerLink;
public readonly LayerLink endHandleLayerLink;
public readonly bool forceLine;
public readonly bool readOnly;
public readonly bool hasFocus;
public readonly int? maxLines;
public readonly int? minLines;

public readonly float textScaleFactor;
public readonly TextAlign textAlign;
public readonly TextAlign? textAlign;
public readonly TextWidthBasis textWidthBasis;
public readonly SmartDashesType smartDashesType;
public readonly SmartQuotesType smartQuotesType;
public readonly bool? enableSuggestions;
public readonly ViewportOffset offset;
public readonly SelectionChangedHandler onSelectionChanged;
public readonly CaretChangedHandler onCaretChanged;

public readonly Offset cursorOffset;
public readonly ui.BoxHeightStyle selectionHeightStyle;
public readonly ui.BoxWidthStyle selectionWidthStyle;
public readonly GlobalKeyEventHandlerDelegate globalKeyEventHandler;
public _Editable(TextSpan textSpan = null,
//public readonly GlobalKeyEventHandlerDelegate globalKeyEventHandler;
public readonly Locale locale;
public _Editable(
Key key = null,
TextSpan textSpan = null,
LayerLink startHandleLayerLink = null,
LayerLink endHandleLayerLink = null,
bool forceLine = false,
bool readOnly = false,
TextWidthBasis textWidthBasis = TextWidthBasis.parent,
bool hasFocus = false,
int? maxLines = null,
int? minLines = null,

float textScaleFactor = 1.0f,
TextAlign? textAlign = null,
Locale locale = null,
TextAlign textAlign = TextAlign.left,
SmartDashesType smartDashesType = SmartDashesType.disabled,
SmartQuotesType smartQuotesType = SmartQuotesType.disabled,
bool? enableSuggestions = null,
Key key = null,
TextSelectionDelegate textSelectionDelegate = null,
bool? paintCursorAboveText = null,
ui.BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
ui.BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
bool? paintCursorAboveText = null,
float? devicePixelRatio = null,
GlobalKeyEventHandlerDelegate globalKeyEventHandler = null) : base(key) {
TextSelectionDelegate textSelectionDelegate = null,
float? devicePixelRatio = null
//GlobalKeyEventHandlerDelegate globalKeyEventHandler = null
) : base(key) {
this.startHandleLayerLink = startHandleLayerLink;
this.endHandleLayerLink = endHandleLayerLink;
this.locale = locale;
this.forceLine = forceLine;
this.readOnly = readOnly;
this.textWidthBasis = textWidthBasis;
this.hasFocus = hasFocus;
this.maxLines = maxLines;
this.minLines = minLines;

this.textDirection = textDirection;
this.obscureText = obscureText;
this.autocorrect = autocorrect;
this.smartDashesType = smartDashesType;
this.smartQuotesType = smartQuotesType;
this.enableSuggestions = enableSuggestions;
this.offset = offset;
this.onSelectionChanged = onSelectionChanged;
this.onCaretChanged = onCaretChanged;

this.cursorRadius = cursorRadius;
this.cursorOffset = cursorOffset;
this.paintCursorAboveText = paintCursorAboveText;
this.selectionHeightStyle = selectionHeightStyle;
this.selectionWidthStyle = selectionWidthStyle;
this.paintCursorAboveText = paintCursorAboveText;
this.globalKeyEventHandler = globalKeyEventHandler;
//this.globalKeyEventHandler = globalKeyEventHandler;
textDirection: textDirection ?? TextDirection.ltr,
offset: offset,
showCursor: showCursor,
startHandleLayerLink: startHandleLayerLink,
endHandleLayerLink: endHandleLayerLink,
showCursor: showCursor,
forceLine: forceLine,
readOnly: readOnly,
hasFocus: hasFocus,
maxLines: maxLines,
minLines: minLines,

textScaleFactor: textScaleFactor,
textAlign: textAlign,
textAlign: textAlign ?? TextAlign.start,
textDirection: textDirection,
locale: locale ?? Localizations.localeOf(context, nullOk: true),
obscureText: obscureText,
offset: offset,
obscureText: obscureText,
textWidthBasis: textWidthBasis,
paintCursorAboveText: paintCursorAboveText ?? false,
selectionHeightStyle: selectionHeightStyle,
selectionWidthStyle: selectionWidthStyle,
paintCursorAboveText: paintCursorAboveText == true,
devicePixelRatio: devicePixelRatio ?? 1.0f,
globalKeyEventHandler : globalKeyEventHandler
devicePixelRatio: devicePixelRatio ?? 1.0f
);
}

edit.cursorColor = cursorColor;
edit.backgroundCursorColor = backgroundCursorColor;
edit.startHandleLayerLink = startHandleLayerLink;
edit.endHandleLayerLink = endHandleLayerLink;
edit.forceLine = forceLine;
edit.readOnly = readOnly;
edit.minLines = minLines;
edit.expands = expands;
edit.locale = locale ?? Localizations.localeOf(context, nullOk: true);
edit.textWidthBasis = textWidthBasis;
edit.textSelectionDelegate = textSelectionDelegate;
edit.cursorWidth = cursorWidth ?? 1.0f;
edit.cursorWidth = cursorWidth ?? 0.0f;
edit.enableInteractiveSelection = enableInteractiveSelection;
edit.paintCursorAboveText = paintCursorAboveText == true;
edit.selectionHeightStyle = selectionHeightStyle;
edit.selectionWidthStyle = selectionWidthStyle;
edit.textSelectionDelegate = textSelectionDelegate;
edit.globalKeyEventHandler = globalKeyEventHandler;
edit.paintCursorAboveText = paintCursorAboveText ?? false;
}
}
}

181
com.unity.uiwidgets/Runtime/widgets/fade_in_image.cs


ImageProvider placeholder,
ImageErrorWidgetBuilder placeholderErrorBuilder,
ImageProvider image,
ImageErrorWidgetBuilder imageErrorBuilder,
ImageErrorWidgetBuilder imageErrorBuilder = null,
TimeSpan? fadeOutDuration = null,
Curve fadeOutCurve = null,
TimeSpan? fadeInDuration = null,

BoxFit? fit = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
Key key = null
Key key = null,
bool matchTextDirection = false
D.assert(placeholder != null);
D.assert(image != null);
D.assert(fadeOutDuration != null);
D.assert(fadeOutCurve != null);

this.fadeInCurve = fadeInCurve ?? Curves.easeIn;
this.alignment = alignment ?? Alignment.center;
this.repeat = repeat;
this.matchTextDirection = matchTextDirection;
byte[] placeholder,
ImageErrorWidgetBuilder placeholderErrorBuilder,
string image,
ImageErrorWidgetBuilder imageErrorBuilder,
byte[] placeholder ,
string image ,
Key key = null,
ImageErrorWidgetBuilder placeholderErrorBuilder = null,
ImageErrorWidgetBuilder imageErrorBuilder = null,
float placeholderScale = 1.0f,
float imageScale = 1.0f,
TimeSpan? fadeOutDuration = null,

float? width = null,
float? height = null,
BoxFit? fit = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
Key key = null,
int placeholderCacheWidth = default,
int placeholderCacheHeight = default,
int imageCacheWidth = default,
int imageCacheHeight = default
bool matchTextDirection = false,
int? placeholderCacheWidth = null,
int? placeholderCacheHeight = null,
int? imageCacheWidth = null,
int? imageCacheHeight = null
D.assert(placeholder != null);
D.assert(image != null);
D.assert(fadeOutDuration != null);
D.assert(fadeOutCurve != null);
D.assert(fadeInDuration != null);
D.assert(fadeInCurve != null);
D.assert(alignment != null);
var memoryImage = new MemoryImage(placeholder, placeholderScale);
var networkImage = new NetworkImage(image, imageScale);
/*placeholder = ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight,
new MemoryImage(placeholder, scale: placeholderScale));
image = ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight,
new NetworkImage(image, scale: imageScale));*/
alignment = alignment ?? Alignment.center;
fadeOutDuration = fadeOutDuration ?? TimeSpan.FromMilliseconds( 300 );
fadeOutCurve = fadeOutCurve ?? Curves.easeOut;
fadeInDuration = fadeInDuration ?? TimeSpan.FromMilliseconds( 700 );
fadeInCurve = fadeInCurve ?? Curves.easeIn;
ImageProvider memoryImage = new MemoryImage(placeholder, placeholderScale);
ImageProvider networkImage = new NetworkImage(image, imageScale);
//placeholder = ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, memoryImage);
//image = ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, networkImage);
placeholder: memoryImage,
placeholder: ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, memoryImage),
image: networkImage,
image: ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, networkImage),
imageErrorBuilder: imageErrorBuilder,
fadeOutDuration: fadeOutDuration,
fadeOutCurve: fadeOutCurve,

fit: fit,
alignment: alignment,
repeat: repeat,
matchTextDirection: matchTextDirection,
key: key
);
}

ImageErrorWidgetBuilder placeholderErrorBuilder,
ImageErrorWidgetBuilder imageErrorBuilder,
ImageErrorWidgetBuilder placeholderErrorBuilder = null,
ImageErrorWidgetBuilder imageErrorBuilder = null,
AssetBundle bundle = null,
float? placeholderScale = null,
float imageScale = 1.0f,

float? width = null,
float? height = null,
BoxFit? fit = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
bool matchTextDirection = false,
int placeholderCacheWidth = default,
int placeholderCacheHeight = default,
int imageCacheWidth = default,
int imageCacheHeight = default
int? placeholderCacheWidth = null,
int? placeholderCacheHeight = null,
int? imageCacheWidth = null,
int? imageCacheHeight = null
D.assert(placeholder != null);
D.assert(image != null);
var imageProvider = placeholderScale != null
? new ExactAssetImage(placeholder, bundle: bundle, scale: placeholderScale ?? 1.0f)
: (ImageProvider) new AssetImage(placeholder, bundle: bundle);
/*placeholder = placeholderScale != null
? ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, ExactAssetImage(placeholder, bundle: bundle, scale: placeholderScale))
: ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, AssetImage(placeholder, bundle: bundle));*/
var networkImage = new NetworkImage(image, imageScale);
var holder = placeholderScale ?? 1.0f;
var _placeholder = placeholderScale != null
? ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight,
new ExactAssetImage(placeholder, bundle: bundle, scale: holder))
: ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight,
new AssetImage(placeholder, bundle: bundle));
placeholder: imageProvider,
placeholder: _placeholder,
image: networkImage,
image: ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, new NetworkImage(image, scale: imageScale)),
imageErrorBuilder: imageErrorBuilder,
fadeOutDuration: fadeOutDuration,
fadeOutCurve: fadeOutCurve,

fit: fit,
alignment: alignment,
repeat: repeat,
matchTextDirection: matchTextDirection,
key: key
);
}

public readonly float? width;
public readonly float? height;
public readonly BoxFit? fit;
public readonly Alignment alignment;
public readonly AlignmentGeometry alignment;
public readonly bool matchTextDirection;
public Image _image(
ImageProvider image = null,

D.assert(image != null);
return new Image(
image: image,
//errorBuilder: errorBuilder,
//frameBuilder: frameBuilder,
errorBuilder: errorBuilder,
frameBuilder: frameBuilder,
//matchTextDirection: matchTextDirection,
matchTextDirection: matchTextDirection,
);
}

errorBuilder: imageErrorBuilder,
frameBuilder: (BuildContext context1, Widget child, int frame, bool wasSynchronouslyLoaded) => {
if (wasSynchronouslyLoaded)
return child;
return new _AnimatedFadeOutFadeIn(
key: key,
target: child,
placeholder: _image(
image: placeholder,
errorBuilder: placeholderErrorBuilder
),
isTargetLoaded: frame != null,
fadeInDuration: fadeInDuration,
fadeOutDuration: fadeOutDuration,
fadeInCurve: fadeInCurve,
fadeOutCurve: fadeOutCurve
);
}
frameBuilder: (BuildContext context1, Widget child, int frame, bool wasSynchronouslyLoaded)=> {
if (wasSynchronouslyLoaded)
return child;
return new _AnimatedFadeOutFadeIn(
target: child,
placeholder: _image(image: placeholder, errorBuilder: placeholderErrorBuilder),
isTargetLoaded: frame != null,
fadeInDuration: fadeInDuration,
fadeOutDuration: fadeOutDuration,
fadeInCurve: fadeInCurve,
fadeOutCurve: fadeOutCurve
);
}
);
return result;
}

public _AnimatedFadeOutFadeIn(
Key key,
Widget target,
Widget placeholder,
bool isTargetLoaded,
Widget target ,
Widget placeholder ,
bool isTargetLoaded ,
Curve fadeInCurve
Curve fadeInCurve,
Key key = null
D.assert(target != null);
D.assert(placeholder != null);
D.assert(isTargetLoaded != null);
D.assert(fadeOutDuration != null);
D.assert(fadeOutCurve != null);
D.assert(fadeInDuration != null);
D.assert(fadeInCurve != null);
this.target = target;
this.placeholder = placeholder;
this.isTargetLoaded = isTargetLoaded;

Animation<float> _targetOpacityAnimation;
Animation<float> _placeholderOpacityAnimation;
/*@override
void forEachTween(TweenVisitor<dynamic> visitor) {
_targetOpacity = visitor(
_targetOpacity,
widget.isTargetLoaded ? 1.0 : 0.0,
(dynamic value) => Tween<double>(begin: value as double),
) as Tween<double>;
_placeholderOpacity = visitor(
_placeholderOpacity,
widget.isTargetLoaded ? 0.0 : 1.0,
(dynamic value) => Tween<double>(begin: value as double),
) as Tween<double>;
}*/
protected override void forEachTween(TweenVisitor visitor) {
_targetOpacity = (FloatTween) visitor.visit(
state: this,

weight: (float) widget.fadeInDuration?.Milliseconds
));
//[!!!] drive
/*_placeholderOpacityAnimation = animation.drive(list).addStatusListener((AnimationStatus status) =>{
_placeholderOpacityAnimation = animation.drive(new TweenSequence<float>(list));
_placeholderOpacityAnimation.addStatusListener((AnimationStatus status) =>{
// Need to rebuild to remove placeholder now that it is invisibile.
});*/
});
List<TweenSequenceItem<float>> list2 = new List<TweenSequenceItem<float>>();
list2.Add(new TweenSequenceItem<float>(

tween: _targetOpacity.chain(new CurveTween(curve: widget.fadeInCurve)),
weight: (float) widget.fadeInDuration?.Milliseconds
));
//_targetOpacityAnimation = animation.drive(list2);[!!!] animation.cs drive
_targetOpacityAnimation = animation.drive(new TweenSequence<float>(list2));
//controller.value = controller.upperBound;[!!!] animation_controller.cs value set
controller.setValue(controller.upperBound);
}
}

return new Stack(
fit: StackFit.passthrough,
alignment: Alignment.center,//AlignmentDirectional.center,[!!!]
alignment: AlignmentDirectional.center,
textDirection: TextDirection.ltr,
children: new List<Widget>() {
target,

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


if (_descendants == null) {
List<FocusNode> result = new List<FocusNode>();
foreach (FocusNode child in _children) {
foreach (var childDescendant in child.descendants) {
result.Add(childDescendant);
}
//result.addAll(child.descendants);
result.AddRange(child.descendants);
result.Add(child);
}

if (!node.skipTraversal && node.canRequestFocus) {
nodes.Add(node);
}
// descendants.where((FocusNode node) => !node.skipTraversal && node.canRequestFocus);
return nodes;
}

public void _notify() {
if (_parent == null) {
return;
}

notifyListeners();
}

}
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<BuildContext>("context", context, defaultValue: null));

}
return child.toDiagnosticsNode(name: "Child ${count++}");
return child.toDiagnosticsNode(name: $"Child {count++}");
public override string toStringShort() {//override
bool hasDebugLabel = debugLabel != null && debugLabel.isNotEmpty();
string nullStr = "";

onKey: onKey,
canRequestFocus: canRequestFocus,
skipTraversal: skipTraversal
) {
D.assert(skipTraversal != null);
D.assert(canRequestFocus != null);
}
) {}
get { return enclosingScope; }
get { return this; }
}
public bool isFirstFocus {

// It is possible that a previously focused child is no longer focusable.
while (focusedChild != null && !focusedChild.canRequestFocus)
_focusedChildren.removeLast();
if (!findFirstFocus) {
if (canRequestFocus) {
_setAsFocusedChildForScope();

_markNextFocus(this);
}
} else {
primaryFocus._doRequestFocus(findFirstFocus: findFirstFocus);
primaryFocus._doRequestFocus(findFirstFocus: findFirstFocus);
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

childList = _focusedChildren.Select((FocusNode child)=> {
return child.toStringShort();
}).ToList();
// properties.add(new IEnumerableProperty<string>("focusedChildren", childList, defaultValue: new List<string>()));
properties.add(new EnumerableProperty<string>("focusedChildren", childList, defaultValue: new List<string>()));
{
{
rootScope._manager = this;
RawKeyboard.instance.addListener(_handleRawKeyEvent);
GestureBinding.instance.pointerRouter.addGlobalRoute(_handlePointerEvent);

24
com.unity.uiwidgets/Runtime/widgets/focus_scope.cs


using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.widgets {
class _FocusScopeMarker : InheritedWidget {
public _FocusScopeMarker(FocusScopeNode node, Widget child, Key key = null) : base(key, child) {
D.assert(node != null);
this.node = node;
}
public readonly FocusScopeNode node;
public override bool updateShouldNotify(InheritedWidget oldWidget) {
return node != ((_FocusScopeMarker) oldWidget).node;
}
}
public class FocusScope : Focus {
public FocusScope(

onKey: onKey,
debugLabel: debugLabel) {
D.assert(child != null);
D.assert(autofocus != null);
}
public static FocusScopeNode of(BuildContext context) {
D.assert(context != null);

bool includeSemantics = true
) :base(key:key) {
D.assert(child != null);
D.assert(autofocus != null);
D.assert(includeSemantics != null);
this.child = child;
this.focusNode = focusNode;
this.autofocus = autofocus;

public static FocusNode of(BuildContext context, bool nullOk = false, bool scopeOk = false ) {
D.assert(context != null);
D.assert(nullOk != null);
D.assert(scopeOk != null);
_FocusMarker marker = context.dependOnInheritedWidgetOfExactType<_FocusMarker>();
FocusNode node = marker?.notifier;
if (node == null) {

public override Widget build(BuildContext context) {
_focusAttachment.reparent();
Widget child = widget.child;
/*if (widget.includeSemantics) {
child = Semantics(
focusable: _canRequestFocus,
focused: _hasPrimaryFocus,
child: widget.child,
);
}*/
return new _FocusMarker(
node: focusNode,
child: child

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


FocusTraversalPolicy policy = null,
Widget child = null
) : base(key: key) {
policy = policy ?? new ReadingOrderTraversalPolicy();
this.policy = policy ?? new ReadingOrderTraversalPolicy();
this.child = child;
}

) {
groupNode = marker?.focusNode;
policy = marker?.policy ?? defaultPolicy ?? new ReadingOrderTraversalPolicy();
members = members ?? new List<FocusNode>();
this.members = members ?? new List<FocusNode>();
}
public readonly FocusNode groupNode;
public readonly FocusTraversalPolicy policy;

D.assert(currentNode != null);
FocusScopeNode scope = currentNode.nearestScope;
FocusNode candidate = scope.focusedChild;
if (candidate == null && scope.descendants.Count() != 0) {
List<FocusNode> sorted = _sortAllDescendants(scope);
candidate = sorted.isNotEmpty() ? sorted.First() : null;
if (candidate == null && scope.descendants.Any()) {
IEnumerable<FocusNode> sorted = _sortAllDescendants(scope);
candidate = sorted.Any() ? sorted.First() : null;
}
candidate = candidate ?? currentNode;

}
HashSet<FocusNode> groupKeys = new HashSet<FocusNode>(groups.Keys);
foreach ( FocusNode key in groups.Keys) {
List<FocusNode> sortedMembers = groups[key].policy.sortDescendants(groups[key].members).ToList();
List<FocusNode> sortedMembers = groups.getOrDefault(key).policy.sortDescendants(groups.getOrDefault(key).members).ToList();
groups[key].members.Clear();
groups[key].members.AddRange(sortedMembers);
}

FocusNode node ) {
this.direction = direction;
this.node = node;
}
public readonly TraversalDirection direction;
public readonly FocusNode node;

public class _DirectionalPolicyData {
public _DirectionalPolicyData(List<_DirectionalPolicyDataEntry> history) {
D.assert(history != null);
this.history = history;
}

public class OrderedTraversalPolicy : DirectionalFocusTraversalPolicyMixinFocusTraversalPolicy {
public OrderedTraversalPolicy(FocusTraversalPolicy secondary) {
this.secondary = secondary;
}
public readonly FocusTraversalPolicy secondary;

public class FocusTraversalOrder : InheritedWidget {
public FocusTraversalOrder(Key key = null, FocusOrder order = null, Widget child = null)
: base(key: key, child: child) {
this.order = order;
}
public readonly FocusOrder order;

D.assert(nullOk != null);
FocusTraversalOrder marker = context.getElementForInheritedWidgetOfExactType<FocusTraversalOrder>()?.widget as FocusTraversalOrder;
FocusOrder order = marker?.order;
if (order == null && !nullOk) {

properties.add(new DiagnosticsProperty<FocusNode>("previous", _previousFocus));
}
}
public class RequestFocusAction : _RequestFocusActionBase {
/// Creates a [RequestFocusAction] with a fixed [key].
public RequestFocusAction() : base(key) {
}
public static readonly LocalKey key = new ValueKey<Type>(typeof(RequestFocusAction));
public override void invoke(FocusNode node, Intent intent) => FocusTravesalUtils._focusAndEnsureVisible(node);
}
public class NextFocusAction : _RequestFocusActionBase {
public NextFocusAction() : base(key) {

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


Widget child = null,
FormState formState = null,
int? generation = null
) :
base(key: key, child: child) {
) : base(key: key, child: child) {
_formState = formState;
_generation = generation;
}

get { return _errorText != null; }
}
//[!!!] call?
/*public bool isValid {
public bool isValid {
return widget.validator?.call(_value) == null;
return widget.validator?.Invoke(_value) == null;
}*/
}
public void save() {
if (widget.onSaved != null) {

258
com.unity.uiwidgets/Runtime/widgets/framework.cs


error = new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary("Multiple widgets used the same GlobalKey."),
new ErrorDescription(
"The key $key was used by multiple widgets. The parents of those widgets were " +
$"The key {key} was used by multiple widgets. The parents of those widgets were " +
" ${parent.toString()}\n" +
$" {parent.toString()}\n" +
"A GlobalKey can only be specified on one widget at a time in the widget tree."
)
});

D.assert(element.widget.key != null);
GlobalKey key = (GlobalKey) element.widget.key;
CompositeKey compKey = new CompositeKey(Window.instance, key);
duplicates = duplicates ?? new Dictionary<GlobalKey, HashSet<Element>>();
var elements = duplicates.putIfAbsent(key, () => new HashSet<Element>());
elements.Add(element);

public abstract Element createElement();
public override string toStringShort() {
return key == null ? GetType().ToString() : GetType() + "-" + key;
return key == null ? GetType().ToString() : $"{GetType()}-{key}";
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

public virtual void didUpdateWidget(StatefulWidget oldWidget) {
}
public virtual void reassemble() {
}
public void setState(VoidCallback fn = null) {
D.assert(() => {
if (_debugLifecycleState == _StateLifecycle.defunct) {

return true;
});
if (fn != null) {
fn();
}

return true;
});
D.assert(!children.Any(child => child == null));
this.children = children;
}

public delegate bool ElementVisitorBool(Element element);
public interface BuildContext {
bool debugDoingBuild { get; }
bool debugDoingBuild { get; }
RenderObject findRenderObject();

State rootAncestorStateOfType(TypeMatcher matcher);
T findRootAncestorStateOfType<T>() where T: State ;//: State<StatefulWidget>;
T findRootAncestorStateOfType<T>() where T: State;
RenderObject ancestorRenderObjectOfType(TypeMatcher matcher);

D.assert(element.owner == this);
D.assert(() => {
if (WidgetsD.debugPrintScheduleBuildForStacks) {
Debug.Log("scheduleBuildFor() called for " + element +
Debug.LogFormat("scheduleBuildFor() called for {0} {1}", element,
(_dirtyElements.Contains(element) ? " (ALREADY IN LIST)" : ""));
}

"calling scheduleBuildFor()."),
new ErrorHint(
"If you did not attempt to call scheduleBuildFor() yourself, then this probably " +
"indicates a bug in the widgets framework. Please report it:\n" +
" https://github.com/flutter/flutter/issues/new?template=BUG.md"
"indicates a bug in the widgets framework."
),
}
);

}
int _debugStateLockLevel = 0;
internal bool _debugStateLocked {
get { return _debugStateLockLevel > 0; }
}

}
bool _debugBuilding = false;
internal Element _debugCurrentBuildTarget;

}
catch (Exception ex) {
IEnumerable<DiagnosticsNode> infoCollector() {
//yield return new DiagnosticsDebugCreator(new DebugCreator(_dirtyElements[index]));
yield return new DiagnosticsDebugCreator(new DebugCreator(_dirtyElements[index]));
"while rebuilding dirty elements", ex,
new ErrorDescription("while rebuilding dirty elements"),
ex,
informationCollector: infoCollector
);
}

}
internal void _debugElementWasRebuilt(Element node) {
if (_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans != null) {
_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans.Remove(node);
}
_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans?.Remove(node);
}
public void finalizeTree() {

D.assert(keyLabels.isNotEmpty());
string the = keys.Count == 1 ? " the" : "";
string s = keys.Count == 1 ? "" : "s";
string were = keys.Count == 1 ? "was" : "were";
string their = keys.Count == 1 ? "its" : "their";
string respective = elementLabels.Count == 1 ? "" : " respective";
string those = keys.Count == 1 ? "that" : "those";
string s2 = elementLabels.Count == 1 ? "" : "s";
string those2 = elementLabels.Count == 1 ? "that" : "those";
string they = elementLabels.Count == 1 ? "it" : "they";
string think = elementLabels.Count == 1 ? "thinks" : "think";
string are = elementLabels.Count == 1 ? "is" : "are";
"The following GlobalKeys were specified multiple times in the widget tree. This will lead to " +
$"The following GlobalKey{s} {were} specified multiple times in the widget tree. This will lead to " +
"the previous instance is moved to the new location. The keys were:\n" + "- " +
$"the previous instance is moved to the new location. The key{s} {were}:\n" + "- " +
"This was determined by noticing that after$the widgets with the above global keys were moved " +
"out of their respective previous parent, those previous parents never updated during this frame, meaning " +
"that they either did not update at all or updated before the widgets were moved, in either case " +
"implying that they still think that they should have a child with those global keys.\n" +
"The specific parent that did not update after having one or more children forcibly removed " +
"due to GlobalKey reparenting are:\n" +
$"This was determined by noticing that after {the} widget{s} with the above global key{s} {were} moved " +
$"out of {their} {respective} previous parent{s2}, {those2} previous parent{s2} never updated during this frame, meaning " +
$"that {they} either did not update at all or updated before the widget{s} {were} moved, in either case " +
$"implying that {they} still {think} that {they} should have a child with {those} global key{s}.\n" +
$"The specific parent{s2} that did not update after having one or more children forcibly removed " +
$"due to GlobalKey reparenting {are}:\n" +
),
)
if (_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans != null) {
_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans.Clear();
}
_debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans?.Clear();
}
return true;

WidgetsD._debugReportException("while finalizing the widget tree", ex);
WidgetsD._debugReportException(new ErrorSummary("while finalizing the widget tree"), ex);
}
}
void reassemble(Element root) {
try {
D.assert(root._parent == null);
D.assert(root.owner == this);
root.reassemble();
}
finally {
}
}
}

}
internal Widget _widget;
public virtual bool debugDoingBuild { get; }
internal BuildOwner _owner;
public BuildOwner owner {

public bool _active = false;
public virtual void reassemble() {
markNeedsBuild();
visitChildren((Element child) => {
child.reassemble();
});
}
public virtual bool debugDoingBuild { get; }
internal bool _debugIsInScope(Element target) {
Element current = this;

}
protected virtual Element updateChild(Element child, Widget newWidget, object newSlot) {
/*D.assert(() => {
if (newWidget != null && newWidget.key is GlobalKey) {
GlobalKey key = (GlobalKey) newWidget.key;
key._debugReserveFor(this);
}
return true;
});*/
if (child != null)
if (child != null) {
}
return null;
}

return true;
});
if (hasSameSuperclass && child.widget == newWidget) {
if (child.slot != newSlot)
if (child.slot != newSlot) {
}
if (child.slot != newSlot)
if (child.slot != newSlot) {
}
child.update(newWidget);
D.assert(child.widget == newWidget);
D.assert(() => {

bool hadDependencies = (_dependencies != null && _dependencies.isNotEmpty()) ||
_hadUnsatisfiedDependencies;
_active = true;
if (_dependencies != null) {
_dependencies.Clear();
}
_dependencies?.Clear();
_hadUnsatisfiedDependencies = false;
_updateInheritance();
D.assert(() => {

new ErrorHint(
"If you need some sizing information during build to decide which " +
"widgets to build, consider using a LayoutBuilder widget, which can " +
"tell you the layout constraints at a given location in the tree. See " +
"<https://api.flutter.dev/flutter/widgets/LayoutBuilder-class.html> " +
"for more details."
"tell you the layout constraints at a given location in the tree."
),
new ErrorSpacer(),
describeElement("The size getter was called for the following element"),

}
public virtual InheritedWidget inheritFromElement(InheritedElement ancestor, object aspect = null) {
D.assert(ancestor != null);
_dependencies = _dependencies ?? new HashSet<InheritedElement>();
_dependencies.Add(ancestor);
ancestor.updateDependencies(this, aspect);
return ancestor.widget;
return dependOnInheritedElement(ancestor, aspect: aspect);
}
public virtual InheritedWidget dependOnInheritedElement(InheritedElement ancestor, object aspect = null) {

internal virtual void _updateInheritance() {
D.assert(_active);
_inheritedWidgets = _parent == null ? null : _parent._inheritedWidgets;
_inheritedWidgets = _parent?._inheritedWidgets;
}
public virtual Widget ancestorWidgetOfExactType(Type targetType) {

ancestor = ancestor._parent;
}
return ancestor == null ? null : ancestor.widget;
return ancestor?.widget;
while (ancestor != null && ancestor.widget.GetType() != typeof(T))
while (ancestor != null && ancestor.widget.GetType() != typeof(T)) {
}
return ancestor?.widget as T;
}

}
var statefulAncestor = ancestor as StatefulElement;
return statefulAncestor == null ? null : statefulAncestor.state;
return statefulAncestor?.state;
}
public T findAncestorStateOfType<T>() where T : State{

if (ancestor is StatefulElement stateAncestor && stateAncestor.state is T)
if (ancestor is StatefulElement stateAncestor && stateAncestor.state is T) {
}
ancestor = ancestor._parent;
}

ancestor = ancestor._parent;
}
return statefulAncestor == null ? null : statefulAncestor.state;
return statefulAncestor?.state;
public T findRootAncestorStateOfType<T>() where T : State{//<StatefulWidget> {
public T findRootAncestorStateOfType<T>() where T : State {
if (ancestor is StatefulElement stateAncestor && stateAncestor.state is T)
if (ancestor is StatefulElement stateAncestor && stateAncestor.state is T) {
}
ancestor = ancestor._parent;
}

D.assert(_debugCheckStateIsActiveForAncestorLookup());
Element ancestor = _parent;
while (ancestor != null) {
if (ancestor is RenderObjectElement && ancestor.renderObject is T)
if (ancestor is RenderObjectElement && ancestor.renderObject is T) {
}
ancestor = ancestor._parent;
}

}
public List<Element> debugGetDiagnosticChain() {
var chain = new List<Element>();
var chain = new List<Element>() {this};
Element node = _parent;
while (node != null) {
chain.Add(node);

}
if (!_debugAllowIgnoredCallsToMarkNeedsBuild) {
throw new UIWidgetsError(
new List<DiagnosticsNode>(){
List<DiagnosticsNode> information = new List<DiagnosticsNode>() {
new ErrorSummary("setState() or markNeedsBuild() called during build.\n"),
new ErrorDescription("This " + widget.GetType() +
" widget cannot be marked as needing to build because the framework " +

"builds parent widgets before children, which means a dirty descendant " +
"will always be built. Otherwise, the framework might not visit this " +
"widget during this build phase.\n" +
"The widget on which setState() or markNeedsBuild() was called was:\n" +
" " + this + "\n" +
(owner._debugCurrentBuildTarget == null
? ""
: "The widget which was currently being built when the offending call was made was:\n " +
owner._debugCurrentBuildTarget))
}
"widget during this build phase.\n"),
describeElement("The widget on which setState() or markNeedsBuild() was called was")
};
if (owner._debugCurrentBuildTarget != null) {
information.Add(owner._debugCurrentBuildTarget.describeWidget("The widget which was currently being built when the offending call was made was"));
}
throw new UIWidgetsError(
information
);
}

}
D.assert(() => {
if (WidgetsD.debugPrintRebuildDirtyWidgets) {
if (!_debugBuiltOnce) {
Debug.Log("Building " + this);

protected abstract void performRebuild();
}
public delegate Widget ErrorWidgetBuilder(UIWidgetsErrorDetails details);
internal class _ElementDiagnosticableTreeNode : DiagnosticableTreeNode {
internal _ElementDiagnosticableTreeNode(
Element value,

}
readonly bool stateful;
/*public override Dictionary<string, object> toJsonMap() {
Dictionary<string, object> json = base.toJsonMap();
Element element = value as Element;
json["widgetRuntimeType"] = element.widget?.GetType()?.ToString();
json["stateful"] = stateful;
return json;
}*/
public override Dictionary<string, object> toJsonMap(DiagnosticsSerializationDelegate Delegate) {
Dictionary<string, object> json = base.toJsonMap(Delegate);
Element element = value as Element;

}
}
public delegate Widget ErrorWidgetBuilder(UIWidgetsErrorDetails details);
public class ErrorWidget : LeafRenderObjectWidget {
public ErrorWidget(Exception exception, string message = null) : base(key: new UniqueKey()) {

return new ErrorWidget(error, message);
}
public static ErrorWidgetBuilder builder = (details) => new ErrorWidget(details.exception);
public static ErrorWidgetBuilder builder = _defaultErrorWidgetBuilder;
static Widget _defaultErrorWidgetBuilder(UIWidgetsErrorDetails details) {
string message = "";

}
catch (Exception e) {
_debugDoingBuild = false;
built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e));
IEnumerable<DiagnosticsNode> informationCollector() {
yield return new DiagnosticsDebugCreator(new DebugCreator(this));
}
built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e, informationCollector));
}
finally {
_dirty = false;

D.assert(_child != null);
}
catch (Exception e) {
built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e));
IEnumerable<DiagnosticsNode> informationCollector() {
yield return new DiagnosticsDebugCreator(new DebugCreator(this));
}
built = ErrorWidget.builder(WidgetsD._debugReportException("building " + this, e, informationCollector));
_child = updateChild(null, built, slot);
}
}

});
D.assert(_state._element == null);
_state._element = this;
D.assert(_state._widget == null);
D.assert(_state._widget == null, () => $"The createState function for {widget} returned an old or invalid state " +
$"instance: {_state._widget}, which is not null, violating the contract " +
"for createState.");
protected override Widget build() {
return _state.build(this);
}
protected override Widget build() {
return _state.build(this);
}
public override void reassemble() {
state.reassemble();
base.reassemble();
}
protected override void _firstBuild() {
D.assert(_state._debugLifecycleState == _StateLifecycle.created);

internal readonly Dictionary<Element, object> _dependents = new Dictionary<Element, object>();
internal override void _updateInheritance() {
Dictionary<Type, InheritedElement> incomingWidgets =
_parent == null ? null : _parent._inheritedWidgets;
D.assert(_active);
Dictionary<Type, InheritedElement> incomingWidgets = _parent?._inheritedWidgets;
if (incomingWidgets != null) {
_inheritedWidgets = new Dictionary<Type, InheritedElement>(incomingWidgets);

}
RenderObject _renderObject;
public override RenderObject renderObject {
get { return _renderObject; }
}
bool _debugDoingBuild = false;

public override RenderObject renderObject {
get { return _renderObject; }
}
RenderObjectElement _ancestorRenderObjectElement;
RenderObjectElement _findAncestorRenderObjectElement() {

ParentDataElement _findAncestorParentDataElement() {
Element ancestor = _parent;
ParentDataElement result = null;
//ParentData>
while (ancestor != null && !(ancestor is RenderObjectElement)) {
if (ancestor is ParentDataElement parentDataElement) {
result = parentDataElement;

if (result == null || ancestor == null) {
return true;
}
// Check that no other ParentDataWidgets want to provide parent data.
List<ParentDataElement> badAncestors = new List<ParentDataElement>();
ancestor = ancestor._parent;
while (ancestor != null && !(ancestor is RenderObjectElement)) {

badAncestors.Insert(0, result);
try {
List<ErrorDescription> errors = new List<ErrorDescription>();
foreach (ParentDataElement<ParentData> parentDataElement in badAncestors)
foreach (ParentDataElement<ParentData> parentDataElement in badAncestors) {
}
List<DiagnosticsNode> results = new List<DiagnosticsNode>();
results.Add( new ErrorSummary("Incorrect use of ParentDataWidget."));

}
}
// Update the middle of the list.
while (newChildrenTop <= newChildrenBottom) {
Element oldChild = null;
Widget newWidget = newWidgets[newChildrenTop];

}
}
catch (UIWidgetsError e) {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("while apply parent data"),
exception: e
));
WidgetsD._debugReportException(new ErrorSummary("while apply parent data"), e);
}
return true;

D.assert(_ancestorRenderObjectElement == null);
_slot = newSlot;
_ancestorRenderObjectElement = _findAncestorRenderObjectElement();
if (_ancestorRenderObjectElement != null) {
_ancestorRenderObjectElement.insertChildRenderObject(renderObject, newSlot);
}
_ancestorRenderObjectElement?.insertChildRenderObject(renderObject, newSlot);
ParentDataElement parentDataElement = _findAncestorParentDataElement();
if (parentDataElement != null) {

}
public class DebugCreator {
public DebugCreator(RenderObjectElement element) {
public DebugCreator(Element element) {
public readonly RenderObjectElement element;
public readonly Element element;
public override string ToString() {
return element.debugGetCreatorChain(12);

33
com.unity.uiwidgets/Runtime/widgets/gesture_detector.cs


public delegate void GestureRecognizerFactoryInitializer<T>(T instance) where T : GestureRecognizer;
public class GestureRecognizerFactoryWithHandlers<T> : GestureRecognizerFactory<T> where T : GestureRecognizer {
public GestureRecognizerFactoryWithHandlers(GestureRecognizerFactoryConstructor<T> constructor,
public GestureRecognizerFactoryWithHandlers(
GestureRecognizerFactoryConstructor<T> constructor,
GestureRecognizerFactoryInitializer<T> initializer) {
D.assert(constructor != null);
D.assert(initializer != null);

GestureDragUpdateCallback onHorizontalDragUpdate = null,
GestureDragEndCallback onHorizontalDragEnd = null,
GestureDragCancelCallback onHorizontalDragCancel = null,
GestureForcePressStartCallback onForcePressStart = null,
GestureForcePressPeakCallback onForcePressPeak = null,
GestureForcePressUpdateCallback onForcePressUpdate = null,
GestureForcePressEndCallback onForcePressEnd = null,
GestureDragDownCallback onPanDown = null,
GestureDragStartCallback onPanStart = null,
GestureDragUpdateCallback onPanUpdate = null,

this.onHorizontalDragUpdate = onHorizontalDragUpdate;
this.onHorizontalDragEnd = onHorizontalDragEnd;
this.onHorizontalDragCancel = onHorizontalDragCancel;
this.onForcePressEnd = onForcePressEnd;
this.onForcePressPeak = onForcePressPeak;
this.onForcePressStart = onForcePressStart;
this.onForcePressUpdate = onForcePressUpdate;
this.onPanDown = onPanDown;
this.onPanStart = onPanStart;
this.onPanUpdate = onPanUpdate;

public readonly GestureScaleEndCallback onScaleEnd;
public readonly HitTestBehavior behavior;
public readonly DragStartBehavior dragStartBehavior;
public readonly GestureForcePressStartCallback onForcePressStart;
public readonly GestureForcePressPeakCallback onForcePressPeak;
public readonly GestureForcePressUpdateCallback onForcePressUpdate;
public readonly GestureForcePressEndCallback onForcePressEnd;
public override Widget build(BuildContext context) {
var gestures = new Dictionary<Type, GestureRecognizerFactory>();

}
);
}
if (onForcePressStart != null ||
onForcePressPeak != null ||
onForcePressUpdate != null ||
onForcePressEnd != null) {
gestures[typeof(ForcePressGestureRecognizer)] =
new GestureRecognizerFactoryWithHandlers<ForcePressGestureRecognizer>(
() => new ForcePressGestureRecognizer(debugOwner: this),
(ForcePressGestureRecognizer instance) => {
instance.onStart = onForcePressStart;
instance.onPeak = onForcePressPeak;
instance.onUpdate = onForcePressUpdate;
instance.onEnd = onForcePressEnd;
}
);
}
return new RawGestureDetector(
gestures: gestures,

public override Widget build(BuildContext context) {
Widget result = new Listener(
onPointerDown: _handlePointerDown,
onPointerScroll: _handlePointerScroll,
return result;
}

30
com.unity.uiwidgets/Runtime/widgets/heroes.cs


}
class HeroUtils {
/*public static Rect _globalBoundingBoxFor(BuildContext context) {
RenderBox box = (RenderBox) context.findRenderObject();
D.assert(box != null && box.hasSize);
return MatrixUtils.transformRect( box.getTransformTo(null), Offset.zero & box.size);
}*/
public static Rect _boundingBoxFor(BuildContext context, BuildContext ancestorContext = null) {
RenderBox box = context.findRenderObject() as RenderBox;
D.assert(box != null && box.hasSize);

public readonly object tag;
public readonly HeroFlightShuttleBuilder flightShuttleBuilder;
public readonly HeroPlaceholderBuilder placeholderBuilder;

BuildContext context,
bool isUserGestureTransition,
NavigatorState navigator) {
Dictionary<object, _HeroState> result = new Dictionary<object, _HeroState> { };
void inviteHero(StatefulElement hero, object tag) {

}
class _HeroState : State<Hero> {
GlobalKey _key = GlobalKey.key();
Size _placeholderSize;
bool _shouldIncludeChild = true;

_HeroState toHero = null,
CreateRectTween createRectTween = null,
HeroFlightShuttleBuilder shuttleBuilder = null,
bool isUserGestureTransition = false,
bool isDiverted = false
bool? isUserGestureTransition = null,
bool? isDiverted = null
) {
D.assert(fromHero.widget.tag.Equals(toHero.widget.tag));
this.type = type;

this.toHero = toHero;
this.createRectTween = createRectTween;
this.shuttleBuilder = shuttleBuilder;
this.isUserGestureTransition = isUserGestureTransition;
this.isDiverted = isDiverted;
this.isUserGestureTransition = isUserGestureTransition ?? false;
this.isDiverted = isDiverted ?? false;
}
public readonly HeroFlightDirection type;

get {
return new CurvedAnimation(
parent: (type == HeroFlightDirection.push) ? toRoute.animation : fromRoute.animation,
curve: Curves.fastOutSlowIn
, reverseCurve: isDiverted ? null : Curves.fastOutSlowIn.flipped
curve: Curves.fastOutSlowIn,
reverseCurve: isDiverted ? null : Curves.fastOutSlowIn.flipped
);
}
}

public void _handleAnimationUpdate(AnimationStatus status) {
if (status == AnimationStatus.completed || status == AnimationStatus.dismissed) {
_proxyAnimation.parent = null;
D.assert(overlayEntry != null);
overlayEntry.remove();
overlayEntry = null;

HeroFlightDirection type = initialManifest.type;
switch (type) {
case HeroFlightDirection.pop:
return initial.value == 1.0f && initialManifest.isUserGestureTransition
return initial.value == 1.0f &&
initialManifest.isUserGestureTransition
? initial.status == AnimationStatus.completed
: initial.status == AnimationStatus.reverse;
case HeroFlightDirection.push:

RouteSettings from = manifest.fromRoute.settings;
RouteSettings to = manifest.toRoute.settings;
object tag = manifest.tag;
return $"HeroFlight(for: {tag}, from: {from}, to: {to} ${_proxyAnimation.parent})";
return $"HeroFlight(for: {tag}, from: {from}, to: {to} {_proxyAnimation.parent})";
}
}

if (toHeroes.ContainsKey(tag)) {
HeroFlightShuttleBuilder fromShuttleBuilder = fromHeroes[tag].widget.flightShuttleBuilder;
HeroFlightShuttleBuilder toShuttleBuilder = toHeroes[tag].widget.flightShuttleBuilder;
//bool isDiverted = _flights[tag] != null;
bool isDiverted = _flights.ContainsKey(tag);
_HeroFlightManifest manifest = new _HeroFlightManifest(
type: flightType,

30
com.unity.uiwidgets/Runtime/widgets/icon.cs


namespace Unity.UIWidgets.widgets {
public class Icon : StatelessWidget {
public Icon(IconData icon,
public Icon(
IconData icon,
Color color = null
Color color = null,
TextDirection? textDirection = null
this.textDirection = textDirection;
}
public readonly IconData icon;

public readonly Color color;
public readonly TextDirection? textDirection;
D.assert(this.textDirection != null || WidgetsD.debugCheckHasDirectionality(context));
TextDirection textDirection = this.textDirection ?? Directionality.of(context);
IconThemeData iconTheme = IconTheme.of(context);
float iconSize = size ?? iconTheme.size.Value;

if (iconOpacity != 1.0) {
iconColor = iconColor.withOpacity(iconColor.opacity * iconOpacity);
}
overflow: TextOverflow.visible,
overflow: TextOverflow.visible, // Never clip.
textDirection: textDirection, // Since we already fetched it for the assert...
text: new TextSpan(
text: new string(new[] {(char) icon.codePoint}),
style: new TextStyle(

)
);
var matrix = Matrix4.identity();
matrix.scale(-1.0f, 1.0f, 1.0f);
if (icon.matchTextDirection) {
switch (textDirection) {
case TextDirection.rtl:
iconWidget = new Transform(
transform: matrix,
alignment: Alignment.center,
transformHitTests: false,
child: iconWidget
);
break;
case TextDirection.ltr:
break;
}
}
return new SizedBox(
width: iconSize,
height: iconSize,

39
com.unity.uiwidgets/Runtime/widgets/icon_data.cs


public class IconData : IEquatable<IconData> {
public IconData(
int codePoint,
string fontFamily = null
string fontFamily = null,
string fontPackage = null,
bool matchTextDirection = false
this.fontPackage = fontPackage;
this.matchTextDirection = matchTextDirection;
public readonly string fontPackage;
public readonly bool matchTextDirection;
public bool Equals(IconData other) {
if (ReferenceEquals(null, other)) {

}
return codePoint == other.codePoint &&
string.Equals(fontFamily, other.fontFamily);
string.Equals(fontFamily, other.fontFamily) &&
string.Equals(fontPackage, other.fontPackage) &&
matchTextDirection == other.matchTextDirection;
}
public override bool Equals(object obj) {

public override int GetHashCode() {
unchecked {
return (codePoint * 397) ^ (fontFamily != null ? fontFamily.GetHashCode() : 0);
var hashCode =
(codePoint * 397) ^ (fontFamily != null ? fontFamily.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (fontPackage != null ? fontPackage.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ matchTextDirection.GetHashCode();
return hashCode;
}
}

public static bool operator !=(IconData left, IconData right) {
return !Equals(left, right);
}

public class IconDataProperty : DiagnosticsProperty<IconData> {
public IconDataProperty(
String name,
string name,
String ifNull = null,
string ifNull = null,
) : base(name, value,
) : base(name,
value,
D.assert(showName != null);
D.assert(style != null);
D.assert(level != null);
public override Dictionary<String, Object> toJsonMap(DiagnosticsSerializationDelegate _delegate) {
Dictionary<String, Object> json = base.toJsonMap(_delegate);
public override Dictionary<string, object> toJsonMap(DiagnosticsSerializationDelegate _delegate) {
Dictionary<string, object> json = base.toJsonMap(_delegate);
json["valueProperties"] = new Dictionary<String, Object>(){
json["valueProperties"] = new Dictionary<string, object>(){
{"codePoint", value.codePoint},
};
}

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


) : base(key: key, child: child) {
D.assert(data != null);
D.assert(child != null);
this.data = data;
}

Widget child = null
) {
return new Builder(
builder: context => new IconTheme(
builder: (BuildContext context)=> {
return new IconTheme(
)
);
}
);
}

IconThemeData iconThemeData = _getInheritedIconThemeData(context);
return iconThemeData.isConcrete ? iconThemeData :
iconThemeData.copyWith(
IconThemeData iconThemeData = _getInheritedIconThemeData(context).resolve(context);
return iconThemeData.isConcrete
? iconThemeData
: iconThemeData.copyWith(
color: iconThemeData.color ?? IconThemeData.fallback().color,
opacity: iconThemeData.opacity ?? IconThemeData.fallback().opacity
color: iconThemeData.color ?? IconThemeData.fallback().color,
opacity: iconThemeData.opacity ?? IconThemeData.fallback().opacity
if (iconTheme != null) {
return iconTheme.data;
}
return IconThemeData.fallback();
return iconTheme?.data ?? IconThemeData.fallback();
}
public override bool updateShouldNotify(InheritedWidget oldWidget) {

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


size: other.size
);
}
IconThemeData resolve(BuildContext context) => this;
public IconThemeData resolve(BuildContext context) => this;
public bool isConcrete {
get { return color != null && opacity != null && size != null; }

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


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

var completer = Completer.create();
Completer completer = Completer.create();
void listener(ImageInfo image, bool sync) {
// TODO: update
// if (!completer.isCompleted) {
// stream.removeListener(listener);
// }
//
// SchedulerBinding.instance.addPostFrameCallback(timeStamp => { stream.removeListener(listener); });
}
void errorListener(Exception exception) {
ImageStreamListener listener = null;
listener = new ImageStreamListener(
(ImageInfo image, bool sync)=> {
// TODO: update
// stream.removeListener(listener);
if (onError != null) {
onError(exception);
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timeStamp)=> {
stream.removeListener(listener);
});
},
onError: (Exception error) =>{
if (!completer.isCompleted) {
completer.complete();
else {
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("image failed to precache"),
library: "image resource service",
exception: exception,
silent: true
));
stream.removeListener(listener);
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("image failed to precache"),
library: "image resource service",
silent: true));
}
// TODO: update
// stream.addListener(listener, onError: errorListener);
);
stream.addListener(listener);
}
}

Color color = null,
BlendMode colorBlendMode = BlendMode.srcIn,
BoxFit? fit = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
bool matchTextDirection = false,
bool gaplessPlayback = false,
FilterQuality filterQuality = FilterQuality.low
) : base(key: key) {

this.centerSlice = centerSlice;
this.gaplessPlayback = gaplessPlayback;
this.filterQuality = filterQuality;
this.matchTextDirection = matchTextDirection;
}
public static Image network(

Color color = null,
BlendMode colorBlendMode = BlendMode.srcIn,
BoxFit? fit = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
bool matchTextDirection = false,
FilterQuality filterQuality = FilterQuality.low,
IDictionary<string, string> headers = null,
int? cacheWidth = null,

alignment: alignment,
repeat: repeat,
centerSlice: centerSlice,
matchTextDirection : matchTextDirection,
gaplessPlayback: gaplessPlayback,
filterQuality: filterQuality
);

Color color = null,
BlendMode colorBlendMode = BlendMode.srcIn,
BoxFit? fit = null,
Alignment alignment = null,
ImageRepeat repeat = ImageRepeat.noRepeat,
AlignmentGeometry alignment = null,
ImageRepeat repeat = ImageRepeat.noRepeat,
bool matchTextDirection = false,
Rect centerSlice = null,
bool gaplessPlayback = false,
FilterQuality filterQuality = FilterQuality.low,

alignment: alignment,
repeat: repeat,
centerSlice: centerSlice,
matchTextDirection: matchTextDirection,
gaplessPlayback: gaplessPlayback,
filterQuality: filterQuality
);

Alignment alignment = null,
ImageRepeat repeat = ImageRepeat.noRepeat,
Rect centerSlice = null,
bool matchTextDirection = false,
string package = null,
/*image = ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight, scale != null
? ExactAssetImage(name, bundle: bundle, scale: scale, package: package)
: AssetImage(name, bundle: bundle, package: package)
);*/
var image = scale != null
? (AssetBundleImageProvider) new ExactAssetImage(name, bundle: bundle, scale: scale.Value)
var _scale = scale ?? 1.0f;
var _image = scale != null
? (AssetBundleImageProvider) new ExactAssetImage(name, bundle: bundle, scale: _scale)
var _Image = ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight, _image);
image: image,
image: _Image,
frameBuilder: frameBuilder,
loadingBuilder: null,
errorBuilder: errorBuilder,

alignment: alignment,
repeat: repeat,
centerSlice: centerSlice,
matchTextDirection: matchTextDirection,
gaplessPlayback: gaplessPlayback,
filterQuality: filterQuality
);

Alignment alignment = null,
ImageRepeat repeat = ImageRepeat.noRepeat,
Rect centerSlice = null,
bool matchTextDirection = false,
bool gaplessPlayback = false,
FilterQuality filterQuality = FilterQuality.low,
int? cacheWidth = default,

var memoryImage = new MemoryImage(bytes, scale);
return new Image(
key: key,
image: memoryImage,
image: ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight, new MemoryImage(bytes, scale: scale)),
frameBuilder: frameBuilder,
loadingBuilder: null,
errorBuilder: errorBuilder,

alignment: alignment,
repeat: repeat,
centerSlice: centerSlice,
matchTextDirection : matchTextDirection,
gaplessPlayback: gaplessPlayback,
filterQuality: filterQuality
);

public readonly FilterQuality filterQuality;
public readonly BlendMode colorBlendMode;
public readonly BoxFit? fit;
public readonly Alignment alignment;
public readonly AlignmentGeometry alignment;
public readonly bool matchTextDirection;
public override State createState() {
return new _ImageState();

properties.add(new EnumProperty<BlendMode>("colorBlendMode", colorBlendMode,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new EnumProperty<BoxFit?>("fit", fit, defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment,
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new EnumProperty<ImageRepeat>("repeat", repeat, defaultValue: ImageRepeat.noRepeat));
properties.add(new DiagnosticsProperty<Rect>("centerSlice", centerSlice,

properties.add(new FlagProperty("matchTextDirection", value: matchTextDirection, ifTrue: "match text direction"));
}
}

}
/*public override void didChangeAccessibilityFeatures() {
base.didChangeAccessibilityFeatures();
public void didChangeAccessibilityFeatures() {
}*/
}
public override void reassemble() {
_resolveImage(); // in case the image cache was flushed
base.reassemble();
}
void _updateInvertColors() {
_invertColors = MediaQuery.of(context, nullOk: true)?.invertColors

void _resolveImage() {
/*ScrollAwareImageProvider provider = new ScrollAwareImageProvider<dynamic>(
/*ScrollAwareImageProvider<object> provider = new ScrollAwareImageProvider<object>(
imageProvider: widget.image
);
ImageStream newStream =
provider.resolve(ImageUtils.createLocalImageConfiguration(
context,
size: widget.width != null && widget.height != null
? new Size(widget.width.Value, widget.height.Value)
: null
));*/
imageProvider: (ImageProvider<object>)widget.image
);*/
ImageStream newStream =
widget.image.resolve(ImageUtils.createLocalImageConfiguration(
context,

setState(() => { _imageInfo = null; });
}
setState(()=> {
_loadingProgress = null;
_frameNumber = 0;
_wasSynchronouslyLoaded = false;
});
if (_isListeningToStream) {
if (_isListeningToStream)
}
}
void _listenToStream() {

alignment: widget.alignment,
repeat: widget.repeat,
centerSlice: widget.centerSlice,
matchTextDirection: widget.matchTextDirection,
invertColors: _invertColors,
filterQuality: widget.filterQuality
);

17
com.unity.uiwidgets/Runtime/widgets/image_filter.cs


public class ImageFiltered : SingleChildRenderObjectWidget {
protected ImageFiltered(
Key key,
ImageFilter imageFilter,
Widget child
) :
base(key: key, child: child) {
Key key = null,
ImageFilter imageFilter = null,
Widget child = null
) : base(key: key, child: child) {
this.imageFilter = imageFilter;
public override RenderObject createRenderObject(BuildContext context) => new _ImageFilterRenderObject(imageFilter);
public override RenderObject createRenderObject(BuildContext context) {
return new _ImageFilterRenderObject(imageFilter);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
((_ImageFilterRenderObject) renderObject).imageFilter = imageFilter;

}
}
}
ImageFilter _imageFilter;
protected override bool alwaysNeedsCompositing {

114
com.unity.uiwidgets/Runtime/widgets/implicit_animations.cs


return EdgeInsets.lerp(begin, end, t);
}
}
public class EdgeInsetsGeometryTween : Tween<EdgeInsetsGeometry> {
public EdgeInsetsGeometryTween(
EdgeInsetsGeometry begin = null,
EdgeInsetsGeometry end = null) : base(begin: begin, end: end) {
}
public override EdgeInsetsGeometry lerp(float t) {
return EdgeInsetsGeometry.lerp(begin, end, t);
}
}
public class BorderRadiusTween : Tween<BorderRadius> {

protected AnimationController controller {
get { return _controller; }
}
Animation<float> _animation;
public override void initState() {

public class AnimatedContainer : ImplicitlyAnimatedWidget {
public AnimatedContainer(
Key key = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
EdgeInsets padding = null,
Color color = null,
Decoration decoration = null,

public readonly Widget child;
public readonly Alignment alignment;
public readonly AlignmentGeometry alignment;
public readonly EdgeInsets padding;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment, showName: false,
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment, showName: false,
defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding, defaultValue: null));
properties.add(new DiagnosticsProperty<Decoration>("bg", decoration, defaultValue: null));

}
class _AnimatedContainerState : AnimatedWidgetBaseState<AnimatedContainer> {
AlignmentTween _alignment;
AlignmentGeometryTween _alignment;
EdgeInsetsTween _padding;
DecorationTween _decoration;
DecorationTween _foregroundDecoration;

protected override void forEachTween(TweenVisitor visitor) {
_alignment = (AlignmentTween) visitor.visit(this, _alignment, widget.alignment,
(Alignment value) => new AlignmentTween(begin: value));
_alignment = (AlignmentGeometryTween) visitor.visit(this, _alignment, widget.alignment,
(AlignmentGeometry value) => new AlignmentGeometryTween(begin: value));
_padding = (EdgeInsetsTween) visitor.visit(this, _padding, widget.padding,
(EdgeInsets value) => new EdgeInsetsTween(begin: value));
_decoration = (DecorationTween) visitor.visit(this, _decoration, widget.decoration,

alignment: _alignment?.evaluate(animation),
padding: _padding?.evaluate(animation),
decoration: _decoration?.evaluate(animation),
forgroundDecoration: _foregroundDecoration?.evaluate(animation),
foregroundDecoration: _foregroundDecoration?.evaluate(animation),
transfrom: _transform?.evaluate(animation)
transform: _transform?.evaluate(animation)
);
}

description.add(new DiagnosticsProperty<AlignmentTween>("alignment", _alignment, showName: false,
description.add(new DiagnosticsProperty<AlignmentGeometryTween>("alignment", _alignment, showName: false,
defaultValue: null));
description.add(new DiagnosticsProperty<EdgeInsetsTween>("padding", _padding, defaultValue: null));
description.add(new DiagnosticsProperty<DecorationTween>("bg", _decoration, defaultValue: null));

public class AnimatedPadding : ImplicitlyAnimatedWidget {
public AnimatedPadding(
Key key = null,
EdgeInsets padding = null,
EdgeInsetsGeometry padding = null,
Widget child = null,
Curve curve = null,
TimeSpan? duration = null,

this.child = child;
}
public readonly EdgeInsets padding;
public readonly EdgeInsetsGeometry padding;
public readonly Widget child;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding));
properties.add(new DiagnosticsProperty<EdgeInsetsGeometry>("padding", padding));
EdgeInsetsTween _padding;
EdgeInsetsGeometryTween _padding;
_padding = (EdgeInsetsTween) visitor.visit(this, _padding, widget.padding,
(EdgeInsets value) => new EdgeInsetsTween(begin: value));
_padding = (EdgeInsetsGeometryTween) visitor.visit(this, _padding, widget.padding,
(EdgeInsetsGeometry value) => new EdgeInsetsGeometryTween(begin: value));
}
public override Widget build(BuildContext context) {

public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(new DiagnosticsProperty<EdgeInsetsTween>("padding", _padding,
description.add(new DiagnosticsProperty<EdgeInsetsGeometryTween>("padding", _padding,
defaultValue: foundation_.kNullDefaultValue));
}
}

Key key = null,
Alignment alignment = null,
AlignmentGeometry alignment = null,
Widget child = null,
Curve curve = null,
TimeSpan? duration = null,

this.child = child;
}
public readonly Alignment alignment;
public readonly AlignmentGeometry alignment;
public readonly Widget child;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new DiagnosticsProperty<Alignment>("alignment", value: alignment));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", value: alignment));
AlignmentTween _alignment;
AlignmentGeometryTween _alignment;
_alignment = (AlignmentTween) visitor.visit(this, tween: _alignment,
targetValue: widget.alignment, constructor: value => new AlignmentTween(begin: value));
_alignment = (AlignmentGeometryTween) visitor.visit(this, tween: _alignment,
targetValue: widget.alignment, constructor: value => new AlignmentGeometryTween(begin: value));
}
public override Widget build(BuildContext context) {

public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(properties: description);
description.add(new DiagnosticsProperty<AlignmentTween>("alignment", value: _alignment, defaultValue: null));
description.add(new DiagnosticsProperty<AlignmentGeometryTween>("alignment", value: _alignment, defaultValue: null));
}
}

Curve curve = null,
TimeSpan? duration = null,
VoidCallback onEnd = null
) : base(key: key, curve: curve, duration: duration, onEnd: onEnd) {
) : base(key: key, curve: curve ?? Curves.linear, duration: duration, onEnd: onEnd) {
D.assert(start == null || end == null || width == null);
D.assert(top == null || bottom == null || height == null);
this.child = child;

base(key: key, curve: curve ?? Curves.linear, duration: duration, onEnd: onEnd) {
D.assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
this.child = child;
this.opacity = opacity ?? 1.0f;
this.opacity = opacity;
public readonly float opacity;
public readonly float? opacity;
public override State createState() {
return new _AnimatedOpacityState();

protected SliverAnimatedOpacity(
Key key = null,
Widget sliver = null,
float opacity = default,
Curve curve = null,//Curve curve = Curve.linear
float? opacity = null,
Curve curve = null,
) : base(key: key, curve: curve, duration: duration, onEnd: onEnd) {
) : base(key: key, curve: curve ?? Curves.linear, duration: duration, onEnd: onEnd) {
this.opacity = opacity;
this.sliver = sliver;
public readonly float opacity;
public readonly float? opacity;
public override State createState() {
return new _SliverAnimatedOpacityState();

Animation<float> _opacityAnimation;
protected override void forEachTween(TweenVisitor visitor) {
_opacity = (FloatTween) visitor.visit(this,_opacity, widget.opacity, (float value) => new FloatTween(begin: value, 0));
_opacity = (FloatTween) visitor.visit(this, _opacity, widget.opacity ?? 0.0f, (float value) => new FloatTween(begin: value, 0));
}
protected override void didUpdateTweens() {

bool softWrap = true,
TextOverflow? overflow = null,
int? maxLines = null,
TextWidthBasis textWidthBasis = TextWidthBasis.parent,
ui.TextHeightBehavior textHeightBehavior = null,
TimeSpan? duration = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
TimeSpan? duration = null,
VoidCallback onEnd = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration, onEnd: onEnd) {
D.assert(overflow != null);
this.child = child;
this.style = style;
this.textAlign = textAlign;

this.textHeightBehavior = textHeightBehavior;
this.textWidthBasis = textWidthBasis;
}
public readonly Widget child;

public readonly bool softWrap;
public readonly TextAlign? textAlign;
public readonly ui.TextHeightBehavior textHeightBehavior;
public readonly TextWidthBasis textWidthBasis;
public readonly VoidCallback onEnd;
public override State createState() {
return new _AnimatedDefaultTextStyleState();

base.debugFillProperties(properties);
properties.add(new EnumProperty<TextAlign>("textAlign", textAlign ?? TextAlign.center,
defaultValue: null));
properties.add(new FlagProperty("softWrap", value: softWrap, ifTrue: "wrapping at box width",
ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextAlign>("textAlign", textAlign ?? TextAlign.start, defaultValue: null));
properties.add(new FlagProperty("softWrap", value: softWrap, ifTrue: "wrapping at box width", ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextWidthBasis>("textWidthBasis", textWidthBasis, defaultValue: TextWidthBasis.parent));
properties.add(new DiagnosticsProperty<ui.TextHeightBehavior>("textHeightBehavior", textHeightBehavior, defaultValue: null));
}
}

softWrap: widget.softWrap,
overflow: widget.overflow,
maxLines: widget.maxLines,
child: widget.child);
textWidthBasis: widget.textWidthBasis,
textHeightBehavior: widget.textHeightBehavior,
child: widget.child
);
}
}

Color shadowColor = null,
bool animateShadowColor = true,
Curve curve = null,
TimeSpan? duration = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
TimeSpan? duration = null,
VoidCallback onEnd = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration,onEnd: onEnd) {
D.assert(duration != null);
this.child = child;
this.shape = shape ?? BoxShape.circle;
this.clipBehavior = clipBehavior;

properties.add(new DiagnosticsProperty<bool>("animateColor", animateColor));
properties.add(new DiagnosticsProperty<Color>("shadowColor", shadowColor));
properties.add(new DiagnosticsProperty<bool>("animateShadowColor", animateShadowColor));
}
}

2
com.unity.uiwidgets/Runtime/widgets/inherited_theme.cs


) : base(key: key) {
D.assert(themes != null);
D.assert(child != null);
this.child = child;
this.themes = themes;
}
public readonly List<InheritedTheme> themes;

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


using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using JetBrains.Annotations;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;

class ListWheelScrollViewUtils {
public static int _getItemFromOffset(
float offset,
float itemExtent,
float minScrollExtent,
float maxScrollExtent
float? offset = null,
float? itemExtent = null,
float? minScrollExtent = null,
float? maxScrollExtent = null
return (_clipOffsetToScrollableRange(offset, minScrollExtent, maxScrollExtent) / itemExtent).round();
var _itemExtent = itemExtent ?? 1.0f;
return (_clipOffsetToScrollableRange(offset ?? 0.0f , minScrollExtent ?? 0.0f, maxScrollExtent ?? 0.0f) / _itemExtent).round();
public static float _clipOffsetToScrollableRange(
float offset,
float minScrollExtent,

public Future animateToItem(
int itemIndex,
TimeSpan duration,
Curve curve
) {///////
TimeSpan? duration = null,
Curve curve = null
) {
if (!hasClients) {
return null;
}

itemIndex * position.itemExtent,
duration: duration,
duration: duration ?? new TimeSpan(0,0,0,0,0),
curve: curve
));
}

}
}
public override ScrollPosition createScrollPosition(ScrollPhysics physics, ScrollContext context,
public override ScrollPosition createScrollPosition(
ScrollPhysics physics,
ScrollContext context,
ScrollPosition oldPosition) {
return new _FixedExtentScrollPosition(
physics: physics,

public class FixedExtentMetrics : FixedScrollMetrics, IFixedExtentMetrics {
public FixedExtentMetrics(
int itemIndex,
float minScrollExtent = 0.0f,
float maxScrollExtent = 0.0f,
float pixels = 0.0f,
float viewportDimension = 0.0f,
AxisDirection axisDirection = AxisDirection.down
float? minScrollExtent = null,
float? maxScrollExtent = null,
float? pixels = null,
float? viewportDimension = null,
AxisDirection axisDirection = AxisDirection.down,
int? itemIndex = null
minScrollExtent: minScrollExtent,
maxScrollExtent: maxScrollExtent,
pixels: pixels,
viewportDimension: viewportDimension,
minScrollExtent: minScrollExtent ?? 0.0f,
maxScrollExtent: maxScrollExtent ?? 0.0f,
pixels: pixels ?? 0.0f,
viewportDimension: viewportDimension ?? 0.0f,
this.itemIndex = itemIndex;
this.itemIndex = itemIndex ?? 0;
}
public int itemIndex { get; set; }

itemIndex: itemIndex ?? this.itemIndex
);
}
ScrollPhysics physics,
ScrollContext context,
int initialItem,
ScrollPhysics physics = null,
ScrollContext context = null,
int? initialItem = null,
bool keepScrollOffset = true,
ScrollPosition oldPosition = null,
string debugLabel = null

static float _getItemExtentFromScrollContext(ScrollContext context) {
_FixedExtentScrollableState scrollable = (_FixedExtentScrollableState) context;
return scrollable.itemExtent;
return scrollable.itemExtent ?? 0.0f;
}
public float itemExtent {

class _FixedExtentScrollable : Scrollable {
public _FixedExtentScrollable(
float itemExtent,
ViewportBuilder viewportBuilder,
ScrollPhysics physics = null
ScrollPhysics physics = null,
float? itemExtent = null,
ViewportBuilder viewportBuilder = null
) : base(
key: key,
axisDirection: axisDirection,

this.itemExtent = itemExtent;
}
public readonly float itemExtent;
public readonly float? itemExtent;
public override State createState() {
return new _FixedExtentScrollableState();

class _FixedExtentScrollableState : ScrollableState {
public float itemExtent {
public float? itemExtent {
get {
_FixedExtentScrollable actualWidget = (_FixedExtentScrollable) widget;
return actualWidget.itemExtent;

}
if (settlingItemIndex == metrics.itemIndex) {
return new SpringSimulation(spring,
return new SpringSimulation(
spring,
metrics.pixels,
settlingPixels,
velocity,

return FrictionSimulation.through(
metrics.pixels,
settlingPixels,
velocity, tolerance.velocity * velocity.sign()
velocity,
tolerance.velocity * velocity.sign()
);
}
}

float itemExtent,
List<Widget> children = null,
Key key = null,
ScrollController controller = null,
ScrollPhysics physics = null,

bool useMagnifier = false,
float magnification = 1.0f,
float overAndUnderCenterOpacity = 1.0f,
float? itemExtent = null,
ListWheelChildDelegate childDelegate = null
List<Widget> children = null
) : base(key: key) {
D.assert(children != null || childDelegate != null);
D.assert(diameterRatio > 0.0, () => RenderListWheelViewport.diameterRatioZeroMessage);

D.assert(overAndUnderCenterOpacity != null);
D.assert(squeeze != null);
D.assert(squeeze > 0);
D.assert(
!renderChildrenOutsideViewport || !clipToSize,

this.childDelegate = childDelegate ?? new ListWheelChildListDelegate(children: children);
childDelegate = new ListWheelChildListDelegate(children: children);
this.overAndUnderCenterOpacity = overAndUnderCenterOpacity;
this.itemExtent = itemExtent;
this.squeeze = squeeze;

}
public static ListWheelScrollView useDelegate(
float itemExtent,
float overAndUnderCenterOpacity = 1.0f,
float squeeze = 1.0f,
List<Widget> children = null,
ListWheelChildDelegate childDelegate = null,
Key key = null,
ScrollController controller = null,
ScrollPhysics physics = null,

bool useMagnifier = false,
float magnification = 1.0f,
float? itemExtent = null,
float squeeze = 1.0f,
float overAndUnderCenterOpacity = 1.0f,
bool renderChildrenOutsideViewport = false
bool renderChildrenOutsideViewport = false,
ListWheelChildDelegate childDelegate = null
return new ListWheelScrollView(
D.assert(childDelegate != null);
D.assert(diameterRatio > 0.0, ()=>RenderListWheelViewport.diameterRatioZeroMessage);
D.assert(perspective > 0);
D.assert(perspective <= 0.01,()=> RenderListWheelViewport.perspectiveTooHighMessage);
D.assert(magnification > 0);
D.assert(overAndUnderCenterOpacity >= 0 && overAndUnderCenterOpacity <= 1);
D.assert(itemExtent != null);
D.assert(itemExtent > 0);
D.assert(squeeze > 0);
D.assert(
!renderChildrenOutsideViewport || !clipToSize,()=>
RenderListWheelViewport.clipToSizeAndRenderChildrenOutsideViewportConflict
);
var view = new ListWheelScrollView(
children: children,
childDelegate: childDelegate,
key: key,
controller: controller,
physics: physics,

clipToSize: clipToSize,
renderChildrenOutsideViewport: renderChildrenOutsideViewport
);
view.childDelegate = childDelegate;
return view;
}
public readonly ScrollController controller;

public readonly float offAxisFraction;
public readonly bool useMagnifier;
public readonly float magnification;
public readonly float itemExtent;
public readonly float? itemExtent;
public readonly ListWheelChildDelegate childDelegate;
public ListWheelChildDelegate childDelegate;
public override State createState() {
return new _ListWheelScrollViewState();

&& notification is ScrollUpdateNotification
&& notification.metrics is FixedExtentMetrics metrics) {
int currentItemIndex = metrics.itemIndex;
if (currentItemIndex != _lastReportedItemIndex) {
_lastReportedItemIndex = currentItemIndex;
int trueIndex = widget.childDelegate.trueIndexOf(currentItemIndex);

useMagnifier: widget.useMagnifier,
magnification: widget.magnification,
overAndUnderCenterOpacity: widget.overAndUnderCenterOpacity,
itemExtent: widget.itemExtent,
itemExtent: widget.itemExtent ?? 0.0f,
squeeze: widget.squeeze,
clipToSize: widget.clipToSize,
renderChildrenOutsideViewport: widget.renderChildrenOutsideViewport,

owner.buildScope(this, () => {
bool insertFirst = after == null;
D.assert(insertFirst || _childElements[index - 1] != null);
// Debug.Log($"{index}: {this._childElements.getOrDefault(index)}");
// Debug.Log(newChild);
if (newChild != null) {
_childElements[index] = newChild;
}

protected override void insertChildRenderObject(RenderObject child, object slot) {
RenderListWheelViewport renderObject = this.renderObject;
D.assert(renderObject.debugValidateChild(child));
renderObject.insert((RenderBox) child,
(RenderBox) _childElements.getOrDefault((int) slot - 1)?.renderObject);
// Debug.Log($"insert: {this._childElements.getOrDefault((int) slot - 1)}");
renderObject.insert(child as RenderBox, after: _childElements[(int)slot - 1]?.renderObject as RenderBox);
D.assert(renderObject == this.renderObject);
}

public class ListWheelViewport : RenderObjectWidget {
public ListWheelViewport(
float itemExtent,
ViewportOffset offset,
ListWheelChildDelegate childDelegate,
Key key = null,
float diameterRatio = RenderListWheelViewport.defaultDiameterRatio,
float perspective = RenderListWheelViewport.defaultPerspective,

float overAndUnderCenterOpacity = 1.0f,
float? itemExtent = null,
float squeeze = 1.0f,
float overAndUnderCenterOpacity = 1.0f,
float squeeze = 1.0f
ViewportOffset offset = null,
ListWheelChildDelegate childDelegate = null
) : base(key: key) {
D.assert(childDelegate != null);
D.assert(offset != null);

D.assert(overAndUnderCenterOpacity != null);
D.assert(itemExtent != null);
D.assert(itemExtent > 0);
D.assert(
!renderChildrenOutsideViewport || !clipToSize,

public readonly bool useMagnifier;
public readonly float magnification;
public readonly float overAndUnderCenterOpacity;
public readonly float itemExtent;
public readonly float? itemExtent;
public readonly float squeeze;
public readonly bool clipToSize;
public readonly bool renderChildrenOutsideViewport;

useMagnifier: useMagnifier,
magnification: magnification,
overAndUnderCenterOpacity: overAndUnderCenterOpacity,
itemExtent: itemExtent,
itemExtent: itemExtent ?? 0.0f,
squeeze: squeeze,
clipToSize: clipToSize,
renderChildrenOutsideViewport: renderChildrenOutsideViewport

viewport.useMagnifier = useMagnifier;
viewport.magnification = magnification;
viewport.overAndUnderCenterOpacity = overAndUnderCenterOpacity;
viewport.itemExtent = itemExtent;
viewport.itemExtent = itemExtent ?? 0.0f;
viewport.squeeze = squeeze;
viewport.clipToSize = clipToSize;
viewport.renderChildrenOutsideViewport = renderChildrenOutsideViewport;

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


namespace Unity.UIWidgets.widgets {
class _Pending {
public _Pending(LocalizationsDelegate del, Future<object> futureValue) {
public _Pending(
LocalizationsDelegate del,
Future<object> futureValue) {
this.del = del;
this.futureValue = futureValue;
}

internal static Future<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) {
//Future<WidgetsLocalizations> inputValue = del.load(locale);
/* Future<object> futureValue = inputValue.then_<object>(value => {
completedValue = value;
return FutureOr.value(completedValue);
})();*/
if (completedValue != null) {
Type type = del.type;
D.assert(!output.ContainsKey(type));

return Future.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) {

}
public abstract class LocalizationsDelegate<T> : LocalizationsDelegate {
//public abstract Future<T> load(Locale locale);
public override Type type {
get { return typeof(T); }
}

public TextDirection textDirection { get; }
static WidgetsLocalizations of(BuildContext context) {
return Localizations.of<WidgetsLocalizations>(context, typeof(WidgetsLocalizations));
}

class _LocalizationsScope : InheritedWidget {
public _LocalizationsScope(
Key key,
Locale locale,
_LocalizationsState localizationsState,
Dictionary<Type, object> typeToResources,
Widget child
Key key = null,
Locale locale = null,
_LocalizationsState localizationsState = null,
Dictionary<Type, object> typeToResources = null,
Widget child = null
) : base(key: key, child: child) {
D.assert(locale != null);
D.assert(localizationsState != null);

public Locale locale {
get { return _locale; }
}
Locale _locale;
public override void initState() {

return resources;
}
TextDirection _textDirection {
get {
WidgetsLocalizations resources = (WidgetsLocalizations)_typeToResources.getOrDefault(typeof(WidgetsLocalizations)) ;
D.assert(resources != null);
return resources.textDirection;
}
}
public override Widget build(BuildContext context) {
if (_locale == null) {
return new Container();

locale: _locale,
localizationsState: this,
typeToResources: _typeToResources,
child: widget.child
child: new Directionality(
textDirection: _textDirection,
child: widget.child
)
);
}
}

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


size: window.physicalSize / window.devicePixelRatio,
devicePixelRatio: window.devicePixelRatio,
textScaleFactor: window.textScaleFactor,
//platformBrightness: window.platformBrightness, // TODO: remove comment when window.platformBrightness is ready
platformBrightness: window.platformBrightness, // TODO: remove comment when window.platformBrightness is ready
padding: EdgeInsets.fromWindowPadding(window.padding, window.devicePixelRatio),
viewPadding : EdgeInsets.fromWindowPadding(window.viewPadding, window.devicePixelRatio),
viewInsets: EdgeInsets.fromWindowPadding(window.viewInsets, window.devicePixelRatio),

float? physicalDepth = null,
bool? alwaysUse24HourFormat = null,
bool? accessibleNavigation = null,
bool? invertColors = null,
bool? invertColors = null,
bool? accessibleNavigation = null,
bool? boldText = null
) {
return new MediaQueryData(

bool removeRight = false,
bool removeBottom = false
) {
if (!(removeLeft || removeTop || removeRight || removeBottom)) {
if (!(removeLeft || removeTop || removeRight || removeBottom))
}
return new MediaQueryData(
size: size,
devicePixelRatio: devicePixelRatio,

left: removeLeft ? (float?) 0.0 : null,
top: removeTop ? (float?) 0.0 : null,
right: removeRight ? (float?) 0.0 : null,
bottom: removeBottom ? (float?) 0.0 : null
left: removeLeft ? (float?)0.0f : null,
top: removeTop ?(float?) 0.0f : null,
right: removeRight ? (float?)0.0f : null,
bottom: removeBottom ?(float?) 0.0f : null
),
viewPadding: viewPadding.copyWith(
left: removeLeft ? (float?)Mathf.Max(0.0f, viewPadding.left - padding.left) : null,

accessibleNavigation: accessibleNavigation,
boldText: boldText
);
}
public MediaQueryData removeViewInsets(

public static MediaQueryData of(BuildContext context, bool nullOk = false) {
D.assert(context != null);
//MediaQuery query = context.dependOnInheritedWidgetOfExactType<MediaQuery>();
MediaQuery query = (MediaQuery) context.dependOnInheritedWidgetOfExactType<MediaQuery>();
if (query != null) {
return query.data;

22
com.unity.uiwidgets/Runtime/widgets/modal_barrier.cs


public readonly Color color;
public readonly bool dismissible;
public ModalBarrier(Key key = null, Color color = null, bool dismissible = true) : base(key) {
public ModalBarrier(
Key key = null,
Color color = null,
bool dismissible = true) : base(key) {
this.color = color;
this.dismissible = dismissible;
}

public class AnimatedModalBarrier : AnimatedWidget {
public readonly bool dismissible;
public AnimatedModalBarrier(Key key = null, Animation<Color> color = null,
bool dismissible = true) : base(key, color) {
public AnimatedModalBarrier(
Key key = null,
Animation<Color> color = null,
bool dismissible = true
) : base(key, color) {
this.dismissible = dismissible;
}

protected internal override Widget build(BuildContext context) {
return new ModalBarrier(color: color?.value, dismissible: dismissible);
return new ModalBarrier(
color: color?.value,
dismissible: dismissible);
public _AnyTapGestureRecognizer( Object debugOwner = null) : base(debugOwner: debugOwner) {}
public _AnyTapGestureRecognizer( object debugOwner = null) : base(debugOwner: debugOwner) {}
protected override bool isPointerAllowed(PointerDownEvent _event) {
protected override bool isPointerAllowed(PointerDownEvent _event ) {
if (onAnyTapUp == null)
return false;
return base.isPointerAllowed(_event);

) : base(key: key) {
D.assert(child != null);
D.assert(onDismiss != null);
this.child = child;
this.onDismiss = onDismiss;
}
public readonly Widget child;

17
com.unity.uiwidgets/Runtime/widgets/navigation_toolbar.cs


namespace Unity.UIWidgets.widgets {
public class NavigationToolbar : StatelessWidget {
public NavigationToolbar(Key key = null, Widget leading = null, Widget middle = null,
Widget trailing = null, bool centerMiddle = true, float middleSpacing = kMiddleSpacing) : base(key) {
public NavigationToolbar(
Key key = null,
Widget leading = null,
Widget middle = null,
Widget trailing = null,
bool centerMiddle = true,
float middleSpacing = kMiddleSpacing
) : base(key) {
this.leading = leading;
this.middle = middle;
this.trailing = trailing;

class _ToolbarLayout : MultiChildLayoutDelegate {
public _ToolbarLayout(
bool? centerMiddle = true,
bool? centerMiddle = null,
float? middleSpacing = null,
TextDirection? textDirection = null
) {

this.middleSpacing = middleSpacing ?? 0.0f;
this.middleSpacing = middleSpacing ?? 0.0f;
this.textDirection = textDirection ?? TextDirection.ltr;
}

float middleStartMargin = leadingWidth + middleSpacing;
float middleStart = middleStartMargin;
float middleY = (size.height - middleSize.height) / 2.0f;
// If the centered middle will not fit between the leading and trailing
// widgets, then align its left or right edge with the adjacent boundary.
if (centerMiddle) {
middleStart = (size.width - middleSize.width) / 2.0f;
if (middleStart + middleSize.width > size.width - trailingWidth) {

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


return other.GetType() == GetType() &&
other.key == key;
}
//public abstract Route createRoute(BuildContext context);
public override string ToString() {
return $"{GetType()}(\"{name}\",{key},{arguments})";
}

public _RouteEntry(
Route route,
_RouteLifecycle initialState
) {
D.assert(
initialState == _RouteLifecycle.staging ||

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


reverse: widget.reverse,
physics: widget.physics != null
? widget.physics.applyTo(new ClampingScrollPhysics())
: new ClampingScrollPhysics(),
controller: _coordinator._outerController,
slivers: widget._buildSlivers(
_context, _coordinator._innerController, _lastHasScrolledBody
),
handle: _absorberHandle
);
: new ClampingScrollPhysics(),
controller: _coordinator._outerController,
slivers: widget._buildSlivers(
context,
_coordinator._innerController,
_lastHasScrolledBody
),
handle: _absorberHandle
);
}
)
);

class _NestedScrollViewCustomScrollView : CustomScrollView {
public _NestedScrollViewCustomScrollView(
Axis scrollDirection,
Axis scrollDirection,
bool reverse,
ScrollPhysics physics,
ScrollController controller,

if (!_outerController.hasClients) {
return null;
}
return _outerController.nestedPositions.Single();
}
}

if (userScrollDirection == value) {
return;
}
_userScrollDirection = value;
_outerPosition.didUpdateScrollDirection(value);
foreach (_NestedScrollPosition position in _innerPositions) {

}
public void goBallistic(float velocity) {
beginActivity(createOuterBallisticScrollActivity(velocity),
beginActivity(
createOuterBallisticScrollActivity(velocity),
(_NestedScrollPosition position) => createInnerBallisticScrollActivity(position, velocity)
);
}

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

}
public override string ToString() {
return "$GetType()(outer=$_outerController; inner=$_innerController)";
return $"{GetType()}(outer={_outerController}; inner={_innerController})";
}
}

24
com.unity.uiwidgets/Runtime/widgets/overlay.cs


namespace Unity.UIWidgets.widgets {
public class OverlayEntry {
public OverlayEntry(WidgetBuilder builder = null, bool opaque = false, bool maintainState = false) {
public OverlayEntry(
WidgetBuilder builder = null,
bool opaque = false,
bool maintainState = false) {
D.assert(builder != null);
_opaque = opaque;
_maintainState = maintainState;

_maintainState = value;
D.assert(_overlay != null);
_overlay._didChangeEntryOpacity();
_overlay?._didChangeEntryOpacity();
}
}

}
class _OverlayEntryWidgetState : State<_OverlayEntryWidget> {
public override Widget build(BuildContext context) {
public override Widget build(
BuildContext context) {
return new TickerMode(
enabled: widget.tickerEnabled,
child: widget.entry.builder(context)

class _RenderTheatre : ContainerRenderObjectMixinRenderBox<RenderBox, StackParentData> {
internal _RenderTheatre(
TextDirection textDirection,
TextDirection textDirection ,
List<RenderBox> children = null,
int skipCount = 0
) {

if (_resolvedAlignment != null) {
return;
}
//FIXME: wait for changes on painting/alignment.cs (by Siyao)
//then uncomment the line below and remove the switch clauses
//_resolvedAlignment = AlignmentDirectional.topStart.resolve(textDirection);
switch (textDirection) {
case TextDirection.rtl:
_resolvedAlignment = new Alignment(-1, -1);
break;
case TextDirection.ltr:
_resolvedAlignment = new Alignment(1, -1);
break;
}
_resolvedAlignment = AlignmentDirectional.topStart.resolve(textDirection);
}
void _markNeedResolution() {

2
com.unity.uiwidgets/Runtime/widgets/page_storage.cs


public static PageStorageBucket of(BuildContext context) {
PageStorage widget = context.findAncestorWidgetOfExactType<PageStorage>();
return widget == null ? null : widget.bucket;
return widget?.bucket;
}
public override Widget build(BuildContext context) {

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


this.initialPage = initialPage;
this.keepPage = keepPage;
this.viewportFraction = viewportFraction;
D.assert(viewportFraction > 0.0);
D.assert(viewportFraction > 0.0f);
}
public readonly int initialPage;

}
}
public Future 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),

}
public void jumpToPage(int page) {
_PagePosition position = (_PagePosition) this.position;

public Future nextPage(TimeSpan duration, Curve curve) {
public Future nextPage(
TimeSpan duration, Curve curve) {
return animateToPage(page.round() + 1, duration: duration, curve: curve);
}

public override ScrollPosition createScrollPosition(ScrollPhysics physics, ScrollContext context,
public override ScrollPosition createScrollPosition(
ScrollPhysics physics,
ScrollContext context,
ScrollPosition oldPosition) {
return new _PagePosition(
physics: physics,

}
public readonly float _viewportFraction;
public PageMetrics copyWith(
float? minScrollExtent = null,
float? maxScrollExtent = null,
float? pixels = null,
float? viewportDimension = null,
AxisDirection? axisDirection = null,
float? viewportFraction = null
) {
return new PageMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent,
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent,
pixels: pixels ?? this.pixels,
viewportDimension: viewportDimension ?? this.viewportDimension,
axisDirection: axisDirection ?? this.axisDirection,
viewportFraction: viewportFraction ?? this.viewportFraction
);
}
public float page {
get {

bool keepPage = true,
float viewportFraction = 1.0f,
ScrollPosition oldPosition = null
) :
base(
) : base(
physics: physics,
context: context,
initialPixels: null,

}
public float getPageFromPixels(float pixels, float viewportDimension) {
return (Mathf.Max(0.0f, pixels) / Mathf.Max(1.0f, viewportDimension * viewportFraction));
float actual = Mathf.Max(0.0f, pixels - _initialPageOffset) / Mathf.Max(1.0f, viewportDimension * viewportFraction);
float round = (int)actual * 1.0f;
if ((actual - round).abs() < 1e-10) {
return round;
}
return actual;
}
public float getPixelsFromPage(float page) {

}
public override bool applyViewportDimension(float viewportDimension) {
float oldViewportDimensions = 0.0f;
if (haveDimensions) {
oldViewportDimensions = this.viewportDimension;
}
float oldViewportDimensions = this.viewportDimension;
float page = (oldPixels == null || oldViewportDimensions == 0.0f)
? _pageToUseOnStartup
: getPageFromPixels(oldPixels.Value, oldViewportDimensions);

return false;
}
return result;
}

return base.applyContentDimensions(
return base.applyContentDimensions(
public PageMetrics copyWith(
float? minScrollExtent = null,
float? maxScrollExtent = null,
float? pixels = null,
float? viewportDimension = null,
AxisDirection? axisDirection = null,
float? viewportFraction = null
) {
return new PageMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent,
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent,
pixels: pixels ?? this.pixels,
viewportDimension: viewportDimension ?? this.viewportDimension,
axisDirection: axisDirection ?? this.axisDirection,
viewportFraction: viewportFraction ?? this.viewportFraction
);
}
}
public class _ForceImplicitScrollPhysics : ScrollPhysics {

) : base(parent: parent) {
D.assert(allowImplicitScrolling != null);
this.allowImplicitScrolling = allowImplicitScrolling;
}
public override ScrollPhysics applyTo(ScrollPhysics ancestor) {

ValueChanged<int> onPageChanged = null,
List<Widget> children = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
IndexedWidgetBuilder itemBuilder = null,
SliverChildDelegate childDelegate = null,
int itemCount = 0,
bool allowImplicitScrolling = false
) : base(key: key) {
this.scrollDirection = scrollDirection;

this.dragStartBehavior = dragStartBehavior;
this.controller = controller ?? PageViewUtils._defaultPageController;
this.allowImplicitScrolling = allowImplicitScrolling;
if (itemBuilder != null) {
childrenDelegate = new SliverChildBuilderDelegate(itemBuilder, childCount: itemCount);
}
else if (childDelegate != null) {
childrenDelegate = childDelegate;
}
else {
childrenDelegate = new SliverChildListDelegate(children ?? new List<Widget>());
}
childrenDelegate = new SliverChildListDelegate(children);
IndexedWidgetBuilder itemBuilder,
Key key = null,
Axis scrollDirection = Axis.horizontal,
bool reverse = false,

ValueChanged<int> onPageChanged = null,
IndexedWidgetBuilder itemBuilder = null,
bool allowImplicitScrolling = false,
DragStartBehavior dragStartBehavior = DragStartBehavior.start
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
bool allowImplicitScrolling = false
) {
var page = new PageView(
key: key,
scrollDirection: scrollDirection,
reverse: reverse,
controller: controller ?? PageViewUtils._defaultPageController,
physics: physics,
pageSnapping: pageSnapping,
onPageChanged: onPageChanged,
allowImplicitScrolling: allowImplicitScrolling,
dragStartBehavior: dragStartBehavior
);
page.childrenDelegate = new SliverChildBuilderDelegate(itemBuilder, childCount: itemCount);
return page;
}
public static PageView custom(
Key key = null,
Axis scrollDirection = Axis.horizontal,
bool reverse = false,
PageController controller = null,
ScrollPhysics physics = null,
bool pageSnapping = true,
ValueChanged<int> onPageChanged = null,
SliverChildDelegate childrenDelegate = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
bool allowImplicitScrolling = false
return new PageView(
itemBuilder: itemBuilder,
D.assert(childrenDelegate != null);
var page = new PageView(
controller: controller,
controller: controller ?? PageViewUtils._defaultPageController,
itemCount: itemCount,
allowImplicitScrolling: allowImplicitScrolling,
allowImplicitScrolling: allowImplicitScrolling,
page.childrenDelegate = childrenDelegate;
return page;
}
// TODO: PageView.custom

public readonly ValueChanged<int> onPageChanged;
public readonly SliverChildDelegate childrenDelegate;
public SliverChildDelegate childrenDelegate;
public readonly DragStartBehavior dragStartBehavior;

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


}
public abstract class PageRoute : ModalRoute {
public readonly bool fullscreenDialog;
public PageRoute() {}
bool fullscreenDialog = false) : base(settings) {
bool fullscreenDialog = false
) : base(settings) {
public readonly bool fullscreenDialog;
public override bool opaque {
get { return true; }

bool fullscreenDialog = false
) : base(settings,fullscreenDialog) {
D.assert(pageBuilder != null);
this.opaque = opaque;
this.pageBuilder = pageBuilder;
this.transitionsBuilder = transitionsBuilder ?? PagesUtils._defaultTransitionsBuilder;

34
com.unity.uiwidgets/Runtime/widgets/performance_overlay.cs


public class PerformanceOverlay : LeafRenderObjectWidget {
public PerformanceOverlay(
Key key = null,
int optionsMask = 0
int optionsMask = 0,
int rasterizerThreshold = 0,
bool checkerboardRasterCacheImages = false,
bool checkerboardOffscreenLayers = false
this.rasterizerThreshold = rasterizerThreshold;
this.checkerboardOffscreenLayers = checkerboardOffscreenLayers;
this.checkerboardRasterCacheImages = checkerboardRasterCacheImages;
public readonly int rasterizerThreshold;
public readonly bool checkerboardRasterCacheImages;
public readonly bool checkerboardOffscreenLayers;
Key key = null
Key key = null,
int rasterizerThreshold = 0,
bool checkerboardRasterCacheImages = false,
bool checkerboardOffscreenLayers = false
optionsMask: (1 << (int) PerformanceOverlayOption.drawFPS) |
(1 << (int) PerformanceOverlayOption.drawFrameCost)
optionsMask :
1 << (int) PerformanceOverlayOption.displayRasterizerStatistics |
1 << (int) PerformanceOverlayOption.visualizeRasterizerStatistics |
1 << (int) PerformanceOverlayOption.displayEngineStatistics |
1 << (int) PerformanceOverlayOption.visualizeEngineStatistics
optionsMask: optionsMask);
optionsMask: optionsMask,
rasterizerThreshold: rasterizerThreshold,
checkerboardRasterCacheImages: checkerboardRasterCacheImages,
checkerboardOffscreenLayers: checkerboardOffscreenLayers
);
_renderObject.rasterizerThreshold = rasterizerThreshold;
}
}
}

2
com.unity.uiwidgets/Runtime/widgets/placeholder.cs


namespace Unity.UIWidgets.widgets {
class _Placeholderpainter : AbstractCustomPainter {
public _Placeholderpainter(
Color color,
Color color = null,
float strokeWidth = 0f
) {
this.color = color;

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


Size preferredSize { get; }
}
public abstract class PreferredSizeWidget : StatefulWidget{//Widget{ //StatefulWidget, SizePreferred {
public abstract class PreferredSizeWidget : StatefulWidget{
protected PreferredSizeWidget(Key key = null) : base(key: key) {
}

public class PreferredSize : StatelessWidget{//PreferredSizeWidget {
public class PreferredSize : StatelessWidget{
public PreferredSize(
Key key = null,
Widget child = null,

public readonly Widget child;
//public override Size preferredSize { get; }
public Size preferredSize { get; }
public Size preferredSize { get; }
/*public override State createState() {
return new _PreferredSizeState();

2
com.unity.uiwidgets/Runtime/widgets/primary_scroll_controller.cs


this.controller = controller;
}
PrimaryScrollController(
public PrimaryScrollController(
Key key = null,
Widget child = null
) : base(key: key, child: child) {

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


namespace Unity.UIWidgets.widgets {
public abstract class OverlayRoute : Route {
public readonly List<OverlayEntry> _overlayEntries = new List<OverlayEntry>();
public OverlayRoute(
RouteSettings settings = null

get { return _overlayEntries; }
}
public readonly List<OverlayEntry> _overlayEntries = new List<OverlayEntry>();
protected virtual bool finishedWhenPopped {
get { return true; }

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

正在加载...
取消
保存