浏览代码

fix expand error

/zxw-devTools
guanghuispark 3 年前
当前提交
58e4378d
共有 2 个文件被更改,包括 126 次插入11 次删除
  1. 120
      com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree_flutter.cs
  2. 17
      com.unity.uiwidgets.devtools/Editor/v2/src/theme.cs

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


using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.DevTools.ui;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.service;
using Unity.UIWidgets.services;
using Unity.UIWidgets.ui;

using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.DevTools.inspector
{

}
public interface InspectorControllerClient {
void onChanged();
void scrollToRect(Rect rect);
void requestFocus();
}
// InspectorControllerClient client
// {
// get
// {
// return _client;
// }
// }
// InspectorControllerClient _client;
public InspectorControllerClient client
{
get
{
return _client;
}
set {
if (_client == value) return;
// Do not set a new client if there is still an old client.
D.assert(value == null || _client == null);
_client = value;
if (config.onClientActiveChange != null) {
config.onClientActiveChange(value != null);
}
}
}
InspectorControllerClient _client;
public float maxRowIndent {

public override void setState(VoidCallback fn)
{
fn();
// client?.onChanged();
Debug.Log("setState here");
if (client != null)
{
client.onChanged();
}
}
public override InspectorTreeNode createNode()

public class InspectorTree : StatefulWidget
{
public InspectorTree(
Key key = null,
InspectorTreeController controller = null,

}
}
public class _InspectorTreeState : State<InspectorTree>
public class _InspectorTreeState : State<InspectorTree>, InspectorControllerClient, TickerProvider
bool isSummaryTree => widget.isSummaryTree;
Future<object> currentAnimateY;
Rect currentAnimateTarget;
AnimationController constraintDisplayController;
public override void initState() {
base.initState();
_scrollControllerX = new ScrollController();
_scrollControllerY = new ScrollController();
// TODO(devoncarew): Commented out as per flutter/devtools/pull/2001.
//_scrollControllerY.addListener(_onScrollYChange);
if (isSummaryTree) {
constraintDisplayController = ThemeUtils.longAnimationController(this);
}
_focusNode = new FocusNode();
_bindToController();
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
if (((InspectorTree)oldWidget).controller != widget.controller) {
InspectorTreeControllerFlutter oldController = ((InspectorTree)oldWidget).controller as InspectorTreeControllerFlutter;
if (oldController != null)
{
oldController.client = null;
}
// cancel();
_bindToController();
}
base.didUpdateWidget(oldWidget);
}
public InspectorTreeControllerFlutter controller
{
get

return false;
}
public void _bindToController() {
if (controller != null)
{
controller.client = this;
}
}
public override Widget build(BuildContext context)
{
// base.build(context);

width: controller.rowWidth + controller.maxRowIndent,
child: new Scrollbar(
child: new GestureDetector(
onTap: null, // gestureTapCallback,
onTap: gestureTapCallback,
child: new Focus(
onKey: _handleKeyEvent,
autofocus: widget.isSummaryTree,

)
)
);
}
public void onChanged()
{
setState(() => {});
}
public void scrollToRect(Rect rect)
{
Debug.Log("scrollToRect");
}
public void requestFocus()
{
Debug.Log("requestFocus");
}
public Ticker createTicker(TickerCallback onTick)
{
Debug.Log("CreateTicker");
return null;
}
}

17
com.unity.uiwidgets.devtools/Editor/v2/src/theme.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

return isDarkTheme ? _darkTheme() : _lightTheme();
}
public static AnimationController longAnimationController(
TickerProvider vsync,
float value = 0.0f
) {
return new AnimationController(
duration: longDuration,
vsync: vsync,
value: value
);
}
static ThemeData _darkTheme() {
var theme = ThemeData.dark();

InspectorTreeUtils.isLight ? Colors.black : Color.fromARGB(255, 187, 187, 187);
public static Color grey => Color.fromARGB(255, 128, 128, 128);
public static TimeSpan longDuration = new TimeSpan(0,0,0,0, 400);
}
}
正在加载...
取消
保存