浏览代码

update inspector date 6.30

/zxw-devTools
guanghuispark 4 年前
当前提交
7e03b636
共有 6 个文件被更改,包括 165 次插入65 次删除
  1. 46
      com.unity.uiwidgets.devtools/Editor/v2/src/inspector/diagnostics_node.cs
  2. 30
      com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_screen.cs
  3. 80
      com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_service.cs
  4. 65
      com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree.cs
  5. 6
      com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree_flutter.cs
  6. 3
      com.unity.uiwidgets.devtools/Editor/v2/src/split.cs

46
com.unity.uiwidgets.devtools/Editor/v2/src/inspector/diagnostics_node.cs


public bool hasChildren {
get
{
List<object> children = json["children"] as List<object>;
if (children != null) {
return children.isNotEmpty();
if (json.ContainsKey("children"))
{
List<Dictionary<string, object>> children = (List<Dictionary<string, object>>)json["children"];
if (children != null) {
return children.isNotEmpty();
}
}
return getBooleanMember("hasChildren", false);
}

bool getBooleanMember(string memberName, bool defaultValue) {
if (json[memberName] == null) {
return defaultValue;
bool getBooleanMember(string memberName, bool defaultValue)
{
if (json.ContainsKey(memberName))
{
if (json[memberName] == null) {
return defaultValue;
}
return (bool)json[memberName];
return (bool)json[memberName];
return false;
}
public List<RemoteDiagnosticsNode> inlineProperties {

cachedProperties = new List<RemoteDiagnosticsNode>();
if (json.ContainsKey("properties")) {
List<object> jsonArray = (List<object>)json["properties"];
List<Dictionary<string,object>> jsonArray = (List<Dictionary<string,object>>)json["properties"];
foreach (Dictionary<string, object> element in jsonArray) {
cachedProperties.Add(
new RemoteDiagnosticsNode(element, inspectorService, true, parent));

public List<RemoteDiagnosticsNode> childrenNow {
get
{
// _maybePopulateChildren();
_maybePopulateChildren();
}
void _maybePopulateChildren() {
if (!hasChildren || _children != null) {
return;
}
List<Dictionary<string, object>> jsonArray = (List<Dictionary<string, object>>)json["children"];
if (jsonArray?.isNotEmpty() == true) {
List<RemoteDiagnosticsNode> nodes = new List<RemoteDiagnosticsNode>();
foreach (Dictionary<string, object> element in jsonArray) {
var child =
new RemoteDiagnosticsNode(element, inspectorService, false, parent);
child.parent = this;
nodes.Add(child);
}
_children = nodes;
}
}
}

30
com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_screen.cs


using Unity.UIWidgets.rendering;
using Unity.UIWidgets.widgets;
using Unity.UIWidgets.DevTools.ui;
using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.DevTools.inspector
{

children: new List<Widget>
{
new SizedBox(width: ThemeUtils.denseSpacing),
new Container(
height: Theme.of(context).buttonTheme.height,
child: new OutlineButton(
onPressed: _refreshInspector,
child: new MaterialIconLabel(
Icons.refresh,
"Refresh Tree",
includeTextWidth: 750
)
)
),
// new Container(
// height: 36,// Theme.of(context).buttonTheme.height,
// child: new OutlineButton(
// onPressed: _refreshInspector,
// child: new MaterialIconLabel(
// Icons.refresh,
// "Refresh Tree",
// includeTextWidth: 750
// )
// )
// ),
child: new Split(
child:
new Split(
axis: splitAxis,
initialFractions: new List<float?> {0.33f, 0.67f},
children: new List<Widget>

controller: inspectorController,
actionButtons: null,
layoutExplorerSupported: _layoutExplorerSupported
)
),
}
)
)

80
com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_service.cs


Dictionary<string, object> widgetTree = new Dictionary<string, object>();
widgetTree["hasChildren"] = true;
widgetTree["name"] = "inspector";
widgetTree["children"] = new List<Widget>()
widgetTree["creationLocation"] = new Dictionary<string, object>()
new Text("text1"),
new Text("text2"),
new Text("text3"),
new Text("text4"),
new Text("text5"),
{"creationLocation1",new Text("creationLocation1")},
widgetTree["properties"] = new List<object>()
widgetTree["parameterLocations"] = new List<object>()
"properties_1",
"properties_2",
"properties_3",
"properties_4",
"properties_5",
new Text("properties_1")
widgetTree["children"] = new List<Dictionary<string, object>>()
{
new Dictionary<string, object>()
{
{
"text1", new List<Dictionary<string,object>>()
{
new Dictionary<string, object>()
{
{"hasChildren", true},
{"name","inspector2"},
{"creationLocation", new Dictionary<string, object>()
{
{"creationLocation1",new Text("creationLocation1")},
}
},
{"parameterLocations", new List<object>()
{
new Text("properties_1")
}
},
{"children", new Dictionary<string, object>()
{
{"te1",new Text("text1a")},
}
}
}
}
},
},
new Dictionary<string, object>()
{
{"te1",new Text("text1a")},
{"te2",new Text("text2a")},
{"te3",new Text("text3a")},
{"te4",new Text("text4a")},
{"te5",new Text("text5a")},
}
};
// widgetTree["properties"] = new List<Dictionary<string, object>>()
// {
// new Dictionary<string, object>()
// {
// {"properties1",new Text("properties1")},
// {"properties2",new Text("properties2")},
// {"properties3",new Text("properties3")},
// {"properties4",new Text("properties4")},
// {"properties5",new Text("properties5")},
// },
// new Dictionary<string, object>()
// {
// {"pro1",new Text("pro1a")},
// {"pro2",new Text("pro2a")},
// {"pro3",new Text("pro3a")},
// {"pro4",new Text("pro4a")},
// {"pro5",new Text("pro5a")},
// }
// };
return new RemoteDiagnosticsNode(widgetTree,
inspectorService: FutureOr.value(inspectorService),
true,

// return invokeServiceMethodReturningNode('getRootWidgetSummaryTree');
Dictionary<string, object> widgetTree = new Dictionary<string, object>();
widgetTree["children"] = new List<Widget>()
widgetTree["hasChildren"] = true;
widgetTree["name"] = "inspector";
widgetTree["children"] = new List<object>()
{
new Text("text1"),
new Text("text2"),

65
com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree.cs


public InspectorTreeNode hover => _hover;
InspectorTreeNode _hover;
List<InspectorTreeRow> cachedRows = new List<InspectorTreeRow>();
void _maybeClearCache() {
if (root.isDirty) {
cachedRows.Clear();
root.isDirty = false;
lastContentWidth = null;
}
}
Debug.Log("getCachedRow");
// _maybeClearCache();
// while (cachedRows.length <= index) {
// cachedRows.add(null);
// }
// cachedRows[index] ??= root.getRow(index);
// return cachedRows[index];
return new InspectorTreeRow();
Debug.Log("getCachedRow: " + index);
_maybeClearCache();
while (cachedRows.Count <= index) {
cachedRows.Add(null);
}
if (cachedRows.Count <= index || cachedRows[index] == null)
{
cachedRows[index] = root.getRow(index);
}
return cachedRows[index];
}
float horizontalPadding

// config.onNodeAdded(node, diagnosticsNode);
// }
// if (diagnosticsNode.hasChildren ||
// diagnosticsNode.inlineProperties.isNotEmpty()) {
// if (diagnosticsNode.childrenReady || !diagnosticsNode.hasChildren) {
// bool styleIsMultiline =
// expandPropertiesByDefault(diagnosticsNode.style.Value);
// setupChildren(
// diagnosticsNode,
// node,
// node.diagnostic.childrenNow,
// expandChildren: expandChildren && styleIsMultiline,
// expandProperties: expandProperties && styleIsMultiline
// );
// } else {
// node.clearChildren();
// node.appendChild(createNode());
// }
// }
if (diagnosticsNode.hasChildren ||
diagnosticsNode.inlineProperties.isNotEmpty()) {
if (diagnosticsNode.childrenReady || !diagnosticsNode.hasChildren) {
bool styleIsMultiline =
expandPropertiesByDefault(diagnosticsNode.style.Value);
setupChildren(
diagnosticsNode,
node,
node.diagnostic.childrenNow,
expandChildren: expandChildren && styleIsMultiline,
expandProperties: expandProperties && styleIsMultiline
);
} else {
node.clearChildren();
node.appendChild(createNode());
}
}
return node;
}

bool _isDirty = true;
bool? _shouldShow;
public readonly List<InspectorTreeNode> _children;
public readonly List<InspectorTreeNode> _children = new List<InspectorTreeNode>();
public bool selected = false;
RemoteDiagnosticsNode _diagnostic;
bool allowExpandCollapse = true;

6
com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree_flutter.cs


using Unity.UIWidgets.animation;
using Unity.UIWidgets.DevTools.ui;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

return new Center(child: new CircularProgressIndicator());
}
GestureTapCallback gestureTapCallback = () => _focusNode.requestFocus();
return new Scrollbar(
child: new SingleChildScrollView(
scrollDirection: Axis.horizontal,

child: new Scrollbar(
child: new GestureDetector(
onTap: null,//_focusNode.requestFocus,
onTap: null,// gestureTapCallback,
child: new Focus(
onKey: _handleKeyEvent,
autofocus: widget.isSummaryTree,

node.showExpandCollapse
? new SizedBox(child:
new InkWell(
onTap: null,//onToggle,
onTap: () => { onToggle();},
child: new RotationTransition(
turns: expandArrowAnimation,
child: new Icon(

3
com.unity.uiwidgets.devtools/Editor/v2/src/split.cs


public static Axis axisFor(BuildContext context, float horizontalAspectRatio) {
var screenSize = MediaQuery.of(context).size;
var aspectRatio = screenSize.width / screenSize.height;
if (aspectRatio >= horizontalAspectRatio) return Axis.horizontal;
if (aspectRatio >= horizontalAspectRatio)
return Axis.horizontal;
return Axis.vertical;
}

正在加载...
取消
保存