浏览代码

fix localizations.cs

/siyaoH-1.17-PlatformMessage
guanghuispark 4 年前
当前提交
dd7a71ac
共有 1 个文件被更改,包括 8 次插入11 次删除
  1. 19
      com.unity.uiwidgets/Runtime/widgets/localizations.cs

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


using System.Linq;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {

public static Locale localeOf(BuildContext context, bool nullOk = false) {
D.assert(context != null);
_LocalizationsScope scope =
(_LocalizationsScope) context.inheritFromWidgetOfExactType(typeof(_LocalizationsScope));
(_LocalizationsScope) context.dependOnInheritedWidgetOfExactType<_LocalizationsScope>();
if (nullOk && scope == null) {
return null;
}

public static List<LocalizationsDelegate> _delegatesOf(BuildContext context) {
D.assert(context != null);
_LocalizationsScope scope =
(_LocalizationsScope) context.inheritFromWidgetOfExactType(typeof(_LocalizationsScope));
(_LocalizationsScope) context.dependOnInheritedWidgetOfExactType<_LocalizationsScope>();
D.assert(scope != null, () => "a Localizations ancestor was not found");
return new List<LocalizationsDelegate>(scope.localizationsState.widget.delegates);
}

D.assert(type != null);
_LocalizationsScope scope =
(_LocalizationsScope) context.inheritFromWidgetOfExactType(typeof(_LocalizationsScope));
(_LocalizationsScope) context.dependOnInheritedWidgetOfExactType<_LocalizationsScope>();
if (scope != null && scope.localizationsState != null) {
return scope.localizationsState.resourcesFor<T>(type);
}

_locale = locale;
}
else {
// WidgetsBinding.instance.deferFirstFrameReport();
// WidgetsBinding.instance.allowFirstFrameReport();
return;
setState(() => {
_typeToResources = (Dictionary<Type, object>) value;
_locale = locale;
});
setState(() => {
_typeToResources = (Dictionary<Type, object>)value;
_locale = locale;
});
});
}
}

正在加载...
取消
保存