浏览代码

fix app.cs

/siyaoH-1.17-PlatformMessage
guanghuispark 4 年前
当前提交
2f30a52a
共有 3 个文件被更改,包括 153 次插入38 次删除
  1. 23
      com.unity.uiwidgets/Runtime/cupertino/app.cs
  2. 164
      com.unity.uiwidgets/Runtime/widgets/app.cs
  3. 4
      com.unity.uiwidgets/Runtime/widgets/basic.cs

23
com.unity.uiwidgets/Runtime/cupertino/app.cs


bool checkerboardRasterCacheImages = false,
bool checkerboardOffscreenLayers = false,
bool showSemanticsDebugger = false,
bool debugShowCheckedModeBanner = true
bool debugShowCheckedModeBanner = true,
//Dictionary<LogicalKeySet, Intent> shortcuts = null,
//Dictionary<LocalKey, ActionFactory> actions = null
Dictionary<LogicalKeySet, Intent> shortcuts = null,
Dictionary<LocalKey, ActionFactory> actions = null
//D.assert(routes != null);
//D.assert(navigatorObservers != null);
D.assert(routes != null);
D.assert(navigatorObservers != null);
D.assert(title != null);
D.assert(showPerformanceOverlay != null);
D.assert(checkerboardRasterCacheImages != null);

this.localeResolutionCallback = localeResolutionCallback;
this.supportedLocales = supportedLocales;
this.showPerformanceOverlay = showPerformanceOverlay;
this.shortcuts = shortcuts;
this.actions = actions;
}
public readonly GlobalKey<NavigatorState> navigatorKey;

public readonly bool debugShowWidgetInspector;
public readonly bool debugShowCheckedModeBanner;
//TBC ????
//public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
//public readonly Dictionary<LocalKey, ActionFactory> actions;
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public readonly Dictionary<LocalKey, ActionFactory> actions;
public override State createState() {
return new _CupertinoAppState();

padding: EdgeInsets.zero,
onPressed: onPressed
);
}//,
//shortcuts: widget.shortcuts,
//actions: widget.actions,
},
shortcuts: widget.shortcuts,
actions: widget.actions
);
}
)

164
com.unity.uiwidgets/Runtime/widgets/app.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unity.UIWidgets.services;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;

public delegate string GenerateAppTitle(BuildContext context);
public delegate PageRoute PageRouteFactory(RouteSettings settings, WidgetBuilder builder);
public delegate List<Route> InitialRouteListFactory(string initialRoute);
public class WidgetsApp : StatefulWidget {

public readonly bool checkerboardOffscreenLayers;
public readonly bool showSemanticsDebugger;
public readonly bool debugShowWidgetInspector;
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public readonly Dictionary<LocalKey, ActionFactory> actions;
public WidgetsApp(
Key key = null,
GlobalKey<NavigatorState> navigatorKey = null,

bool showSemanticsDebugger = false,
bool debugShowWidgetInspector = false,
bool debugShowCheckedModeBanner = true,
InspectorSelectButtonBuilder inspectorSelectButtonBuilder = null
//shortcuts
//actions
InspectorSelectButtonBuilder inspectorSelectButtonBuilder = null,
Dictionary<LogicalKeySet, Intent> shortcuts = null,
Dictionary<LocalKey, ActionFactory> actions = null
) : base(key) {
routes = routes ?? new Dictionary<string, WidgetBuilder>();

//D.assert(routes != null);
D.assert(routes != null);
this.home = home;
this.navigatorKey = navigatorKey;
this.onGenerateRoute = onGenerateRoute;

this.title = title;
this.color = color;
this.inspectorSelectButtonBuilder = inspectorSelectButtonBuilder;
this.shortcuts = shortcuts;
this.actions = actions;
D.assert(
home == null ||

);
}
/*public static readonly Dictionary<LogicalKeySet, Intent> _defaultShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
{new LogicalKeySet(LogicalKeyboardKey.enter), new Intent(ActivateAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.gameButtonA), new Intent(ActivateAction.key)},
// Keyboard traversal.
{new widgets.LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab), new Intent(PreviousFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowLeft), new DirectionalFocusIntent(TraversalDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowRight), new DirectionalFocusIntent(TraversalDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowDown), new DirectionalFocusIntent(TraversalDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowUp), new DirectionalFocusIntent(TraversalDirection.up)},
// Scrolling
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
// Default shortcuts for the web platform.
public static readonly Dictionary<LogicalKeySet, Intent> _defaultWebShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
{new widgets.LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key)},
// Keyboard traversal.
{new widgets.LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab),new Intent(PreviousFocusAction.key)},
// Scrolling
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new widgets.LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
// Default shortcuts for the macOS platform.
public static readonly Dictionary<LogicalKeySet, Intent> _defaultMacOsShortcuts = new Dictionary<LogicalKeySet, Intent>(){
// Activation
new LogicalKeySet(LogicalKeyboardKey.enter), new Intent(ActivateAction.key),
new LogicalKeySet(LogicalKeyboardKey.space), new Intent(ActivateAction.key),
// Keyboard traversal
{new LogicalKeySet(LogicalKeyboardKey.tab), new Intent(NextFocusAction.key)},
{new LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab), new Intent(PreviousFocusAction.key)},
{new LogicalKeySet(LogicalKeyboardKey.arrowLeft), new DirectionalFocusIntent(TraversalDirection.left)},
{new LogicalKeySet(LogicalKeyboardKey.arrowRight), new DirectionalFocusIntent(TraversalDirection.right)},
{new LogicalKeySet(LogicalKeyboardKey.arrowDown), new DirectionalFocusIntent(TraversalDirection.down)},
{new LogicalKeySet(LogicalKeyboardKey.arrowUp), new DirectionalFocusIntent(TraversalDirection.up)},
// Scrolling
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowDown), new ScrollIntent(direction: AxisDirection.down)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowLeft), new ScrollIntent(direction: AxisDirection.left)},
{new LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowRight), new ScrollIntent(direction: AxisDirection.right)},
{new LogicalKeySet(LogicalKeyboardKey.pageUp), new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)},
{new LogicalKeySet(LogicalKeyboardKey.pageDown), new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)},
};
/// Generates the default shortcut key bindings based on the
/// [defaultTargetPlatform].
///
/// Used by [WidgetsApp] to assign a default value to [WidgetsApp.shortcuts].
public static Dictionary<LogicalKeySet, Intent> defaultShortcuts {
get {
if (kIsWeb) {
return _defaultWebShortcuts;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
return _defaultShortcuts;
case TargetPlatform.macOS:
return _defaultMacOsShortcuts;
case TargetPlatform.iOS:
// No keyboard support on iOS yet.
break;
}
return new Dictionary<LogicalKeySet, Intent>();
}
}
/// The default value of [WidgetsApp.actions].
public static readonly Dictionary<LocalKey, ActionFactory> defaultActions = new Dictionary<LocalKey, ActionFactory>(){
{DoNothingAction.key, () => new DoNothingAction()},
{RequestFocusAction.key, () => new RequestFocusAction()},
{NextFocusAction.key, () => new NextFocusAction()},
{PreviousFocusAction.key, () => new PreviousFocusAction()},
{DirectionalFocusAction.key, () => new DirectionalFocusAction()},
{ScrollAction.key, () => new ScrollAction()},
};*/
public override State createState() {
return new _WidgetsAppState();
}

/*bool _debugCheckLocalizations(Locale appLocale) {
D.assert(() =>{
HashSet<Type> unsupportedTypes =
_localizationsDelegates.map<Type>((LocalizationsDelegate delegate) => delegate.type).toSet();
foreach ( LocalizationsDelegate<dynamic> delegate in _localizationsDelegates) {
if (!unsupportedTypes.contains(delegate.type))
D.assert(() => {
HashSet<Type> unsupportedTypes = new HashSet<Type>();
foreach (var _delegate in _localizationsDelegates) {
unsupportedTypes.Add(_delegate.type);
}
foreach ( LocalizationsDelegate<dynamic> _delegate in _localizationsDelegates) {
if (!unsupportedTypes.Contains(_delegate.type))
if (delegate.isSupported(appLocale))
unsupportedTypes.remove(delegate.type);
if (_delegate.isSupported(appLocale))
unsupportedTypes.Remove(_delegate.type);
if (listEquals(unsupportedTypes.map((Type type) => type.toString()).toList(), <String>['CupertinoLocalizations']))
return true;
List<string> list = new List<string> {"CupertinoLocalizations"};
List<string> unsupportedTypesList = new List<string>();
foreach (var type in unsupportedTypes) {
unsupportedTypesList.Add(type.ToString());
}
if (unsupportedTypesList.SequenceEqual(list))
return true;
"Warning: This application's locale, $appLocale, is not supported by all of its\n"
'localization delegates.'
"Warning: This application's locale, $appLocale, is not supported by all of its\n" +
"localization delegates."
if (unsupportedType.toString() == 'CupertinoLocalizations')
if (unsupportedType.ToString() == "CupertinoLocalizations")
'> A $unsupportedType delegate that supports the $appLocale locale was not found.'
"> A "+ unsupportedType + " delegate that supports the " + appLocale + "locale was not found."
'See https://flutter.dev/tutorials/internationalization/ for more\n'
"information about configuring an app's locale, supportedLocales,\n"
'and localizationsDelegates parameters.'
"See https://flutter.dev/tutorials/internationalization/ for more\n" +
"information about configuring an app's locale, supportedLocales,\n" +
"and localizationsDelegates parameters."
debugPrint(message.toString());
//Debug.Log(message.toString());
return true;
});
return true;

}
}
/*public class _MediaQueryFromWindow : StatefulWidget {
public class _MediaQueryFromWindow : StatefulWidget {
public _MediaQueryFromWindow(Key key = null, Widget child = null) : base(key: key) {
}
public readonly Widget child;

base.dispose();
}
}
*/
class _InspectorSelectButton : StatelessWidget {
public readonly GestureTapCallback onPressed;

4
com.unity.uiwidgets/Runtime/widgets/basic.cs


listeners.Add("exit");
if (onHover != null)
listeners.Add("hover");
//properties.add(IterableProperty<string>("listeners", listeners, ifEmpty: "<none>"));
properties.add(new EnumerableProperty<string>("listeners", listeners, ifEmpty: "<none>"));
}
}
}
public class _MouseRegionState : State<MouseRegion> {
void handleExit(PointerExitEvent _event) {

正在加载...
取消
保存