浏览代码

add configuration about showdebuglog

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
e26f1a97
共有 12 个文件被更改,包括 2042 次插入1907 次删除
  1. 239
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/bottom_app_bar_demo.cs
  2. 21
      com.unity.uiwidgets/Editor/UIWidgetsEditorPanel.cs
  3. 683
      com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs
  4. 50
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
  5. 11
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanelWrapper.cs
  6. 85
      com.unity.uiwidgets/Runtime/foundation/debug.cs
  7. 278
      com.unity.uiwidgets/Runtime/painting/text_style.cs
  8. 437
      com.unity.uiwidgets/Runtime/scheduler2/binding.cs
  9. 754
      com.unity.uiwidgets/Runtime/ui2/text.cs
  10. 600
      com.unity.uiwidgets/Runtime/widgets/app.cs
  11. 288
      com.unity.uiwidgets/Runtime/widgets/image.cs
  12. 503
      com.unity.uiwidgets/Runtime/widgets/shortcuts.cs

239
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/bottom_app_bar_demo.cs


internal class _BottomAppBarDemoState : State<BottomAppBarDemo>
{
private static GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>.key();
private static readonly GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>.key();
// FAB shape

value: FloatingActionButtonLocation.centerFloat
);
private static void _showSnackbar()
{
string text =
"When the Scaffold\"s floating action button location changes, " +
"the floating action button animates to its new position. " +
"The BottomAppBar adapts its shape appropriately.";
_scaffoldKey.currentState.showSnackBar(
new SnackBar(content: new Text(text))
);
}
private static List<_NamedColor> kBabColors = new List<_NamedColor>
private static readonly List<_NamedColor> kBabColors = new List<_NamedColor>
{
new _NamedColor(null, "Clear"),
new _NamedColor(new Color(0xFFFFC100), "Orange"),

new _NamedColor(new Color(0xFF009BEE), "Blue"),
new _NamedColor(new Color(0xFF009BEE), "Blue")
private Color _babColor = kBabColors.First().color;
private _ChoiceValue<FloatingActionButtonLocation> _fabLocation = kFabEndDocked;
private _ChoiceValue<FloatingActionButtonLocation> _fabLocation = kFabEndDocked;
private Color _babColor = kBabColors.First().color;
private static void _showSnackbar()
{
var text =
"When the Scaffold\"s floating action button location changes, " +
"the floating action button animates to its new position. " +
"The BottomAppBar adapts its shape appropriately.";
_scaffoldKey.currentState.showSnackBar(
new SnackBar(content: new Text(text))
);
}
this.setState(() => { this._showNotch = value; });
setState(() => { _showNotch = value; });
this.setState(() => { this._fabShape = value; });
setState(() => { _fabShape = value; });
this.setState(() => { this._fabLocation = value; });
setState(() => { _fabLocation = value; });
this.setState(() => { this._babColor = value; });
setState(() => { _babColor = value; });
key: _scaffoldKey,
appBar: new AppBar(
_scaffoldKey,
new AppBar(
title: new Text("Bottom app bar"),
elevation: 0.0f,
actions: new List<Widget>

icon: new Icon(Icons.sentiment_very_satisfied),
onPressed: () =>
{
this.setState(() =>
{
this._fabShape = this._fabShape == kCircularFab ? kDiamondFab : kCircularFab;
});
setState(() => { _fabShape = _fabShape == kCircularFab ? kDiamondFab : kCircularFab; });
body: new Scrollbar(
new Scrollbar(
child: new ListView(
padding: EdgeInsets.only(bottom: 88.0f),
children: new List<Widget>

new _RadioItem<Widget>(kCircularFab, this._fabShape, this._onFabShapeChanged),
new _RadioItem<Widget>(kDiamondFab, this._fabShape, this._onFabShapeChanged),
new _RadioItem<Widget>(kNoFab, this._fabShape, this._onFabShapeChanged),
new _RadioItem<Widget>(kCircularFab, _fabShape, _onFabShapeChanged),
new _RadioItem<Widget>(kDiamondFab, _fabShape, _onFabShapeChanged),
new _RadioItem<Widget>(kNoFab, _fabShape, _onFabShapeChanged),
new _RadioItem<bool>(kShowNotchTrue, this._showNotch, this._onShowNotchChanged),
new _RadioItem<bool>(kShowNotchFalse, this._showNotch, this._onShowNotchChanged),
new _RadioItem<bool>(kShowNotchTrue, _showNotch, _onShowNotchChanged),
new _RadioItem<bool>(kShowNotchFalse, _showNotch, _onShowNotchChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabEndDocked, this._fabLocation,
this._onFabLocationChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabCenterDocked, this._fabLocation,
this._onFabLocationChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabEndFloat, this._fabLocation,
this._onFabLocationChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabCenterFloat, this._fabLocation,
this._onFabLocationChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabEndDocked, _fabLocation,
_onFabLocationChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabCenterDocked, _fabLocation,
_onFabLocationChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabEndFloat, _fabLocation,
_onFabLocationChanged),
new _RadioItem<FloatingActionButtonLocation>(kFabCenterFloat, _fabLocation,
_onFabLocationChanged),
new _ColorsItem(kBabColors, this._babColor, this._onBabColorChanged)
new _ColorsItem(kBabColors, _babColor, _onBabColorChanged)
floatingActionButton: this._fabShape.value,
floatingActionButtonLocation: this._fabLocation.value,
_fabShape.value,
_fabLocation.value,
color: this._babColor,
fabLocation: this._fabLocation.value,
shape: this._selectNotch()
_babColor,
_fabLocation.value,
_selectNotch()
)
);
}

if (!this._showNotch.value)
if (!_showNotch.value)
if (this._fabShape == kCircularFab)
if (_fabShape == kCircularFab)
if (this._fabShape == kDiamondFab)
if (_fabShape == kDiamondFab)
return new _DiamondNotchedRectangle();
return null;
}

{
public readonly string label; // For the Semantics widget that contains title
public readonly string title;
public readonly T value;
public _ChoiceValue(T value, string title, string label)
{
this.value = value;

public readonly T value;
public readonly string title;
public readonly string label; // For the Semantics widget that contains title
return $"{this.GetType()}(\"{this.title}\")";
return $"{GetType()}(\"{title}\")";
public readonly _ChoiceValue<T> groupValue;
public readonly ValueChanged<_ChoiceValue<T>> onChanged;
public readonly _ChoiceValue<T> value;
public _RadioItem(_ChoiceValue<T> value, _ChoiceValue<T> groupValue, ValueChanged<_ChoiceValue<T>> onChanged)
{
this.value = value;

public readonly _ChoiceValue<T> value;
public readonly _ChoiceValue<T> groupValue;
public readonly ValueChanged<_ChoiceValue<T>> onChanged;
ThemeData theme = Theme.of(context);
var theme = Theme.of(context);
//TODO: uncomment this when fixes on EdgeInsetsDirectional lands
//padding: const EdgeInsetsDirectional.only(start: 16.0),
padding: EdgeInsets.only(left: 16.0f),
padding: EdgeInsetsDirectional.only(16.0f),
value: this.value,
groupValue: this.groupValue,
onChanged: this.onChanged
value: value,
groupValue: groupValue,
onChanged: onChanged
onTap: () =>
{
this.onChanged(this.value);
},
child: new Text(this.value.title,
onTap: () => { onChanged(value); },
child: new Text(value.title,
style: theme.textTheme.subtitle1
)
)

internal class _NamedColor
{
public readonly Color color;
public readonly string name;
public readonly Color color;
public readonly string name;
public readonly List<_NamedColor> colors;
public readonly ValueChanged<Color> onChanged;
public readonly Color selectedColor;
public _ColorsItem(List<_NamedColor> colors, Color selectedColor, ValueChanged<Color> onChanged)
{
this.colors = colors;

public readonly List<_NamedColor> colors;
public readonly Color selectedColor;
public readonly ValueChanged<Color> onChanged;
children: this.colors.Select<_NamedColor, Widget>((_NamedColor namedColor) =>
children: colors.Select<_NamedColor, Widget>(namedColor =>
onPressed: () => { this.onChanged(namedColor.color); },
onPressed: () => { onChanged(namedColor.color); },
width: 32.0f,
height: 32.0f
32.0f,
32.0f
side: new BorderSide(
color: namedColor.color == this.selectedColor ? Colors.black : new Color(0xFFD5D7DA),
width: 2.0f
new BorderSide(
namedColor.color == selectedColor ? Colors.black : new Color(0xFFD5D7DA),
2.0f
)
),
child: new Container(

internal class _Heading : StatelessWidget
{
public readonly string text;
public readonly string text;
ThemeData theme = Theme.of(context);
var theme = Theme.of(context);
//TODO: uncomment this when fixes on EdgeInsetsDirectional lands
//padding: EdgeInsetsDirectional.only(start: 56.0),
padding: EdgeInsets.only(left: 56.0f),
padding: EdgeInsetsDirectional.only(56.0f),
child: new Text(this.text,
child: new Text(text,
style: theme.textTheme.bodyText2.copyWith(
color: theme.primaryColor
)

internal class _DemoBottomAppBar : StatelessWidget
{
private static readonly List<FloatingActionButtonLocation> kCenterLocations =
new List<FloatingActionButtonLocation>
{
FloatingActionButtonLocation.centerDocked,
FloatingActionButtonLocation.centerFloat
};
public readonly Color color;
public readonly FloatingActionButtonLocation fabLocation;
public readonly NotchedShape shape;
public _DemoBottomAppBar(
Color color = null,
FloatingActionButtonLocation fabLocation = null,

this.shape = shape;
}
public readonly Color color;
public readonly FloatingActionButtonLocation fabLocation;
public readonly NotchedShape shape;
private static readonly List<FloatingActionButtonLocation> kCenterLocations =
new List<FloatingActionButtonLocation>
{
FloatingActionButtonLocation.centerDocked,
FloatingActionButtonLocation.centerFloat
};
public override Widget build(BuildContext context)
{

onPressed: () =>
{
material_.showModalBottomSheet<object>(
context: context,
builder: (BuildContext subContext) => new _DemoDrawer()
context,
subContext => new _DemoDrawer()
if (kCenterLocations.Contains(this.fabLocation)) children.Add(new Expanded(child: new SizedBox()));
if (kCenterLocations.Contains(fabLocation)) children.Add(new Expanded(child: new SizedBox()));
children.Add(
new IconButton(

return new BottomAppBar(
color: this.color,
shape: this.shape,
color: color,
shape: shape,
child: new Row(children: children)
);
}

{
public _DemoDrawer()
{
}
public override Widget build(BuildContext context)
{
return new Drawer(

internal class _DiamondFab : StatelessWidget
{
public readonly Widget child;
public readonly VoidCallback onPressed;
public _DiamondFab(
Widget child = null,
VoidCallback onPressed = null

this.onPressed = onPressed;
}
public readonly Widget child;
public readonly VoidCallback onPressed;
public override Widget build(BuildContext context)
{
return new Material(

onTap: () => this.onPressed?.Invoke(),
onTap: () => onPressed?.Invoke(),
data: new IconThemeData(color: Theme.of(context).accentIconTheme.color),
child: this.child
data: new IconThemeData(Theme.of(context).accentIconTheme.color),
child: child
)
)
),

internal class _DiamondNotchedRectangle : NotchedShape
{
public _DiamondNotchedRectangle()
{
}
public override Path getOuterPath(Rect host, Rect guest)
{
//there is a bug in flutter when guest == null, we fix it here

D.assert(guest.width > 0.0f);
Rect intersection = guest.intersect(host);
var intersection = guest.intersect(host);
// We are computing a "V" shaped notch, as in this diagram:
// -----\**** /-----
// \ /

// notchToCenter is the horizontal distance between the guest's center and
// the host's top edge where the notch starts (marked with "*").
// We compute notchToCenter by similar triangles:
float notchToCenter =
var notchToCenter =
intersection.height * (guest.height / 2.0f)
/ (guest.width / 2.0f);

internal class _DiamondBorder : ShapeBorder
{
public _DiamondBorder()
{
}
return this.getOuterPath(rect, textDirection: textDirection);
return getOuterPath(rect, textDirection);
}

21
com.unity.uiwidgets/Editor/UIWidgetsEditorPanel.cs


namespace Unity.UIWidgets.Editor {
public class UIWidgetsEditorPanel : EditorWindow, IUIWidgetsWindow {
Configurations _configurations;
bool _ShowDebugLog;
UIWidgetsPanelWrapper _wrapper;
int _currentWidth {

float _currentDevicePixelRatio {
get { return EditorGUIUtility.pixelsPerPoint; }
}
readonly Dictionary<string, TextFont> _internalTextFonts =
new Dictionary<string, TextFont>();
void Update() {
_wrapper.onEditorUpdate();

D.assert(_wrapper == null);
_configurations = new Configurations();
settings: _internalTextFonts);
_internalTextFonts.Clear();
_configurations: _configurations);
_configurations._internalTextFonts.Clear();
Input_OnEnable();
}

protected virtual void onEnable() {
}
protected void SetShowDebugLog(bool showDebugLog) {
_configurations._showDebugLog = showDebugLog;
}
var textFont = new TextFont {family = family};
var fonts = new Font[assets.Count];
for (var j = 0; j < assets.Count; j++) {

_internalTextFonts[key: family] = textFont;
_configurations._internalTextFonts[key: family] = textFont;
Vector2? _getPointerPosition(Vector2 position) {
return new Vector2(x: position.x, y: position.y);

683
com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs
文件差异内容过多而无法显示
查看文件

50
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs


GameObjectPanel = 1,
EditorWindowPanel = 2
}
[Serializable]
public struct Font {
public string asset;

UIWidgetsWindowType getWindowType();
}
public class ConfigurationSettings {
public static Dictionary<IntPtr, bool> _internalShowDebugLog = new Dictionary<IntPtr, bool>();
}
public class Configurations {
public Dictionary<string, TextFont> _internalTextFonts = new Dictionary<string, TextFont>();
public bool _showDebugLog;
}
static bool _ShowDebugLog;
public float devicePixelRatioOverride;
public bool hardwareAntiAliasing;

public bool m_ShowDebugLog;
Configurations _configurations;
readonly Dictionary<string, TextFont> _internalTextFonts = new Dictionary<string, TextFont>();
UIWidgetsPanelWrapper _wrapper;
int _currentWidth {

}
}
public static bool ShowDebugLog {
get { return _ShowDebugLog; }
set {
foreach (var panel in panels) {
panel.m_ShowDebugLog = value;
}
_ShowDebugLog = value;
}
}
public static bool ShowDebugLog { get; set; }
protected virtual void Update() {
Input_Update();

base.OnEnable();
D.assert(_wrapper == null);
_configurations = new Configurations();
AddFont(font.family, font);
AddFont(family: font.family, font: font);
settings: _internalTextFonts);
_internalTextFonts.Clear();
_configurations: _configurations);
_configurations._internalTextFonts.Clear();
_ShowDebugLog = m_ShowDebugLog;
}
protected override void OnDisable() {

texture = null;
_internalTextFonts.Clear();
//ConfigurationSettings._internalTextFonts.Clear();
Input_OnDisable();
base.OnDisable();
panels.Remove(this);

}
protected void AddFont(string family, TextFont font) {
_internalTextFonts[key: family] = font;
_configurations._internalTextFonts[key: family] = font;
}
protected void AddFont(string family, List<string> assets, List<int> weights) {

}
var textFont = new TextFont {family = family};
var fonts = new Font[assets.Count];
for (var j = 0; j < assets.Count; j++) {

AddFont(family, textFont);
AddFont(family: family, font: textFont);
}
protected void SetShowDebugLog(bool showDebugLog) {
_configurations._showDebugLog = showDebugLog || m_ShowDebugLog;
}
protected virtual void main() {

11
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanelWrapper.cs


get { return Window.instance._panel; }
}
IntPtr _ptr;
public IntPtr _ptr;
GCHandle _handle;
int _width;

public float devicePixelRatio { get; private set; }
public void Initiate(IUIWidgetsWindow host, int width, int height, float dpr,
Dictionary<string, TextFont> settings) {
public bool ShowDebugLog { get; set; }
public void Initiate(IUIWidgetsWindow host, int width, int height, float dpr, Configurations _configurations) {
D.assert(renderTexture == null);
_recreateRenderTexture(width: width, height: height, devicePixelRatio: dpr);

window = host;
var fontsetting = new Dictionary<string, object>();
fontsetting.Add("fonts", fontsToObject(settings: settings));
fontsetting.Add("fonts", fontsToObject(settings: _configurations._internalTextFonts));
ShowDebugLog = _configurations._showDebugLog;
NativeConsole.OnEnable();
}

Window.instance._panel = this;
window.mainEntry();
}
catch (Exception ex) {

85
com.unity.uiwidgets/Runtime/foundation/debug.cs


using System;
using System.Diagnostics;
using System.Linq;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Canvas = Unity.UIWidgets.ui.Canvas;

namespace Unity.UIWidgets.foundation {
public static class D {
public static void logError(string message, Exception ex = null) {
Debug.LogException(new AssertionError(message, ex));
}
[Conditional("UNITY_ASSERTIONS")]
public static void assert(Func<bool> result, Func<string> message = null) {
if (UIWidgetsPanel.ShowDebugLog && !result()) {
throw new AssertionError(message != null ? message() : "");
}
}
[Conditional("UNITY_ASSERTIONS")]
public static void assert(bool result, Func<string> message = null) {
if (UIWidgetsPanel.ShowDebugLog && !result) {
throw new AssertionError(message != null ? message() : "");
}
}
public static bool debugPaintPointersEnabled = false;
public static bool debugPaintPointersEnabled;
public static bool debugPaintBaselinesEnabled = false;
public static bool debugPaintBaselinesEnabled;
public static bool debugPaintSizeEnabled = false;
public static bool debugPaintSizeEnabled;
public static bool debugRepaintRainbowEnabled = false;
public static bool debugRepaintRainbowEnabled;
public static bool debugPaintLayerBordersEnabled = false;
public static bool debugPaintLayerBordersEnabled;
public static bool debugPrintMarkNeedsLayoutStacks = false;

public static bool debugPrintMouseHoverEvents = false;
public static bool debugLog = true;
public static int? debugFloatPrecision;
public static void logError(string message, Exception ex = null) {
Debug.LogException(new AssertionError(message: message, innerException: ex));
}
[Conditional("UNITY_ASSERTIONS")]
public static void assert(Func<bool> result, Func<string> message = null) {
if (debugLog && !result()) {
throw new AssertionError(message != null ? message() : "");
}
}
[Conditional("UNITY_ASSERTIONS")]
public static void assert(bool result, Func<string> message = null) {
if (debugLog && !result) {
throw new AssertionError(message != null ? message() : "");
}
}
public static void setDebugLog(bool _debugLog) {
debugLog = _debugLog;
}
Path path = new Path();
var path = new Path();
path.addRect(outerRect);
path.addRect(innerRect);
path.addRect(rect: outerRect);
path.addRect(rect: innerRect);
canvas.drawPath(path, paint);
canvas.drawPath(path: path, paint: paint);
_debugDrawDoubleRect(canvas, outerRect, innerRect, new Color(0x900090FF));
_debugDrawDoubleRect(canvas, innerRect.inflate(outlineWidth).intersect(outerRect), innerRect,
_debugDrawDoubleRect(canvas: canvas, outerRect: outerRect, innerRect: innerRect,
new Color(0x900090FF));
_debugDrawDoubleRect(canvas: canvas,
innerRect.inflate(delta: outlineWidth).intersect(other: outerRect), innerRect: innerRect,
Paint paint = new Paint();
var paint = new Paint();
canvas.drawRect(outerRect, paint);
canvas.drawRect(rect: outerRect, paint: paint);
}
return true;

bool? debugPaintPointersEnabled = null,
bool? debugPaintLayerBordersEnabled = null,
bool? debugRepaintRainbowEnabled = null) {
bool needRepaint = false;
var needRepaint = false;
if (debugPaintSizeEnabled != null && debugPaintSizeEnabled != D.debugPaintSizeEnabled) {
D.debugPaintSizeEnabled = debugPaintSizeEnabled.Value;
needRepaint = true;

}*/
}
}
public static int? debugFloatPrecision;
public static string debugFormatFloat(float? value) {
if (value == null) {

return value.Value.ToString($"N{debugFloatPrecision}");
}
return value.Value.ToString($"N1");
return value.Value.ToString("N1");
}
}

public AssertionError(string message) : base(message) {
public AssertionError(string message) : base(message: message) {
public AssertionError(string message, Exception innerException = null) : base(message) {
public AssertionError(string message, Exception innerException = null) : base(message: message) {
this.innerException = innerException;
}

var lines = stackTrace.Split('\n');
var strippedLines = lines.Skip(1);
return string.Join("\n", strippedLines);
return string.Join("\n", values: strippedLines);
}
}
}

278
com.unity.uiwidgets/Runtime/painting/text_style.cs


using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using FontStyle = Unity.UIWidgets.ui.FontStyle;
const string _kDefaultDebugLabel = "unknown";
const string _kColorForegroundWarning = "Cannot provide both a color and a foreground\n" +
"The color argument is just a shorthand for 'foreground: new Paint()..color = color'.";
const string _kColorBackgroundWarning = "Cannot provide both a backgroundColor and a background\n" +
"The backgroundColor argument is just a shorthand for 'background: new Paint()..color = color'.";
public readonly bool inherit;
public readonly Paint background;
public readonly Color backgroundColor;
public readonly Color backgroundColor;
public readonly float? fontSize;
public readonly FontWeight fontWeight;
public readonly FontStyle? fontStyle;
public readonly float? letterSpacing;
public readonly float? wordSpacing;
public readonly TextBaseline? textBaseline;
public readonly float? height;
public readonly string debugLabel;
public readonly Paint foreground;
public readonly Paint background;
public readonly List<BoxShadow> shadows;
public List<string> fontFamilyFallback {
get { return _fontFamilyFallback; }
}
readonly List<string> _fontFamilyFallback;
public readonly string debugLabel;
const string _kDefaultDebugLabel = "unknown";
const string _kColorForegroundWarning = "Cannot provide both a color and a foreground\n" +
"The color argument is just a shorthand for 'foreground: new Paint()..color = color'.";
const string _kColorBackgroundWarning = "Cannot provide both a backgroundColor and a background\n" +
"The backgroundColor argument is just a shorthand for 'background: new Paint()..color = color'.";
public readonly float? fontSize;
public readonly FontStyle? fontStyle;
public readonly FontWeight fontWeight;
public readonly Paint foreground;
public readonly float? height;
public readonly bool inherit;
public readonly float? letterSpacing;
public readonly List<BoxShadow> shadows;
public readonly TextBaseline? textBaseline;
public readonly float? wordSpacing;
public TextStyle(bool inherit = true,
Color color = null,

this.decorationStyle = decorationStyle;
this.decorationThickness = decorationThickness;
this.fontFamily = fontFamily;
_fontFamilyFallback = fontFamilyFallback;
this.fontFamilyFallback = fontFamilyFallback;
this.debugLabel = debugLabel;
this.foreground = foreground;
this.background = background;

public List<string> fontFamilyFallback { get; }
public bool Equals(TextStyle other) {
if (ReferenceEquals(null, objB: other)) {
return false;
}
if (ReferenceEquals(this, objB: other)) {
return true;
}
return inherit == other.inherit &&
Equals(objA: color, objB: other.color) &&
Equals(objA: backgroundColor, objB: other.backgroundColor) &&
fontSize.Equals(other: other.fontSize) &&
fontWeight == other.fontWeight &&
fontStyle == other.fontStyle &&
letterSpacing.Equals(other: other.letterSpacing) &&
wordSpacing.Equals(other: other.wordSpacing) &&
textBaseline == other.textBaseline &&
height.Equals(other: other.height) &&
Equals(objA: decoration, objB: other.decoration) &&
Equals(objA: decorationColor, objB: other.decorationColor) &&
decorationStyle == other.decorationStyle &&
decorationThickness == other.decorationThickness &&
Equals(objA: foreground, objB: other.foreground) &&
Equals(objA: background, objB: other.background) &&
fontFamilyFallback.equalsList(list: other.fontFamilyFallback) &&
shadows.equalsList(list: other.shadows) &&
fontFeatures.equalsList(list: other.fontFeatures) &&
string.Equals(a: fontFamily, b: other.fontFamily);
}
if (ReferenceEquals(this, other))
if (ReferenceEquals(this, objB: other)) {
}
if (inherit != other.inherit ||
fontFamily != other.fontFamily ||
fontSize != other.fontSize ||

height != other.height ||
foreground != other.foreground ||
background != other.background ||
!shadows.equalsList(other.shadows) ||
!fontFeatures.equalsList(other.fontFeatures) ||
!fontFamilyFallback.equalsList(other.fontFamilyFallback)) {
!shadows.equalsList(list: other.shadows) ||
!fontFeatures.equalsList(list: other.fontFeatures) ||
!fontFamilyFallback.equalsList(list: other.fontFamilyFallback)) {
return RenderComparison.layout;
}

) {
D.assert(textScaleFactor != null);
D.assert(maxLines == null || maxLines > 0);
return new ui.ParagraphStyle(
return new ParagraphStyle(
textDirection: textDirection,
textDirection ?? TextDirection.ltr,
fontWeight: fontWeight ?? this.fontWeight,
fontStyle: fontStyle ?? this.fontStyle,
fontFamily: fontFamily ?? this.fontFamily,

: new ui.StrutStyle(
fontFamily: strutStyle.fontFamily,
fontFamilyFallback: strutStyle.fontFamilyFallback,
fontSize: strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor,
strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor,
height: strutStyle.height,
leading: strutStyle.leading,
fontWeight: strutStyle.fontWeight,

float heightFactor = 1.0f,
float heightDelta = 0.0f
) {
D.assert(fontSize != null || (fontSizeFactor == 1.0f && fontSizeDelta == 0.0f));
D.assert(fontSize != null || fontSizeFactor == 1.0f && fontSizeDelta == 0.0f);
D.assert(letterSpacing != null || (letterSpacingFactor == 1.0f && letterSpacingDelta == 0.0f));
D.assert(wordSpacing != null || (wordSpacingFactor == 1.0f && wordSpacingDelta == 0.0f));
D.assert(height != null || (heightFactor == 1.0f && heightDelta == 0.0f));
D.assert(letterSpacing != null || letterSpacingFactor == 1.0f && letterSpacingDelta == 0.0f);
D.assert(wordSpacing != null || wordSpacingFactor == 1.0f && wordSpacingDelta == 0.0f);
D.assert(height != null || heightFactor == 1.0f && heightDelta == 0.0f);
(decorationThicknessFactor == 1.0f && decorationThicknessDelta == 0.0f));
decorationThicknessFactor == 1.0f && decorationThicknessDelta == 0.0f);
string modifiedDebugLabel = "";
var modifiedDebugLabel = "";
D.assert(() => {
if (debugLabel != null) {
modifiedDebugLabel = debugLabel + ".apply";

return new TextStyle(
inherit: inherit,
color: foreground == null ? color ?? this.color : null,
backgroundColor: background == null ? backgroundColor ?? this.backgroundColor : null,
foreground == null ? color ?? this.color : null,
background == null ? backgroundColor ?? this.backgroundColor : null,
fontFamily: fontFamily ?? this.fontFamily,
fontFamilyFallback: fontFamilyFallback ?? this.fontFamilyFallback,
fontSize: fontSize == null ? null : fontSize * fontSizeFactor + fontSizeDelta,

});
return new TextStyle(
inherit: inherit ?? this.inherit,
color: this.foreground == null && foreground == null ? color ?? this.color : null,
backgroundColor: this.background == null && background == null ? backgroundColor ?? this.backgroundColor : null,
inherit ?? this.inherit,
this.foreground == null && foreground == null ? color ?? this.color : null,
this.background == null && background == null ? backgroundColor ?? this.backgroundColor : null,
fontFamily: fontFamily ?? this.fontFamily,
fontFamilyFallback: fontFamilyFallback ?? this.fontFamilyFallback,
fontSize: fontSize ?? this.fontSize,

return null;
}
string lerpDebugLabel = "";
var lerpDebugLabel = "";
D.assert(() => {
lerpDebugLabel = "lerp" + (a?.debugLabel ?? _kDefaultDebugLabel) + "-" + t + "-" +
(b?.debugLabel ?? _kDefaultDebugLabel);

if (a == null) {
return new TextStyle(
inherit: b.inherit,
color: Color.lerp(null, b.color, t),
backgroundColor: Color.lerp(null, b.backgroundColor, t),
Color.lerp(null, b: b.color, t: t),
Color.lerp(null, b: b.backgroundColor, t: t),
fontFamily: t < 0.5f ? null : b.fontFamily,
fontFamilyFallback: t < 0.5f ? null : b.fontFamilyFallback,
fontSize: t < 0.5f ? null : b.fontSize,

foreground: t < 0.5f ? null : b.foreground,
background: t < 0.5f ? null : b.background,
decoration: t < 0.5f ? null : b.decoration,
decorationColor: Color.lerp(null, b.decorationColor, t),
decorationColor: Color.lerp(null, b: b.decorationColor, t: t),
decorationStyle: t < 0.5f ? null : b.decorationStyle,
decorationThickness: t < 0.5f ? null : b.decorationThickness,
shadows: t < 0.5f ? null : b.shadows,

if (b == null) {
return new TextStyle(
inherit: a.inherit,
color: Color.lerp(a.color, null, t),
backgroundColor: Color.lerp(a.backgroundColor, null, t),
Color.lerp(a: a.color, null, t: t),
Color.lerp(a: a.backgroundColor, null, t: t),
fontFamily: t < 0.5f ? a.fontFamily : null,
fontFamilyFallback: t < 0.5f ? a.fontFamilyFallback : null,
fontSize: t < 0.5f ? a.fontSize : null,

foreground: t < 0.5f ? a.foreground : null,
background: t < 0.5f ? a.background : null,
decoration: t < 0.5f ? a.decoration : null,
decorationColor: Color.lerp(a.decorationColor, null, t),
decorationColor: Color.lerp(a: a.decorationColor, null, t: t),
decorationStyle: t < 0.5f ? a.decorationStyle : null,
decorationThickness: t < 0.5f ? a.decorationThickness : null,
shadows: t < 0.5f ? a.shadows : null,

return new TextStyle(
inherit: b.inherit,
color: a.foreground == null && b.foreground == null ? Color.lerp(a.color, b.color, t) : null,
backgroundColor: a.background == null && b.background == null
? Color.lerp(a.backgroundColor, b.backgroundColor, t)
a.foreground == null && b.foreground == null ? Color.lerp(a: a.color, b: b.color, t: t) : null,
a.background == null && b.background == null
? Color.lerp(a: a.backgroundColor, b: b.backgroundColor, t: t)
fontSize: MathUtils.lerpNullableFloat(a.fontSize ?? b.fontSize, b.fontSize ?? a.fontSize, t),
fontSize: MathUtils.lerpNullableFloat(a.fontSize ?? b.fontSize, b.fontSize ?? a.fontSize, t: t),
b.letterSpacing ?? a.letterSpacing, t),
b.letterSpacing ?? a.letterSpacing, t: t),
b.wordSpacing ?? a.wordSpacing, t),
b.wordSpacing ?? a.wordSpacing, t: t),
height: MathUtils.lerpNullableFloat(a.height ?? b.height, b.height ?? a.height, t),
foreground: (a.foreground != null || b.foreground != null)
height: MathUtils.lerpNullableFloat(a.height ?? b.height, b.height ?? a.height, t: t),
foreground: a.foreground != null || b.foreground != null
? a.foreground ?? new Paint() {color = a.color}
: b.foreground ?? new Paint() {color = b.color}
? a.foreground ?? new Paint {color = a.color}
: b.foreground ?? new Paint {color = b.color}
background: (a.background != null || b.background != null)
background: a.background != null || b.background != null
? a.background ?? new Paint() {color = a.backgroundColor}
: b.background ?? new Paint() {color = b.backgroundColor}
? a.background ?? new Paint {color = a.backgroundColor}
: b.background ?? new Paint {color = b.backgroundColor}
decorationColor: Color.lerp(a.decorationColor, b.decorationColor, t),
decorationColor: Color.lerp(a: a.decorationColor, b: b.decorationColor, t: t),
b.decorationThickness ?? a.decorationThickness ?? 0.0f, t),
b.decorationThickness ?? a.decorationThickness ?? 0.0f, t: t),
shadows: t < 0.5f ? a.shadows : b.shadows,
fontFeatures: t < 0.5 ? a.fontFeatures : b.fontFeatures,
debugLabel: lerpDebugLabel

ui.ParagraphStyle getParagraphStyle(
ParagraphStyle getParagraphStyle(
ui.TextHeightBehavior textHeightBehavior = null,
TextHeightBehavior textHeightBehavior = null,
Locale locale = null,
string fontFamily = null,
float? fontSize = null,

StrutStyle strutStyle = null
) {
D.assert(maxLines == null || maxLines > 0);
return new ui.ParagraphStyle(
return new ParagraphStyle(
textDirection: textDirection,
textDirection ?? TextDirection.ltr,
fontWeight: fontWeight ?? this.fontWeight,
fontStyle: fontStyle ?? this.fontStyle,
fontFamily: fontFamily ?? this.fontFamily,

: new ui.StrutStyle(
fontFamily: strutStyle.fontFamily,
fontFamilyFallback: strutStyle.fontFamilyFallback,
fontSize: strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor,
strutStyle.fontSize == null ? null : strutStyle.fontSize * textScaleFactor,
height: strutStyle.height,
leading: strutStyle.leading,
fontWeight: strutStyle.fontWeight,

textBaseline: textBaseline,
fontFamily: fontFamily,
fontFamilyFallback: fontFamilyFallback,
fontSize: fontSize == null ? null : fontSize * textScaleFactor,
fontSize == null ? null : fontSize * textScaleFactor,
letterSpacing: letterSpacing,
wordSpacing: wordSpacing,
height: height,

);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
debugFillProperties(properties, "");
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
debugFillProperties(properties: properties);
base.debugFillProperties(properties);
base.debugFillProperties(properties: properties);
List<DiagnosticsNode> styles = new List<DiagnosticsNode>();
styles.Add(new ColorProperty($"{prefix}color", color,
var styles = new List<DiagnosticsNode>();
styles.Add(new ColorProperty($"{prefix}color", value: color,
styles.Add(new ColorProperty($"{prefix}backgroundColor", backgroundColor,
styles.Add(new ColorProperty($"{prefix}backgroundColor", value: backgroundColor,
styles.Add(new StringProperty($"{prefix}family", fontFamily, defaultValue: foundation_.kNullDefaultValue,
styles.Add(new StringProperty($"{prefix}family", value: fontFamily,
defaultValue: foundation_.kNullDefaultValue,
styles.Add(new EnumerableProperty<string>($"{prefix}familyFallback", fontFamilyFallback,
styles.Add(new EnumerableProperty<string>($"{prefix}familyFallback", value: fontFamilyFallback,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}size", fontSize,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}size", value: fontSize,
string weightDescription = "";
var weightDescription = "";
"weight", fontWeight,
"weight", value: fontWeight,
styles.Add(new EnumProperty<FontStyle?>($"{prefix}style", fontStyle,
styles.Add(new EnumProperty<FontStyle?>($"{prefix}style", value: fontStyle,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}letterSpacing", letterSpacing,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}letterSpacing", value: letterSpacing,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}wordSpacing", wordSpacing,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}wordSpacing", value: wordSpacing,
styles.Add(new EnumProperty<TextBaseline?>($"{prefix}baseline", textBaseline,
styles.Add(new EnumProperty<TextBaseline?>($"{prefix}baseline", value: textBaseline,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}height", height,
styles.Add(new DiagnosticsProperty<float?>($"{prefix}height", value: height,
defaultValue: foundation_.kNullDefaultValue));
styles.Add(new StringProperty($"{prefix}foreground", foreground == null ? null : foreground.ToString(),
defaultValue: foundation_.kNullDefaultValue, quoted: false));

List<string> decorationDescription = new List<string>();
var decorationDescription = new List<string>();
styles.Add(new ColorProperty($"{prefix}decorationColor", decorationColor,
styles.Add(new ColorProperty($"{prefix}decorationColor", value: decorationColor,
defaultValue: foundation_.kNullDefaultValue,
level: DiagnosticLevel.fine));
if (decorationColor != null) {

styles.Add(new DiagnosticsProperty<TextDecoration>($"{prefix}decoration", decoration,
styles.Add(new DiagnosticsProperty<TextDecoration>($"{prefix}decoration", value: decoration,
defaultValue: foundation_.kNullDefaultValue,
level: DiagnosticLevel.hidden));
if (decoration != null) {

D.assert(decorationDescription.isNotEmpty);
styles.Add(new MessageProperty($"{prefix}decoration", string.Join(" ", decorationDescription.ToArray())));
styles.Add(new FloatProperty($"{prefix}decorationThickness", decorationThickness, unit: "x",
D.assert(result: decorationDescription.isNotEmpty);
styles.Add(
new MessageProperty($"{prefix}decoration", string.Join(" ", decorationDescription.ToArray())));
styles.Add(new FloatProperty($"{prefix}decorationThickness", value: decorationThickness, unit: "x",
bool styleSpecified = styles.Any((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info));
properties.add(new DiagnosticsProperty<bool>("inherit", inherit,
level: (!styleSpecified && inherit) ? DiagnosticLevel.fine : DiagnosticLevel.info));
var styleSpecified = styles.Any(n => !n.isFiltered(minLevel: DiagnosticLevel.info));
properties.add(new DiagnosticsProperty<bool>("inherit", value: inherit,
level: !styleSpecified && inherit ? DiagnosticLevel.fine : DiagnosticLevel.info));
properties.add(style);
properties.add(property: style);
properties.add(new FlagProperty("inherit", value: inherit, ifTrue: $"{prefix}<all styles inherited>",
ifFalse: $"{prefix}<no style specified>"));
properties.add(new FlagProperty("inherit", value: inherit, $"{prefix}<all styles inherited>",
$"{prefix}<no style specified>"));
public bool Equals(TextStyle other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return inherit == other.inherit &&
Equals(color, other.color) &&
Equals(backgroundColor, other.backgroundColor) &&
fontSize.Equals(other.fontSize) &&
fontWeight == other.fontWeight &&
fontStyle == other.fontStyle &&
letterSpacing.Equals(other.letterSpacing) &&
wordSpacing.Equals(other.wordSpacing) &&
textBaseline == other.textBaseline &&
height.Equals(other.height) &&
Equals(decoration, other.decoration) &&
Equals(decorationColor, other.decorationColor) &&
decorationStyle == other.decorationStyle &&
decorationThickness == other.decorationThickness &&
Equals(foreground, other.foreground) &&
Equals(background, other.background) &&
fontFamilyFallback.equalsList(other.fontFamilyFallback) &&
shadows.equalsList(other.shadows) &&
fontFeatures.equalsList(other.fontFeatures) &&
string.Equals(fontFamily, other.fontFamily);
}
if (ReferenceEquals(null, obj)) {
if (ReferenceEquals(null, objB: obj)) {
if (ReferenceEquals(this, obj)) {
if (ReferenceEquals(this, objB: obj)) {
return true;
}

}
public static bool operator ==(TextStyle left, TextStyle right) {
return Equals(left, right);
return Equals(objA: left, objB: right);
return !Equals(left, right);
return !Equals(objA: left, objB: right);
}
public override string toStringShort() {

437
com.unity.uiwidgets/Runtime/scheduler2/binding.cs


using developer;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.editor2;
using Timer = Unity.UIWidgets.async2.Timer;
static float _timeDilation = 1.0f;
if (_timeDilation == value)
if (_timeDilation == value) {
}
static float _timeDilation = 1.0f;
}
public delegate void FrameCallback(TimeSpan timeStamp);

}
class _TaskEntry<T> : _TaskEntry {
public readonly TaskCallback<T> task;
public Completer completer;
internal _TaskEntry(TaskCallback<T> task, int priority) {
this.task = task;
this.priority = priority;

completer = Completer.create();
}
public readonly TaskCallback<T> task;
public Completer completer;
public void run() {
if (!foundation_.kReleaseMode) {

}
public int CompareTo(_TaskEntry other) {
return -priority.CompareTo(other.priority);
return -priority.CompareTo(value: other.priority);
public static string debugCurrentCallbackStack;
public readonly FrameCallback callback;
public string debugStack;
internal _FrameCallbackEntry(FrameCallback callback, bool rescheduling = false) {
this.callback = callback;

if (debugCurrentCallbackStack == null) {
throw new UIWidgetsError(
new List<DiagnosticsNode>() {
new List<DiagnosticsNode> {
new ErrorSummary(
"scheduleFrameCallback called with rescheduling true, but no callback is in scope."),
new ErrorDescription(

return true;
});
}
public readonly FrameCallback callback;
public static string debugCurrentCallbackStack;
public string debugStack;
}
public enum SchedulerPhase {

persistentCallbacks,
postFrameCallbacks,
postFrameCallbacks
readonly List<FrameCallback> _persistentCallbacks = new List<FrameCallback>();
readonly List<FrameCallback> _postFrameCallbacks = new List<FrameCallback>();
readonly HashSet<int> _removedIds = new HashSet<int>();
readonly PriorityQueue<_TaskEntry> _taskQueue = new PriorityQueue<_TaskEntry>();
readonly List<TimingsCallback> _timingsCallbacks = new List<TimingsCallback>();
TimeSpan? _currentFrameTimeStamp;
string _debugBanner;
int _debugFrameNumber;
TimeSpan _epochStart = TimeSpan.Zero;
TimeSpan? _firstRawTimeStampInEpoch;
bool _hasRequestedAnEventLoopCallback;
bool _ignoreNextEngineDrawFrame;
int _nextFrameCallbackId;
Completer _nextFrameCompleter;
Dictionary<int, _FrameCallbackEntry> _transientCallbacks = new Dictionary<int, _FrameCallbackEntry>();
bool _warmUpFrame;
public SchedulingStrategy schedulingStrategy = scheduler_.defaultSchedulingStrategy;
public static SchedulerBinding instance {
get { return (SchedulerBinding) Window.instance._binding; }
private set { Window.instance._binding = value; }
}
public AppLifecycleState? lifecycleState { get; private set; }
public int transientCallbackCount {
get { return _transientCallbacks.Count; }
}
public Future endOfFrame {
get {
if (_nextFrameCompleter == null) {
if (schedulerPhase == SchedulerPhase.idle) {
scheduleFrame();
}
_nextFrameCompleter = Completer.create();
addPostFrameCallback(timeStamp => {
_nextFrameCompleter.complete();
_nextFrameCompleter = null;
});
}
return _nextFrameCompleter.future;
}
}
public bool hasScheduledFrame { get; private set; }
public SchedulerPhase schedulerPhase { get; private set; } = SchedulerPhase.idle;
public bool framesEnabled { get; private set; } = true;
public TimeSpan currentFrameTimeStamp {
get {
D.assert(_currentFrameTimeStamp != null);
return _currentFrameTimeStamp.Value;
}
}
public TimeSpan currentSystemFrameTimeStamp { get; private set; } = TimeSpan.Zero;
protected override void initInstances() {
base.initInstances();
instance = this;

if (!foundation_.kReleaseMode) {
int frameNumber = 0;
addTimingsCallback((List<FrameTiming> timings) => {
foreach (FrameTiming frameTiming in timings) {
var frameNumber = 0;
addTimingsCallback(timings => {
foreach (var frameTiming in timings) {
_profileFramePostEvent(frameNumber, frameTiming);
_profileFramePostEvent(frameNumber: frameNumber, frameTiming: frameTiming);
readonly List<TimingsCallback> _timingsCallbacks = new List<TimingsCallback>();
_timingsCallbacks.Add(callback);
_timingsCallbacks.Add(item: callback);
if (_timingsCallbacks.Count == 1) {
D.assert(window.onReportTimings == null);
window.onReportTimings = _executeTimingsCallbacks;

}
public void removeTimingsCallback(TimingsCallback callback) {
D.assert(_timingsCallbacks.Contains(callback));
_timingsCallbacks.Remove(callback);
D.assert(_timingsCallbacks.Contains(item: callback));
_timingsCallbacks.Remove(item: callback);
if (_timingsCallbacks.isEmpty()) {
window.onReportTimings = null;
}

List<TimingsCallback> clonedCallbacks =
new List<TimingsCallback>(_timingsCallbacks);
foreach (TimingsCallback callback in clonedCallbacks) {
var clonedCallbacks =
new List<TimingsCallback>(collection: _timingsCallbacks);
foreach (var callback in clonedCallbacks) {
if (_timingsCallbacks.Contains(callback)) {
callback(timings);
if (_timingsCallbacks.Contains(item: callback)) {
callback(timings: timings);
}
}
catch (Exception ex) {

yield return new DiagnosticsProperty<TimingsCallback>(
"The TimingsCallback that gets executed was",
callback,
value: callback,
collector = infoCollect;
return true;
});

}
}
public static SchedulerBinding instance {
get { return (SchedulerBinding) Window.instance._binding; }
private set { Window.instance._binding = value; }
}
public AppLifecycleState? lifecycleState => _lifecycleState;
AppLifecycleState? _lifecycleState;
if (_lifecycleState == null) {
handleAppLifecycleStateChanged(_parseAppLifecycleMessage(window.initialLifecycleState));
if (lifecycleState == null) {
handleAppLifecycleStateChanged(_parseAppLifecycleMessage(message: window.initialLifecycleState));
_lifecycleState = state;
lifecycleState = state;
switch (state) {
case AppLifecycleState.resumed:
case AppLifecycleState.inactive:

throw new Exception("unknown AppLifecycleState: " + message);
}
public SchedulingStrategy schedulingStrategy = scheduler_.defaultSchedulingStrategy;
readonly PriorityQueue<_TaskEntry> _taskQueue = new PriorityQueue<_TaskEntry>();
bool isFirstTask = _taskQueue.isEmpty;
_TaskEntry<T> entry = new _TaskEntry<T>(
task,
priority.value
var isFirstTask = _taskQueue.isEmpty;
var entry = new _TaskEntry<T>(
task: task,
priority: priority.value
_taskQueue.enqueue(entry);
if (isFirstTask && !locked)
_taskQueue.enqueue(item: entry);
if (isFirstTask && !locked) {
}
if (_taskQueue.isNotEmpty)
if (_taskQueue.isNotEmpty) {
}
bool _hasRequestedAnEventLoopCallback = false;
D.assert(!locked);
D.assert(result: !locked);
if (_hasRequestedAnEventLoopCallback)
if (_hasRequestedAnEventLoopCallback) {
}
Timer.run(_runTasks);
Timer.run(callback: _runTasks);
if (handleEventLoopCallback())
if (handleEventLoopCallback()) {
}
if (_taskQueue.isEmpty || locked)
if (_taskQueue.isEmpty || locked) {
}
_TaskEntry entry = _taskQueue.first;
if (schedulingStrategy(priority: entry.priority, scheduler: this)) {
var entry = _taskQueue.first;
if (schedulingStrategy(priority: entry.priority, this)) {
try {
_taskQueue.removeFirst();
entry.run();

});
IEnumerable<DiagnosticsNode> infoCollector() {
yield return DiagnosticsNode.message("\nThis exception was thrown in the context of a scheduler callback. " +
"When the scheduler callback was _registered_ (as opposed to when the " +
"exception was thrown), this was the stack: " + callbackStack);
yield return DiagnosticsNode.message(
"\nThis exception was thrown in the context of a scheduler callback. " +
"When the scheduler callback was _registered_ (as opposed to when the " +
"exception was thrown), this was the stack: " + callbackStack);
library: "scheduler library",
context: new ErrorDescription("during a task callback"),
"scheduler library",
new ErrorDescription("during a task callback"),
informationCollector: callbackStack == null
? (InformationCollector) null
: infoCollector

return false;
}
int _nextFrameCallbackId = 0;
Dictionary<int, _FrameCallbackEntry> _transientCallbacks = new Dictionary<int, _FrameCallbackEntry>();
readonly HashSet<int> _removedIds = new HashSet<int>();
public int transientCallbackCount => _transientCallbacks.Count;
_transientCallbacks[_nextFrameCallbackId] =
new _FrameCallbackEntry(callback, rescheduling: rescheduling);
_transientCallbacks[key: _nextFrameCallbackId] =
new _FrameCallbackEntry(callback: callback, rescheduling: rescheduling);
_transientCallbacks.Remove(id);
_removedIds.Add(id);
_transientCallbacks.Remove(key: id);
_removedIds.Add(item: id);
readonly List<FrameCallback> _persistentCallbacks = new List<FrameCallback>();
_persistentCallbacks.Add(callback);
_persistentCallbacks.Add(item: callback);
readonly List<FrameCallback> _postFrameCallbacks = new List<FrameCallback>();
_postFrameCallbacks.Add(callback);
_postFrameCallbacks.Add(item: callback);
Completer _nextFrameCompleter;
public Future endOfFrame {
get {
if (_nextFrameCompleter == null) {
if (schedulerPhase == SchedulerPhase.idle)
scheduleFrame();
_nextFrameCompleter = Completer.create();
addPostFrameCallback((timeStamp) => {
_nextFrameCompleter.complete();
_nextFrameCompleter = null;
});
}
return _nextFrameCompleter.future;
void _setFramesEnabledState(bool enabled) {
if (framesEnabled == enabled) {
return;
}
public bool hasScheduledFrame => _hasScheduledFrame;
bool _hasScheduledFrame = false;
public SchedulerPhase schedulerPhase => _schedulerPhase;
SchedulerPhase _schedulerPhase = SchedulerPhase.idle;
public bool framesEnabled => _framesEnabled;
bool _framesEnabled = true;
void _setFramesEnabledState(bool enabled) {
if (_framesEnabled == enabled)
return;
_framesEnabled = enabled;
if (enabled)
framesEnabled = enabled;
if (enabled) {
}
}
protected void ensureFrameCallbacksRegistered() {

}
public void scheduleFrame() {
if (_hasScheduledFrame || !framesEnabled)
if (hasScheduledFrame || !framesEnabled) {
}
D.assert(() => {
if (scheduler_.debugPrintScheduleFrameStacks) {

ensureFrameCallbacksRegistered();
Window.instance.scheduleFrame();
_hasScheduledFrame = true;
hasScheduledFrame = true;
if (!framesEnabled)
if (!framesEnabled) {
}
if (_hasScheduledFrame)
if (hasScheduledFrame) {
}
D.assert(() => {
if (scheduler_.debugPrintScheduleFrameStacks) {

ensureFrameCallbacksRegistered();
Window.instance.scheduleFrame();
_hasScheduledFrame = true;
hasScheduledFrame = true;
bool _warmUpFrame = false;
if (_warmUpFrame || schedulerPhase != SchedulerPhase.idle)
if (_warmUpFrame || schedulerPhase != SchedulerPhase.idle) {
}
bool hadScheduledFrame = _hasScheduledFrame;
var hadScheduledFrame = hasScheduledFrame;
D.assert(_warmUpFrame);
D.assert(result: _warmUpFrame);
D.assert(_warmUpFrame);
D.assert(result: _warmUpFrame);
handleDrawFrame();
// We call resetEpoch after this frame so that, in the hot reload case,
// the very next frame pretends to have occurred immediately after this

// then skipping every frame and finishing in the new time.
resetEpoch();
_warmUpFrame = false;
if (hadScheduledFrame)
if (hadScheduledFrame) {
}
return null;
});

return FutureOr.nil;
}));
}
TimeSpan? _firstRawTimeStampInEpoch;
TimeSpan _epochStart = TimeSpan.Zero;
TimeSpan _lastRawTimeStamp = TimeSpan.Zero;
_epochStart = _adjustForEpoch(_lastRawTimeStamp);
_epochStart = _adjustForEpoch(rawTimeStamp: currentSystemFrameTimeStamp);
_firstRawTimeStampInEpoch = null;
}

_epochStart.Ticks);
}
public TimeSpan currentFrameTimeStamp {
get {
D.assert(_currentFrameTimeStamp != null);
return _currentFrameTimeStamp.Value;
}
}
TimeSpan? _currentFrameTimeStamp;
public TimeSpan currentSystemFrameTimeStamp => _lastRawTimeStamp;
int _debugFrameNumber = 0;
string _debugBanner;
bool _ignoreNextEngineDrawFrame = false;
D.assert(!_ignoreNextEngineDrawFrame);
D.assert(result: !_ignoreNextEngineDrawFrame);
handleBeginFrame(rawTimeStamp);
handleBeginFrame(rawTimeStamp: rawTimeStamp);
}
void _handleDrawFrame() {

public void handleBeginFrame(TimeSpan? rawTimeStamp) {
Timeline.startSync("Frame");
D.setDebugLog(_debugLog: UIWidgetsPanelWrapper.current.ShowDebugLog);
_currentFrameTimeStamp = _adjustForEpoch(rawTimeStamp ?? _lastRawTimeStamp);
_currentFrameTimeStamp = _adjustForEpoch(rawTimeStamp ?? currentSystemFrameTimeStamp);
if (rawTimeStamp != null)
_lastRawTimeStamp = rawTimeStamp.Value;
if (rawTimeStamp != null) {
currentSystemFrameTimeStamp = rawTimeStamp.Value;
}
StringBuilder frameTimeStampDescription = new StringBuilder();
var frameTimeStampDescription = new StringBuilder();
_debugDescribeTimeStamp(_currentFrameTimeStamp.Value, frameTimeStampDescription);
_debugDescribeTimeStamp(timeStamp: _currentFrameTimeStamp.Value,
buffer: frameTimeStampDescription);
}
else {
frameTimeStampDescription.Append("(warm-up frame)");

$"▄▄▄▄▄▄▄▄ Frame {_debugFrameNumber.ToString().PadRight(7)} ${frameTimeStampDescription.ToString().PadLeft(18)} ▄▄▄▄▄▄▄▄";
if (scheduler_.debugPrintBeginFrameBanner)
Debug.Log(_debugBanner);
if (scheduler_.debugPrintBeginFrameBanner) {
Debug.Log(message: _debugBanner);
}
D.assert(_schedulerPhase == SchedulerPhase.idle);
_hasScheduledFrame = false;
D.assert(schedulerPhase == SchedulerPhase.idle);
hasScheduledFrame = false;
_schedulerPhase = SchedulerPhase.transientCallbacks;
schedulerPhase = SchedulerPhase.transientCallbacks;
if (!_removedIds.Contains(entry.Key)) {
if (!_removedIds.Contains(item: entry.Key)) {
entry.Value.callback, _currentFrameTimeStamp.Value, entry.Value.debugStack);
callback: entry.Value.callback, timeStamp: _currentFrameTimeStamp.Value,
callbackStack: entry.Value.debugStack);
}
}

_schedulerPhase = SchedulerPhase.midFrameMicrotasks;
D.setDebugLog(true);
schedulerPhase = SchedulerPhase.midFrameMicrotasks;
D.assert(_schedulerPhase == SchedulerPhase.midFrameMicrotasks);
D.setDebugLog(_debugLog: UIWidgetsPanelWrapper.current.ShowDebugLog);
D.assert(schedulerPhase == SchedulerPhase.midFrameMicrotasks);
_schedulerPhase = SchedulerPhase.persistentCallbacks;
foreach (FrameCallback callback in _persistentCallbacks)
_invokeFrameCallback(callback, _currentFrameTimeStamp.Value);
schedulerPhase = SchedulerPhase.persistentCallbacks;
foreach (var callback in _persistentCallbacks) {
_invokeFrameCallback(callback: callback, timeStamp: _currentFrameTimeStamp.Value);
}
_schedulerPhase = SchedulerPhase.postFrameCallbacks;
var localPostFrameCallbacks = new List<FrameCallback>(_postFrameCallbacks);
schedulerPhase = SchedulerPhase.postFrameCallbacks;
var localPostFrameCallbacks = new List<FrameCallback>(collection: _postFrameCallbacks);
foreach (FrameCallback callback in localPostFrameCallbacks)
_invokeFrameCallback(callback, _currentFrameTimeStamp.Value);
foreach (var callback in localPostFrameCallbacks) {
_invokeFrameCallback(callback: callback, timeStamp: _currentFrameTimeStamp.Value);
}
_schedulerPhase = SchedulerPhase.idle;
D.setDebugLog(true);
schedulerPhase = SchedulerPhase.idle;
if (scheduler_.debugPrintEndFrameBanner)
Debug.Log(new string('▀', _debugBanner.Length));
if (scheduler_.debugPrintEndFrameBanner) {
Debug.Log(new string('▀', count: _debugBanner.Length));
}
_debugBanner = null;
return true;
});

void _profileFramePostEvent(int frameNumber, FrameTiming frameTiming) {
developer_.postEvent("Flutter.Frame", new Hashtable {
{"number", frameNumber},
{"startTime", frameTiming.timestampInMicroseconds(FramePhase.buildStart)},
{"startTime", frameTiming.timestampInMicroseconds(phase: FramePhase.buildStart)},
{"raster", (int) (frameTiming.rasterDuration.TotalMilliseconds * 1000)},
{"raster", (int) (frameTiming.rasterDuration.TotalMilliseconds * 1000)}
if (timeStamp.TotalDays > 0)
buffer.AppendFormat("{0}d ", timeStamp.Days);
if (timeStamp.TotalHours > 0)
buffer.AppendFormat("{0}h ", timeStamp.Hours);
if (timeStamp.TotalMinutes > 0)
buffer.AppendFormat("{0}m ", timeStamp.Minutes);
if (timeStamp.TotalSeconds > 0)
buffer.AppendFormat("{0}s ", timeStamp.Seconds);
buffer.AppendFormat("{0}", timeStamp.Milliseconds);
if (timeStamp.TotalDays > 0) {
buffer.AppendFormat("{0}d ", arg0: timeStamp.Days);
}
if (timeStamp.TotalHours > 0) {
buffer.AppendFormat("{0}h ", arg0: timeStamp.Hours);
}
if (timeStamp.TotalMinutes > 0) {
buffer.AppendFormat("{0}m ", arg0: timeStamp.Minutes);
}
if (timeStamp.TotalSeconds > 0) {
buffer.AppendFormat("{0}s ", arg0: timeStamp.Seconds);
}
buffer.AppendFormat("{0}", arg0: timeStamp.Milliseconds);
int microseconds = (int) (timeStamp.Ticks % 10000 / 10);
if (microseconds > 0)
var microseconds = (int) (timeStamp.Ticks % 10000 / 10);
if (microseconds > 0) {
}
buffer.Append("ms");
}

});
try {
callback(timeStamp);
callback(timeStamp: timeStamp);
yield return DiagnosticsNode.message("\nThis exception was thrown in the context of a scheduler callback. " +
"When the scheduler callback was _registered_ (as opposed to when the " +
"exception was thrown), this was the stack:");
StringBuilder builder = new StringBuilder();
yield return DiagnosticsNode.message(
"\nThis exception was thrown in the context of a scheduler callback. " +
"When the scheduler callback was _registered_ (as opposed to when the " +
"exception was thrown), this was the stack:");
var builder = new StringBuilder();
builder.AppendLine(line);
builder.AppendLine(value: line);
library: "scheduler library",
context: new ErrorDescription("during a scheduler callback"),
"scheduler library",
new ErrorDescription("during a scheduler callback"),
informationCollector: callbackStack == null
? (InformationCollector) null
: infoCollector

public static partial class scheduler_ {
public static bool defaultSchedulingStrategy(int priority, SchedulerBinding scheduler) {
if (scheduler.transientCallbackCount > 0)
if (scheduler.transientCallbackCount > 0) {
}
return true;
}
}

754
com.unity.uiwidgets/Runtime/ui2/text.cs
文件差异内容过多而无法显示
查看文件

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


using System.Linq;
using System.Text;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.engine;
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 static bool showPerformanceOverlayOverride = false;
public static bool debugShowWidgetInspectorOverride = false;
public static bool debugAllowBannerOverride = true;
public static readonly Dictionary<LogicalKeySet, Intent> _defaultShortcuts =
new Dictionary<LogicalKeySet, Intent> {
// Activation
{new LogicalKeySet(key1: LogicalKeyboardKey.enter), new Intent(key: ActivateAction.key)},
{new LogicalKeySet(key1: LogicalKeyboardKey.space), new Intent(key: ActivateAction.key)},
{new LogicalKeySet(key1: LogicalKeyboardKey.gameButtonA), new Intent(key: ActivateAction.key)},
// Keyboard traversal.
{new LogicalKeySet(key1: LogicalKeyboardKey.tab), new Intent(key: NextFocusAction.key)}, {
new LogicalKeySet(key1: LogicalKeyboardKey.shift, key2: LogicalKeyboardKey.tab),
new Intent(key: PreviousFocusAction.key)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowLeft),
new DirectionalFocusIntent(direction: TraversalDirection.left)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowRight),
new DirectionalFocusIntent(direction: TraversalDirection.right)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowDown),
new DirectionalFocusIntent(direction: TraversalDirection.down)
},
{new LogicalKeySet(key1: LogicalKeyboardKey.arrowUp), new DirectionalFocusIntent()},
// Scrolling
{
new LogicalKeySet(key1: LogicalKeyboardKey.control, key2: LogicalKeyboardKey.arrowUp),
new ScrollIntent(direction: AxisDirection.up)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.control, key2: LogicalKeyboardKey.arrowDown),
new ScrollIntent(direction: AxisDirection.down)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.control, key2: LogicalKeyboardKey.arrowLeft),
new ScrollIntent(direction: AxisDirection.left)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.control, key2: LogicalKeyboardKey.arrowRight),
new ScrollIntent(direction: AxisDirection.right)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.pageUp),
new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)
}, {
new LogicalKeySet(key1: 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 LogicalKeySet(key1: LogicalKeyboardKey.space), new Intent(key: ActivateAction.key)},
// Keyboard traversal.
{new LogicalKeySet(key1: LogicalKeyboardKey.tab), new Intent(key: NextFocusAction.key)}, {
new LogicalKeySet(key1: LogicalKeyboardKey.shift, key2: LogicalKeyboardKey.tab),
new Intent(key: PreviousFocusAction.key)
},
// Scrolling
{new LogicalKeySet(key1: LogicalKeyboardKey.arrowUp), new ScrollIntent(direction: AxisDirection.up)}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowDown),
new ScrollIntent(direction: AxisDirection.down)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowLeft),
new ScrollIntent(direction: AxisDirection.left)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowRight),
new ScrollIntent(direction: AxisDirection.right)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.pageUp),
new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)
}, {
new LogicalKeySet(key1: 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(key1: LogicalKeyboardKey.enter), new Intent(key: ActivateAction.key)},
{new LogicalKeySet(key1: LogicalKeyboardKey.space), new Intent(key: ActivateAction.key)},
// Keyboard traversal
{new LogicalKeySet(key1: LogicalKeyboardKey.tab), new Intent(key: NextFocusAction.key)}, {
new LogicalKeySet(key1: LogicalKeyboardKey.shift, key2: LogicalKeyboardKey.tab),
new Intent(key: PreviousFocusAction.key)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowLeft),
new DirectionalFocusIntent(direction: TraversalDirection.left)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowRight),
new DirectionalFocusIntent(direction: TraversalDirection.right)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.arrowDown),
new DirectionalFocusIntent(direction: TraversalDirection.down)
},
{new LogicalKeySet(key1: LogicalKeyboardKey.arrowUp), new DirectionalFocusIntent()},
// Scrolling
{
new LogicalKeySet(key1: LogicalKeyboardKey.meta, key2: LogicalKeyboardKey.arrowUp),
new ScrollIntent(direction: AxisDirection.up)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.meta, key2: LogicalKeyboardKey.arrowDown),
new ScrollIntent(direction: AxisDirection.down)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.meta, key2: LogicalKeyboardKey.arrowLeft),
new ScrollIntent(direction: AxisDirection.left)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.meta, key2: LogicalKeyboardKey.arrowRight),
new ScrollIntent(direction: AxisDirection.right)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.pageUp),
new ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page)
}, {
new LogicalKeySet(key1: LogicalKeyboardKey.pageDown),
new ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page)
}
};
/// 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 readonly Dictionary<LocalKey, ActionFactory> actions;
public readonly bool checkerboardOffscreenLayers;
public readonly bool checkerboardRasterCacheImages;
public readonly Color color;
public readonly bool debugShowCheckedModeBanner;
public readonly bool debugShowWidgetInspector;
public readonly InspectorSelectButtonBuilder inspectorSelectButtonBuilder;
public readonly Locale locale;
public readonly LocaleListResolutionCallback localeListResolutionCallback;
public readonly LocaleResolutionCallback localeResolutionCallback;
public readonly List<LocalizationsDelegate> localizationsDelegates;
public readonly InitialRouteListFactory onGenerateInitialRoutes;
public readonly InitialRouteListFactory onGenerateInitialRoutes;
public readonly GenerateAppTitle onGenerateTitle;
public readonly TextStyle textStyle;
public readonly Window window;
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public readonly Locale locale;
public readonly List<LocalizationsDelegate> localizationsDelegates;
public readonly LocaleListResolutionCallback localeListResolutionCallback;
public readonly LocaleResolutionCallback localeResolutionCallback;
public readonly bool showSemanticsDebugger;
public readonly TextStyle textStyle;
public readonly GenerateAppTitle onGenerateTitle;
public readonly Color color;
public readonly InspectorSelectButtonBuilder inspectorSelectButtonBuilder;
public static bool showPerformanceOverlayOverride = false;
public static bool debugShowWidgetInspectorOverride = false;
public static bool debugAllowBannerOverride = true;
public readonly bool debugShowCheckedModeBanner;
public readonly bool checkerboardRasterCacheImages;
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 readonly Window window;
public WidgetsApp(
Key key = null,
GlobalKey<NavigatorState> navigatorKey = null,

InspectorSelectButtonBuilder inspectorSelectButtonBuilder = null,
Dictionary<LogicalKeySet, Intent> shortcuts = null,
Dictionary<LocalKey, ActionFactory> actions = null
) : base(key) {
) : base(key: key) {
routes = routes ?? new Dictionary<string, WidgetBuilder>();
supportedLocales = supportedLocales ?? new List<Locale> {new Locale("en", "US")};
window = Window.instance;

this.inspectorSelectButtonBuilder = inspectorSelectButtonBuilder;
this.shortcuts = shortcuts;
this.actions = actions;
);
);
!this.routes.ContainsKey(Navigator.defaultRouteName),
!this.routes.ContainsKey(key: Navigator.defaultRouteName),
() => "If the home property is specified, the routes table " +
"cannot include an entry for \" / \", since it would be redundant."
);

home != null ||
this.routes.ContainsKey(Navigator.defaultRouteName) ||
this.routes.ContainsKey(key: Navigator.defaultRouteName) ||
onGenerateRoute != null ||
onUnknownRoute != null,
() => "Either the home property must be specified, " +

"app is started with an intent that specifies an unknown route."
);
D.assert(
(home != null ||
routes.isNotEmpty() ||
onGenerateRoute != null ||
onUnknownRoute != null)
home != null ||
routes.isNotEmpty() ||
onGenerateRoute != null ||
onUnknownRoute != null
(builder != null &&
navigatorKey == null &&
initialRoute == null &&
navigatorObservers.isEmpty()),()=>
"If no route is provided using " +
"home, routes, onGenerateRoute, or onUnknownRoute, " +
"a non-null callback for the builder property must be provided, " +
"and the other navigator-related properties, " +
"navigatorKey, initialRoute, and navigatorObservers, " +
"must have their initial values " +
"(null, null, and the empty list, respectively).");
builder != null &&
navigatorKey == null &&
initialRoute == null &&
navigatorObservers.isEmpty(), () =>
"If no route is provided using " +
"home, routes, onGenerateRoute, or onUnknownRoute, " +
"a non-null callback for the builder property must be provided, " +
"and the other navigator-related properties, " +
"navigatorKey, initialRoute, and navigatorObservers, " +
"must have their initial values " +
"(null, null, and the empty list, respectively).");
D.assert(
builder != null ||

"pageRouteBuilder must be specified so that the default handler " +
"will know what kind of PageRoute transition to build."
);
}
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)},
};
switch (Application.platform) {
case RuntimePlatform.Android:
//case TargetPlatform.fuchsia:

// No keyboard support on iOS yet.
break;
}
/// 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()},
};
Locale _locale;
GlobalKey<NavigatorState> _navigator;
List<LocalizationsDelegate> _localizationsDelegates {
get {
var _delegates = new List<LocalizationsDelegate>();
if (widget.localizationsDelegates != null) {
_delegates.AddRange(collection: widget.localizationsDelegates);
}
_delegates.Add(item: DefaultWidgetsLocalizations.del);
return _delegates;
}
}
public void didChangeMetrics() {
setState();
}

}
public void didChangeLocales(List<Locale> locale) {
Locale newLocale = _resolveLocales(locale, widget.supportedLocales);
var newLocale = _resolveLocales(preferredLocales: locale, supportedLocales: widget.supportedLocales);
List<LocalizationsDelegate> _localizationsDelegates {
get {
List<LocalizationsDelegate> _delegates = new List<LocalizationsDelegate>();
if (widget.localizationsDelegates != null) {
_delegates.AddRange(widget.localizationsDelegates);
}
public Future<bool> didPopRoute() {
///async
D.assert(result: mounted);
var navigator = _navigator?.currentState;
if (navigator == null) {
return Future.value(false).to<bool>();
}
return navigator.maybePop<bool>();
}
_delegates.Add(DefaultWidgetsLocalizations.del);
return _delegates;
public Future<bool> didPushRoute(string route) {
D.assert(result: mounted);
var navigator = _navigator?.currentState;
if (navigator == null) {
return Future.value(false).to<bool>();
navigator.pushNamed<bool>(routeName: route);
return Future.value(true).to<bool>();
}
public void didChangeAccessibilityFeatures() {
}
public override void initState() {

_resolveLocales(new List<Locale> {new Locale("en", "US")}, widget.supportedLocales);
_resolveLocales(new List<Locale> {new Locale("en", "US")}, supportedLocales: widget.supportedLocales);
base.didUpdateWidget(oldWidget);
base.didUpdateWidget(oldWidget: oldWidget);
if (widget.navigatorKey != ((WidgetsApp) oldWidget).navigatorKey) {
_updateNavigator();
}

base.dispose();
}
GlobalKey<NavigatorState> _navigator;
void _updateNavigator() {
_navigator = widget.navigatorKey ?? new GlobalObjectKey<NavigatorState>(this);

var name = settings.name;
var pageContentBuilder = name == Navigator.defaultRouteName && widget.home != null
? context => widget.home
: widget.routes.getOrDefault(name);
: widget.routes.getOrDefault(key: name);
if (pageContentBuilder != null) {
D.assert(widget.pageRouteBuilder != null,

settings,
pageContentBuilder
settings: settings,
builder: pageContentBuilder
);
D.assert(route != null,
() => "The pageRouteBuilder for WidgetsApp must return a valid non-null Route.");

if (widget.onGenerateRoute != null) {
return widget.onGenerateRoute(settings);
return widget.onGenerateRoute(settings: settings);
public Future<bool> didPopRoute() {
///async
D.assert(mounted);
var navigator = _navigator?.currentState;
if (navigator == null) {
return Future.value(false).to<bool>();
}
return navigator.maybePop<bool>();
}
public Future<bool> didPushRoute(string route) {
D.assert(mounted);
var navigator = _navigator?.currentState;
if (navigator == null) {
return Future.value(false).to<bool>();
}
navigator.pushNamed<bool>(route);
return Future.value(true).to<bool>();
}
public void didChangeAccessibilityFeatures() {}
$"Generators for routes are searched for in the following order:\n" +
"Generators for routes are searched for in the following order:\n" +
" 1. For the \"/\" route, the \"home\" property, if non-null, is used.\n" +
" 2. Otherwise, the \"routes\" table is used, if it has an entry for " +
"the route.\n" +

return true;
});
var result = widget.onUnknownRoute(settings) as Route<object>;
var result = widget.onUnknownRoute(settings: settings) as Route<object>;
D.assert(() => {
if (result == null) {
throw new UIWidgetsError(

return result;
}
Locale _locale;
Locale locale =
widget.localeListResolutionCallback(preferredLocales, widget.supportedLocales);
var locale =
widget.localeListResolutionCallback(locales: preferredLocales,
supportedLocales: widget.supportedLocales);
if (locale != null) {
return locale;
}

Locale locale = widget.localeResolutionCallback(
var locale = widget.localeResolutionCallback(
widget.supportedLocales
supportedLocales: widget.supportedLocales
);
if (locale != null) {
return locale;

return basicLocaleListResolution(preferredLocales, supportedLocales);
return basicLocaleListResolution(preferredLocales: preferredLocales, supportedLocales: supportedLocales);
}

}
Dictionary<string, Locale> allSupportedLocales = new Dictionary<string, Locale>();
Dictionary<string, Locale> languageAndCountryLocales = new Dictionary<string, Locale>();
Dictionary<string, Locale> languageAndScriptLocales = new Dictionary<string, Locale>();
Dictionary<string, Locale> languageLocales = new Dictionary<string, Locale>();
Dictionary<string, Locale> countryLocales = new Dictionary<string, Locale>();
foreach (Locale locale in supportedLocales) {
var allSupportedLocales = new Dictionary<string, Locale>();
var languageAndCountryLocales = new Dictionary<string, Locale>();
var languageAndScriptLocales = new Dictionary<string, Locale>();
var languageLocales = new Dictionary<string, Locale>();
var countryLocales = new Dictionary<string, Locale>();
foreach (var locale in supportedLocales) {
languageLocales.putIfAbsent(locale.languageCode, () => locale);
countryLocales.putIfAbsent(locale.countryCode, () => locale);
languageLocales.putIfAbsent(key: locale.languageCode, () => locale);
countryLocales.putIfAbsent(key: locale.countryCode, () => locale);
for (int localeIndex = 0; localeIndex < preferredLocales.Count; localeIndex++) {
Locale userLocale = preferredLocales[localeIndex];
for (var localeIndex = 0; localeIndex < preferredLocales.Count; localeIndex++) {
var userLocale = preferredLocales[index: localeIndex];
if (allSupportedLocales.ContainsKey(userLocale.languageCode + "_" + userLocale.scriptCode + "_" +
userLocale.countryCode)) {
return userLocale;

Locale match = null;
if (languageAndScriptLocales.TryGetValue(userLocale.languageCode + "_" + userLocale.scriptCode,
out match)) {
value: out match)) {
if (match != null) {
return match;
}

//Locale match = languageAndCountryLocales['${userLocale.languageCode}_${userLocale.countryCode}'];
Locale match = null;
if (languageAndCountryLocales.TryGetValue(userLocale.languageCode + "_" + userLocale.countryCode,
out match)) {
value: out match)) {
if (match != null) {
return match;
}

return matchesLanguageCode;
}
if (languageLocales.ContainsKey(userLocale.languageCode)) {
matchesLanguageCode = languageLocales[userLocale.languageCode];
if (languageLocales.ContainsKey(key: userLocale.languageCode)) {
matchesLanguageCode = languageLocales[key: userLocale.languageCode];
if (localeIndex == 0 &&
!(localeIndex + 1 < preferredLocales.Count && preferredLocales[localeIndex + 1].languageCode ==

if (matchesCountryCode == null && userLocale.countryCode != null) {
if (countryLocales.ContainsKey(userLocale.countryCode)) {
matchesCountryCode = countryLocales[userLocale.countryCode];
if (countryLocales.ContainsKey(key: userLocale.countryCode)) {
matchesCountryCode = countryLocales[key: userLocale.countryCode];
Locale resolvedLocale = matchesLanguageCode ?? matchesCountryCode ?? supportedLocales.first();
var resolvedLocale = matchesLanguageCode ?? matchesCountryCode ?? supportedLocales.first();
return resolvedLocale;
}

}
HashSet<Type> unsupportedTypes = new HashSet<Type>();
var unsupportedTypes = new HashSet<Type>();
unsupportedTypes.Add(_delegate.type);
unsupportedTypes.Add(item: _delegate.type);
foreach ( LocalizationsDelegate _delegate in _localizationsDelegates) {
if (!unsupportedTypes.Contains(_delegate.type))
foreach (var _delegate in _localizationsDelegates) {
if (!unsupportedTypes.Contains(item: _delegate.type)) {
if (_delegate.isSupported(appLocale))
unsupportedTypes.Remove(_delegate.type);
}
if (_delegate.isSupported(locale: appLocale)) {
unsupportedTypes.Remove(item: _delegate.type);
}
if (unsupportedTypes.isEmpty())
if (unsupportedTypes.isEmpty()) {
List<string> list = new List<string> {"CupertinoLocalizations"};
List<string> unsupportedTypesList = new List<string>();
}
var list = new List<string> {"CupertinoLocalizations"};
var unsupportedTypesList = new List<string>();
if (unsupportedTypesList.SequenceEqual(list))
if (unsupportedTypesList.SequenceEqual(second: list)) {
}
StringBuilder message = new StringBuilder();
var message = new StringBuilder();
"localization delegates."
);
foreach ( Type unsupportedType in unsupportedTypes) {
if (unsupportedType.ToString() == "CupertinoLocalizations")
"localization delegates."
);
foreach (var unsupportedType in unsupportedTypes) {
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."
"information about configuring an app's locale, supportedLocales,\n" +
"and localizationsDelegates parameters."
);
"information about configuring an app's locale, supportedLocales,\n" +
"and localizationsDelegates parameters."
);
return true;
});
return true;

Widget navigator = null;
if (_navigator != null) {
RouteListFactory routeListFactory = (state, route) => {return widget.onGenerateInitialRoutes(route); };
RouteListFactory routeListFactory = (state, route) => {
return widget.onGenerateInitialRoutes(initialRoute: route);
};
initialRoute:
WidgetsBinding.instance.window.defaultRouteName != Navigator.defaultRouteName
initialRoute: WidgetsBinding.instance.window.defaultRouteName != Navigator.defaultRouteName
? WidgetsBinding.instance.window.defaultRouteName
: widget.initialRoute ?? WidgetsBinding.instance.window.defaultRouteName,
onGenerateRoute: _onGenerateRoute,

);
}
builder: _context => { return widget.builder(_context, navigator); }
);
builder: context1 => { return widget.builder(context: context, child: navigator); });
}
else {
D.assert(navigator != null);

}
PerformanceOverlay performanceOverlay = null;
} else if (widget.checkerboardRasterCacheImages || widget.checkerboardOffscreenLayers) {
}
else if (widget.checkerboardRasterCacheImages || widget.checkerboardOffscreenLayers) {
performanceOverlay = new PerformanceOverlay(
checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers

new Positioned(top: 0.0f,
left: 0.0f,
right: 0.0f,
child: performanceOverlay)
});
new Positioned(top: 0.0f, left: 0.0f, right: 0.0f, child: performanceOverlay)
}
);
D.assert(() => {
if (widget.debugShowWidgetInspector || WidgetsApp.debugShowWidgetInspectorOverride) {

);
}
return true;
});

builder: (BuildContext context1)=> {
string title1 = widget.onGenerateTitle(context1);
D.assert(title1 != null,()=> "onGenerateTitle must return a non-null String");
return new Title(
title: title1,
color: widget.color,
child: result
);
}
builder: context2 => {
var _title = widget.onGenerateTitle(context: context2);
D.assert(_title != null, () => "onGenerateTitle must return a non-null String");
return new Title(
title: _title,
color: widget.color,
child: result
);
}
} else {
}
else {
title = new Title(
title: widget.title,
color: widget.color,

Locale appLocale = widget.locale != null
? _resolveLocales(new List<Locale> {widget.locale}, widget.supportedLocales)
var appLocale = widget.locale != null
? _resolveLocales(new List<Locale> {widget.locale}, supportedLocales: widget.supportedLocales)
D.assert(_debugCheckLocalizations(appLocale));
result = new Shortcuts(
D.assert(_debugCheckLocalizations(appLocale: appLocale));
return new Shortcuts(
shortcuts: widget.shortcuts ?? WidgetsApp.defaultShortcuts,
debugLabel: "<Default WidgetsApp Shortcuts>",
child: new Actions(

)
)
);
return result;
return new _InspectorSelectButton(onPressed);
return new _InspectorSelectButton(onPressed: onPressed);
public readonly Widget child;
public readonly Widget child;
class _MediaQueryFromWindowsState : State<_MediaQueryFromWindow>,WidgetsBindingObserver {
public override void initState() {
base.initState();
WidgetsBinding.instance.addObserver(this);
class _MediaQueryFromWindowsState : State<_MediaQueryFromWindow>, WidgetsBindingObserver {
public void didChangeAccessibilityFeatures() {
setState(() => { });
public void didChangeAccessibilityFeatures() {
setState(()=> {
});
public void didChangeMetrics() {
setState(() => { });
public void didChangeMetrics() {
setState(()=>{
});
public void didChangeTextScaleFactor() {
setState(() => { });
public void didChangeTextScaleFactor() {
setState(()=> {
});
}
setState(()=> {
});
setState(() => { });
}
public void didChangeLocales(List<Locale> locale) {

throw new NotImplementedException();
}
public override void initState() {
base.initState();
WidgetsBinding.instance.addObserver(this);
}
data: MediaQueryData.fromWindow(WidgetsBinding.instance.window),
data: MediaQueryData.fromWindow(window: WidgetsBinding.instance.window),
class _InspectorSelectButton : StatelessWidget {
public readonly GestureTapCallback onPressed;

) : base(key) {
) : base(key: key) {
this.onPressed = () => onPressed();
}

288
com.unity.uiwidgets/Runtime/widgets/image.cs


using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Object = System.Object;
using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.widgets {

bundle: DefaultAssetBundle.of(context),
devicePixelRatio: MediaQuery.of(context, nullOk: true)?.devicePixelRatio ?? 1.0f,
locale: Localizations.localeOf(context, nullOk: true),
DefaultAssetBundle.of(context: context),
MediaQuery.of(context: context, true)?.devicePixelRatio ?? 1.0f,
Localizations.localeOf(context: context, true),
size: size,
platform: Application.platform
);

Size size = null,
ImageErrorListener onError = null
) {
ImageConfiguration config = createLocalImageConfiguration(context, size: size);
Completer completer = Completer.create();
ImageStream stream = provider.resolve(config);
var config = createLocalImageConfiguration(context: context, size: size);
var completer = Completer.create();
var stream = provider.resolve(configuration: config);
(ImageInfo image, bool sync)=> {
if (!completer.isCompleted) {
completer.complete();
}
SchedulerBinding.instance.addPostFrameCallback((TimeSpan timeStamp)=> {
stream.removeListener(listener);
});
},
onError: (Exception error) =>{
if (!completer.isCompleted) {
completer.complete();
}
stream.removeListener(listener);
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("image failed to precache"),
library: "image resource service",
silent: true));
(image, sync) => {
if (!completer.isCompleted) {
completer.complete();
}
SchedulerBinding.instance.addPostFrameCallback(timeStamp => {
stream.removeListener(listener: listener);
});
},
onError: error => {
if (!completer.isCompleted) {
completer.complete();
}
stream.removeListener(listener: listener);
UIWidgetsError.reportError(new UIWidgetsErrorDetails(
context: new ErrorDescription("image failed to precache"),
library: "image resource service",
silent: true));
stream.addListener(listener);
stream.addListener(listener: listener);
}
}

public delegate Widget ImageErrorWidgetBuilder(
BuildContext context,
Object error,
object error,
public readonly AlignmentGeometry alignment;
public readonly Rect centerSlice;
public readonly Color color;
public readonly BlendMode colorBlendMode;
public readonly ImageErrorWidgetBuilder errorBuilder;
public readonly FilterQuality filterQuality;
public readonly BoxFit? fit;
public readonly ImageFrameBuilder frameBuilder;
public readonly bool gaplessPlayback;
public readonly float? height;
public readonly ImageProvider image;
public readonly ImageLoadingBuilder loadingBuilder;
public readonly bool matchTextDirection;
public readonly ImageRepeat repeat;
public readonly float? width;
public Image(
Key key = null,
ImageProvider image = null,

int? cacheWidth = null,
int? cacheHeight = null
) {
var image = ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight,
new NetworkImage(src, scale: scale, headers: headers));
var image = ResizeImage.resizeIfNeeded(cacheWidth: cacheWidth, cacheHeight: cacheHeight,
new NetworkImage(url: src, scale: scale, headers: headers));
return new Image(
key: key,
image: image,

alignment: alignment,
repeat: repeat,
centerSlice: centerSlice,
matchTextDirection : matchTextDirection,
matchTextDirection: matchTextDirection,
gaplessPlayback: gaplessPlayback,
filterQuality: filterQuality
);

BlendMode colorBlendMode = BlendMode.srcIn,
BoxFit? fit = null,
AlignmentGeometry alignment = null,
ImageRepeat repeat = ImageRepeat.noRepeat,
ImageRepeat repeat = ImageRepeat.noRepeat,
bool matchTextDirection = false,
Rect centerSlice = null,
bool gaplessPlayback = false,

) {
var fileImage = ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight, new FileImage(file, scale: scale));
var fileImage = ResizeImage.resizeIfNeeded(cacheWidth: cacheWidth, cacheHeight: cacheHeight,
new FileImage(file: file, scale: scale));
loadingBuilder: null,
null,
errorBuilder: errorBuilder,
width: width,
height: height,

) {
var _scale = scale ?? 1.0f;
var _image = scale != null
? (AssetBundleImageProvider) new ExactAssetImage(name, bundle: bundle, scale: _scale)
: new AssetImage(name, bundle: bundle);
var _Image = ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight, _image);
? (AssetBundleImageProvider) new ExactAssetImage(assetName: name, bundle: bundle, scale: _scale)
: new AssetImage(assetName: name, bundle: bundle);
var _Image = ResizeImage.resizeIfNeeded(cacheWidth: cacheWidth, cacheHeight: cacheHeight, provider: _image);
loadingBuilder: null,
null,
errorBuilder: errorBuilder,
width: width,
height: height,

int? cacheHeight = null
) {
// ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight, MemoryImage(bytes, scale: scale));
var memoryImage = new MemoryImage(bytes, scale);
var memoryImage = new MemoryImage(bytes: bytes, scale: scale);
image: ResizeImage.resizeIfNeeded(cacheWidth, cacheHeight, new MemoryImage(bytes, scale: scale)),
ResizeImage.resizeIfNeeded(cacheWidth: cacheWidth, cacheHeight: cacheHeight,
new MemoryImage(bytes: bytes, scale: scale)),
loadingBuilder: null,
null,
errorBuilder: errorBuilder,
width: width,
height: height,

alignment: alignment,
repeat: repeat,
centerSlice: centerSlice,
matchTextDirection : matchTextDirection,
matchTextDirection: matchTextDirection,
public readonly ImageProvider image;
public readonly ImageFrameBuilder frameBuilder;
public readonly ImageLoadingBuilder loadingBuilder;
public readonly ImageErrorWidgetBuilder errorBuilder;
public readonly float? width;
public readonly float? height;
public readonly Color color;
public readonly FilterQuality filterQuality;
public readonly BlendMode colorBlendMode;
public readonly BoxFit? fit;
public readonly AlignmentGeometry alignment;
public readonly ImageRepeat repeat;
public readonly Rect centerSlice;
public readonly bool gaplessPlayback;
public readonly bool matchTextDirection;
base.debugFillProperties(properties);
base.debugFillProperties(properties: properties);
properties.add(new DiagnosticsProperty<ImageProvider>("image", image));
properties.add(new DiagnosticsProperty<ImageFrameBuilder>("frameBuilder", frameBuilder));
properties.add(new DiagnosticsProperty<ImageLoadingBuilder>("loadingBuilder", loadingBuilder));
properties.add(new FloatProperty("width", width, defaultValue: foundation_.kNullDefaultValue));
properties.add(new FloatProperty("height", height, defaultValue: foundation_.kNullDefaultValue));
properties.add(new ColorProperty("color", color,
properties.add(new DiagnosticsProperty<ImageProvider>("image", value: image));
properties.add(new DiagnosticsProperty<ImageFrameBuilder>("frameBuilder", value: frameBuilder));
properties.add(new DiagnosticsProperty<ImageLoadingBuilder>("loadingBuilder", value: loadingBuilder));
properties.add(new FloatProperty("width", value: width, defaultValue: foundation_.kNullDefaultValue));
properties.add(new FloatProperty("height", value: height, defaultValue: foundation_.kNullDefaultValue));
properties.add(new ColorProperty("color", value: color,
properties.add(new EnumProperty<BlendMode>("colorBlendMode", colorBlendMode,
properties.add(new EnumProperty<BlendMode>("colorBlendMode", value: colorBlendMode,
properties.add(new EnumProperty<BoxFit?>("fit", fit, defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment,
properties.add(new EnumProperty<BoxFit?>("fit", value: fit, defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", value: alignment,
properties.add(new EnumProperty<ImageRepeat>("repeat", repeat, defaultValue: ImageRepeat.noRepeat));
properties.add(new DiagnosticsProperty<Rect>("centerSlice", centerSlice,
properties.add(new EnumProperty<ImageRepeat>("repeat", value: repeat, defaultValue: ImageRepeat.noRepeat));
properties.add(new DiagnosticsProperty<Rect>("centerSlice", value: centerSlice,
properties.add(new EnumProperty<FilterQuality>("filterQuality", filterQuality,
foundation_.kNullDefaultValue));
properties.add(new FlagProperty("matchTextDirection", value: matchTextDirection, ifTrue: "match text direction"));
properties.add(new EnumProperty<FilterQuality>("filterQuality", value: filterQuality,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new FlagProperty("matchTextDirection", value: matchTextDirection, "match text direction"));
ImageStream _imageStream;
int _frameNumber;
ImageStream _imageStream;
bool _invertColors;
bool _isListeningToStream;
object _lastException;
StackTrace _lastStack;
bool _isListeningToStream = false;
bool _invertColors;
int _frameNumber;
bool _wasSynchronouslyLoaded;
Object _lastException;
StackTrace _lastStack;
bool _wasSynchronouslyLoaded;
public void didChangeAccessibilityFeatures() {
setState(() => { _updateInvertColors(); });
}
public void didChangeMetrics() {
setState();
}
public void didChangeTextScaleFactor() {
setState();
}
public void didChangePlatformBrightness() {
setState();
}
public void didChangeLocales(List<Locale> locale) {
setState();
}
public Future<bool> didPopRoute() {
return Future.value(false).to<bool>();
}
public Future<bool> didPushRoute(string route) {
return Future.value(false).to<bool>();
}
public override void initState() {
base.initState();

_updateInvertColors();
_resolveImage();
if (TickerMode.of(context)) {
if (TickerMode.of(context: context)) {
_listenToStream();
}
else {

}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget(oldWidget);
Image image = (Image) oldWidget;
base.didUpdateWidget(oldWidget: oldWidget);
var image = (Image) oldWidget;
(widget.loadingBuilder == null) != (image.loadingBuilder == null)) {
_imageStream.removeListener(_getListener(image.loadingBuilder));
widget.loadingBuilder == null != (image.loadingBuilder == null)) {
_imageStream.removeListener(_getListener(loadingBuilder: image.loadingBuilder));
_imageStream.addListener(_getListener());
}

}
public void didChangeAccessibilityFeatures() {
setState(() => {
_updateInvertColors();
});
}
public override void reassemble() {
_resolveImage(); // in case the image cache was flushed
base.reassemble();

void _updateInvertColors() {
_invertColors = MediaQuery.of(context, nullOk: true)?.invertColors
_invertColors = MediaQuery.of(context: context, true)?.invertColors
ScrollAwareImageProvider<object> provider = new ScrollAwareImageProvider<object>(
/*ScrollAwareImageProvider<object> provider = new ScrollAwareImageProvider<object>(
imageProvider: (ImageProvider<object>)widget.image
);
ImageStream newStream =
provider.resolve(ImageUtils.createLocalImageConfiguration(
context,
size: widget.width != null && widget.height != null
? new Size(widget.width.Value, widget.height.Value)
imageProvider: widget.image);*/
var newStream =
widget.image.resolve(ImageUtils.createLocalImageConfiguration(
context: context,
widget.width != null && widget.height != null
? new Size(width: widget.width.Value, height: widget.height.Value)
_updateSourceStream(newStream);
_updateSourceStream(newStream: newStream);
}
void _onError(Exception error) {

ImageErrorListener onError = null;
if (widget.errorBuilder != null) {
onError = (Exception error) => {
onError = error => {
setState(() => {
_lastException = error;
// _lastStack = stackTrace;

return new ImageStreamListener(
_handleImageFrame,
onImage: _handleImageFrame,
onChunk: onChunk,
onError: onError
);

setState(() => { _imageInfo = null; });
}
setState(()=> {
setState(() => {
_loadingProgress = null;
_frameNumber = 0;
_wasSynchronouslyLoaded = false;

if (_isListeningToStream)
if (_isListeningToStream) {
}
}
void _listenToStream() {

public override Widget build(BuildContext context) {
if (_lastException != null) {
D.assert(widget.errorBuilder != null);
return widget.errorBuilder(context, _lastException, _lastStack);
return widget.errorBuilder(context: context, error: _lastException, stackTrace: _lastStack);
}
Widget image = new RawImage(

invertColors: _invertColors,
filterQuality: widget.filterQuality
);
if (widget.frameBuilder != null)
image = widget.frameBuilder(context, image, _frameNumber, _wasSynchronouslyLoaded);
if (widget.frameBuilder != null) {
image = widget.frameBuilder(context: context, child: image, frame: _frameNumber,
wasSynchronouslyLoaded: _wasSynchronouslyLoaded);
}
if (widget.loadingBuilder != null)
image = widget.loadingBuilder(context, image, _loadingProgress);
if (widget.loadingBuilder != null) {
image = widget.loadingBuilder(context: context, child: image, loadingProgress: _loadingProgress);
}
base.debugFillProperties(description);
description.add(new DiagnosticsProperty<ImageStream>("stream", _imageStream));
description.add(new DiagnosticsProperty<ImageInfo>("pixels", _imageInfo));
description.add(new DiagnosticsProperty<ImageChunkEvent>("loadingProgress", _loadingProgress));
description.add(new DiagnosticsProperty<int>("frameNumber", _frameNumber));
description.add(new DiagnosticsProperty<bool>("wasSynchronouslyLoaded", _wasSynchronouslyLoaded));
}
public void didChangeMetrics() {
setState();
}
public void didChangeTextScaleFactor() {
setState();
}
public void didChangePlatformBrightness() {
setState();
}
public void didChangeLocales(List<Locale> locale) {
setState();
}
public Future<bool> didPopRoute() {
return Future.value(false).to<bool>();
}
public Future<bool> didPushRoute(string route) {
return Future.value(false).to<bool>();
base.debugFillProperties(properties: description);
description.add(new DiagnosticsProperty<ImageStream>("stream", value: _imageStream));
description.add(new DiagnosticsProperty<ImageInfo>("pixels", value: _imageInfo));
description.add(new DiagnosticsProperty<ImageChunkEvent>("loadingProgress", value: _loadingProgress));
description.add(new DiagnosticsProperty<int>("frameNumber", value: _frameNumber));
description.add(new DiagnosticsProperty<bool>("wasSynchronouslyLoaded", value: _wasSynchronouslyLoaded));
}
}
}

503
com.unity.uiwidgets/Runtime/widgets/shortcuts.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
public class KeySet<T> : KeyboardKey, IEquatable<KeySet<T>> {
public static readonly List<int> _tempHashStore3 = new List<int> {0, 0, 0}; // used to sort exactly 3 keys
public static readonly List<int> _tempHashStore4 = new List<int> {0, 0, 0, 0}; // used to sort exactly 4 keys
public readonly HashSet<T> _keys;
public class KeySet<T> : KeyboardKey, IEquatable<KeySet<T>>
{
public int _hashCode;
T key2 = default(T),
T key3 = default(T),
T key4 = default(T)
T key2 = default,
T key3 = default,
T key4 = default
_keys.Add(key1);
int count = 1;
_keys.Add(item: key1);
var count = 1;
_keys.Add(key2);
_keys.Add(item: key2);
D.assert(() => {
count++;
return true;

if (key3 != null) {
_keys.Add(key3);
_keys.Add(item: key3);
D.assert(() => {
count++;
return true;

if (key4 != null) {
_keys.Add(key4);
_keys.Add(item: key4);
D.assert(() => {
count++;
return true;

() => "Two or more provided keys are identical. Each key must appear only once.");
}
public KeySet (HashSet<T> keys)
{
public KeySet(HashSet<T> keys) {
D.assert(keys.isNotEmpty);
D.assert(!keys.Contains(default(T)));
D.assert(result: keys.isNotEmpty);
D.assert(!keys.Contains(default));
_keys.Add(key);
_keys.Add(item: key);
public HashSet<T> keys
{
get { return new HashSet<T>(_keys); }
public HashSet<T> keys {
get { return new HashSet<T>(collection: _keys); }
public readonly HashSet<T> _keys;
public static readonly List<int> _tempHashStore3 = new List<int>() {0, 0, 0}; // used to sort exactly 3 keys
public static readonly List<int> _tempHashStore4 = new List<int>() {0, 0, 0, 0}; // used to sort exactly 4 keys
public int _hashCode;
public bool Equals(KeySet<T> other)
{
if (ReferenceEquals(null, other)) {
public bool Equals(KeySet<T> other) {
if (ReferenceEquals(null, objB: other)) {
if (ReferenceEquals(this, other)) {
if (ReferenceEquals(this, objB: other)) {
return Equals(_keys, other._keys) && _hashCode == other._hashCode;
return Equals(objA: _keys, objB: other._keys) && _hashCode == other._hashCode;
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) {
public override bool Equals(object obj) {
if (ReferenceEquals(null, objB: obj)) {
if (ReferenceEquals(this, obj)) {
if (ReferenceEquals(this, objB: obj)) {
return true;
}

return Equals((KeySet<T>) obj);
}
public override int GetHashCode()
{
unchecked
{
public override int GetHashCode() {
unchecked {
int length = _keys.Count;
var length = _keys.Count;
int h1 = iterator.GetHashCode();
var h1 = iterator.GetHashCode();
if (length == 1) {
// Don't do anything fancy if there's exactly one key.

iterator.MoveNext();
int h2 = iterator.GetHashCode();
var h2 = iterator.GetHashCode();
if (length == 2) {
// No need to sort if there's two keys, just compare them.
return _hashCode = h1 < h2

// Sort key hash codes and feed to hashList to ensure the aggregate
// hash code does not depend on the key order.
List<int> sortedHashes = length == 3
var sortedHashes = length == 3
? _tempHashStore3
: _tempHashStore4;
sortedHashes[0] = h1;

iterator.MoveNext();
sortedHashes[3] = iterator.GetHashCode();
}
return _hashCode = (_hashCode * 397) ^ (sortedHashes != null ? sortedHashes.GetHashCode() : 0);
return _hashCode = (_hashCode * 397) ^ (sortedHashes != null ? sortedHashes.GetHashCode() : 0);
return Equals(left, right);
return Equals(objA: left, objB: right);
return !Equals(left, right);
return !Equals(objA: left, objB: right);
public static readonly HashSet<LogicalKeyboardKey> _modifiers = new HashSet<LogicalKeyboardKey> {
LogicalKeyboardKey.alt,
LogicalKeyboardKey.control,
LogicalKeyboardKey.meta,
LogicalKeyboardKey.shift
};
public LogicalKeySet(
LogicalKeyboardKey key1,

) : base(key1: key1, key2: key2, key3: key3, key4: key4){ }
public LogicalKeySet(HashSet<LogicalKeyboardKey> keys) : base(keys) { }
) : base(key1: key1, key2: key2, key3: key3, key4: key4) {
}
public static readonly HashSet<LogicalKeyboardKey> _modifiers = new HashSet<LogicalKeyboardKey>(){
LogicalKeyboardKey.alt,
LogicalKeyboardKey.control,
LogicalKeyboardKey.meta,
LogicalKeyboardKey.shift,
};
public LogicalKeySet(HashSet<LogicalKeyboardKey> keys) : base(keys: keys) {
}
public string debugDescribeKeys() {
List<LogicalKeyboardKey> sortedKeys = keys.ToList();
public string debugDescribeKeys() {
var sortedKeys = keys.ToList();
(LogicalKeyboardKey a, LogicalKeyboardKey b) => {
bool aIsModifier = a.synonyms.isNotEmpty() || _modifiers.Contains(a);
bool bIsModifier = b.synonyms.isNotEmpty() || _modifiers.Contains(b);
if (aIsModifier && !bIsModifier) {
return -1;
} else if (bIsModifier && !aIsModifier) {
return 1;
}
return a.debugName.CompareTo(b.debugName);
}
);
var results = sortedKeys.Select((LogicalKeyboardKey key) => key.debugName.ToString());
return string.Join(" + ",results);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<HashSet<LogicalKeyboardKey>>("keys", _keys, description: debugDescribeKeys()));
}
(a, b) => {
var aIsModifier = a.synonyms.isNotEmpty() || _modifiers.Contains(item: a);
var bIsModifier = b.synonyms.isNotEmpty() || _modifiers.Contains(item: b);
if (aIsModifier && !bIsModifier) {
return -1;
}
if (bIsModifier && !aIsModifier) {
return 1;
}
return a.debugName.CompareTo(strB: b.debugName);
}
);
var results = sortedKeys.Select(key => key.debugName);
return string.Join(" + ", values: results);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(
new DiagnosticsProperty<HashSet<LogicalKeyboardKey>>("keys", value: _keys, debugDescribeKeys()));
}
object defaultValue = null,
object defaultValue = null,
name: name,
value: value,
showName: showName,
defaultValue: defaultValue ?? foundation_.kNoDefaultValue,
level: level,
description: description
)
{
}
name: name,
value: value,
showName: showName,
defaultValue: defaultValue ?? foundation_.kNoDefaultValue,
level: level,
description: description
) {
}
protected override string valueToString( TextTreeConfiguration parentConfiguration = null) {
List<string> res = new List<string>();
protected override string valueToString(TextTreeConfiguration parentConfiguration = null) {
var res = new List<string>();
string temp = "{" + key.debugDescribeKeys() + "}:" + value[key];
res.Add(temp);
var temp = "{" + key.debugDescribeKeys() + "}:" + value[key: key];
res.Add(item: temp);
return string.Join(", ", res);
return string.Join(", ", values: res);
public readonly bool modal;
public ShortcutManager(
Dictionary<LogicalKeySet, Intent> shortcuts = null,
bool modal = false
) {
shortcuts = shortcuts ?? new Dictionary<LogicalKeySet, Intent>();
this.modal = modal;
this.shortcuts = shortcuts;
Dictionary<LogicalKeySet, Intent> _shortcuts;
public ShortcutManager(
Dictionary<LogicalKeySet, Intent> shortcuts = null,
bool modal = false
) {
shortcuts = shortcuts ?? new Dictionary<LogicalKeySet, Intent>();
this.modal = modal;
this.shortcuts = shortcuts;
public readonly bool modal;
public Dictionary<LogicalKeySet, Intent> shortcuts {
get { return _shortcuts; }
set {
_shortcuts = value;
notifyListeners();
}
}
Dictionary<LogicalKeySet, Intent> _shortcuts;
public Dictionary<LogicalKeySet, Intent> shortcuts {
get { return _shortcuts; }
set {
_shortcuts = value;
notifyListeners();
}
}
public bool handleKeypress(
BuildContext context,
RawKeyEvent rawKeyEvent,
LogicalKeySet keysPressed = null
) {
if (!(rawKeyEvent is RawKeyDownEvent)) {
return false;
}
public bool handleKeypress(
BuildContext context,
RawKeyEvent rawKeyEvent,
LogicalKeySet keysPressed = null
) {
if (!(rawKeyEvent is RawKeyDownEvent)) {
return false;
}
D.assert(context != null);
LogicalKeySet keySet = keysPressed ?? new LogicalKeySet(RawKeyboard.instance.keysPressed);
Intent matchedIntent = _shortcuts[keySet];
if (matchedIntent == null) {
HashSet<LogicalKeyboardKey> pseudoKeys = new HashSet<LogicalKeyboardKey>{};
foreach (LogicalKeyboardKey setKey in keySet.keys) {
HashSet<LogicalKeyboardKey> synonyms = setKey.synonyms;
if (synonyms.isNotEmpty()) {
D.assert(context != null);
/*LogicalKeySet keySet = keysPressed ?? new LogicalKeySet(RawKeyboard.instance.keysPressed);
Intent matchedIntent = _shortcuts[keySet];
if (matchedIntent == null) {
pseudoKeys.Add(synonyms.First());
} else {
pseudoKeys.Add(setKey);
HashSet<LogicalKeyboardKey> pseudoKeys = new HashSet<LogicalKeyboardKey>{};
foreach (LogicalKeyboardKey setKey in keySet.keys) {
HashSet<LogicalKeyboardKey> synonyms = setKey.synonyms;
if (synonyms.isNotEmpty()) {
pseudoKeys.Add(synonyms.First());
} else {
pseudoKeys.Add(setKey);
}
}
matchedIntent = _shortcuts[new LogicalKeySet(pseudoKeys)];
}
matchedIntent = _shortcuts[new LogicalKeySet(pseudoKeys)];
}
if (matchedIntent != null) {
BuildContext primaryContext = FocusManagerUtils.primaryFocus?.context;
if (primaryContext == null) {
if (matchedIntent != null) {
BuildContext primaryContext = FocusManagerUtils.primaryFocus?.context;
if (primaryContext == null) {
return false;
}
return Actions.invoke(primaryContext, matchedIntent, nullOk: true);
}*/
}
return Actions.invoke(primaryContext, matchedIntent, nullOk: true);
return false;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new DiagnosticsProperty<Dictionary<LogicalKeySet, Intent>>("shortcuts", _shortcuts));
properties.add(new FlagProperty("modal", value: modal, ifTrue: "modal", defaultValue: false));
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new DiagnosticsProperty<Dictionary<LogicalKeySet, Intent>>("shortcuts", value: _shortcuts));
properties.add(new FlagProperty("modal", value: modal, "modal", defaultValue: false));
}
public Shortcuts(
Key key = null,
ShortcutManager manager = null,
Dictionary<LogicalKeySet, Intent> shortcuts = null,
Widget child = null,
string debugLabel = null
) : base(key: key) {
this.manager = manager;
this.shortcuts = shortcuts;
this.child = child;
this.debugLabel = debugLabel;
}
public readonly ShortcutManager manager;
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public readonly Widget child;
public readonly string debugLabel;
public readonly Widget child;
public readonly string debugLabel;
public readonly ShortcutManager manager;
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public Shortcuts(
Key key = null,
ShortcutManager manager = null,
Dictionary<LogicalKeySet, Intent> shortcuts = null,
Widget child = null,
string debugLabel = null
) : base(key: key) {
this.manager = manager;
this.shortcuts = shortcuts;
this.child = child;
this.debugLabel = debugLabel;
}
public static ShortcutManager of(BuildContext context, bool nullOk = false) {
D.assert(context != null);
var inherited = context.dependOnInheritedWidgetOfExactType<_ShortcutsMarker>();
D.assert(() => {
if (nullOk) {
return true;
}
if (inherited == null) {
throw new UIWidgetsError($"Unable to find a {typeof(Shortcuts)} widget in the context.\n" +
$"{typeof(Shortcuts)}.of()was called with a context that does not contain a " +
$"{typeof(Shortcuts)} widget.\n" +
$"No {typeof(Shortcuts)} ancestor could be found starting from the context that was " +
$"passed to {typeof(Shortcuts)}.of().\n" +
"The context used was:\n" +
$" {context}");
}
return true;
});
return inherited?.notifier;
}
public static ShortcutManager of(BuildContext context, bool nullOk = false) {
D.assert(context != null);
_ShortcutsMarker inherited = context.dependOnInheritedWidgetOfExactType<_ShortcutsMarker>();
D.assert(() => {
if (nullOk) {
return true;
}
if (inherited == null) {
throw new UIWidgetsError($"Unable to find a {typeof(Shortcuts)} widget in the context.\n" +
$"{typeof(Shortcuts)}.of()was called with a context that does not contain a " +
$"{typeof(Shortcuts)} widget.\n" +
$"No {typeof(Shortcuts)} ancestor could be found starting from the context that was " +
$"passed to {typeof(Shortcuts)}.of().\n" +
"The context used was:\n" +
$" {context}");
}
return true;
});
return inherited?.notifier;
}
public override State createState() {
return new _ShortcutsState();
}
public override State createState() {
return new _ShortcutsState();
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ShortcutManager>("manager", manager, defaultValue: null));
properties.add(new ShortcutMapProperty("shortcuts", shortcuts, description: debugLabel?.isNotEmpty() ?? false ? debugLabel : null));
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new DiagnosticsProperty<ShortcutManager>("manager", value: manager, defaultValue: null));
properties.add(new ShortcutMapProperty("shortcuts", value: shortcuts,
description: debugLabel?.isNotEmpty() ?? false ? debugLabel : null));
}
private ShortcutManager _internalManager;
public ShortcutManager manager {
get { return widget.manager ?? _internalManager; }
}
ShortcutManager _internalManager;
public ShortcutManager manager {
get { return widget.manager ?? _internalManager; }
}
public override void dispose() {
_internalManager?.dispose();
base.dispose();
}
public override void initState() {
base.initState();
if (widget.manager == null) {
_internalManager = new ShortcutManager();
}
manager.shortcuts = widget.shortcuts;
}
public override void dispose() {
_internalManager?.dispose();
base.dispose();
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget((Shortcuts) oldWidget);
if (widget.manager != ((Shortcuts) oldWidget).manager) {
if (widget.manager != null) {
_internalManager?.dispose();
_internalManager = null;
}
else {
_internalManager = _internalManager ?? new ShortcutManager();
}
}
public override void initState() {
base.initState();
if (widget.manager == null) {
_internalManager = new ShortcutManager();
manager.shortcuts = widget.shortcuts;
manager.shortcuts = widget.shortcuts;
}
public bool _handleOnKey(FocusNode node, RawKeyEvent _event) {
if (node.context == null) {
return false;
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget((Shortcuts)oldWidget);
if (widget.manager != ((Shortcuts)oldWidget).manager) {
if (widget.manager != null) {
_internalManager?.dispose();
_internalManager = null;
} else {
_internalManager = _internalManager?? new ShortcutManager();
}
return manager.handleKeypress(context: node.context, rawKeyEvent: _event) || manager.modal;
manager.shortcuts = widget.shortcuts;
}
public bool _handleOnKey(FocusNode node, RawKeyEvent _event)
{
if (node.context == null) {
return false;
public override Widget build(BuildContext context) {
return new Focus(
debugLabel: typeof(Shortcuts).ToString(),
canRequestFocus: false,
onKey: _handleOnKey,
child: new _ShortcutsMarker(
manager: manager,
child: widget.child
)
);
return manager.handleKeypress(node.context, _event) || manager.modal;
}
public override Widget build(BuildContext context) {
return new Focus(
debugLabel: typeof(Shortcuts).ToString(),
canRequestFocus: false,
onKey: _handleOnKey,
child: new _ShortcutsMarker(
manager: manager,
child: widget.child
)
);
}
}
public class _ShortcutsMarker : InheritedNotifier<ShortcutManager> {

D.assert(child != null);
}
}
}
正在加载...
取消
保存