浏览代码

updated to value_listenable_builder.cs

/siyaoH-1.17-PlatformMessage
guanghuispark 4 年前
当前提交
5a006b82
共有 5 个文件被更改,包括 52 次插入109 次删除
  1. 22
      com.unity.uiwidgets/Runtime/rendering/proxy_sliver.cs
  2. 19
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  3. 22
      com.unity.uiwidgets/Runtime/widgets/visibility.cs
  4. 86
      com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
  5. 12
      com.unity.uiwidgets/Runtime/widgets/widget_span.cs

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


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 {

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


public SliverIgnorePointer(
Key key = null,
bool ignoring = true,
bool? ignoringSemantics = null,
this.ignoringSemantics = ignoringSemantics;
public readonly bool? ignoringSemantics;
ignoring: ignoring,
ignoringSemantics: ignoringSemantics
ignoring: ignoring
((RenderSliverIgnorePointer)renderObject).ignoringSemantics = ignoringSemantics;
properties.add(new DiagnosticsProperty<bool>("ignoringSemantics", (bool)ignoringSemantics, defaultValue: null));
}
}
public class SliverOffstage : SingleChildRenderObjectWidget {

public SliverOpacity(
Key key = null,
float opacity = 0f,
bool alwaysIncludeSemantics = false,
D.assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
D.assert(alwaysIncludeSemantics != null);
D.assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
public readonly bool alwaysIncludeSemantics;
opacity: opacity,
alwaysIncludeSemantics: alwaysIncludeSemantics
opacity: opacity
((RenderSliverOpacity) renderObject).alwaysIncludeSemantics = alwaysIncludeSemantics;
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
}
}

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


public class SliverVisibility : StatelessWidget {
public SliverVisibility(
Widget sliver,
Widget replacementSliver ,
Widget replacementSliver,
bool maintainSemantics = false,
D.assert(replacementSliver != null);
D.assert(maintainSemantics != null);
D.assert(maintainInteractivity != null);
D.assert(
maintainState == true || maintainAnimation == false,

()=> "Cannot maintain size if animations are not maintained."
);
D.assert(
maintainSize == true || maintainSemantics == false,
maintainSize == true,
()=> "Cannot maintain semantics if size is not maintained."
);
D.assert(

this.sliver = sliver;
this.replacementSliver = replacementSliver;
this.visible = visible;
this.maintainState = maintainState;
this.maintainAnimation = maintainAnimation;
this.maintainSize = maintainSize;
this.maintainInteractivity = maintainInteractivity;
}

public readonly bool maintainState;
public readonly bool maintainAnimation;
public readonly bool maintainSize;
public readonly bool maintainSemantics;
public readonly bool maintainInteractivity;
public override Widget build(BuildContext context) {
if (maintainSize) {

sliver: sliver,
ignoring: !visible,
ignoringSemantics: !visible && !maintainSemantics
ignoring: !visible
alwaysIncludeSemantics: maintainSemantics,
D.assert(!maintainSemantics);
D.assert(!maintainSize);
if (maintainState) {
Widget result = sliver;

properties.add( new FlagProperty("maintainState", value: maintainState, ifFalse: "maintainState"));
properties.add( new FlagProperty("maintainAnimation", value: maintainAnimation, ifFalse: "maintainAnimation"));
properties.add( new FlagProperty("maintainSize", value: maintainSize, ifFalse: "maintainSize"));
properties.add( new FlagProperty("maintainSemantics", value: maintainSemantics, ifFalse: "maintainSemantics"));
properties.add( new FlagProperty("maintainInteractivity", value: maintainInteractivity, ifFalse: "maintainInteractivity"));
}
}

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


using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Debug = System.Diagnostics.Debug;
using Rect = Unity.UIWidgets.ui.Rect;
using TextStyle = Unity.UIWidgets.painting.TextStyle;

public static Color _kHighlightedRenderObjectBorderColor = Color.fromARGB(128, 64, 64, 128);
bool _isDebugCreator(DiagnosticsNode node) => node is DiagnosticsDebugCreator;
List<DiagnosticsNode> transformDebugCreator(IEnumerable<DiagnosticsNode> properties) {
IEnumerable transformDebugCreator(IEnumerable<DiagnosticsNode> properties) {
List<DiagnosticsNode> result = new List<DiagnosticsNode>();
List<DiagnosticsNode> pending = new List<DiagnosticsNode>();
bool foundStackTrace = false;

_locationToId[location] = id;
return id;
}
public List<DiagnosticsNode> _parseDiagnosticsNode(DiagnosticsNode node) {
public IEnumerable _parseDiagnosticsNode(DiagnosticsNode node) {
return _describeRelevantUserCode(element).ToList();
return _describeRelevantUserCode(element);
}
public IEnumerable<DiagnosticsNode> _describeRelevantUserCode(Element element) {
if (!WidgetInspectorService.instance.isWidgetCreationTracked()) {

),
new ErrorSpacer()
};
}
List<DiagnosticsNode> nodes = new List<DiagnosticsNode>();

layerOffset = layerOffset ?? Offset.zero;
addChildrenToScene(builder, layerOffset);
}
}
public class _SerializeConfig {
public _SerializeConfig(string groupName, bool summaryTree = false,
int subtreeDepth = 1, List<Diagnosticable> pathToInclude = null,
bool includeProperties = false, bool expandPropertyValues = true) {
this.groupName = groupName;
this.summaryTree = summaryTree;
this.subtreeDepth = subtreeDepth;
this.pathToInclude = pathToInclude;
this.includeProperties = includeProperties;
this.expandPropertyValues = expandPropertyValues;
}
public static _SerializeConfig merge(_SerializeConfig from, int? subtreeDepth = null,
List<Diagnosticable> pathToInclude = null) {
return new _SerializeConfig(from.groupName, from.summaryTree, subtreeDepth ?? from.subtreeDepth,
pathToInclude ?? from.pathToInclude, from.includeProperties, from.expandPropertyValues);
}
public readonly string groupName;
public readonly bool summaryTree;
public readonly int subtreeDepth;
public readonly List<Diagnosticable> pathToInclude;
public readonly bool includeProperties;
public readonly bool expandPropertyValues;
}
public delegate void InspectorSelectionChangedCallback();

return null;
}
_InspectorReferenceData data;
_idToReferenceData.TryGetValue(id, out data);
_InspectorReferenceData data = _idToReferenceData.getOrDefault(id);
throw new UIWidgetsError("Id does not exist.");
throw new UIWidgetsError(new List<DiagnosticsNode>{new ErrorSummary("Id does not exist.")});
}
return data.obj;

if (ReferenceEquals(obj, selection.currentElement)) {
return false;
}
// [!!!] developer.inspect(selection.currentElement);
// [!!!] developer.inspect(selection.current);
}
if (selectionChangedCallback != null) {

else if (value is Element)
path = _getElementParentChain((Element)value, groupName);
else
throw new UIWidgetsError($"Cannot get parent chain for node of type {value.GetType()}");
throw new UIWidgetsError(new List<DiagnosticsNode>{new ErrorSummary($"Cannot get parent chain for node of type {value.GetType()}")});
return path.Select(
(_DiagnosticsPathNode node) =>

}
public List<DiagnosticsNode> _truncateNodes(IEnumerable<DiagnosticsNode>nodes, int maxDescendentsTruncatableNode) {
int count = 0;
foreach (var node in nodes) {
if (node is DiagnosticsNode) {
if (((DiagnosticsNode) node).value is Element) {
count++;
}
}
bool isElement = true;
foreach (var node in nodes) {
if (!(node.value is Element)) {
isElement = false;
break;
}
if (count == nodes.Count() && isWidgetCreationTracked()) {
if (isElement && isWidgetCreationTracked()) {
List<DiagnosticsNode> localNodes = nodes.Where((DiagnosticsNode node) =>
_isValueCreatedByLocalProject(node.value)).ToList();
if (localNodes.isNotEmpty()) {

results.Add(nodes.ToList()[i]);
results.Add(nodes.ElementAt(i));
}
return results;
}

public Dictionary<string, object> _getSelectedWidget(string previousSelectionId, string groupName) {
DiagnosticsNode previousSelection = toObject(previousSelectionId) as DiagnosticsNode;
Element current = selection?.currentElement;
return _nodeToJson(current == previousSelection?.value ? previousSelection : current?.toDiagnosticsNode(), new InspectorSerializationDelegate(groupName: groupName, service: this));
return _nodeToJson(Equals(current, previousSelection?.value) ? previousSelection : current?.toDiagnosticsNode(), new InspectorSerializationDelegate(groupName: groupName, service: this));
}
string getSelectedSummaryWidget(string previousSelectionId, string groupName) {
return _safeJsonEncode(_getSelectedSummaryWidget(previousSelectionId, groupName));

}
current = firstLocal;
}
return _nodeToJson(current == previousSelection?.value ? previousSelection : current?.toDiagnosticsNode(), new InspectorSerializationDelegate(groupName: groupName, service: this));
return _nodeToJson(Equals(current, previousSelection?.value) ? previousSelection : current?.toDiagnosticsNode(), new InspectorSerializationDelegate(groupName: groupName, service: this));
}
public bool isWidgetCreationTracked() {

D.assert(foundTarget);
return containerLayer.offset;
}
}
public void SetScreenshotOffset(Offset offset) {
containerLayer.offset = offset;
set {
containerLayer.offset = value;
}
}
}
public class _ScreenshotPaintingContext : PaintingContext {

D.assert(!_data.includeInScreenshot);
D.assert(!_data.foundTarget);
_data.foundTarget = true;
_data.SetScreenshotOffset(offset);
_data.screenshotOffset = offset;
_data.includeInScreenshot = true;
}
base.paintChild(child, offset);

data.containerLayer.append(new _ProxyLayer(repaintBoundary.debugLayer));
data.foundTarget = true;
OffsetLayer offsetLayer = repaintBoundary.debugLayer as OffsetLayer;
data.SetScreenshotOffset( offsetLayer.offset);
data.screenshotOffset = offsetLayer.offset;
} else {
PaintingContext.debugInstrumentRepaintCompositedChild(
repaintBoundary,

public InspectorSerializationDelegate(
string groupName = null,
bool? summaryTree = null,
int? maxDescendentsTruncatableNode = null,
int? maxDescendentsTruncatableNode = -1,
int? subtreeDepth = null,
int? subtreeDepth = 1,
bool? includeProperties = null,
WidgetInspectorService service = null,
AddAdditionalPropertiesCallback addAdditionalPropertiesCallback = null

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


style: style
) {
D.assert(child != null);
D.assert(!(
D.assert(baseline != null ||!(
(alignment == PlaceholderAlignment.aboveBaseline) ||
(alignment == PlaceholderAlignment.belowBaseline) ||
(alignment == PlaceholderAlignment.baseline)

public Widget child;
public readonly Widget child;
public override void build(
ParagraphBuilder builder,

public override RenderComparison compareTo(InlineSpan other) {
if (this == other)
return RenderComparison.identical;
if (style.GetType() == GetType())
if (style.GetType() != GetType())
return RenderComparison.layout;
if ((style == null) != (other.style == null))
return RenderComparison.layout;

public static bool operator !=(WidgetSpan left, WidgetSpan right) {
return !Equals(left, right);
}
public override InlineSpan getSpanForPosition(TextPosition position) {
D.assert(debugAssertIsValid());
return null;
}
public override bool debugAssertIsValid() {
return true;
}
正在加载...
取消
保存