浏览代码

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

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
c8af76a9
共有 18 个文件被更改,包括 810 次插入327 次删除
  1. 8
      com.unity.uiwidgets/Runtime/material/dialog.cs
  2. 4
      com.unity.uiwidgets/Runtime/material/dialog_theme.cs
  3. 105
      com.unity.uiwidgets/Runtime/material/divider.cs
  4. 116
      com.unity.uiwidgets/Runtime/material/drawer.cs
  5. 88
      com.unity.uiwidgets/Runtime/rendering/RenderAnimatedOpacityMixin.mixin.gen.cs
  6. 55
      com.unity.uiwidgets/Runtime/rendering/RenderAnimatedOpacityMixin.mixin.njk
  7. 1
      com.unity.uiwidgets/Runtime/rendering/debug.cs
  8. 17
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  9. 2
      com.unity.uiwidgets/Runtime/rendering/object.cs
  10. 41
      com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs
  11. 23
      com.unity.uiwidgets/Runtime/rendering/object.mixin.njk
  12. 40
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  13. 7
      com.unity.uiwidgets/Runtime/rendering/performance_overlay.cs
  14. 396
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  15. 202
      com.unity.uiwidgets/Runtime/rendering/proxy_sliver.cs
  16. 2
      com.unity.uiwidgets/Runtime/rendering/table.cs
  17. 30
      com.unity.uiwidgets/Runtime/widgets/debug.cs

8
com.unity.uiwidgets/Runtime/material/dialog.cs


using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {

ThemeData theme = Theme.of(context);
DialogTheme dialogTheme = DialogTheme.of(context);
Widget titleWidget = null;
Widget contentWidget = null;
Widget actionsWidget = null;

public static Future<T> showDialog<T>(
BuildContext context = null,
bool barrierDismissible = true,
Widget child = null,
D.assert(child == null || builder == null);
D.assert(debugCheckHasMaterialLocalizations(context));
ThemeData theme = Theme.of(context, shadowThemeOnly: true);

Widget pageChild = new Builder(builder: builder);
Widget pageChild = child ?? new Builder(builder: builder);
return new SafeArea(
child: new Builder(
builder: (_) => theme != null

4
com.unity.uiwidgets/Runtime/material/dialog_theme.cs


public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Color>("backgroundColor", backgroundColor));
properties.add(new ColorProperty("backgroundColor", backgroundColor));
properties.add(new DiagnosticsProperty<float?>("elevation", elevation));
properties.add(new FloatProperty("elevation", elevation));
properties.add(new DiagnosticsProperty<TextStyle>("titleTextStyle", titleTextStyle));
properties.add(new DiagnosticsProperty<TextStyle>("contentTextStyle", contentTextStyle));
}

105
com.unity.uiwidgets/Runtime/material/divider.cs


public class Divider : StatelessWidget {
public Divider(
Key key = null,
float height = 16.0f,
float indent = 0.0f,
float? height = null,
float? thickness = null,
float? indent = null,
float? endIndent = null,
this.thickness = thickness;
this.endIndent = endIndent;
public readonly float height;
public readonly float? height;
public readonly float? thickness;
public readonly float? indent;
public readonly float indent;
public readonly float? endIndent;
public static BorderSide createBorderSide(BuildContext context, Color color = null, float width = 0.0f) {
public static BorderSide createBorderSide(BuildContext context, Color color = null, float? width = null) {
Color effectiveColor = color
?? (context != null
? (DividerTheme.of(context).color ?? Theme.of(context).dividerColor)
: null);
float effectiveWidth = width
?? (context != null ? DividerTheme.of(context).thickness : null)
?? 0.0f;
// Prevent assertion since it is possible that context is null and no color
// is specified.
if (effectiveColor == null) {
return new BorderSide(
width: effectiveWidth
);
}
color: color ?? Theme.of(context).dividerColor,
width: width);
color: effectiveColor,
width: effectiveWidth
);
DividerThemeData dividerTheme = DividerTheme.of(context);
float height = this.height ?? dividerTheme.space ?? 16.0f;
float thickness = this.thickness ?? dividerTheme.thickness ?? 0.0f;
float indent = this.indent ?? dividerTheme.indent ?? 0.0f;
float endIndent = this.endIndent ?? dividerTheme.endIndent ?? 0.0f;
height: 0.0f,
margin: EdgeInsets.only(indent),
height: thickness,
//TODO: update to EdgeInsetsGeometry
margin: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(start: indent,
end: endIndent),
decoration: new BoxDecoration(
border: new Border(
bottom: createBorderSide(context, color: color, width: thickness))
)
)
)
);
}
}
public class VerticalDivider : StatelessWidget {
public VerticalDivider(
Key key = null,
float? width = null,
float? thickness = null,
float? indent = null,
float? endIndent = null,
Color color = null
) : base(key) {
D.assert(width == null || width >= 0.0);
D.assert(thickness == null || thickness >= 0.0);
D.assert(indent == null || indent >= 0.0);
D.assert(endIndent == null || endIndent >= 0.0);
this.width = width;
this.thickness = thickness;
this.indent = indent;
this.endIndent = endIndent;
this.color = color;
}
public readonly float? width;
public readonly float? thickness;
public readonly float? indent;
public readonly float? endIndent;
public readonly Color color;
public override Widget build(BuildContext context) {
DividerThemeData dividerTheme = DividerTheme.of(context);
float width = this.width ?? dividerTheme.space ?? 16.0f;
float thickness = this.thickness ?? dividerTheme.thickness ?? 0.0f;
float indent = this.indent ?? dividerTheme.indent ?? 0.0f;
float endIndent = this.endIndent ?? dividerTheme.endIndent ?? 0.0f;
return new SizedBox(
width: width,
child: new Center(
child: new Container(
width: thickness,
//TODO: update to EdgeInsetsGeometry
margin: (EdgeInsets) (EdgeInsetsGeometry) EdgeInsetsDirectional.only(top: indent,
bottom: endIndent),
bottom: createBorderSide(context, color: color))
left: Divider.createBorderSide(context, color: color, width: thickness)
)
)
)
)

116
com.unity.uiwidgets/Runtime/material/drawer.cs


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
static class DrawerUtils {

Widget child = null,
DrawerAlignment? alignment = null,
DrawerCallback drawerCallback = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.start
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
Color scrimColor = null,
bool? enableOpenDragGesture = true,
float? edgeDragWidth = null
) : base(key: key) {
D.assert(child != null);
D.assert(alignment != null);

this.dragStartBehavior = dragStartBehavior;
this.scrimColor = scrimColor;
this.enableOpenDragGesture = enableOpenDragGesture;
this.edgeDragWidth = edgeDragWidth;
}
public readonly Widget child;

public readonly DragStartBehavior? dragStartBehavior;
public readonly DrawerCallback drawerCallback;
public readonly Color scrimColor;
public readonly bool? enableOpenDragGesture;
public readonly float? edgeDragWidth;
public override State createState() {
return new DrawerControllerState();

public class DrawerControllerState : SingleTickerProviderStateMixin<DrawerController> {
public override void initState() {
base.initState();
_scrimColorTween = _buildScrimColorTween();
_controller = new AnimationController(duration: DrawerUtils._kBaseSettleDuration, vsync: this);
_controller.addListener(_animationChanged);
_controller.addStatusListener(_animationStatusChanged);

_historyEntry?.remove();
_controller.dispose();
base.dispose();
}
public override void didUpdateWidget(StatefulWidget statefulWidget) {
base.didUpdateWidget(statefulWidget);
if (statefulWidget is DrawerController oldWidget && widget.scrimColor != oldWidget.scrimColor)
_scrimColorTween = _buildScrimColorTween();
}
void _animationChanged() {

_controller.setValue(_controller.value + delta);
bool opened = _controller.value > 0.5;
bool opened = _controller.value > 0.5f;
if (opened != _previouslyOpened && widget.drawerCallback != null) {
widget.drawerCallback(opened);
}

break;
}
_controller.fling(velocity: visualVelocity);
switch (Directionality.of(context)) {
case TextDirection.rtl:
_controller.fling(velocity: -visualVelocity);
if (widget.drawerCallback != null)
widget.drawerCallback(visualVelocity < 0.0f);
break;
case TextDirection.ltr:
_controller.fling(velocity: visualVelocity);
if (widget.drawerCallback != null)
widget.drawerCallback(visualVelocity > 0.0f);
break;
}
else if (_controller.value < 0.5) {
else if (_controller.value < 0.5f) {
close();
}
else {

}
}
ColorTween _color = new ColorTween(begin: Colors.transparent, end: Colors.black54);
ColorTween _scrimColorTween;
ColorTween _buildScrimColorTween() {
return new ColorTween(begin: Colors.transparent, end: widget.scrimColor ?? Colors.black54);
}
Alignment _drawerOuterAlignment {
get {
switch (widget.alignment) {

Widget _buildDrawer(BuildContext context) {
bool drawerIsStart = widget.alignment == DrawerAlignment.start;
EdgeInsets padding = MediaQuery.of(context).padding;
float dragAreaWidth = drawerIsStart ? padding.left : padding.right;
TextDirection textDirection = Directionality.of(context);
dragAreaWidth = Mathf.Max(dragAreaWidth, DrawerUtils._kEdgeDragWidth);
float? dragAreaWidth = widget.edgeDragWidth;
if (widget.edgeDragWidth == null) {
switch (textDirection) {
case TextDirection.ltr:
dragAreaWidth = DrawerUtils._kEdgeDragWidth +
(drawerIsStart ? padding.left : padding.right);
break;
case TextDirection.rtl:
dragAreaWidth = DrawerUtils._kEdgeDragWidth +
(drawerIsStart ? padding.right : padding.left);
break;
}
}
return new Align(
alignment: _drawerOuterAlignment,
child: new GestureDetector(
key: _gestureDetectorKey,
onHorizontalDragUpdate: _move,
onHorizontalDragEnd: _settle,
behavior: HitTestBehavior.translucent,
dragStartBehavior: widget.dragStartBehavior ?? DragStartBehavior.down,
child: new Container(width: dragAreaWidth)
)
);
if (widget.enableOpenDragGesture ?? false) {
return new Align(
alignment: _drawerOuterAlignment,
child: new GestureDetector(
key: _gestureDetectorKey,
onHorizontalDragUpdate: _move,
onHorizontalDragEnd: _settle,
behavior: HitTestBehavior.translucent,
dragStartBehavior: widget.dragStartBehavior ?? DragStartBehavior.down,
child: new Container(width: dragAreaWidth)
)
);
}
else {
return SizedBox.shrink();
}
bool? platformHasBackButton = null;
switch (Theme.of(context).platform) {
case RuntimePlatform.Android:
platformHasBackButton = true;
break;
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
case RuntimePlatform.LinuxEditor:
case RuntimePlatform.LinuxPlayer:
case RuntimePlatform.WindowsEditor:
case RuntimePlatform.WindowsPlayer:
platformHasBackButton = false;
break;
}
D.assert(platformHasBackButton != null);
return new GestureDetector(
key: _gestureDetectorKey,
onHorizontalDragDown: _handleDragDown,

children: new List<Widget> {
new GestureDetector(
onTap: close,
child: new Container(
color: _color.evaluate(_controller)
child: new MouseRegion(
opaque: true,
child: new Container( // The drawer's "scrim"
color: _scrimColorTween.evaluate(_controller)
)
)
),
new Align(

child: new FocusScope(
key: _drawerKey,
node: _focusScopeNode,
child: widget.child)
child: widget.child
)
)
)
)

88
com.unity.uiwidgets/Runtime/rendering/RenderAnimatedOpacityMixin.mixin.gen.cs


using System;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
public abstract class RenderAnimatedOpacityMixinRenderSliver<ChildType> : RenderProxySliver, RenderAnimatedOpacityMixin<ChildType> where ChildType : RenderObject {
public int _alpha { get; set; }
public new bool alwaysNeedsCompositing {
public abstract class RenderAnimatedOpacityMixinRenderSliver<ChildType> : RenderProxySliver, RenderAnimatedOpacityMixin<ChildType> where ChildType : RenderObject {
public int _alpha { get; set;}
public new bool alwaysNeedsCompositing {
public bool _currentlyNeedsCompositing { get; set; }
public bool _currentlyNeedsCompositing { get;set; }
public Animation<float> opacity {
get { return _opacity; }

_updateOpacity();
}
}
public bool alwaysIncludeSemantics {
get { return _alwaysIncludeSemantics; }
set {

}
}
public bool _alwaysIncludeSemantics { get; set; }
public override void attach(object owner) {
owner = (PipelineOwner) owner;
base.attach(owner);
_opacity.addListener(_updateOpacity);
_updateOpacity();
}
public bool _alwaysIncludeSemantics { get; set; }
_updateOpacity();
_updateOpacity();
public override void detach() {
_opacity.removeListener(_updateOpacity);
base.detach();

markNeedsPaint();
//if (oldAlpha == 0 || _alpha == 0)
// markNeedsSemanticsUpdate();
}
}
public override void paint(PaintingContext context, Offset offset) {

layer = context.pushOpacity(offset, _alpha, base.paint, oldLayer: layer as OpacityLayer);
}
}
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary(
$"A {GetType()} expected a child of type {typeof(ChildType)} but received a " +
$"child of type {child.GetType()}."
),
new ErrorDescription(
"RenderObjects expect specific types of children because they " +
"coordinate with their children during layout and paint. For " +
"example, a RenderSliver cannot be the child of a RenderBox because " +
"a RenderSliver does not understand the RenderBox layout protocol."
),
new ErrorSpacer(),
new DiagnosticsProperty<dynamic>(
"The $runtimeType that expected a $ChildType child was created by",
debugCreator,
style: DiagnosticsTreeStyle.errorProperty
),
new ErrorSpacer(),
new DiagnosticsProperty<dynamic>(
"The ${child.runtimeType} that did not match the expected child type " +
"was created by",
child.debugCreator,
style: DiagnosticsTreeStyle.errorProperty
),
});
}
return true;
});
return true;
}
RenderObject RenderObjectWithChildMixin.child {
get { return child; }
set { child = (ChildType) value; }
}
}

55
com.unity.uiwidgets/Runtime/rendering/RenderAnimatedOpacityMixin.mixin.njk


using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
public abstract class RenderAnimatedOpacityMixin{{with}}<ChildType> : {{with}}, RenderAnimatedOpacityMixin<ChildType> where ChildType : RenderSliver {
public abstract class RenderAnimatedOpacityMixin{{with}}<ChildType> : RenderProxySliver, RenderAnimatedOpacityMixin<ChildType> where ChildType : RenderObject {
get { child != null && _currentlyNeedsCompositing;}
get { return child != null && _currentlyNeedsCompositing;}
}
public bool _currentlyNeedsCompositing { get;set; }

}
public bool _alwaysIncludeSemantics { get; set; }
public override void attach(PipelineOwner owner) {
public void attach(PipelineOwner owner) {
_updateOpacity();
_updateOpacity();
public override void detach() {
_opacity.removeListener(_updateOpacity);
base.detach();

base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Animation<float>>("opacity", opacity));
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
}
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary(
$"A {GetType()} expected a child of type {typeof(ChildType)} but received a " +
$"child of type {child.GetType()}."
),
new ErrorDescription(
"RenderObjects expect specific types of children because they " +
"coordinate with their children during layout and paint. For " +
"example, a RenderSliver cannot be the child of a RenderBox because " +
"a RenderSliver does not understand the RenderBox layout protocol."
),
new ErrorSpacer(),
new DiagnosticsProperty<dynamic>(
"The $runtimeType that expected a $ChildType child was created by",
debugCreator,
style: DiagnosticsTreeStyle.errorProperty
),
new ErrorSpacer(),
new DiagnosticsProperty<dynamic>(
"The ${child.runtimeType} that did not match the expected child type " +
"was created by",
child.debugCreator,
style: DiagnosticsTreeStyle.errorProperty
),
});
}
return true;
});
return true;
}
public ChildType child { get; set; }
RenderObject RenderObjectWithChildMixin.child {
get { return child; }
set { child = (ChildType) value; }
}
}

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


namespace Unity.UIWidgets.rendering {
public static class RenderingDebugUtils {
public static bool debugDisableShadows = false;
public static bool debugCheckElevationsEnabled = false;
public static bool debugRepaintTextRainbowEnabled = false;
static readonly HSVColor _kDebugDefaultRepaintColor = HSVColor.fromAHSV(0.4f, 60.0f, 1.0f, 1.0f);

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


}
}
public class RenderEditable : RenderBox, RelayoutWhenSystemFontsChangeMixin {
public class RenderEditable : RelayoutWhenSystemFontsChangeMixinRenderBox {
public RenderEditable(
TextSpan text = null,
TextDirection? textDirection = null,

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 {

public override void attach(object ownerObject) {
base.attach(ownerObject);
attach((PipelineOwner)ownerObject);
/*_tap = new TapGestureRecognizer(debugOwner: this);
_tap = new TapGestureRecognizer(debugOwner: this);
_showCursor.addListener(markNeedsPaint);*/
_showCursor.addListener(markNeedsPaint);
}
public override void detach() {

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


_needsCompositingBitsUpdate = false;
}
bool debugNeedsPaint {
public bool debugNeedsPaint {
get {
bool result = false;
D.assert(() => {

41
com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
using UnityEngine;

public bool debugValidateChild(RenderObject child) {
public virtual bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(

public abstract class RenderObjectWithChildMixinRenderBox<ChildType> : RenderBox, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
public bool debugValidateChild(RenderObject child) {
public virtual bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is ChildType)) {
throw new UIWidgetsError(

public virtual void insert(ChildType child, ChildType after = null) {
D.assert(child != this, ()=>"A RenderObject cannot be inserted into itself.");
D.assert(after != this,()=>
"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(after != this,
()=>"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
adoptChild(child);
_insertIntoChildList(child, after);
}

public virtual void insert(ChildType child, ChildType after = null) {
D.assert(child != this, ()=>"A RenderObject cannot be inserted into itself.");
D.assert(after != this,()=>
"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(after != this,
()=>"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
adoptChild(child);
_insertIntoChildList(child, after);
}

public virtual void insert(ChildType child, ChildType after = null) {
D.assert(child != this, ()=>"A RenderObject cannot be inserted into itself.");
D.assert(after != this,
()=> "A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(child != after,()=> "A RenderObject cannot be inserted after itself.");
()=>"A RenderObject cannot simultaneously be both the parent and the sibling of another RenderObject.");
D.assert(child != after, ()=>"A RenderObject cannot be inserted after itself.");
adoptChild(child);
_insertIntoChildList(child, after);
}

invokeLayoutCallback(_callback);
}
}
public abstract class RelayoutWhenSystemFontsChangeMixinRenderBox : RenderBox {
protected void systemFontsDidChange() {
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
}
public override void detach() {
PaintingBinding.instance.systemFonts.removeListener(systemFontsDidChange);
base.detach();
}
}
}

23
com.unity.uiwidgets/Runtime/rendering/object.mixin.njk


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
using UnityEngine;

{{ RenderConstrainedLayoutBuilderMixin('abstract', 'RenderObject', 'Constraints') }}
{{ RenderConstrainedLayoutBuilderMixin('', 'RenderBox', 'BoxConstraints') }}
{{ RenderConstrainedLayoutBuilderMixin('abstract', 'RenderSliver', 'SliverConstraints') }}
{% macro RelayoutWhenSystemFontsChangeMixin(with) %}
public abstract class RelayoutWhenSystemFontsChangeMixin{{with}} : {{with}} {
protected void systemFontsDidChange() {
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
}
public override void detach() {
PaintingBinding.instance.systemFonts.removeListener(systemFontsDidChange);
base.detach();
}
}
{% endmacro %}
{{ RelayoutWhenSystemFontsChangeMixin('RenderBox') }}
}

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


_needsClipping = true;
break;
}*/
//[!!!]need to replace it?
switch (_overflow) {
case TextOverflow.visible:
_needsClipping = false;

paintParagraph(context, offset);
}
} */
// need to replace it?
public override void paint(PaintingContext context2, Offset offset2) {
public override void paint(PaintingContext context, Offset offset) {
_layoutTextWithConstraints(constraints);
D.assert(() => {

context2.canvas.drawRect(offset2 & size, paint);
context.canvas.drawRect(offset & size, paint);
Rect bounds = offset2 & size;
Rect bounds = offset & size;
context2.canvas.saveLayer(bounds, new Paint());
context.canvas.saveLayer(bounds, new Paint());
context2.canvas.save();
context.canvas.save();
context2.canvas.clipRect(bounds);
context.canvas.clipRect(bounds);
_textPainter.paint(context2.canvas, offset2);
_textPainter.paint(context.canvas, offset);
RenderBox child = firstChild;
int childIndex = 0;

float scale = textParentData.scale;
context2.pushTransform(
context.pushTransform(
offset2 + textParentData.offset,
offset + textParentData.offset,
(PaintingContext context, Offset offset) => {
context.paintChild(
(PaintingContext context2, Offset offset2) => {
context2.paintChild(
offset
offset2
}
);
});
context2.canvas.translate(offset2.dx, offset2.dy);
context.canvas.translate(offset.dx, offset.dy);
context2.canvas.drawRect(Offset.zero & size, paint);
context.canvas.drawRect(Offset.zero & size, paint);
context2.canvas.restore();
context.canvas.restore();
}
}

_textPainter.layout(minWidth, widthMatters ? maxWidth : float.PositiveInfinity);
}
/*public override void systemFontsDidChange() {
base.systemFontsDidChange();
_textPainter.markNeedsLayout();
}*/
List<PlaceholderDimensions> _placeholderDimensions;
void _layoutTextWithConstraints(BoxConstraints constraints) {

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


bool checkerboardRasterCacheImages = false,
bool checkerboardOffscreenLayers = false
) {
D.assert(optionsMask != null);
D.assert(rasterizerThreshold != null);
D.assert(checkerboardRasterCacheImages != null);
D.assert(checkerboardOffscreenLayers != null);
_optionsMask = optionsMask;
_rasterizerThreshold = rasterizerThreshold;
_checkerboardRasterCacheImages = checkerboardRasterCacheImages;

return _rasterizerThreshold;
}
set {
D.assert(value != null);
if (value == _rasterizerThreshold)
return;
_rasterizerThreshold = value;

return _checkerboardRasterCacheImages;
}
set {
D.assert(value != null);
if (value == _checkerboardRasterCacheImages)
return;
_checkerboardRasterCacheImages = value;

public bool checkerboardOffscreenLayers {
get { return _checkerboardOffscreenLayers; }
set {
D.assert(value != null);
if (value == _checkerboardOffscreenLayers)
return;
_checkerboardOffscreenLayers = value;

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


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

BlendMode blendMode = BlendMode.modulate
) : base(child) {
D.assert(shaderCallback != null);
D.assert(blendMode != null);
_shaderCallback = shaderCallback;
_blendMode = blendMode;
}

public BlendMode blendMode {
get { return _blendMode;}
set {
D.assert(value != null);
if (_blendMode == value)
return;
_blendMode = value;

get;
}
bool _currentlyNeedsCompositing { get; set; }
Animation<float> opacity {
get;
set;
}
Animation<float> _opacity { get; set; }
bool alwaysIncludeSemantics {
Animation<float> _opacity {
bool _alwaysIncludeSemantics { get; set; }
void attach(PipelineOwner owner);
void detach();

}
protected override void performLayout() {
BoxConstraints constraints = this.constraints;
if (child != null) {
child.layout(_additionalConstraints.enforce(constraints), parentUsesSize: true);
size = child.size;

protected override void performLayout() {
if (child != null) {
BoxConstraints constraints = this.constraints;
child.layout(_limitConstraints(constraints), parentUsesSize: true);
size = constraints.constrain(child.size);
}

float width = constraints.maxWidth;
float height = width / _aspectRatio;
if (width.isFinite()) {
height = width / _aspectRatio;
} else {
height = constraints.maxHeight;
width = height * _aspectRatio;
}
if (width > constraints.maxWidth) {
width = constraints.maxWidth;
height = width / _aspectRatio;

public override void paint(PaintingContext context, Offset offset) {
if (child != null) {
if (_alpha == 0) {
layer = null;
layer = null;
context.pushOpacity(offset, _alpha, base.paint);
layer = context.pushOpacity(offset, _alpha, base.paint, oldLayer: layer as OpacityLayer);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

public override void paint(PaintingContext context, Offset offset) {
if (child != null) {
D.assert(needsCompositing);
context.pushLayer(new BackdropFilterLayer(filter), base.paint, offset);
layer = layer?? new BackdropFilterLayer(_filter);
context.pushLayer(layer, base.paint, offset);
} else {
layer = null;
}
}
}

}
_clipBehavior = value;
markNeedsPaint();
}
}

new List<Color> {
new Color(0x00000000),
new Color(0xFFFF00FF),
}, null, TileMode.repeated);
new Color(0xFFFF00FF),
new Color(0x00000000)
},
new List<float>{0.25f,0.25f,0.75f,0.75f},
TileMode.repeated);
_debugPaint.strokeWidth = 2.0f;
_debugPaint.style = PaintingStyle.stroke;
}

text: new TextSpan(
text: "x",
text: "✂",
));
),
textDirection: TextDirection.rtl
);
_debugText.layout();
}

child: child,
clipper: clipper,
clipBehavior: clipBehavior) {
D.assert(clipBehavior != Clip.none);
}
protected override Rect _defaultClip {

public override void paint(PaintingContext context, Offset offset) {
if (child != null) {
_updateClip();
context.pushClipRect(needsCompositing, offset, _clip,
base.paint, clipBehavior: clipBehavior);
layer = context.pushClipRect(
needsCompositing,
offset,
_clip,
base.paint,
clipBehavior: clipBehavior,
oldLayer: layer as ClipRectLayer
);
} else {
layer = null;
}
}

public override void paint(PaintingContext context, Offset offset) {
if (child != null) {
_updateClip();
context.pushClipRRect(needsCompositing, offset, _clip.outerRect, _clip,
base.paint, clipBehavior: clipBehavior);
layer = context.pushClipRRect(
needsCompositing,
offset,
_clip.outerRect,
_clip,
base.paint,
clipBehavior: clipBehavior,
oldLayer: layer as ClipRRectLayer
);
} else {
layer = null;
}
}

get { return Offset.zero & size; }
}
public override bool hitTest(BoxHitTestResult result,
Offset position = null
) {
public override bool hitTest(BoxHitTestResult result, Offset position = null) {
_updateClip();
D.assert(_clip != null);
Offset center = _clip.center;

public override void paint(PaintingContext context, Offset offset) {
if (child != null) {
_updateClip();
context.pushClipPath(needsCompositing, offset, _clip, _getClipPath(_clip),
base.paint, clipBehavior: clipBehavior);
layer = context.pushClipPath(
needsCompositing,
offset,
_clip,
_getClipPath(_clip),
base.paint,
clipBehavior: clipBehavior,
oldLayer: layer as ClipPathLayer
);
} else {
layer = null;
}
}

public override void paint(PaintingContext context, Offset offset) {
if (child != null) {
_updateClip();
context.pushClipPath(needsCompositing, offset, Offset.zero & size,
_clip, base.paint, clipBehavior: clipBehavior);
layer = context.pushClipPath(
needsCompositing,
offset,
Offset.zero & size,
_clip,
base.paint,
clipBehavior: clipBehavior,
oldLayer: layer as ClipPathLayer
);
} else {
layer = null;
}
}

_shape = shape;
_borderRadius = borderRadius;
}
public PhysicalModelLayer layer { // [!!!] override
get {
return base.layer as PhysicalModelLayer;
}
set {
if (layer == value) {
return;
}
base.layer = value;
}
}
public BoxShape shape {
get { return _shape; }

Rect offsetBounds = offsetRRect.outerRect;
Path offsetRRectAsPath = new Path();
offsetRRectAsPath.addRRect(offsetRRect);
PhysicalModelLayer physicalModel = new PhysicalModelLayer(
clipPath: offsetRRectAsPath,
clipBehavior: clipBehavior,
elevation: elevation,
color: color,
shadowColor: shadowColor);
bool paintShadows = true;
D.assert(() => {
if (RenderingDebugUtils.debugDisableShadows) {
if (elevation > 0.0) {
Paint paint = new Paint();
paint.color = shadowColor;
paint.style = PaintingStyle.stroke;
paint.strokeWidth = elevation * 2.0f;
context.canvas.drawRRect(
offsetRRect,
paint
);
}
paintShadows = false;
}
return true;
});
layer = layer?? new PhysicalModelLayer();
layer.clipPath = offsetRRectAsPath;
layer.clipBehavior = clipBehavior;
layer.elevation = paintShadows ? elevation : 0.0f;
layer.color = color;
layer.shadowColor = shadowColor;
context.pushLayer(layer, base.paint, offset, childPaintBounds: offsetBounds);
physicalModel.debugCreator = debugCreator;
layer.debugCreator = debugCreator;
context.pushLayer(physicalModel, base.paint, offset, childPaintBounds: offsetBounds);
} else {
layer = null;
}
}

clipBehavior: clipBehavior) {
D.assert(clipper != null);
D.assert(color != null);
D.assert(elevation >= 0.0);
}
public PhysicalModelLayer layer { // [!!!] override
get {
return base.layer as PhysicalModelLayer;
}
set {
if (layer == value) {
return;
}
base.layer = value;
}
}
protected override Path _defaultClip {

_updateClip();
Rect offsetBounds = offset & size;
Path offsetPath = _clip.shift(offset);
PhysicalModelLayer physicalModel = new PhysicalModelLayer(
clipPath: offsetPath,
clipBehavior: clipBehavior,
elevation: elevation,
color: color,
shadowColor: shadowColor);
context.pushLayer(physicalModel, base.paint, offset, childPaintBounds: offsetBounds);
bool paintShadows = true;
D.assert(() => {
if (RenderingDebugUtils.debugDisableShadows) {
if (elevation > 0.0) {
Paint paint = new Paint();
paint.color = shadowColor;
paint.style = PaintingStyle.stroke;
paint.strokeWidth = elevation * 2.0f;
context.canvas.drawPath(
offsetPath,
paint
);
}
paintShadows = false;
}
return true;
});
layer = layer?? new PhysicalModelLayer();
layer.clipPath = offsetPath;
layer.clipBehavior = clipBehavior;
layer.elevation = paintShadows ? elevation : 0.0f;
layer.color = color;
layer.shadowColor = shadowColor;
context.pushLayer(layer, base.paint, offset, childPaintBounds: offsetBounds);
D.assert(() => {
layer.debugCreator = debugCreator;
return true;
});
} else {
layer = null;
}
}

protected override bool hitTestSelf(Offset position) {
return _decoration.hitTest(size, position);
// [!!!] hitTest no textDirection
// return _decoration.hitTest(size, position, textDirection: configuration.textDirection);
}
public override void paint(PaintingContext context, Offset offset) {

D.assert(() => {
if (debugSaveCount != context.canvas.getSaveCount()) {
throw new UIWidgetsError(
_decoration.GetType() + " painter had mismatching save and restore calls.\n" +
"Before painting the decoration, the canvas save count was $debugSaveCount. " +
"After painting it, the canvas save count was " + context.canvas.getSaveCount() + ". " +
"Every call to save() or saveLayer() must be matched by a call to restore().\n" +
"The decoration was:\n" +
" " + decoration + "\n" +
"The painter was:\n" +
" " + _painter
);
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary($"{_decoration.GetType()} painter had mismatching save and restore calls."),
new ErrorDescription(
"Before painting the decoration, the canvas save count was $debugSaveCount. " +
"After painting it, the canvas save count was ${context.canvas.getSaveCount()}. " +
"Every call to save() or saveLayer() must be matched by a call to restore()."
),
new DiagnosticsProperty<Decoration>("The decoration was", decoration, style: DiagnosticsTreeStyle.errorProperty),
new DiagnosticsProperty<BoxPainter>("The painter was", _painter, style: DiagnosticsTreeStyle.errorProperty),
});
}
return true;

bool transformHitTests = true,
RenderBox child = null
) : base(child) {
D.assert(transform != null);
this.transform = transform;
this.origin = origin;
this.alignment = alignment;

}
_transform = value;
//_transform = Matrix4.copy(value);
markNeedsPaint();
}
}

public void setIdentity() {
_transform.setIdentity();
_transform = Matrix4.identity();
markNeedsPaint();
}

Offset childOffset = transform.getAsTranslation();
if (childOffset == null) {
context.pushTransform(needsCompositing, offset, transform, base.paint);
}
else {
layer = context.pushTransform(
needsCompositing,
offset,
transform,
base.paint,
oldLayer: layer as TransformLayer
);
} else {
layer = null;
}
}
}

Rect sourceRect = _resolvedAlignment.inscribe(sizes.source, Offset.zero & childSize);
Rect destinationRect = _resolvedAlignment.inscribe(sizes.destination, Offset.zero & size);
_hasVisualOverflow = sourceRect.width < childSize.width || sourceRect.height < childSize.height;
D.assert(scaleX.isFinite() && scaleY.isFinite());
bool result = true;
foreach (var value in _transform.storage) {
if (!value.isFinite()) {
result = false;
}
}
D.assert(result);
context.pushTransform(needsCompositing, offset, _transform, base.paint);
context.pushTransform(needsCompositing, offset, _transform, base.paint,
oldLayer: layer is TransformLayer ? layer as TransformLayer : null);
/*TransformLayer _paintChildWithTransform(PaintingContext context, Offset offset) {
Offset childOffset = _transform.getAsTranslation();
if (childOffset == null) {
return context.pushTransform(needsCompositing, offset, _transform, base.paint,
oldLayer: layer is TransformLayer ? layer as TransformLayer : null);
}
else {
base.paint(context, offset + childOffset);
return null;
}
}*/
//[!!!]
if (size.isEmpty) {
if (size.isEmpty || child.size.isEmpty) {
return;
}

context.pushClipRect(needsCompositing, offset, Offset.zero & size,
_paintChildWithTransform);
painter: _paintChildWithTransform,
oldLayer: layer is ClipRectLayer ? layer as ClipRectLayer : null);
else {
else{
_paintChildWithTransform(context, offset);
}
}

}
public override void applyPaintTransform(RenderObject child, Matrix4 transform) {
if (size.isEmpty) {
if (size.isEmpty || ((RenderBox)child).size.isEmpty) {
transform.setZero();
}
else {

Offset _translation;
public override bool hitTest(BoxHitTestResult result, Offset position) {
public override bool hitTest(BoxHitTestResult result, Offset position = null) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
D.assert(!debugNeedsLayout);
return result.addWithPaintOffset(
offset: transformHitTests

{"cancel", onPointerCancel},
{"signal", onPointerSignal}
},
ifEmpty: "<none>"));
ifEmpty: "<none>"
));
}
}

bool opaque = true,
RenderBox child = null
) : base(child) {
D.assert(opaque != null);
_onEnter = onEnter;
_onHover = onHover;
_onExit = onExit;

}
}
PointerEnterEventListener _onEnter;
public void _handleEnter(PointerEnterEvent Event) {
public void _handleEnter(PointerEnterEvent _event) {
_onEnter(Event);
_onEnter(_event);
}
public PointerHoverEventListener onHover {

}
PointerHoverEventListener _onHover;
void _handleHover(PointerHoverEvent Event) {
void _handleHover(PointerHoverEvent _event) {
_onHover(Event);
_onHover(_event);
}
public PointerExitEventListener onExit {

}
PointerExitEventListener _onExit;
void _handleExit(PointerExitEvent Event) {
void _handleExit(PointerExitEvent _event) {
_onExit(Event);
_onExit(_event);
}
MouseTrackerAnnotation _hoverAnnotation;

owner = (PipelineOwner)owner;
base.attach(owner);
// todo
//RendererBinding.instance.mouseTracker.addListener(_handleUpdatedMouseIsConnected);
RendererBinding.instance.mouseTracker.addListener(_handleUpdatedMouseIsConnected);
// RendererBinding.instance.mouseTracker.removeListener(_handleUpdatedMouseIsConnected);
RendererBinding.instance.mouseTracker.removeListener(_handleUpdatedMouseIsConnected);
base.detach();
}
public bool _annotationIsActive;

AnnotatedRegionLayer<MouseTrackerAnnotation> layer = new AnnotatedRegionLayer<MouseTrackerAnnotation>(
_hoverAnnotation,
size: size,
offset: offset
//opaque: opaque // todo
offset: offset,
opaque: opaque // TODO
);
context.pushLayer(layer, base.paint, offset);
} else {

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
// todo
/* properties.add(FlagsSummary<Function>(
properties.add(new FlagsSummary<Delegate>(
<string, Function>{
"enter": onEnter,
"hover": onHover,
"exit": onExit,
}
ifEmpty: "<none>",
));*/
new Dictionary<string, Delegate>{
{"enter", onEnter},
{"hover", onHover},
{"exit", onExit},
},
ifEmpty: "<none>"
));
properties.add(new DiagnosticsProperty<bool>("opaque", opaque, defaultValue: true));
}
}

public override bool isRepaintBoundary {
get { return true; }
}
Future<ui.Image> toImage( float pixelRatio = 1.0f) {
D.assert(!debugNeedsPaint);
OffsetLayer offsetLayer = layer as OffsetLayer;
return offsetLayer.toImage(Offset.zero & size, pixelRatio: pixelRatio);
}
public int debugSymmetricPaintCount {
get { return _debugSymmetricPaintCount; }

bool _ignoring;
public override bool hitTest(BoxHitTestResult result, Offset position = null) {
return ignoring ? false : base.hitTest(result, position: position);
return !ignoring && base.hitTest(result, position: position);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

}
public class RenderOffstage : RenderProxyBox {
public RenderOffstage(bool offstage = true,
RenderBox child = null) : base(child) {
public RenderOffstage(bool offstage = true, RenderBox child = null) : base(child) {
_offstage = offstage;
}

}
}
public override bool hitTest(BoxHitTestResult result, Offset position) {
public override bool hitTest(BoxHitTestResult result, Offset position = null) {
return !offstage && base.hitTest(result, position: position);
}

public bool absorbing {
get { return _absorbing; }
set { _absorbing = value; }
set {
if (_absorbing == value)
return;
_absorbing = value;
}
public override bool hitTest(BoxHitTestResult result, Offset position) {
public override bool hitTest(BoxHitTestResult result, Offset position = null) {
return absorbing
? size.contains(position)
: base.hitTest(result, position: position);

}
public override void paint(PaintingContext context, Offset offset) {
context.pushLayer(new LeaderLayer(link: link, offset: offset), base.paint, Offset.zero);
if (layer == null) {
layer = new LeaderLayer(link: link, offset: offset);
} else {
LeaderLayer leaderLayer = (LeaderLayer)layer;
leaderLayer.link = link;
leaderLayer.offset = offset;
}
context.pushLayer(layer, base.paint, Offset.zero);
D.assert(layer != null);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

Offset offset = null,
RenderBox child = null
) : base(child) {
D.assert(link != null);
this.offset = offset;
this.offset = offset?? Offset.zero;
}
public LayerLink link {

Offset _offset;
public override void detach() {
_layer = null;
layer = null;
base.detach();
}

new FollowerLayer _layer;
public FollowerLayer layer { // [!!!] override
get {
return base.layer as FollowerLayer;
}
set {
if (layer == value)
return;
layer = value;
}
}
return _layer?.getLastTransform() ?? Matrix4.identity();
return layer?.getLastTransform() ?? Matrix4.identity();
public override bool hitTest(BoxHitTestResult result, Offset position) {
public override bool hitTest(BoxHitTestResult result, Offset position = null) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position) {
protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
return result.addWithPaintTransform(
transform: getCurrentTransform(),
position: position,

}
public override void paint(PaintingContext context, Offset offset) {
_layer = new FollowerLayer(
link: link,
showWhenUnlinked: showWhenUnlinked,
linkedOffset: this.offset,
unlinkedOffset: offset
);
context.pushLayer(_layer,
if (layer == null) {
layer = new FollowerLayer(
link: link,
showWhenUnlinked: showWhenUnlinked,
linkedOffset: this.offset,
unlinkedOffset: offset
);
}
else {
layer.link = link;
layer.showWhenUnlinked = showWhenUnlinked;
layer.linkedOffset = this.offset;
layer.unlinkedOffset = offset;
}
context.pushLayer(
layer,
base.paint,
Offset.zero,
childPaintBounds: Rect.fromLTRB(

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


using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.rendering {
public abstract class RenderProxySliver : RenderSliver , RenderObjectWithChildMixin<RenderSliver> {
public RenderProxySliver(RenderSliver child = null) {
namespace Unity.UIWidgets.rendering
{
public abstract class RenderProxySliver : RenderSliver, RenderObjectWithChildMixin<RenderSliver>
{
public RenderProxySliver(RenderSliver child = null)
{
RenderSliver _child;
public RenderSliver child {
RenderSliver _child;
public RenderSliver child
{
set {
set
{
if (_child != null)
dropChild(_child);
_child = value;

}
public override void setupParentData(RenderObject child) {
public override void setupParentData(RenderObject child)
{
protected override void performLayout() {
protected override void performLayout()
{
public override void paint(PaintingContext context, Offset offset) {
public override void paint(PaintingContext context, Offset offset)
{
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
return child != null
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0)
{
return child != null
&& child.geometry.hitTestExtent > 0
&& child.hitTest(
result,

public override float? childMainAxisPosition(RenderObject child) {
public override float? childMainAxisPosition(RenderObject child)
{
D.assert(child != null);
D.assert(child != null);
public override void applyPaintTransform(RenderObject child, Matrix4 transform) {
D.assert(child != null);
public override void applyPaintTransform(RenderObject child, Matrix4 transform)
{
D.assert(child != null);
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is RenderSliver)) {
public bool debugValidateChild(RenderObject child)
{
D.assert(() =>
{
if (!(child is RenderSliver))
{
string result = "";
result += new ErrorDescription(
$"A {GetType()} expected a child of type $ChildType but received a " +

}
RenderObject RenderObjectWithChildMixin.child {
RenderObject RenderObjectWithChildMixin.child
{
set { child = (RenderSliver) value; }
set { child = (RenderSliver)value; }
public class RenderSliverAnimatedOpacity :RenderAnimatedOpacityMixinRenderSliver<RenderSliver>{
public class RenderSliverAnimatedOpacity : RenderAnimatedOpacityMixinRenderSliver<RenderSliver>
{
Animation<float> opacity ,
Animation<float> opacity,
) {
)
{
public class RenderSliverOpacity : RenderProxySliver {
public class RenderSliverOpacity : RenderProxySliver
{
) : base( child:sliver) {
D.assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
) : base(child: sliver)
{
D.assert(opacity >= 0.0 && opacity <= 1.0);
child = sliver;
bool alwaysNeedsCompositing {
get { return child != null && (_alpha != 0 && _alpha != 255);}
bool alwaysNeedsCompositing
{
get { return child != null && (_alpha != 0 && _alpha != 255); }
public float opacity {
public float opacity
{
set {
D.assert(value != null);
set
{
if (_opacity == value)
if (_opacity == value)
if (didNeedCompositing != alwaysNeedsCompositing)
if (didNeedCompositing != alwaysNeedsCompositing)
markNeedsPaint();
//if (wasVisible != (_alpha != 0) && !alwaysIncludeSemantics)
// markNeedsSemanticsUpdate();
markNeedsPaint();
public override void paint(PaintingContext context, Offset offset) {
if (child != null && child.geometry.visible) {
if (_alpha == 0) {
public override void paint(PaintingContext context, Offset offset)
{
if (child != null && child.geometry.visible)
{
if (_alpha == 0)
{
}
if (_alpha == 255) {
}
if (_alpha == 255)
{
var opacity = context.pushOpacity(
layer = context.pushOpacity(
layer = opacity;
/*public override void visitChildrenForSemantics(RenderObject visitor) {
visitor = (RenderObjectVisitor)visitor;
if (child != null && (_alpha != 0 || alwaysIncludeSemantics))
visitor(child);
}*/
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
public override void debugFillProperties(DiagnosticPropertiesBuilder properties)
{
public class RenderSliverIgnorePointer : RenderProxySliver {
public class RenderSliverIgnorePointer : RenderProxySliver
{
bool ignoring = true,
bool? ignoringSemantics = null
):base(child:sliver){
child = sliver;
D.assert(ignoring != null);
_ignoring = ignoring;
bool ignoring = true
)
{
_ignoring = ignoring;
child = sliver;
public bool ignoring {
public bool ignoring
{
set {
D.assert(value != null);
set
{
//if (_ignoringSemantics == null || !_ignoringSemantics)
// markNeedsSemanticsUpdate();
public override bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
public override bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0)
{
return !ignoring && base.hitTest(
result,
mainAxisPosition: mainAxisPosition,

/*public override void visitChildrenForSemantics(RenderObjectVisitor visitor) {
if (child != null && !_effectiveIgnoringSemantics)
visitor(child);
}*/
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
public override void debugFillProperties(DiagnosticPropertiesBuilder properties)
{
public class RenderSliverOffstage : RenderProxySliver {
public class RenderSliverOffstage : RenderProxySliver
{
bool offstage = true): base(child:sliver) {
D.assert(offstage != null);
_offstage = offstage;
child = sliver;
bool offstage = true) : base(child: sliver)
{
_offstage = offstage;
public bool offstage {
public bool offstage
{
set {
D.assert(value != null);
set
{
if (value == _offstage)
return;
_offstage = value;

bool _offstage;
protected override void performLayout() {
protected override void performLayout()
{
D.assert(child != null);
child.layout(constraints, parentUsesSize: true);
if (!offstage)

visible: false,
maxPaintExtent: 0.0f);
}
public override bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
public override bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0)
{
}
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
}
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0)
{
return !offstage
&& child != null
&& child.geometry.hitTestExtent > 0

crossAxisPosition: crossAxisPosition
);
}
public override void paint(PaintingContext context, Offset offset) {
public override void paint(PaintingContext context, Offset offset)
{
/*public override void visitChildrenForSemantics(RenderObjectVisitor visitor) {
if (offstage)
return;
base.visitChildrenForSemantics(visitor);
}*/
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
public override void debugFillProperties(DiagnosticPropertiesBuilder properties)
{
public override List<DiagnosticsNode> debugDescribeChildren() {
if (child == null)
public override List<DiagnosticsNode> debugDescribeChildren()
{
if (child == null)
return new List<DiagnosticsNode>();
return new List<DiagnosticsNode>{
child.toDiagnosticsNode(

}
}*/
}

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


readonly List<float> _rowTops = new List<float>();
List<float> _columnLefts;
Rect getRowBox(int row) {
public Rect getRowBox(int row) {
D.assert(row >= 0);
D.assert(row < rows);

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


public static bool debugProfileBuildsEnabled = false;
public static bool debugHighlightDeprecatedWidgets = false;
static Key _firstNonUniqueKey(IEnumerable<Widget> widgets) {

return false;
}
public static bool debugCheckHasTable(BuildContext context) {
D.assert(() => {
if (!(context.widget is Table) && context.findAncestorWidgetOfExactType<Table>() == null) {
throw new UIWidgetsError(new List<DiagnosticsNode> {
new ErrorSummary("No Table widget found."),
new ErrorDescription($"{context.widget.GetType()} widgets require a Table widget ancestor."),
context.describeWidget("The specific widget that could not find a Table ancestor was"),
context.describeOwnershipChain("The ownership chain for the affected widget is")
});
}
return true;
});
return true;
}
public static void debugWidgetBuilderValue(Widget widget, Widget built) {
D.assert(() => {
if (built == null) {

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

D.assert(() => {
if (!(context.widget is Directionality) &&
context.findAncestorWidgetOfExactType<Directionality>() == null) {
throw new UIWidgetsError(new List<DiagnosticsNode>{
throw new UIWidgetsError(new List<DiagnosticsNode> {
new ErrorDescription($"{context.widget.GetType()} 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(

UIWidgetsError.reportError(details);
return details;
}
D.assert(()=> {
D.assert(() => {
if (debugPrintRebuildDirtyWidgets ||
debugPrintBuildScope ||
debugPrintScheduleBuildForStacks ||

});
return true;
}
}
}
正在加载...
取消
保存