浏览代码

update inspector

/zxw-devTools
guanghuispark 3 年前
当前提交
ead80815
共有 13 个文件被更改,包括 971 次插入284 次删除
  1. 16
      com.unity.uiwidgets.devtools/Editor/v2/dependencies/nested/nested.cs
  2. 315
      com.unity.uiwidgets.devtools/Editor/v2/dependencies/provider/inherited_provider.cs
  3. 128
      com.unity.uiwidgets.devtools/Editor/v2/dependencies/provider/provider.cs
  4. 443
      com.unity.uiwidgets.devtools/Editor/v2/src/app.cs
  5. 47
      com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_screen.cs
  6. 2
      com.unity.uiwidgets.devtools/Editor/v2/src/screen.cs
  7. 43
      com.unity.uiwidgets.devtools/Editor/v2/src/snapshot_screen.cs
  8. 17
      com.unity.uiwidgets.devtools/Editor/v2/src/split.cs
  9. 12
      com.unity.uiwidgets.devtools/Editor/v2/dependencies/nested/nested.mixin.gen.cs
  10. 15
      com.unity.uiwidgets.devtools/Editor/v2/dependencies/nested/nested.mixin.njk
  11. 57
      com.unity.uiwidgets.devtools/Editor/v2/src/banner_messages.cs
  12. 51
      com.unity.uiwidgets.devtools/Editor/v2/src/initializer.cs
  13. 109
      com.unity.uiwidgets.devtools/Editor/v2/src/scaffold.cs

16
com.unity.uiwidgets.devtools/Editor/v2/dependencies/nested/nested.cs


{
public Nested(
Key key = null,
List<SingleChildWidget> children = null,
List<SingleChildWidgetMixinStatelessWidget> children = null,
D.assert(children != null && children.isNotEmpty());
// D.assert(children != null && children.isNotEmpty());
public readonly List<SingleChildWidget> _children;
public readonly List<SingleChildWidgetMixinStatelessWidget> _children;
public readonly Widget _child;
public override Widget build(BuildContext context)

{
public _NestedHook(
Widget injectedChild = null,
SingleChildWidget wrappedWidget = null,
SingleChildWidgetMixinStatelessWidget wrappedWidget = null,
_NestedElement owner = null
)
{

this.owner = owner;
}
public readonly SingleChildWidget wrappedWidget;
public readonly SingleChildWidgetMixinStatelessWidget wrappedWidget;
public readonly Widget injectedChild;
public readonly _NestedElement owner;

}
}
SingleChildWidget _wrappedChild;
SingleChildWidgetMixinStatelessWidget _wrappedChild;
internal SingleChildWidget wrappedChild
internal SingleChildWidgetMixinStatelessWidget wrappedChild
{
get { return _wrappedChild; }
set

public abstract override Element createElement();
}
public abstract class SingleChildStatelessWidget : StatelessWidget
public abstract class SingleChildStatelessWidget : SingleChildWidgetMixinStatelessWidget
{
public SingleChildStatelessWidget(Key key = null, Widget child = null) : base(key : key)
{

315
com.unity.uiwidgets.devtools/Editor/v2/dependencies/provider/inherited_provider.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
delegate bool UpdateShouldNotify<T>(T previous, T current);
public delegate bool UpdateShouldNotify<T>(T previous, T current);
delegate T Create<T>(BuildContext context);
public delegate T Create<T>(BuildContext context);
delegate void Dispose<T>(BuildContext context, T value);
public delegate T Update<T>(BuildContext context, T value);
public delegate void Dispose<T>(BuildContext context, T value);
// delegate VoidCallback StartListening<T>(InheritedContext<T> element, T value);
public delegate void DebugCheckInvalidValueType<T>(T value);
public delegate VoidCallback StartListening<T>(InheritedContext<T> element, T value);
public InheritedProvider(
Key key = null,
Create<T> create = null,
Update<T> update = null,
UpdateShouldNotify<T> updateShouldNotify = null,
DebugCheckInvalidValueType<T> debugCheckInvalidValueType = null,
StartListening<T> startListening = null,
Dispose<T> dispose = null,
TransitionBuilder builder = null,
bool? lazy = null,
Widget child = null
) :
base(key: key, child: child)
{
_lazy = lazy;
_delegate = new _CreateInheritedProvider<T>(
create: create,
update: update,
updateShouldNotify: updateShouldNotify,
debugCheckInvalidValueType: debugCheckInvalidValueType,
startListening: startListening,
dispose: dispose
);
}
public readonly _Delegate<T> _delegate;
public readonly bool? _lazy;
public readonly TransitionBuilder builder;
public InheritedProvider(
Key key,
_Delegate<T> _delegate,
bool lazy,
TransitionBuilder builder,
Widget child
) :
base(key: key, child: child)
{
_lazy = lazy;
_delegate = _delegate;
}
class _CreateInheritedProvider<T> : _Delegate<T> {
public _CreateInheritedProvider(
Create<T> create,
Update<T> update,
UpdateShouldNotify<T> updateShouldNotify = null,
DebugCheckInvalidValueType<T> debugCheckInvalidValueType = null,
StartListening<T> startListening = null,
Dispose<T> dispose = null
)
{
D.assert(create != null || update != null);
this.create = create;
this.update = update;
_updateShouldNotify = updateShouldNotify;
this.debugCheckInvalidValueType = debugCheckInvalidValueType;
this.startListening = startListening;
this.dispose = dispose;
}
public readonly Create<T> create;
public readonly Update<T> update;
public readonly UpdateShouldNotify<T> _updateShouldNotify;
public readonly DebugCheckInvalidValueType<T> debugCheckInvalidValueType;
public readonly StartListening<T> startListening;
public readonly Dispose<T> dispose;
public override _DelegateState<T, _Delegate<T>> createState()
{
throw new System.NotImplementedException();
}
}
public abstract class _Delegate<T> {
public abstract _DelegateState<T, _Delegate<T>> createState();
void debugFillProperties(DiagnosticPropertiesBuilder properties) {}
}
public abstract class _DelegateState<T, D> where D : _Delegate<T>{
_InheritedProviderScopeElement<T> element;
public T value
{
get;
}
D _delegate
{
get
{
return element.widget.owner._delegate as D;
}
}
private bool hasValue
{
get;
}
bool debugSetInheritedLock(bool value) {
return element._debugSetInheritedLock(value);
}
bool willUpdateDelegate(D newDelegate) => false;
void dispose() {}
void debugFillProperties(DiagnosticPropertiesBuilder properties) {}
void build(bool isBuildFromExternalSources) {}
}
class _InheritedProviderScopeElement<T> : InheritedElement
{
public _InheritedProviderScopeElement(Widget widget) : base(widget)
{
}
bool _debugInheritLocked = false;
_DelegateState<T, _Delegate<T>> _delegateState;
public new _InheritedProviderScope<T> widget
{
get
{
return base.widget as _InheritedProviderScope<T>;
}
}
public bool _debugSetInheritedLock(bool value) {
D.assert(() => {
_debugInheritLocked = value;
return true;
});
return true;
}
public new T value
{
get
{
return _delegateState.value;
}
}
}
class _InheritedProviderScope<T> : InheritedWidget {
public _InheritedProviderScope(
InheritedProvider<T> owner = null,
Widget child = null
) : base(child: child)
{
this.owner = owner;
}
public readonly InheritedProvider<T> owner;
public override bool updateShouldNotify(InheritedWidget oldWidget) {
return false;
}
public override Element createElement() {
return new _InheritedProviderScopeElement<T>(this);
}
}
public abstract class InheritedContext<T> : BuildContext {
/// The current value exposed by [InheritedProvider].
///
/// This property is lazy loaded, and reading it the first time may trigger
/// some side-effects such as creating a [T] instance or start a subscription.
private T value { get; }
/// Marks the [InheritedProvider] as needing to update dependents.
///
/// This bypass [InheritedWidget.updateShouldNotify] and will force widgets
/// that depends on [T] to rebuild.
void markNeedsNotifyDependents(){}
/// Wether `setState` was called at least once or not.
///
/// It can be used by [DeferredStartListening] to differentiate between the
/// very first listening, and a rebuild after `controller` changed.
private bool hasValue { get; }
public Widget widget { get; }
public BuildOwner owner { get; }
public bool debugDoingBuild { get; }
public RenderObject findRenderObject()
{
throw new NotImplementedException();
}
public Size size { get; }
public InheritedWidget inheritFromElement(InheritedElement ancestor, object aspect = null)
{
throw new NotImplementedException();
}
public InheritedWidget dependOnInheritedElement(InheritedElement ancestor, object aspect = null)
{
throw new NotImplementedException();
}
public InheritedWidget inheritFromWidgetOfExactType(Type targetType, object aspect = null)
{
throw new NotImplementedException();
}
public T1 dependOnInheritedWidgetOfExactType<T1>(object aspect = null) where T1 : InheritedWidget
{
throw new NotImplementedException();
}
public InheritedElement ancestorInheritedElementForWidgetOfExactType(Type targetType)
{
throw new NotImplementedException();
}
public InheritedElement getElementForInheritedWidgetOfExactType<T1>() where T1 : InheritedWidget
{
throw new NotImplementedException();
}
public Widget ancestorWidgetOfExactType(Type targetType)
{
throw new NotImplementedException();
}
public T1 findAncestorWidgetOfExactType<T1>() where T1 : Widget
{
throw new NotImplementedException();
}
public State ancestorStateOfType(TypeMatcher matcher)
{
throw new NotImplementedException();
}
public T1 findAncestorStateOfType<T1>() where T1 : State
{
throw new NotImplementedException();
}
public State rootAncestorStateOfType(TypeMatcher matcher)
{
throw new NotImplementedException();
}
public T1 findRootAncestorStateOfType<T1>() where T1 : State
{
throw new NotImplementedException();
}
public RenderObject ancestorRenderObjectOfType(TypeMatcher matcher)
{
throw new NotImplementedException();
}
public T1 findAncestorRenderObjectOfType<T1>() where T1 : RenderObject
{
throw new NotImplementedException();
}
public void visitAncestorElements(ElementVisitorBool visitor)
{
throw new NotImplementedException();
}
public void visitChildElements(ElementVisitor visitor)
{
throw new NotImplementedException();
}
public DiagnosticsNode describeElement(string name, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.errorProperty)
{
throw new NotImplementedException();
}
public DiagnosticsNode describeWidget(string name, DiagnosticsTreeStyle style = DiagnosticsTreeStyle.errorProperty)
{
throw new NotImplementedException();
}
public List<DiagnosticsNode> describeMissingAncestor(Type expectedAncestorType)
{
throw new NotImplementedException();
}
public DiagnosticsNode describeOwnershipChain(string name)
{
throw new NotImplementedException();
}
}
}

128
com.unity.uiwidgets.devtools/Editor/v2/dependencies/provider/provider.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
using UnityEditor.VersionControl;
using UnityEngine;
public class Privoder<T> : InheritedProvider<T>
public class Provider<T> : InheritedProvider<T>
public Provider(
Key key = null,
Create<T> create = null,
Dispose<T> dispose = null,
bool? lazy = null,
TransitionBuilder builder = null,
Widget child = null
) :
base(
key: key,
lazy: lazy,
builder: builder,
create: create,
dispose: dispose,
debugCheckInvalidValueType: null,
child: child
)
{
D.assert(create != null);
}
public static T of<T>(BuildContext context, bool listen = true) {
D.assert(context != null);
// D.assert(
// context.owner.debugBuilding ||
// listen == false ||
// debugIsInInheritedProviderUpdate,
// @"
// Tried to listen to a value exposed with provider, from outside of the widget tree.
//
// This is likely caused by an event handler (like a button's onPressed) that called
// Provider.of without passing `listen: false`.
//
// To fix, write:
// Provider.of<$T>(context, listen: false);
//
// It is unsupported because may pointlessly rebuild the widget associated to the
// event handler, when the widget tree doesn't care about the value.
//
// The context used was: $context
// "
// );
var inheritedElement = _inheritedElementOf<T>(context);
if (listen) {
context.dependOnInheritedElement(inheritedElement);
}
return inheritedElement.value;
}
static _InheritedProviderScopeElement<T> _inheritedElementOf<T>(
BuildContext context
) {
D.assert(context != null, ()=> @"
Tried to call context.read/watch/select or similar on a `context` that is null.
This can happen if you used the context of a StatefulWidget and that
StatefulWidget was disposed.
");
// D.assert(
// _debugIsSelecting == false,
// 'Cannot call context.read/watch/select inside the callback of a context.select'
// );
// assert(
// T != dynamic,
// '''
// Tried to call Provider.of<dynamic>. This is likely a mistake and is therefore
// unsupported.
//
// If you want to expose a variable that can be anything, consider changing
// `dynamic` to `Object` instead.
// ''',
// );
_InheritedProviderScopeElement<T> inheritedElement = null;
if (context.widget is _InheritedProviderScope<T>) {
// An InheritedProvider<T>'s update tries to obtain a parent provider of
// the same type.
context.visitAncestorElements((parent) => {
inheritedElement = parent.getElementForInheritedWidgetOfExactType<
_InheritedProviderScope<T>>() as _InheritedProviderScopeElement<T>;
return false;
});
} else {
inheritedElement = context.getElementForInheritedWidgetOfExactType<
_InheritedProviderScope<T>>() as _InheritedProviderScopeElement<T>;
}
if (inheritedElement == null) {
Debug.Log("error:" + context.widget.GetType());
}
return inheritedElement;
}
}
public class MultiProvider : Nested
{
public MultiProvider(
Key key = null,
List<SingleChildWidgetMixinStatelessWidget> providers = null,
Widget child = null,
TransitionBuilder builder = null
) :
base(
key: key,
children: providers,
child: builder != null
? new Builder(
builder: (context) => builder(context, child)
)
: child
)
{
D.assert(providers != null);
}
}
}

443
com.unity.uiwidgets.devtools/Editor/v2/src/app.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.ui;
using UnityEngine;
static class AppUtils
{
public static string homeRoute = "/";
public static string snapshotRoute = "/snapshot";
public static List<DevToolsScreen<object>> defaultScreens {
get
{
return new List<DevToolsScreen<object>>
{
new DevToolsScreen<object>(
new InspectorScreen(),
createController: null
)
};
}
}
}
class DevToolsApp : StatefulWidget {
public DevToolsApp(List<DevToolsScreen<object>> screens, PreferencesController preferences)
{
this.screens = screens;
this.preferences = preferences;
}
public delegate Widget UrlParametersBuilder(BuildContext buildContext, Dictionary<string, string> dictionary,
SnapshotArguments args);
static class AppUtils
{
public static string homeRoute = "/";
public static string snapshotRoute = "/snapshot";
public static List<DevToolsScreen<object>> defaultScreens
{
get
{
return new List<DevToolsScreen<object>>
{
new DevToolsScreen<object>(
screen: new InspectorScreen(),
createController: null
)
};
}
}
}
class DevToolsApp : StatefulWidget
{
public DevToolsApp(List<DevToolsScreen<object>> screens, PreferencesController preferences)
{
this.screens = screens;
this.preferences = preferences;
}
public readonly List<DevToolsScreen<object>> screens;
public readonly PreferencesController preferences;
public readonly List<DevToolsScreen<object>> screens;
public readonly PreferencesController preferences;
public override State createState() => new DevToolsAppState();
public override State createState() => new DevToolsAppState();
public static DevToolsAppState of(BuildContext context) {
public static DevToolsAppState of(BuildContext context)
{
}
}
class DevToolsAppState : State<DevToolsApp>
{
List<Screen> _screens
{
get
{
List<Screen> screensList = new List<Screen>();
foreach (var screen in widget.screens)
{
screensList.Add(screen.screen);
}
return screensList;
}
}
class DevToolsAppState : State<DevToolsApp> {
Route _generateRoute(RouteSettings settings)
{
return new MaterialPageRoute(
settings: settings,
builder: (BuildContext context2) => { return new Container(); });
}
public override Widget build(BuildContext context)
{
return new ValueListenableBuilder<bool>(
valueListenable: widget.preferences.darkModeTheme,
builder: (subContext, value, _) => {
return new MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeUtils.themeFor(isDarkTheme: true),
builder: (subsubContext, child) => new Notifications(child: child),
onGenerateRoute: _generateRoute
);
}
);
}
}
Route _generateRoute(RouteSettings settings)
{
// var uri = new Uri(settings.name);
// var path = uri.PathAndQuery.isEmpty() ? AppUtils.homeRoute : uri.PathAndQuery;
var args = (SnapshotArguments) settings.arguments;
var path = AppUtils.snapshotRoute;
// Provide the appropriate page route.
if (routes.ContainsKey(path))
{
WidgetBuilder builder = (context2) => routes[path](
context2,
null,
args
);
D.assert(() =>
{
// builder = (context2) => _AlternateCheckedModeBanner(
// builder: (context3) => routes[path](
// context3,
// null,
// args
// )
// );
return true;
});
return new MaterialPageRoute(settings: settings, builder: builder);
}
return new MaterialPageRoute(
settings: settings,
builder: (BuildContext context) => {
return DevToolsScaffold.withChild(
child: new Container()
);
}
);
}
Dictionary<string, UrlParametersBuilder> routes
{
get
{
if (_routes != null)
{
return _routes;
}
Dictionary<string, UrlParametersBuilder> builders = new Dictionary<string, UrlParametersBuilder>();
builders.Add(AppUtils.homeRoute, (_, _params, __) =>
{
if (_params.ContainsKey("uri"))
{
var embed = _params["embed"] == "true";
var page = _params["page"];
return new Initializer(
url: _params["uri"].ToString(),
allowConnectionScreenOnDisconnect: !embed,
builder: null
);
}
// return DevToolsScaffold.withChild(child: ConnectScreenBody());
return new Container(child: new Text("this is a text!"));
});
builders.Add(AppUtils.snapshotRoute, (_, __, args) =>
{
return DevToolsScaffold.withChild(
child: _providedControllers(
offline: true,
child: new SnapshotScreenBody(args, _screens)
)
);
});
return builders;
}
}
Dictionary<string, UrlParametersBuilder> _routes;
Widget _providedControllers(Widget child = null, bool offline = false)
{
List<SingleChildWidgetMixinStatelessWidget> _providers = new List<SingleChildWidgetMixinStatelessWidget>();
foreach (var screen in widget.screens)
{
if (screen.createController != null)
{
_providers.Add((SingleChildWidgetMixinStatelessWidget)screen.controllerProvider);
}
}
return new MultiProvider(
providers: _providers,
child: child
);
}
public override Widget build(BuildContext context)
{
return new ValueListenableBuilder<bool>(
valueListenable: widget.preferences.darkModeTheme,
builder: (subContext, value, _) =>
{
return new MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeUtils.themeFor(isDarkTheme: true),
builder: (subsubContext, child) => new Notifications(child: child),
onGenerateRoute: _generateRoute
);
}
);
}
}
class DevToolsScreen<C>
{
public DevToolsScreen(
Screen screen,
Func<C> createController,
bool supportsOffline = false
)
{
this.screen = screen;
this.createController = createController;
this.supportsOffline = supportsOffline;
}
public readonly Screen screen;
// class DevToolsAppState : State<DevToolsApp> {
// List<Screen> _screens => widget.screens.Select(s => s.screen).ToList();
//
// PreferencesController preferences => widget.preferences;
//
// public override void initState() {
// base.initState();
//
// Globals.serviceManager.isolateManager.onSelectedIsolateChanged.listen((_) => {
// setState(() => {
// _clearCachedRoutes();
// });
// });
// }
//
// public override void didUpdateWidget(StatefulWidget oldWidget) {
// base.didUpdateWidget(oldWidget);
// _clearCachedRoutes();
// }
//
// /// Generates routes, separating the path from URL query parameters.
// Route _generateRoute(RouteSettings settings) {
// var uri = settings.name;
// var path = uri.isEmpty() ? AppUtils.homeRoute : uri;
// var args = settings.arguments as SnapshotArguments;
//
// // Provide the appropriate page route.
// if (routes.ContainsKey(path)) {
// WidgetBuilder builder = (context) => routes[path](
// context,
// uri.queryParameters,
// args
// );
// D.assert(() => {
// builder = (context) => new _AlternateCheckedModeBanner(
// builder: (subContext) => routes[path](
// subContext,
// uri.queryParameters,
// args
// )
// );
// return true;
// }());
//
// return new MaterialPageRoute(settings: settings, builder: builder);
// }
//
// // Return a page not found.
// return new MaterialPageRoute(
// settings: settings,
// builder: (BuildContext context) => {
// return DevToolsScaffold.withChild(
// child: new CenteredMessage("'$uri' not found.")
// );
// }
// );
// }
//
// /// The routes that the app exposes.
// Dictionary<string, UrlParametersBuilder> routes => {
// _routes = _routes ?? new Dictionary<string, UrlParametersBuilder>(){
// {AppUtils.homeRoute, (_, buildParam, __) => {
// if (buildParam.getOrDefault("uri")?.isNotEmpty() ?? false) {
// var embed = buildParam["embed"] == "true";
// var page = buildParam["page"];
// var tabs = embed && page != null
// ? _visibleScreens().Where((p) => p.screenId == page)
// : _visibleScreens();
// return new Initializer(
// url: buildParam["uri"],
// allowConnectionScreenOnDisconnect: !embed,
// builder: (_) => _providedControllers(
// child: new DevToolsScaffold(
// embed: embed,
// initialPage: page,
// tabs: tabs,
// actions: [
// if (serviceManager.connectedApp.isFlutterAppNow) ...[
// HotReloadButton(),
// HotRestartButton(),
// ],
// OpenSettingsAction(),
// OpenAboutAction(),
// ],
// ),
// ),
// );
// } else {
// return DevToolsScaffold.withChild(child: ConnectScreenBody());
// }
// },
// snapshotRoute: (_, __, args) => {
// return DevToolsScaffold.withChild(
// child: _providedControllers(
// offline: true,
// child: SnapshotScreenBody(args, _screens),
// ),
// );
// },
// }};
//
// return _routes;
// }
//
// Dictionary<string, UrlParametersBuilder> _routes;
//
// void _clearCachedRoutes() {
// _routes = null;
// }
//
// List<Screen> _visibleScreens() {
// var visibleScreens = new List<Screen>();
// foreach (var screen in _screens) {
// if (screen.conditionalLibrary != null) {
// if (Globals.serviceManager.isServiceAvailable &&
// Globals.serviceManager
// .isolateManager.selectedIsolateAvailable.isCompleted &&
// Globals.serviceManager.libraryUriAvailableNow(screen.conditionalLibrary)) {
// visibleScreens.Add(screen);
// }
// } else {
// visibleScreens.Add(screen);
// }
// }
// return visibleScreens;
// }
//
// Widget _providedControllers(Widget child, bool offline = false)
// {
// var _providers = widget.screens
// .Where((s) =>
// s.createController != null && (offline ? s.supportsOffline : true))
// .Select((s) => s.controllerProvider);
//
// return new MultiProvider(
// providers: _providers,
// child: child
// );
// }
//
// public override Widget build(BuildContext context) {
// return new ValueListenableBuilder<bool>(
// valueListenable: widget.preferences.darkModeTheme,
// builder: (subContext, value, _) => {
// return new MaterialApp(
// debugShowCheckedModeBanner: false,
// theme: ThemeUtils.themeFor(isDarkTheme: value),
// builder: (subsubContext, child) => new Notifications(child: child),
// onGenerateRoute: _generateRoute
// );
// }
// );
// }
// }
//
class DevToolsScreen<C> {
public DevToolsScreen(
Screen screen,
Func<C> createController,
bool supportsOffline = false
)
{
this.screen = screen;
this.createController = createController;
this.supportsOffline = supportsOffline;
}
public readonly Func<C> createController;
public readonly Screen screen;
public readonly Func<C> createController;
public readonly bool supportsOffline;
public readonly bool supportsOffline;
public Provider<C> controllerProvider {
get
{
D.assert(createController != null);
return new Provider<C>(create: (_) => createController());
}
}
// internal Provider<C> controllerProvider => {
// D.assert(createController != null);
// return new Provider<C>(create: (_) => createController());
// }
}
// public delegate Widget UrlParametersBuilder(
// BuildContext buildContext,
// Dictionary<string, string> route,
// SnapshotArguments args
// );
}
}

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


{
}
protected override Widget build(BuildContext context)
public override Widget build(BuildContext context)
{
// var isFlutterApp = serviceManager.connectedApp.isFlutterAppNow;
// var isProfileBuild = serviceManager.connectedApp.isProfileBuildNow;

return new InspectorScreenBody();
}
class InspectorScreenBody : StatefulWidget {
public class InspectorScreenBody : StatefulWidget {
public InspectorScreenBody(){}
public override State createState()

);
var splitAxis = Split.axisFor(context, 0.85f);
return new Column(
children: new List<Widget>
{
new Expanded(
child: new Split(
axis: splitAxis,
initialFractions: new List<float?>{0.33f, 0.67f},
children: new List<Widget>
{
summaryTree,
new InspectorDetailsTabController(
detailsTree: detailsTree,
controller: inspectorController,
actionButtons: null,
layoutExplorerSupported: _layoutExplorerSupported
)
}
)
)
}
);
// return new Column(
// children: new List<Widget>
// {
// new Expanded(
// child: new Split(
// axis: splitAxis,
// initialFractions: new List<float?>{0.33f, 0.67f},
// children: new List<Widget>
// {
// summaryTree,
// new InspectorDetailsTabController(
// detailsTree: detailsTree,
// controller: inspectorController,
// actionButtons: null,
// layoutExplorerSupported: _layoutExplorerSupported
// )
// }
// )
// )
// }
// );
return new Container();
}
}
}

2
com.unity.uiwidgets.devtools/Editor/v2/src/screen.cs


);
}
protected abstract Widget build(BuildContext context);
public abstract Widget build(BuildContext context);
Widget buildStatus(BuildContext context, TextTheme textTheme) {
return null;

43
com.unity.uiwidgets.devtools/Editor/v2/src/snapshot_screen.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.DevTools
{
public class SnapshotArguments {

public readonly string screenId;
}
public class SnapshotScreenBody : StatefulWidget {
public SnapshotScreenBody(SnapshotArguments args, List<Screen> possibleScreens)
{
this.args = args;
this.possibleScreens = possibleScreens;
}
public readonly SnapshotArguments args;
public readonly List<Screen> possibleScreens;
public override State createState()
{
return new _SnapshotScreenBodyState();
}
}
public class _SnapshotScreenBodyState : State<SnapshotScreenBody>
{
Screen _screen;
public override Widget build(BuildContext context)
{
return new Column(
children: new List<Widget>()
{
new Expanded(
child: _screen != null ? _screen.build(context) : _buildSnapshotError()
)
}
);
}
Widget _buildSnapshotError()
{
return new Container(child: new Text($"Cannot load snapshot for screen \'{widget.args?.screenId}\'"));
}
}
}

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


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.DevTools

{
return new _SplitState();
}
class _SplitState : State<Split>
}
class _SplitState : State<Split>
{
public override Widget build(BuildContext context)
public override Widget build(BuildContext context)
{
throw new System.NotImplementedException();
}
// return new LayoutBuilder(builder: _buildLayout);
return new Container(child: new Text("this is a text!"));
}
}

12
com.unity.uiwidgets.devtools/Editor/v2/dependencies/nested/nested.mixin.gen.cs


using Unity.UIWidgets.widgets;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.DevTools {
public abstract class SingleChildWidgetMixinStatelessWidget : StatelessWidget {
public SingleChildWidgetMixinStatelessWidget(Key key = null) : base(key: key){}
public abstract override Element createElement();
}
}

15
com.unity.uiwidgets.devtools/Editor/v2/dependencies/nested/nested.mixin.njk


using Unity.UIWidgets.widgets;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.DevTools {
{% macro SingleChildWidgetMixin(with) %}
{% set className = 'SingleChildWidgetMixin' + with %}
public abstract class {{className}} : {{with}} {
public SingleChildWidgetMixin{{with}}(Key key = null) : base(key: key){}
public abstract override Element createElement();
}
{% endmacro %}
{{ SingleChildWidgetMixin('StatelessWidget') }}
}

57
com.unity.uiwidgets.devtools/Editor/v2/src/banner_messages.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.DevTools
{
class BannerMessages : StatelessWidget {
public BannerMessages(Key key = null, Screen screen = null) : base(key: key)
{
this.screen = screen;
}
public readonly Screen screen;
public override Widget build(BuildContext context)
{
return new Container();
// var controller = Provider<object>.of<BannerMessagesController>(context);
// var messagesForScreen = controller?.messagesForScreen(screen.screenId);
// List<Widget> temp = new List<Widget>();
// if (messagesForScreen != null)
// {
// temp.Add(new ValueListenableBuilder<List<BannerMessage>>(
// valueListenable: messagesForScreen,
// builder: (context2, messages, _) => {
// return new Column(
// children: messages
// );
// }
// ));
// }
// temp.Add(new Expanded(
// child: screen.build(context)
// ));
//
//
// return new Column(
// children: temp
// );
}
}
// class BannerMessagesController
// {
// ValueNotifier<List<BannerMessage>> _messagesForScreen(string screenId) {
// return _messages.putIfAbsent(
// screenId, () => new ValueNotifier<List<BannerMessage>>());
// }
//
// ValueListenable<List<BannerMessage>> messagesForScreen(string screenId) {
// return _messagesForScreen(screenId);
// }
// }
}

51
com.unity.uiwidgets.devtools/Editor/v2/src/initializer.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.DevTools
{
class Initializer : StatefulWidget
{
public Initializer(
Key key = null,
string url = null,
WidgetBuilder builder = null,
bool allowConnectionScreenOnDisconnect = true
) : base(key: key)
{
D.assert(builder != null);
this.url = url;
this.builder = builder;
this.allowConnectionScreenOnDisconnect = allowConnectionScreenOnDisconnect;
}
public readonly WidgetBuilder builder;
public readonly string url;
public readonly bool allowConnectionScreenOnDisconnect;
public override State createState()
{
return new _InitializerState();
}
}
class _InitializerState : State<Initializer>
{
public override Widget build(BuildContext context)
{
// return _checkLoaded() && _dependenciesLoaded
// ? widget.builder(context)
// : new Scaffold(
// body: new Center(child: new CircularProgressIndicator())
// );
return new Scaffold(
body: new Center(child: new CircularProgressIndicator())
);
}
}
}

109
com.unity.uiwidgets.devtools/Editor/v2/src/scaffold.cs


using System.Collections.Generic;
using Unity.UIWidgets.DevTools;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.DevTools
{
class DevToolsScaffold : StatefulWidget
{
public DevToolsScaffold(
Key key = null,
List<Screen> tabs = null,
string initialPage = null,
List<Widget> actions = null,
bool embed = false
) :
base(key: key)
{
D.assert(tabs != null);
}
public static readonly EdgeInsets appPadding =
EdgeInsets.fromLTRB(16.0f, 16.0f, 16.0f, 8.0f);
public readonly List<Screen> tabs;
public readonly string initialPage;
public readonly bool embed;
public readonly List<Widget> actions;
public override State createState()
{
return new DevToolsScaffoldState();
}
public static DevToolsScaffold withChild(Key key = null, Widget child = null)
{
return new DevToolsScaffold(key: key, tabs: new List<Screen>(){new SimpleScreen(child)});
}
}
class DevToolsScaffoldState : State<DevToolsScaffold>
{
public override Widget build(BuildContext context)
{
var tabBodies = new List<Widget>();
if (widget.tabs != null)
{
foreach (var screen in widget.tabs)
{
tabBodies.Add(new Container(
padding: DevToolsScaffold.appPadding,
alignment: Alignment.topLeft,
child: new FocusScope(
child: new BannerMessages(
screen: screen
)
)
));
};
}
// return ValueListenableProvider.value(
// value: _currentScreen,
// child: Provider<BannerMessagesController>(
// create: (_) => BannerMessagesController(),
// child: DragAndDrop(
// // TODO(kenz): we are handling drops from multiple scaffolds. We need
// // to make sure we are only handling drops from the active scaffold.
// handleDrop: _importController.importData,
// child: Scaffold(
// appBar: widget.embed ? null : _buildAppBar(),
// body: TabBarView(
// physics: defaultTabBarViewPhysics,
// controller: _tabController,
// children: tabBodies
// ),
// bottomNavigationBar:
// widget.embed ? null : _buildStatusLine(context)
// )
// )
// )
// );
return new Container(child:new Text("enter here"));
}
}
class SimpleScreen : Screen {
public SimpleScreen(Widget child) : base(id)
{
this.child = child;
}
public static readonly string id = "simple";
public readonly Widget child;
public override Widget build(BuildContext context)
{
return child;
}
}
}
正在加载...
取消
保存