浏览代码

Merge branch 'siyaoH/1.17/android_bug' into siyaoH/1.17/android

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
7b5a9f48
共有 83 个文件被更改,包括 3122 次插入2597 次删除
  1. 60
      Samples/UIWidgetsSamples_2019_4/Assets/CountDemo.unity
  2. 15
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/GalleryMain.cs
  3. 88
      Samples/UIWidgetsSamples_2019_4/Assets/Script/TextTest.cs
  4. 26
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/GalleryMain.cs
  5. 5
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/backdrop_demo.cs
  6. 239
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/bottom_app_bar_demo.cs
  7. 4
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/date_and_time_picker_demo.cs
  8. 12
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/search_demo.cs
  9. 2
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/text_form_field_demo.cs
  10. 3
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/expanding_bottom_sheet.cs
  11. 5
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/backdrop.cs
  12. 4
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demo.cs
  13. 3
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demos.cs
  14. 3
      Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ToDoAppSample.cs
  15. 142
      com.unity.uiwidgets/Editor/UIWidgetsEditorPanel.cs
  16. 23
      com.unity.uiwidgets/Editor/UIWidgetsPanelEditor.cs
  17. 12
      com.unity.uiwidgets/Runtime/cupertino/date_picker.cs
  18. 683
      com.unity.uiwidgets/Runtime/cupertino/nav_bar.cs
  19. 4
      com.unity.uiwidgets/Runtime/engine/DisplayMetrics.cs
  20. 6
      com.unity.uiwidgets/Runtime/engine/UIWidgetsMessageManager.cs
  21. 308
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
  22. 394
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanelWrapper.cs
  23. 5
      com.unity.uiwidgets/Runtime/external/SplayTree.cs
  24. 2
      com.unity.uiwidgets/Runtime/external/simplejson/SimpleJSON.cs
  25. 7
      com.unity.uiwidgets/Runtime/foundation/assertions.cs
  26. 4
      com.unity.uiwidgets/Runtime/foundation/collections.cs
  27. 104
      com.unity.uiwidgets/Runtime/foundation/debug.cs
  28. 19
      com.unity.uiwidgets/Runtime/foundation/diagnostics.cs
  29. 5
      com.unity.uiwidgets/Runtime/gestures/hit_test.cs
  30. 2
      com.unity.uiwidgets/Runtime/material/about.cs
  31. 6
      com.unity.uiwidgets/Runtime/material/animated_icons/animated_icons_data.cs
  32. 4
      com.unity.uiwidgets/Runtime/material/animated_icons/data/add_event.g.cs
  33. 4
      com.unity.uiwidgets/Runtime/material/animated_icons/data/arrow_menu.g.cs
  34. 4
      com.unity.uiwidgets/Runtime/material/animated_icons/data/close_menu.g.cs
  35. 4
      com.unity.uiwidgets/Runtime/material/animated_icons/data/ellipsis_search.g.cs
  36. 4
      com.unity.uiwidgets/Runtime/material/animated_icons/data/event_add.g.cs
  37. 5
      com.unity.uiwidgets/Runtime/material/bottom_navigation_bar.cs
  38. 5
      com.unity.uiwidgets/Runtime/material/button_bar.cs
  39. 23
      com.unity.uiwidgets/Runtime/material/data_table.cs
  40. 12
      com.unity.uiwidgets/Runtime/material/dropdown.cs
  41. 3
      com.unity.uiwidgets/Runtime/material/feedback.cs
  42. 20
      com.unity.uiwidgets/Runtime/material/navigation_rail.cs
  43. 43
      com.unity.uiwidgets/Runtime/material/paginated_data_table.cs
  44. 9
      com.unity.uiwidgets/Runtime/material/range_slider.cs
  45. 3
      com.unity.uiwidgets/Runtime/material/text_selection.cs
  46. 6
      com.unity.uiwidgets/Runtime/painting/borders.cs
  47. 10
      com.unity.uiwidgets/Runtime/painting/gradient.cs
  48. 8
      com.unity.uiwidgets/Runtime/painting/image_provider.cs
  49. 4
      com.unity.uiwidgets/Runtime/painting/image_resolution.cs
  50. 14
      com.unity.uiwidgets/Runtime/painting/image_stream.cs
  51. 1
      com.unity.uiwidgets/Runtime/painting/shader_warmup.cs
  52. 18
      com.unity.uiwidgets/Runtime/painting/text_span.cs
  53. 278
      com.unity.uiwidgets/Runtime/painting/text_style.cs
  54. 9
      com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs
  55. 434
      com.unity.uiwidgets/Runtime/scheduler2/binding.cs
  56. 1
      com.unity.uiwidgets/Runtime/services/asset_bundle.cs
  57. 3
      com.unity.uiwidgets/Runtime/ui2/painting.cs
  58. 753
      com.unity.uiwidgets/Runtime/ui2/text.cs
  59. 1
      com.unity.uiwidgets/Runtime/ui2/window.cs
  60. 3
      com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.gen.cs
  61. 3
      com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.njk
  62. 21
      com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.gen.cs
  63. 21
      com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.njk
  64. 606
      com.unity.uiwidgets/Runtime/widgets/app.cs
  65. 11
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  66. 20
      com.unity.uiwidgets/Runtime/widgets/focus_manager.cs
  67. 13
      com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs
  68. 17
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  69. 4
      com.unity.uiwidgets/Runtime/widgets/gesture_detector.cs
  70. 5
      com.unity.uiwidgets/Runtime/widgets/heroes.cs
  71. 289
      com.unity.uiwidgets/Runtime/widgets/image.cs
  72. 6
      com.unity.uiwidgets/Runtime/widgets/localizations.cs
  73. 26
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  74. 3
      com.unity.uiwidgets/Runtime/widgets/page_storage.cs
  75. 2
      com.unity.uiwidgets/Runtime/widgets/routes.cs
  76. 2
      com.unity.uiwidgets/Runtime/widgets/scroll_position.cs
  77. 513
      com.unity.uiwidgets/Runtime/widgets/shortcuts.cs
  78. 4
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  79. 7
      com.unity.uiwidgets/Runtime/widgets/viewport.cs
  80. 27
      com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
  81. 113
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/HoverSample.cs
  82. 40
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/NetWorkImageSample.cs
  83. 85
      com.unity.uiwidgets/Runtime/external/LinqUtils.cs

60
Samples/UIWidgetsSamples_2019_4/Assets/CountDemo.unity


m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!28 &766599190
Texture2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 2
m_Width: 0
m_Height: 0
m_CompleteImageSize: 0
m_TextureFormat: 0
m_MipCount: 1
m_IsReadable: 1
m_IgnoreMasterTextureLimit: 0
m_IsPreProcessed: 0
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_AlphaIsTransparency: 0
m_ImageCount: 0
m_TextureDimension: 2
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 0
m_WrapV: 0
m_WrapW: 0
m_LightmapFormat: 0
m_ColorSpace: 0
image data: 0
_typelessdata:
m_StreamData:
offset: 0
size: 0
path:
--- !u!1 &1344837310
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 1777874941}
- component: {fileID: 1777874942}
- component: {fileID: 1777874943}
- component: {fileID: 1777874944}
m_Layer: 5
m_Name: RawImage
m_TagString: Untagged

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1777874940}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0817e3443c80cb943a03dcf7b120bd2e, type: 3}
m_Name:

m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 766599190}
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0

hardwareAntiAliasing: 0
fonts: []
m_ShowDebugLog: 0
--- !u!114 &1777874944
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1777874940}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcb4984097885463dbe58d12837993ce, type: 3}
m_Name:
m_EditorClassIdentifier:
panel: {fileID: 0}

15
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/GalleryMain.cs


#if UNITY_EDITOR
using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.widgets;
using ui_ = Unity.UIWidgets.widgets.ui_;
using UnityEngine;
protected override void onEnable()
{
AddFont("Material Icons", new List<string> {"MaterialIcons-Regular.ttf"}, new List<int> {0});
AddFont("CupertinoIcons", new List<string> {"CupertinoIcons.ttf"}, new List<int> {0});
AddFont("GalleryIcons", new List<string> {"gallery/GalleryIcons.ttf"}, new List<int> {0});
}
protected override void main()
{
ui_.runApp(new GalleryApp());

88
Samples/UIWidgetsSamples_2019_4/Assets/Script/TextTest.cs


using Brightness = Unity.UIWidgets.ui.Brightness;
using UnityEngine;
using System;
using uiwidgets;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using UnityEngine.Networking;
using Transform = Unity.UIWidgets.widgets.Transform;
namespace UIWidgetsSample
{

{
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget {
public override Widget build(BuildContext context) {
return new MaterialApp(
debugShowCheckedModeBanner: false,
title: "Flutter Demo",
home: new Scaffold(
appBar: new AppBar(title: new Text("good")),
body: new Center(
child: new MyStatefulWidget()
)
)
);
}
}
class MyStatefulWidget : StatefulWidget {
public MyStatefulWidget(Key key = null) : base(key: key)
{
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new CupertinoApp(
home: new HomeScreen() //new DetailScreen1("ok")
//color: Color.white
);
}
public override State createState() => new _MyStatefulWidgetState();
class _MyStatefulWidgetState : State<MyStatefulWidget> {
Color textColor = Colors.blue;
int _enterCounter = 0;
int _exitCounter = 0;
float x = 0.0f;
float y = 0.0f;
void _incrementEnter(PointerEvent details) {
UnityEngine.Debug.Log("enter");
setState(() =>{
_enterCounter++;
});
}
void _incrementExit(PointerEvent details) {
setState(() =>{
textColor = Colors.blue;
_exitCounter++;
});
}
void _updateLocation(PointerEvent details) {
setState(() =>{
textColor = Colors.red;
x = details.position.dx;
y = details.position.dy;
});
}
public override Widget build(BuildContext context) {
return new MouseRegion(
onEnter: _incrementEnter,
onHover: _updateLocation,
onExit: _incrementExit,
child: new FlatButton(
color: Colors.white,
textColor: Colors.teal[700], //when hovered text color change
shape: new RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side: new BorderSide(
color: Colors.teal[700]
)
),
onPressed: () => { },
child: new Text("Log in", style: new TextStyle(color: textColor))
)
);
}
}
class HomeScreen : StatelessWidget
{

26
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/GalleryMain.cs


using System.Collections.Generic;
using ui_ = Unity.UIWidgets.widgets.ui_;
using Unity.UIWidgets.widgets;
namespace UIWidgetsGallery {
public class GalleryMain : UIWidgetsPanel {
protected override void main() {
namespace UIWidgetsGallery
{
public class GalleryMain : UIWidgetsPanel
{
protected new void OnEnable()
{
base.OnEnable();
}
protected override void main()
{
protected new void OnEnable() {
base.OnEnable();
protected override void onEnable()
{
AddFont("Material Icons", new List<string> {"MaterialIcons-Regular.ttf"}, new List<int> {0});
AddFont("CupertinoIcons", new List<string> {"CupertinoIcons.ttf"}, new List<int> {0});
AddFont("GalleryIcons", new List<string> {"gallery/GalleryIcons.ttf"}, new List<int> {0});
}
}

5
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/backdrop_demo.cs


{
new IconButton(
onPressed: this._toggleBackdropPanelVisibility,
icon: new AnimatedIcon(
icon: AnimatedIcons.close_menu,
progress: this._controller.view
icon: new Icon(
icon: Icons.close
)
)
}

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);
}

4
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/date_and_time_picker_demo.cs


if (picked != null && picked != this.selectedDate) this.selectDate(picked);
});
return Future.value();
return null;
}
private Future _selectTime(BuildContext context)

if (picked != null && picked != this.selectedTime) this.selectTime(picked);
});
return Future.value();
return null;
}
public override Widget build(BuildContext context)

12
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/search_demo.cs


appBar: new AppBar(
leading: new IconButton(
tooltip: "Navigation menu",
icon: new AnimatedIcon(
icon: AnimatedIcons.arrow_menu,
color: Colors.white,
progress: this._delegate.transitionAnimation
icon: new Icon(
icon: Icons.menu,
color: Colors.white
),
onPressed: () => { this._scaffoldKey.currentState.openDrawer(); }
),

public override Widget buildLeading(BuildContext context) {
return new IconButton(
tooltip: "Back",
icon: new AnimatedIcon(
icon: AnimatedIcons.arrow_menu,
progress: this.transitionAnimation
icon: new Icon(
icon: Icons.menu
),
onPressed: () => { this.close(context, null); }
);

2
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/material/text_form_field_demo.cs


}
);
}
);
)?? Future.value(false).to<bool>();
}

3
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/shrine/expanding_bottom_sheet.cs


// Closes the cart if the cart is open, otherwise exits the app (this should
// only be relevant for Android).
Future<bool> _onWillPop() {
if (!_isOpen) {
if (!_isOpen)
{
//SystemNavigator.pop();
return Future.value(true).to<bool>();
}

5
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/backdrop.cs


trailing: new IconButton(
onPressed: this._toggleFrontLayer,
tooltip: "Toggle options page",
icon: new AnimatedIcon(
icon: AnimatedIcons.close_menu,
progress: this._controller
icon: new Icon(
icon: Icons.close
)
)
),

4
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demo.cs


}
);
}
);
);
return Future.value();
return null;
}
public override Widget build(BuildContext context)

3
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/gallery/demos.cs


using System.Linq;
using UIWidgetsGallery.demo;
using UIWidgetsGallery.demo.material;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.material;
using Unity.UIWidgets.widgets;

foreach (var category in kAllGalleryDemoCategories)
result.Add(category,
kAllGalleryDemos.Where((GalleryDemo demo) => { return demo.category == category; }).ToList());
LinqUtils<GalleryDemo>.WhereList(kAllGalleryDemos,((GalleryDemo demo) => { return demo.category == category; })));
return result;
}

3
Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/ToDoAppSample.cs


using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using Unity.UIWidgets.external;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using TextStyle = Unity.UIWidgets.painting.TextStyle;

Widget contents()
{
var children = this.items.Select((item) =>
var children = LinqUtils<Widget,ToDoItem>.SelectList(this.items, (ToDoItem item) =>
{
return (Widget) new Text(
item.content, style: new TextStyle(

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


using System.Collections;
using System.Collections.Generic;
using Unity.UIWidgets.editor2;
using Font = Unity.UIWidgets.engine2.Font;
UIWidgetsPanelWrapper _wrapper;
public UIWidgetsWindowType getWindowType() {
return UIWidgetsWindowType.EditorWindowPanel;
}
public bool isActive() {
return true;
}
public void startCoroutine(IEnumerator routing) {
this.StartCoroutine(routing);
}
public void onNewFrameScheduled() {
Repaint();
}
public Offset windowPosToScreenPos(Offset offset) {
return offset;
}
Configurations _configurations;
bool _ShowDebugLog;
UIWidgetsPanelWrapper _wrapper;
get { return Mathf.RoundToInt(position.size.x); }
get { return Mathf.RoundToInt(f: position.size.x); }
get { return Mathf.RoundToInt(position.size.y); }
get { return Mathf.RoundToInt(f: position.size.y); }
}
float _currentDevicePixelRatio {

void OnDestroy() {
D.assert(_wrapper != null);
_wrapper?.Destroy();
_wrapper = null;
Input_OnDisable();
void Update() {
_wrapper.onEditorUpdate();
_configurations = new Configurations();
_wrapper.Initiate(this, _currentWidth, _currentHeight, _currentDevicePixelRatio, new Dictionary<string, object>());
onEnable();
_wrapper.Initiate(this, width: _currentWidth, height: _currentHeight, dpr: _currentDevicePixelRatio,
_configurations: _configurations);
_configurations.Clear();
void Update() {
_wrapper.onEditorUpdate();
void OnDestroy() {
D.assert(_wrapper != null);
_wrapper?.Destroy();
_wrapper = null;
Input_OnDisable();
void OnGUI()
{
void OnGUI() {
if (_wrapper.didDisplayMetricsChanged(_currentWidth, _currentHeight, _currentDevicePixelRatio)) {
_wrapper.OnDisplayMetricsChanged(_currentWidth, _currentHeight, _currentDevicePixelRatio);
if (_wrapper.didDisplayMetricsChanged(width: _currentWidth, height: _currentHeight,
dpr: _currentDevicePixelRatio)) {
_wrapper.OnDisplayMetricsChanged(width: _currentWidth, height: _currentHeight,
dpr: _currentDevicePixelRatio);
GUI.DrawTexture(new Rect(0.0f, 0.0f, position.width, position.height), _wrapper.renderTexture);
Input_OnGUIEvent(Event.current);
GUI.DrawTexture(new Rect(0.0f, 0.0f, width: position.width, height: position.height),
image: _wrapper.renderTexture);
Input_OnGUIEvent(evt: Event.current);
public UIWidgetsWindowType getWindowType() {
return UIWidgetsWindowType.EditorWindowPanel;
}
public bool isActive() {
return true;
}
public void startCoroutine(IEnumerator routing) {
this.StartCoroutine(coroutine: routing);
}
public void onNewFrameScheduled() {
Repaint();
}
public Offset windowPosToScreenPos(Offset offset) {
return offset;
}
public void mainEntry() {
main();
}
protected virtual void onEnable() {
}
protected void AddFont(string family, List<string> assets, List<int> weights) {
if (assets.Count != weights.Count) {
Debug.LogError($"The size of {family}‘s assets should be equal to the weights'.");
return;
}
var textFont = new TextFont {family = family};
var fonts = new Font[assets.Count];
for (var j = 0; j < assets.Count; j++) {
var font = new Font {asset = assets[index: j], weight = weights[index: j]};
fonts[j] = font;
}
textFont.fonts = fonts;
_configurations.AddFont(family,textFont);
}
return new Vector2(position.x, position.y);
return new Vector2(x: position.x, y: position.y);
}
int _buttonToPointerId(int buttonId) {

else if (buttonId == 1) {
if (buttonId == 1) {
return -2;
}

void Input_OnGUIEvent(Event evt) {
if (evt.type == EventType.MouseDown) {
var pos = _getPointerPosition(evt.mousePosition);
_wrapper.OnPointerDown(pos, _buttonToPointerId(evt.button));
var pos = _getPointerPosition(position: evt.mousePosition);
_wrapper.OnPointerDown(pos: pos, _buttonToPointerId(buttonId: evt.button));
var pos = _getPointerPosition(evt.mousePosition);
_wrapper.OnPointerUp(pos, _buttonToPointerId(evt.button));
var pos = _getPointerPosition(position: evt.mousePosition);
_wrapper.OnPointerUp(pos: pos, _buttonToPointerId(buttonId: evt.button));
var pos = _getPointerPosition(evt.mousePosition);
_wrapper.OnMouseMove(pos);
var pos = _getPointerPosition(position: evt.mousePosition);
_wrapper.OnMouseMove(pos: pos);
var pos = _getPointerPosition(evt.mousePosition);
_wrapper.OnMouseMove(pos);
var pos = _getPointerPosition(position: evt.mousePosition);
_wrapper.OnMouseMove(pos: pos);
var pos = _getPointerPosition(evt.mousePosition);
_wrapper.OnMouseScroll(delta, pos);
var pos = _getPointerPosition(position: evt.mousePosition);
_wrapper.OnMouseScroll(delta: delta, pos: pos);
}
public void mainEntry() {
main();
}
protected virtual void main() {

}
}
}

23
com.unity.uiwidgets/Editor/UIWidgetsPanelEditor.cs


using Unity.UIWidgets.engine;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using UnityEditor;
using UnityEditor.UI;
using UnityEngine;

base.OnInspectorGUI();
var pixelRatioProperty = serializedObject.FindProperty("devicePixelRatioOverride");
var antiAliasingProperty = serializedObject.FindProperty("hardwareAntiAliasing");
var ShowDebugLog = serializedObject.FindProperty("m_ShowDebugLog");
EditorGUILayout.PropertyField(ShowDebugLog);
if (EditorGUI.EndChangeCheck()) {
UIWidgetsPanel.ShowDebugLog = ShowDebugLog.boolValue;
}
UIWidgetsPanel panel = (UIWidgetsPanel)target;
UIWidgetsPanel panel = (UIWidgetsPanel)target;
serializedObject.ApplyModifiedProperties();
}
serializedObject.ApplyModifiedProperties();
[MenuItem("UIWidgets/EnableDebug")]
public static void ToggleDebugMode(){
D.enableDebug = !D.enableDebug;
}
[MenuItem("UIWidgets/EnableDebug",true)]
public static bool CurrentDebugModeState() {
Menu.SetChecked("UIWidgets/EnableDebug", D.enableDebug );
return true;
}
}
}

12
com.unity.uiwidgets/Runtime/cupertino/date_picker.cs


using System.Globalization;
using System.Linq;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

};
break;
}
CupertinoThemeData themeData = CupertinoTheme.of(context);
CupertinoThemeData themeData = CupertinoTheme.of(context);
return new MediaQuery(
// The native iOS picker's text scaling is fixed, so we will also fix it
// as well in our picker.

child: new DefaultTextStyle(
style: _textStyleFrom(context),
child: new Row(
children:
columns.Select((Widget child) => {
var result = new Expanded(child: child);
return (Widget) result;
}).ToList()
children: LinqUtils<Widget>.SelectList(columns, (Widget child) => {
var result = new Expanded(child: child);
return (Widget) result;
})
)
)
)

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

4
com.unity.uiwidgets/Runtime/engine/DisplayMetrics.cs


}
#if UNITY_ANDROID
this._devicePixelRatio = AndroidDevicePixelRatio();
_devicePixelRatio = AndroidDevicePixelRatio();
#endif
#if UNITY_WEBGL

float padding_left = metrics.Get<float>("padding_left");
float padding_right = metrics.Get<float>("padding_right");
this._viewMetrics = new viewMetrics {
_viewMetrics = new viewMetrics {
insets_bottom = insets_bottom,
insets_left = insets_left,
insets_right = insets_right,

6
com.unity.uiwidgets/Runtime/engine/UIWidgetsMessageManager.cs


void UpdateNameIfNeed() {
#if UNITY_IOS || UNITY_ANDROID || UNITY_WEBGL
var name = this.gameObject.name;
if (name != this._lastObjectName) {
var name = gameObject.name;
if (name != _lastObjectName) {
this._lastObjectName = name;
_lastObjectName = name;
}
#endif
}

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


using System;
using System.Collections;
using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.editor2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;

namespace Unity.UIWidgets.engine2 {
[Serializable]
public struct Font {
public string asset;
public int weight;
}
[Serializable]
public struct TextFont {
public string family;
[SerializeField] public Font[] fonts;
}
public interface IUIWidgetsWindow {
Offset windowPosToScreenPos(Offset offset);

UIWidgetsWindowType getWindowType();
}
public partial class UIWidgetsPanel : RawImage, IUIWidgetsWindow {
UIWidgetsPanelWrapper _wrapper;
public float devicePixelRatioOverride;
public bool hardwareAntiAliasing;
public UIWidgetsWindowType getWindowType() {
return UIWidgetsWindowType.GameObjectPanel;
}
public class Configurations {
public bool isActive() {
return IsActive();
}
private Dictionary<string, TextFont> _textFonts = new Dictionary<string, TextFont>();
public void startCoroutine(IEnumerator routing) {
StartCoroutine(routing);
public void Clear() {
_textFonts.Clear();
public void onNewFrameScheduled() {
}
public Offset windowPosToScreenPos(Offset offset) {
Camera camera = null;
if (canvas.renderMode != RenderMode.ScreenSpaceCamera) {
camera = canvas.GetComponent<GraphicRaycaster>().eventCamera;
}
var pos = new Vector2(offset.dx, offset.dy);
pos = pos * _currentDevicePixelRatio / canvas.scaleFactor;
var rect = rectTransform.rect;
pos.x += rect.min.x;
pos.y = rect.max.y - pos.y;
var worldPos = rectTransform.TransformPoint(new Vector2(pos.x, pos.y));
var screenPos = RectTransformUtility.WorldToScreenPoint(camera, worldPos);
return new Offset(screenPos.x, Screen.height - screenPos.y);
public void AddFont(string family, TextFont font) {
_textFonts[key: family] = font;
[Serializable]
public struct Font {
public string asset;
public int weight;
}
[Serializable]
public struct TextFont {
public string family;
[SerializeField] public Font[] fonts;
}
public TextFont[] fonts;
static object fontsToObject(TextFont[] textFont) {
if (textFont == null || textFont.Length == 0) {
public object fontsToObject() {
Dictionary<string, TextFont> settings = _textFonts;
if (settings == null || settings.Count == 0) {
var result = new object[textFont.Length];
for (int i = 0; i < textFont.Length; i++) {
var result = new object[settings.Count];
var i = 0;
foreach (var setting in settings) {
font.Add("family", textFont[i].family);
var dic = new Dictionary<string, object>[textFont[i].fonts.Length];
for (int j = 0; j < textFont[i].fonts.Length; j++) {
font.Add("family", value: setting.Key);
var dic = new Dictionary<string, object>[setting.Value.fonts.Length];
for (var j = 0; j < setting.Value.fonts.Length; j++) {
if (textFont[i].fonts[j].asset.Length > 0) {
dic[j].Add("asset", textFont[i].fonts[j].asset);
if (setting.Value.fonts[j].asset.Length > 0) {
dic[j].Add("asset", value: setting.Value.fonts[j].asset);
if (textFont[i].fonts[j].weight > 0) {
dic[j].Add("weight", textFont[i].fonts[j].weight);
if (setting.Value.fonts[j].weight > 0) {
dic[j].Add("weight", value: setting.Value.fonts[j].weight);
font.Add("fonts", dic);
font.Add("fonts", value: dic);
i++;
}
public partial class UIWidgetsPanel : RawImage, IUIWidgetsWindow {
public static List<UIWidgetsPanel> panels = new List<UIWidgetsPanel>();
static bool _ShowDebugLog;
public float devicePixelRatioOverride;
public bool hardwareAntiAliasing;
public TextFont[] fonts;
Configurations _configurations;
UIWidgetsPanelWrapper _wrapper;
int _currentWidth {
get { return Mathf.RoundToInt(rectTransform.rect.width * canvas.scaleFactor); }

float _currentDevicePixelRatio {
get {
float currentDpi = Screen.dpi;
var currentDpi = Screen.dpi;
if (currentDpi == 0) {
currentDpi = canvas.GetComponent<CanvasScaler>().fallbackScreenDPI;
}

}
public bool m_ShowDebugLog = false;
public static List<UIWidgetsPanel> panels = new List<UIWidgetsPanel>();
get => _ShowDebugLog;
get { return _ShowDebugLog; }
foreach (var panel in panels) {
panel.m_ShowDebugLog = value;
}
static bool _ShowDebugLog = false;
protected virtual void Update() {
Input_Update();
}
#if !UNITY_EDITOR && UNITY_ANDROID
bool InitAnroidGLFlag = true;

#endif
base.OnEnable();
var settings = new Dictionary<string, object>();
if (fonts != null && fonts.Length > 0) {
settings.Add("fonts", fontsToObject(fonts));
}
_configurations = new Configurations();
_wrapper.Initiate(this, _currentWidth, _currentHeight, _currentDevicePixelRatio, settings);
onEnable();
if (fonts != null && fonts.Length > 0) {
foreach (var font in fonts) {
AddFont(family: font.family, font: font);
}
}
_wrapper.Initiate(this, width: _currentWidth, height: _currentHeight, dpr: _currentDevicePixelRatio,
_configurations: _configurations);
_configurations.Clear();
_ShowDebugLog = m_ShowDebugLog;
public void mainEntry() {
main();
protected override void OnDisable() {
D.assert(_wrapper != null);
_wrapper?.Destroy();
_wrapper = null;
texture = null;
Input_OnDisable();
base.OnDisable();
panels.Remove(this);
protected virtual void main() {
protected virtual void OnGUI() {
Input_OnGUI();
if (_wrapper != null && _wrapper.didDisplayMetricsChanged(_currentWidth, _currentHeight, _currentDevicePixelRatio)) {
_wrapper.OnDisplayMetricsChanged(_currentWidth, _currentHeight, _currentDevicePixelRatio);
if (_wrapper != null && _wrapper.didDisplayMetricsChanged(width: _currentWidth, height: _currentHeight,
dpr: _currentDevicePixelRatio)) {
_wrapper.OnDisplayMetricsChanged(width: _currentWidth, height: _currentHeight,
dpr: _currentDevicePixelRatio);
protected override void OnDisable() {
D.assert(_wrapper != null);
_wrapper?.Destroy();
_wrapper = null;
texture = null;
public UIWidgetsWindowType getWindowType() {
return UIWidgetsWindowType.GameObjectPanel;
}
public bool isActive() {
return IsActive();
}
public void startCoroutine(IEnumerator routing) {
StartCoroutine(routine: routing);
}
public void onNewFrameScheduled() {
}
public Offset windowPosToScreenPos(Offset offset) {
Camera camera = null;
if (canvas.renderMode != RenderMode.ScreenSpaceCamera) {
camera = canvas.GetComponent<GraphicRaycaster>().eventCamera;
}
Input_OnDisable();
base.OnDisable();
panels.Remove(this);
var pos = new Vector2(x: offset.dx, y: offset.dy);
pos = pos * _currentDevicePixelRatio / canvas.scaleFactor;
var rect = rectTransform.rect;
pos.x += rect.min.x;
pos.y = rect.max.y - pos.y;
var worldPos = rectTransform.TransformPoint(new Vector2(x: pos.x, y: pos.y));
var screenPos = RectTransformUtility.WorldToScreenPoint(cam: camera, worldPoint: worldPos);
return new Offset(dx: screenPos.x, Screen.height - screenPos.y);
protected virtual void Update() {
Input_Update();
public void mainEntry() {
main();
protected virtual void OnGUI() {
Input_OnGUI();
protected virtual void onEnable() {
}
protected void AddFont(string family, TextFont font) {
_configurations.AddFont(family,font);
}
protected void AddFont(string family, List<string> assets, List<int> weights) {
if (assets.Count != weights.Count) {
Debug.LogError($"The size of {family}‘s assets should be equal to the weights'.");
return;
}
var textFont = new TextFont {family = family};
var fonts = new Font[assets.Count];
for (var j = 0; j < assets.Count; j++) {
var font = new Font {asset = assets[index: j], weight = weights[index: j]};
fonts[j] = font;
}
textFont.fonts = fonts;
AddFont(family: family, font: textFont);
}
protected virtual void main() {
}
}

Vector2 _lastMousePosition;
public void OnDrag(PointerEventData eventData) {
var pos = _getPointerPosition(position: Input.mousePosition);
_wrapper.OnDrag(pos: pos, pointerId: eventData.pointerId);
}
public void OnPointerDown(PointerEventData eventData) {
var pos = _getPointerPosition(position: Input.mousePosition);
_wrapper.OnPointerDown(pos: pos, pointerId: eventData.pointerId);
}
public void OnPointerEnter(PointerEventData eventData) {
D.assert(eventData.pointerId < 0);
_isEntered = true;
_lastMousePosition = Input.mousePosition;
}
public void OnPointerExit(PointerEventData eventData) {
D.assert(eventData.pointerId < 0);
_isEntered = false;
_wrapper.OnPointerLeave();
}
public void OnPointerUp(PointerEventData eventData) {
var pos = _getPointerPosition(position: Input.mousePosition);
_wrapper.OnPointerUp(pos: pos, pointerId: eventData.pointerId);
}
Camera worldCamera = canvas.worldCamera;
var worldCamera = canvas.worldCamera;
rectTransform, position, worldCamera, out var localPoint)) {
rect: rectTransform, screenPoint: position, cam: worldCamera, out var localPoint)) {
var scaleFactor = canvas.scaleFactor;
localPoint.x = (localPoint.x - rectTransform.rect.min.x) * scaleFactor;
localPoint.y = (rectTransform.rect.max.y - localPoint.y) * scaleFactor;

}
void Input_OnGUI() {
Event e = Event.current;
var e = Event.current;
_wrapper.OnKeyDown(e);
_wrapper.OnKeyDown(e: e);
var pos = _getPointerPosition(Input.mousePosition);
_wrapper.OnMouseMove(pos);
var pos = _getPointerPosition(position: Input.mousePosition);
_wrapper.OnMouseMove(pos: pos);
var pos = _getPointerPosition(Input.mousePosition);
_wrapper.OnMouseScroll(Input.mouseScrollDelta, pos);
}
public void OnPointerDown(PointerEventData eventData) {
var pos = _getPointerPosition(Input.mousePosition);
_wrapper.OnPointerDown(pos, eventData.pointerId);
}
public void OnPointerUp(PointerEventData eventData) {
var pos = _getPointerPosition(Input.mousePosition);
_wrapper.OnPointerUp(pos, eventData.pointerId);
}
public void OnPointerEnter(PointerEventData eventData) {
D.assert(eventData.pointerId < 0);
_isEntered = true;
_lastMousePosition = Input.mousePosition;
}
public void OnPointerExit(PointerEventData eventData) {
D.assert(eventData.pointerId < 0);
_isEntered = false;
_wrapper.OnPointerLeave();
}
public void OnDrag(PointerEventData eventData) {
var pos = _getPointerPosition(Input.mousePosition);
_wrapper.OnDrag(pos, eventData.pointerId);
var pos = _getPointerPosition(position: Input.mousePosition);
_wrapper.OnMouseScroll(delta: Input.mouseScrollDelta, pos: pos);
}
}
}

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


using UnityEngine;
using Path = Unity.UIWidgets.ui.Path;
namespace Unity.UIWidgets.editor2 {
#region Platform: Windows Specific Functionalities
namespace Unity.UIWidgets.engine2 {
#region Platform: Windows Specific Functionalities
RenderTexture _renderTexture;
public RenderTexture renderTexture {
get { return _renderTexture; }
}
public RenderTexture renderTexture { get; private set; }
D.assert(_renderTexture == null);
D.assert(renderTexture == null);
width, height, RenderTextureFormat.ARGB32, 0) {
width: width, height: height, colorFormat: RenderTextureFormat.ARGB32, 0) {
autoGenerateMips = false,
autoGenerateMips = false
_renderTexture = new RenderTexture(desc) {hideFlags = HideFlags.HideAndDontSave};
_renderTexture.Create();
renderTexture = new RenderTexture(desc: desc) {hideFlags = HideFlags.HideAndDontSave};
renderTexture.Create();
_devicePixelRatio = devicePixelRatio;
this.devicePixelRatio = devicePixelRatio;
D.assert(_renderTexture != null);
ObjectUtils.SafeDestroy(_renderTexture);
_renderTexture = null;
D.assert(renderTexture != null);
ObjectUtils.SafeDestroy(obj: renderTexture);
renderTexture = null;
UIWidgetsPanel_onEnable(_ptr, _renderTexture.GetNativeTexturePtr(),
_width, _height, _devicePixelRatio, Application.streamingAssetsPath, font_settings);
UIWidgetsPanel_onEnable(ptr: _ptr, renderTexture.GetNativeTexturePtr(),
width: _width, height: _height, dpi: devicePixelRatio,
streamingAssetsPath: Application.streamingAssetsPath, font_settings: font_settings);
UIWidgetsPanel_onRenderTexture(_ptr,
_renderTexture.GetNativeTexturePtr(),
_width, _height, _devicePixelRatio);
UIWidgetsPanel_onRenderTexture(ptr: _ptr,
renderTexture.GetNativeTexturePtr(),
width: _width, height: _height, dpi: devicePixelRatio);
_renderTexture = null;
renderTexture = null;
[DllImport(NativeBindings.dllName)]
[DllImport(dllName: NativeBindings.dllName)]
[DllImport(NativeBindings.dllName)]
[DllImport(dllName: NativeBindings.dllName)]
#endregion
#endregion
#region Platform: MacOs Specific Functionalities
#region Platform: MacOs Specific Functionalities
#if (UNITY_EDITOR && UNITY_EDITOR_OSX) || UNITY_STANDALONE_OSX
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
public partial class UIWidgetsPanelWrapper {
Texture _renderTexture;

_width = width;
_height = height;
_devicePixelRatio = devicePixelRatio;
this.devicePixelRatio = devicePixelRatio;
}
void _destroyRenderTexture() {

void _enableUIWidgetsPanel(string font_settings) {
D.assert(_renderTexture == null);
IntPtr native_tex_ptr = UIWidgetsPanel_onEnable(_ptr, _width, _height, _devicePixelRatio,
IntPtr native_tex_ptr = UIWidgetsPanel_onEnable(_ptr, _width, _height, devicePixelRatio,
Application.streamingAssetsPath, font_settings);
D.assert(native_tex_ptr != IntPtr.Zero);

void _resizeUIWidgetsPanel() {
D.assert(_renderTexture == null);
IntPtr native_tex_ptr = UIWidgetsPanel_onRenderTexture(_ptr, _width, _height, _devicePixelRatio);
IntPtr native_tex_ptr = UIWidgetsPanel_onRenderTexture(_ptr, _width, _height, devicePixelRatio);
D.assert(native_tex_ptr != IntPtr.Zero);
_renderTexture =

#endif
#endregion
#endregion
#region Platform: Android Runtime Specific Functionalities

_width = width;
_height = height;
_devicePixelRatio = devicePixelRatio;
this.devicePixelRatio = devicePixelRatio;
}
void _destroyRenderTexture() {

void _enableUIWidgetsPanel(string font_settings) {
UIWidgetsPanel_onEnable(_ptr, _renderTexture.GetNativeTexturePtr(),
_width, _height, _devicePixelRatio, Application.temporaryCachePath, font_settings);
_width, _height, devicePixelRatio, Application.streamingAssetsPath, font_settings);
_width, _height, _devicePixelRatio);
_width, _height, devicePixelRatio);
}
void _disableUIWidgetsPanel() {

#endregion
#region Window Common Properties and Functions
#region Window Common Properties and Functions
public partial class UIWidgetsPanelWrapper {
public static UIWidgetsPanelWrapper current {
get { return Window.instance._panel; }
}
public partial class UIWidgetsPanelWrapper {
public static UIWidgetsPanelWrapper current {
get { return Window.instance._panel; }
}
IntPtr _ptr;
GCHandle _handle;
IntPtr _ptr;
GCHandle _handle;
int _width;
int _height;
float _devicePixelRatio;
int _width;
int _height;
IUIWidgetsWindow _host;
public IUIWidgetsWindow window { get; private set; }
public IUIWidgetsWindow window {
get { return _host; }
}
public Isolate isolate { get; private set; }
public Isolate isolate { get; private set; }
public float devicePixelRatio { get; private set; }
public float devicePixelRatio {
get { return _devicePixelRatio; }
}
public void Initiate(IUIWidgetsWindow host, int width, int height, float dpr,
Dictionary<string, object> settings) {
D.assert(_renderTexture == null);
NativeConsole.OnEnable();
public void Initiate(IUIWidgetsWindow host, int width, int height, float dpr, Configurations _configurations) {
D.assert(renderTexture == null);
NativeConsole.OnEnable();
AndroidUnpackStreamingAssets.OnEnable();
AndroidUnpackStreamingAssets.OnEnable();
_recreateRenderTexture(width, height, dpr);
_recreateRenderTexture(width: width, height: height, devicePixelRatio: dpr);
_handle = GCHandle.Alloc(this);
_ptr = UIWidgetsPanel_constructor((IntPtr) _handle, (int) host.getWindowType(), UIWidgetsPanel_entrypoint);
_host = host;
_enableUIWidgetsPanel(JSONMessageCodec.instance.toJson(settings));
}
_handle = GCHandle.Alloc(this);
_ptr = UIWidgetsPanel_constructor((IntPtr) _handle, (int) host.getWindowType(),
entrypointCallback: UIWidgetsPanel_entrypoint);
window = host;
public void _entryPoint() {
try {
isolate = Isolate.current;
Window.instance._panel = this;
var fontsetting = new Dictionary<string, object>();
fontsetting.Add("fonts", _configurations.fontsToObject());
_enableUIWidgetsPanel(JSONMessageCodec.instance.toJson(message: fontsetting));
}
_host.mainEntry();
}
catch (Exception ex) {
Debug.LogException(new Exception("exception in main", ex));
public void _entryPoint() {
try {
isolate = Isolate.current;
Window.instance._panel = this;
window.mainEntry();
}
catch (Exception ex) {
Debug.LogException(new Exception("exception in main", innerException: ex));
}
}
public bool didDisplayMetricsChanged(int width, int height, float dpr) {
return width != _width || height != _height || dpr != _devicePixelRatio;
}
public bool didDisplayMetricsChanged(int width, int height, float dpr) {
return width != _width || height != _height || dpr != devicePixelRatio;
}
public void OnDisplayMetricsChanged(int width, int height, float dpr) {
if (_ptr != IntPtr.Zero && _renderTexture) {
if (_recreateRenderTexture(width, height, dpr)) {
_resizeUIWidgetsPanel();
public void OnDisplayMetricsChanged(int width, int height, float dpr) {
if (_ptr != IntPtr.Zero && renderTexture) {
if (_recreateRenderTexture(width: width, height: height, devicePixelRatio: dpr)) {
_resizeUIWidgetsPanel();
}
}
public void Destroy() {
UIWidgetsPanel_onDisable(ptr: _ptr);
UIWidgetsPanel_dispose(ptr: _ptr);
_ptr = IntPtr.Zero;
_handle.Free();
_handle = default;
public void Destroy() {
UIWidgetsPanel_onDisable(_ptr);
UIWidgetsPanel_dispose(_ptr);
_ptr = IntPtr.Zero;
_disableUIWidgetsPanel();
D.assert(result: !isolate.isValid);
}
_handle.Free();
_handle = default;
bool _recreateRenderTexture(int width, int height, float devicePixelRatio) {
if (renderTexture != null && _width == width && _height == height &&
this.devicePixelRatio == devicePixelRatio) {
return false;
}
_disableUIWidgetsPanel();
D.assert(!isolate.isValid);
}
if (renderTexture) {
_destroyRenderTexture();
}
bool _recreateRenderTexture(int width, int height, float devicePixelRatio) {
if (_renderTexture != null && _width == width && _height == height &&
_devicePixelRatio == devicePixelRatio) {
return false;
_createRenderTexture(width: width, height: height, devicePixelRatio: devicePixelRatio);
return true;
if (_renderTexture) {
_destroyRenderTexture();
public int registerTexture(Texture texture) {
return UIWidgetsPanel_registerTexture(ptr: _ptr, texture.GetNativeTexturePtr());
_createRenderTexture(width, height, devicePixelRatio);
return true;
}
public void unregisterTexture(int textureId) {
UIWidgetsPanel_unregisterTexture(ptr: _ptr, textureId: textureId);
}
public int registerTexture(Texture texture) {
return UIWidgetsPanel_registerTexture(_ptr, texture.GetNativeTexturePtr());
}
public void markNewFrameAvailable(int textureId) {
UIWidgetsPanel_markNewFrameAvailable(ptr: _ptr, textureId: textureId);
}
public void unregisterTexture(int textureId) {
UIWidgetsPanel_unregisterTexture(_ptr, textureId);
}
public void onEditorUpdate() {
UIWidgetsPanel_onEditorUpdate(ptr: _ptr);
}
public void markNewFrameAvailable(int textureId) {
UIWidgetsPanel_markNewFrameAvailable(_ptr, textureId);
}
delegate void UIWidgetsPanel_EntrypointCallback(IntPtr handle);
public void onEditorUpdate() {
UIWidgetsPanel_onEditorUpdate(_ptr);
}
[MonoPInvokeCallback(typeof(UIWidgetsPanel_EntrypointCallback))]
static void UIWidgetsPanel_entrypoint(IntPtr handle) {
var gcHandle = (GCHandle) handle;
var panel = (UIWidgetsPanelWrapper) gcHandle.Target;
panel._entryPoint();
}
delegate void UIWidgetsPanel_EntrypointCallback(IntPtr handle);
[DllImport(dllName: NativeBindings.dllName)]
static extern IntPtr UIWidgetsPanel_constructor(IntPtr handle, int windowType,
UIWidgetsPanel_EntrypointCallback entrypointCallback);
[MonoPInvokeCallback(typeof(UIWidgetsPanel_EntrypointCallback))]
static void UIWidgetsPanel_entrypoint(IntPtr handle) {
GCHandle gcHandle = (GCHandle) handle;
UIWidgetsPanelWrapper panel = (UIWidgetsPanelWrapper) gcHandle.Target;
panel._entryPoint();
}
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_dispose(IntPtr ptr);
[DllImport(NativeBindings.dllName)]
static extern IntPtr UIWidgetsPanel_constructor(IntPtr handle, int windowType,
UIWidgetsPanel_EntrypointCallback entrypointCallback);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onDisable(IntPtr ptr);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_dispose(IntPtr ptr);
[DllImport(dllName: NativeBindings.dllName)]
static extern int UIWidgetsPanel_registerTexture(IntPtr ptr, IntPtr nativeTexturePtr);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onDisable(IntPtr ptr);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_unregisterTexture(IntPtr ptr, int textureId);
[DllImport(NativeBindings.dllName)]
static extern int UIWidgetsPanel_registerTexture(IntPtr ptr, IntPtr nativeTexturePtr);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_unregisterTexture(IntPtr ptr, int textureId);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_markNewFrameAvailable(IntPtr ptr, int textureId);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_markNewFrameAvailable(IntPtr ptr, int textureId);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onEditorUpdate(IntPtr ptr);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onEditorUpdate(IntPtr ptr);
}
}
#endregion
#endregion
#region Input Events Handles
#region Input Events Handles
public partial class UIWidgetsPanelWrapper {
public void OnMouseMove(Vector2? pos) {
if (pos == null) {
return;
}
public partial class UIWidgetsPanelWrapper {
public void OnMouseMove(Vector2? pos) {
if (pos == null) {
return;
UIWidgetsPanel_onMouseMove(ptr: _ptr, x: pos.Value.x, y: pos.Value.y);
UIWidgetsPanel_onMouseMove(_ptr, pos.Value.x, pos.Value.y);
}
public void OnMouseScroll(Vector2 delta, Vector2? pos) {
if (pos == null) {
return;
}
public void OnMouseScroll(Vector2 delta, Vector2? pos) {
if (pos == null) {
return;
UIWidgetsPanel_onScroll(ptr: _ptr, x: delta.x, y: delta.y, px: pos.Value.x, py: pos.Value.y);
UIWidgetsPanel_onScroll(_ptr, delta.x, delta.y, pos.Value.x, pos.Value.y);
}
public void OnPointerDown(Vector2? pos, int pointerId) {
if (pos == null) {
return;
}
public void OnPointerDown(Vector2? pos, int pointerId) {
if (pos == null) {
return;
// mouse event
if (pointerId < 0) {
UIWidgetsPanel_onMouseDown(ptr: _ptr, x: pos.Value.x, y: pos.Value.y, button: pointerId);
}
// mouse event
if (pointerId < 0) {
UIWidgetsPanel_onMouseDown(_ptr, pos.Value.x, pos.Value.y, pointerId);
}
}
public void OnPointerUp(Vector2? pos, int pointerId) {
if (pos == null) {
return;
}
public void OnPointerUp(Vector2? pos, int pointerId) {
if (pos == null) {
return;
// mouse event
if (pointerId < 0) {
UIWidgetsPanel_onMouseUp(ptr: _ptr, x: pos.Value.x, y: pos.Value.y, button: pointerId);
}
// mouse event
if (pointerId < 0) {
UIWidgetsPanel_onMouseUp(_ptr, pos.Value.x, pos.Value.y, pointerId);
}
}
public void OnDrag(Vector2? pos, int pointerId) {
if (pos == null) {
return;
}
public void OnDrag(Vector2? pos, int pointerId) {
if (pos == null) {
return;
// mouse event
if (pointerId < 0) {
UIWidgetsPanel_onMouseMove(ptr: _ptr, x: pos.Value.x, y: pos.Value.y);
}
// mouse event
if (pointerId < 0) {
UIWidgetsPanel_onMouseMove(_ptr, pos.Value.x, pos.Value.y);
public void OnPointerLeave() {
UIWidgetsPanel_onMouseLeave(ptr: _ptr);
}
public void OnPointerLeave() {
UIWidgetsPanel_onMouseLeave(_ptr);
}
public void OnKeyDown(Event e) {
UIWidgetsPanel_onKey(_ptr, e.keyCode, e.type == EventType.KeyDown);
if (e.character != 0 || e.keyCode == KeyCode.Backspace) {
PointerEventConverter.KeyEvent.Enqueue(new Event(e));
// TODO: add on char
// UIWidgetsPanel_onChar(_ptr, e.character);
public void OnKeyDown(Event e) {
UIWidgetsPanel_onKey(ptr: _ptr, keyCode: e.keyCode, e.type == EventType.KeyDown);
if (e.character != 0 || e.keyCode == KeyCode.Backspace) {
PointerEventConverter.KeyEvent.Enqueue(new Event(other: e));
// TODO: add on char
// UIWidgetsPanel_onChar(_ptr, e.character);
}
}
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onChar(IntPtr ptr, char c);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onChar(IntPtr ptr, char c);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onKey(IntPtr ptr, KeyCode keyCode, bool isKeyDown);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onKey(IntPtr ptr, KeyCode keyCode, bool isKeyDown);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onMouseDown(IntPtr ptr, float x, float y, int button);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onMouseDown(IntPtr ptr, float x, float y, int button);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onMouseUp(IntPtr ptr, float x, float y, int button);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onMouseUp(IntPtr ptr, float x, float y, int button);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onMouseMove(IntPtr ptr, float x, float y);
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onMouseMove(IntPtr ptr, float x, float y);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onMouseLeave(IntPtr ptr);
[DllImport(NativeBindings.dllName)]
static extern void UIWidgetsPanel_onScroll(IntPtr ptr, float x, float y, float px, float py);
}
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onMouseLeave(IntPtr ptr);
#endregion
[DllImport(dllName: NativeBindings.dllName)]
static extern void UIWidgetsPanel_onScroll(IntPtr ptr, float x, float y, float px, float py);
}
#endregion
}

5
com.unity.uiwidgets/Runtime/external/SplayTree.cs


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Unity.UIWidgets.external
{ class SplayTree<TKey, TValue> : IDictionary<TKey, TValue> where TKey : IComparable<TKey> {
namespace Unity.UIWidgets.external {
class SplayTree<TKey, TValue> : IDictionary<TKey, TValue> where TKey : IComparable<TKey> {
SplayTreeNode root;
int count;
int version = 0;

2
com.unity.uiwidgets/Runtime/external/simplejson/SimpleJSON.cs


{
try
{
var item = m_Dict.Where(k => k.Value == aNode).First();
var item = LinqUtils<string, JSONNode>.WhereDictionary(m_Dict,(k => k.Value == aNode)).First();
m_Dict.Remove(item.Key);
return aNode;
}

7
com.unity.uiwidgets/Runtime/foundation/assertions.cs


using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unity.UIWidgets.external;
using UnityEngine;
namespace Unity.UIWidgets.foundation {

D.assert(() => {
IEnumerable<DiagnosticsNode> summaries =
diagnostics.Where((DiagnosticsNode node) => node.level == DiagnosticLevel.summary);
LinqUtils<DiagnosticsNode>.WhereList(diagnostics,((DiagnosticsNode node) => node.level == DiagnosticLevel.summary));
if (summaries.Count() > 1) {
return false;
}

diagnostics.Where((DiagnosticsNode node) => node.level == DiagnosticLevel.summary);
LinqUtils<DiagnosticsNode>.WhereList(diagnostics,((DiagnosticsNode node) => node.level == DiagnosticLevel.summary));
List<DiagnosticsNode> message = new List<DiagnosticsNode>() {
new ErrorSummary("UIWidgetsError contained multiple error summaries."),
new ErrorDescription(

public override string ToString() {
TextTreeRenderer renderer = new TextTreeRenderer(wrapWidth: 400000000);
return string.Join("\n", diagnostics.Select((DiagnosticsNode node) => renderer.render(node).TrimEnd()));
return string.Join("\n", LinqUtils<string,DiagnosticsNode>.SelectList(diagnostics,((DiagnosticsNode node) => renderer.render(node).TrimEnd())));
}
public static void reportError(UIWidgetsErrorDetails details) {

4
com.unity.uiwidgets/Runtime/foundation/collections.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.InternalBridge;
namespace Unity.UIWidgets.foundation {

if (it == null) {
return null;
}
return "{ " + string.Join(", ", it.Select(item => item.ToString())) + " }";
return "{ " + string.Join(", ", LinqUtils<string,T>.SelectList(it,(item => item.ToString()))) + " }";
}
public static void reset<T>(this List<T> list, int size) {

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


using System;
using System.Diagnostics;
using System.Linq;
using Unity.UIWidgets.engine2;
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Debug = UnityEngine.Debug;

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 HSVColor debugCurrentRepaintColor =
HSVColor.fromAHSV(0.4f, 60.0f, 1.0f, 1.0f);
public static void _debugDrawDoubleRect(Canvas canvas, Rect outerRect, Rect innerRect, Color color) {
Path path = new Path();
public static int? debugFloatPrecision;
public static void logError(string message, Exception ex = null) {
Debug.LogException(new AssertionError(message: message, innerException: ex));
}
#if UNITY_EDITOR
[Conditional("UNITY_ASSERTIONS")]
#endif
public static void assert(Func<bool> result, Func<string> message = null) {
if ( enableDebug && !result() ) {
throw new AssertionError(message != null ? message() : "");
}
}
#if UNITY_EDITOR
[Conditional("UNITY_ASSERTIONS")]
#endif
public static void assert(bool result, Func<string> message = null) {
if ( enableDebug && !result ) {
throw new AssertionError(message != null ? message() : "");
}
}
static bool? _enableDebug = null;
public static bool enableDebug {
get {
if (_enableDebug == null) {
_enableDebug = PlayerPrefs.GetInt("UIWidgetsDebug") == 1;
}
return _enableDebug.Value;
}
set {
if (_enableDebug == value) {
return;
}
_enableDebug = value;
PlayerPrefs.SetInt("UIWidgetsDebug",value ? 1 : 0);
}
}
public static void _debugDrawDoubleRect(Canvas canvas, Rect outerRect, Rect innerRect, Color color) {
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);
}
}
}

19
com.unity.uiwidgets/Runtime/foundation/diagnostics.cs


using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unity.UIWidgets.external;
using Unity.UIWidgets.ui;
using UnityEngine;

builder.writeStretched(config.suffixLineOne, builder.wrapWidth.Value);
}
IEnumerable<DiagnosticsNode> propertiesIterable = node.getProperties().Where(
IEnumerable<DiagnosticsNode> propertiesIterable = LinqUtils<DiagnosticsNode>.WhereList(node.getProperties(), (
);
));
List<DiagnosticsNode> properties;
if (_maxDescendentsTruncatableNode >= 0 && node.allowTruncate) {
if (propertiesIterable.Count() < _maxDescendentsTruncatableNode) {

}
if (parentConfiguration != null && !parentConfiguration.lineBreakProperties) {
return string.Join(", ", value.Select(v => v.ToString()).ToArray());
return string.Join(", ", LinqUtils<string, T>.SelectList(value, (v => v.ToString())));
return string.Join(style == DiagnosticsTreeStyle.singleLine ? ", " : "\n",
value.Select(v => v.ToString()).ToArray());
return string.Join(style == DiagnosticsTreeStyle.singleLine ? ", " : "\n",
LinqUtils<string, T>.SelectList(value, (v => v.ToString())));
}
public override DiagnosticLevel level {

public override Dictionary<string, object> toJsonMap(DiagnosticsSerializationDelegate Delegate) {
var json = base.toJsonMap(Delegate);
if (value != null) {
json["values"] = value.Select(v => v.ToString()).ToList();
json["values"] = LinqUtils<string, T>.SelectList(value, (v => v.ToString()));
}
return json;

result.Append(joiner);
DiagnosticPropertiesBuilder builder = new DiagnosticPropertiesBuilder();
debugFillProperties(builder);
result.Append(string.Join(joiner,
builder.properties.Where(n => !n.isFiltered(minLevel)).Select(n => n.ToString()).ToArray())
result.Append(string.Join(joiner,LinqUtils<string,DiagnosticsNode>.SelectList(
LinqUtils<DiagnosticsNode>.WhereList(builder.properties, (n => !n.isFiltered(minLevel)))
,(n => n.ToString())))
);
shallowString = result.ToString();
return true;

5
com.unity.uiwidgets/Runtime/gestures/hit_test.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;

public override string ToString() {
return
$"HitTestResult({(_path.isEmpty() ? "<empty path>" : string.Join(", ", _path.Select(x => x.ToString()).ToArray()))})";
}
$"HitTestResult({(_path.isEmpty() ? "<empty path>" : string.Join(", ", LinqUtils<string,HitTestEntry>.SelectList(_path, (x => x.ToString())) ))})";
}
}
}

2
com.unity.uiwidgets/Runtime/material/about.cs


// }
//TODO: implement
setState(() => { _loaded = true; });
return Future.value();
return null;
// D.assert(() {
// Timeline.timeSync("Build scheduled", () { }, flow: Flow.end(debugFlowId));
// return true;

6
com.unity.uiwidgets/Runtime/material/animated_icons/animated_icons_data.cs


namespace Unity.UIWidgets.material {
public abstract class AnimatedIcons {
public static readonly AnimatedIconData add_event = AnimatedIconsData._add_event;
//public static readonly AnimatedIconData add_event = AnimatedIconsData._add_event;
public static readonly AnimatedIconData arrow_menu = AnimatedIconsData._arrow_menu;
//public static readonly AnimatedIconData arrow_menu = AnimatedIconsData._arrow_menu;
public static readonly AnimatedIconData close_menu = AnimatedIconsData._close_menu;
//public static readonly AnimatedIconData close_menu = AnimatedIconsData._close_menu;
// public readonly AnimatedIconData ellipsis_search = AnimatedIconsData._ellipsis_search;

4
com.unity.uiwidgets/Runtime/material/animated_icons/data/add_event.g.cs


using System.Collections.Generic;
/*using System.Collections.Generic;
using Unity.UIWidgets.ui;
using UnityEngine;

);
}
}
}*/

4
com.unity.uiwidgets/Runtime/material/animated_icons/data/arrow_menu.g.cs


using System.Collections.Generic;
/*using System.Collections.Generic;
using Unity.UIWidgets.ui;
using UnityEngine;

);
}
}
}*/

4
com.unity.uiwidgets/Runtime/material/animated_icons/data/close_menu.g.cs


using System.Collections.Generic;
/*using System.Collections.Generic;
using Unity.UIWidgets.ui;
using UnityEngine;

);
}
}
}*/

4
com.unity.uiwidgets/Runtime/material/animated_icons/data/ellipsis_search.g.cs


using Unity.UIWidgets.ui;
/*using Unity.UIWidgets.ui;
using System.Collections.Generic;
namespace Unity.UIWidgets.material

}
);
}
}
}*/

4
com.unity.uiwidgets/Runtime/material/animated_icons/data/event_add.g.cs


using Unity.UIWidgets.ui;
/*using Unity.UIWidgets.ui;
using System.Collections.Generic;
namespace Unity.UIWidgets.material {

}
);
}
}
}*/

5
com.unity.uiwidgets/Runtime/material/bottom_navigation_bar.cs


using System.Linq;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

public float horizontalLeadingOffset {
get {
float weightSum(IEnumerable<Animation<float>> animations) {
return animations.Select(state._evaluateFlex).Sum();
return LinqUtils<float,Animation<float>>.SelectList(animations, state._evaluateFlex).Sum();
float allWeights = weightSum(state._animations);
float allWeights = weightSum(state._animations);
float leadingWeights = weightSum(state._animations.GetRange(0, index ?? 0));
return (leadingWeights + state._evaluateFlex(state._animations[index ?? 0]) / 2.0f) /

5
com.unity.uiwidgets/Runtime/material/button_bar.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

mainAxisAlignment: alignment ?? barTheme?.alignment ?? MainAxisAlignment.end,
mainAxisSize: mainAxisSize ?? barTheme?.mainAxisSize ?? MainAxisSize.max,
overflowDirection: overflowDirection ?? barTheme?.overflowDirection ?? VerticalDirection.down,
children: children.Select((Widget childWidget) => {
children: LinqUtils<Widget>.SelectList(children,((Widget childWidget) => {
}).ToList(),
})),
overflowButtonSpacing: overflowButtonSpacing
)
);

23
com.unity.uiwidgets/Runtime/material/data_table.cs


using System.Linq;
using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

List<TableColumnWidth> tableColumns =
new List<TableColumnWidth>(new TableColumnWidth[columns.Count + (displayCheckboxColumn ? 1 : 0)]);
List<TableRow> tableRows = Enumerable.Range(0, rows.Count + 1).Select((index) => {
return new TableRow(
key: index == 0 ? _headingRowKey : rows[index - 1].key,
decoration: index > 0 && rows[index - 1].selected
? _kSelectedDecoration
: _kUnselectedDecoration,
children: new List<Widget>(new Widget[tableColumns.Count])
);
}).ToList();
List<TableRow> tableRows = LinqUtils<TableRow,int>.SelectList(Enumerable.Range(0, rows.Count + 1), (index) => {
return new TableRow(
key: index == 0 ? _headingRowKey : rows[index - 1].key,
decoration: index > 0 && rows[index - 1].selected
? _kSelectedDecoration
: _kUnselectedDecoration,
children: new List<Widget>(new Widget[tableColumns.Count])
);
});
int rowIndex;

displayColumnIndex += 1;
}
columnWidths: tableColumns.Select((x, i) => new {x, i})
.ToDictionary(a => a.i, a => a.x),
columnWidths: LinqUtils<int, TableColumnWidth>.SelectDictionary(tableColumns, ((TableColumnWidth x) => tableColumns.IndexOf(x))),
children: tableRows
);
}

12
com.unity.uiwidgets/Runtime/material/dropdown.cs


using uiwidgets;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;

) :
base(key: key) {
D.assert(items == null || items.isEmpty() || value == null ||
items.Where((DropdownMenuItem<T> item) => { return item.value.Equals(value); }).Count() == 1,
LinqUtils<DropdownMenuItem<T>>.WhereList(items,((DropdownMenuItem<T> item) => { return item.value.Equals(value); })).Count() == 1,
() => "There should be exactly one item with [DropdownButton]'s value: " +
$"{value}. \n" +
"Either zero or 2 or more [DropdownMenuItem]s were detected " +

}
D.assert(widget.value == null ||
widget.items.Where((DropdownMenuItem<T> item) => item.value.Equals(widget.value))
.ToList().Count == 1);
LinqUtils<DropdownMenuItem<T>>.WhereList(widget.items,((DropdownMenuItem<T> item) => item.value.Equals(widget.value))
).Count == 1);
_selectedIndex = null;
for (int itemIndex = 0; itemIndex < widget.items.Count; itemIndex++) {
if (widget.items[itemIndex].value.Equals(widget.value)) {

alignment: AlignmentDirectional.centerStart,
children: widget.isDense
? items
: items.Select((Widget item) => {
: LinqUtils<Widget>.SelectList(items,(Widget item) => {
}).ToList()
);
}));
}
Icon defaultIcon = new Icon(Icons.arrow_drop_down);

3
com.unity.uiwidgets/Runtime/material/feedback.cs


public static Future forTap(BuildContext context) {
switch (_platform(context)) {
case RuntimePlatform.Android:
return
Future.value(); // SystemSound.play(SystemSoundType.click); TODO: replace with unity equivalent
return Future.value(); // SystemSound.play(SystemSoundType.click); TODO: replace with unity equivalent
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.LinuxEditor:
case RuntimePlatform.LinuxPlayer:

20
com.unity.uiwidgets/Runtime/material/navigation_rail.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

}
void _initControllers() {
_destinationControllers = widget.destinations.Select((destination, i) => {
var result = new AnimationController(
duration: ThemeUtils.kThemeAnimationDuration,
vsync: this
);
result.addListener(_rebuild);
return result;
}).ToList();
_destinationAnimations = _destinationControllers.Select((AnimationController controller) => controller.view)
.ToList();
_destinationControllers = LinqUtils<AnimationController, NavigationRailDestination>.SelectList(widget.destinations, ((destination) => {
var result = new AnimationController(
duration: ThemeUtils.kThemeAnimationDuration,
vsync: this
);
result.addListener(_rebuild);
return result;
}));
_destinationAnimations = LinqUtils<Animation<float>, AnimationController>.SelectList(_destinationControllers,((AnimationController controller) => controller.view));
_destinationControllers[widget.selectedIndex ?? 0].setValue(1.0f);
_extendedController = new AnimationController(
duration: ThemeUtils.kThemeAnimationDuration,

43
com.unity.uiwidgets/Runtime/material/paginated_data_table.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;

DataRow _getBlankRowFor(int index) {
return DataRow.byIndex(
index: index,
cells: widget.columns.Select((DataColumn column) => DataCell.empty).ToList()
);
cells: LinqUtils<DataCell,DataColumn>.SelectList(widget.columns,((DataColumn column) => DataCell.empty))
);
List<DataCell> cells = widget.columns.Select((DataColumn column) => {
if (!column.numeric) {
haveProgressIndicator = true;
return new DataCell(new CircularProgressIndicator());
}
return DataCell.empty;
}).ToList();
List<DataCell> cells = LinqUtils<DataCell, DataColumn>.SelectList(widget.columns,((DataColumn column) => {
if (!column.numeric) {
haveProgressIndicator = true;
return new DataCell(new CircularProgressIndicator());
}
return DataCell.empty;
}));
if (!haveProgressIndicator) {
haveProgressIndicator = true;
cells[0] = new DataCell(new CircularProgressIndicator());

if (widget.actions != null) {
headerWidgets.AddRange(
widget.actions.Select((Widget action) => {
return new Padding(
padding: EdgeInsetsDirectional.only(
start: 24.0f - 8.0f * 2.0f),
child: action
);
}).ToList()
LinqUtils<Widget>.SelectList(widget.actions, ((Widget action) => {
return new Padding(
padding: EdgeInsetsDirectional.only(
start: 24.0f - 8.0f * 2.0f),
child: action
);
}))
);
}

List<Widget> availableRowsPerPage = widget.availableRowsPerPage
.Where((int value) => value <= _rowCount || value == widget.rowsPerPage)
.Select((int value) => {
List<Widget> availableRowsPerPage = LinqUtils<Widget,int>.SelectList(
LinqUtils<int>.WhereList(widget.availableRowsPerPage, ((int value) => value <= _rowCount || value == widget.rowsPerPage)),
(int value) => {
}).ToList();
});
footerWidgets.AddRange(new List<Widget>() {
new Container(width: 14.0f), // to match trailing padding in case we overflow and end up scrolling
new Text(localizations.rowsPerPageTitle),

9
com.unity.uiwidgets/Runtime/material/range_slider.cs


using System.Linq;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

const float _minPreferredTrackWidth = 144.0f;
float _maxSliderPartWidth {
get { return Mathf.Max(_sliderPartSizes.Select((Size size) => size.width).ToArray()); }
get {
return Mathf.Max(LinqUtils<float, Size>.SelectArray(_sliderPartSizes,((Size size) => size.width)));
}
get { return Mathf.Max(_sliderPartSizes.Select((Size size) => size.height).ToArray()); }
get {
return Mathf.Max(LinqUtils<float,Size>.SelectArray(_sliderPartSizes,((Size size) => size.height)));
}
}
List<Size> _sliderPartSizes {

3
com.unity.uiwidgets/Runtime/material/text_selection.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;

}
public override void debugVisitOnstageChildren(ElementVisitor visitor) {
foreach (var child in children.Where(_shouldPaint)) {
foreach (var child in LinqUtils<Element>.WhereList(children,(_shouldPaint))) {
visitor(child);
}
}

6
com.unity.uiwidgets/Runtime/painting/borders.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;

public override ShapeBorder scale(float t) {
return new _CompoundBorder(
borders.Select(border => border.scale(t)).ToList()
LinqUtils<ShapeBorder>.SelectList(borders,(border => border.scale(t)))
);
}

public override string ToString() {
return string.Join(" + ",
((IList<ShapeBorder>) borders).Reverse().Select((border) => border.ToString()));
(LinqUtils<string,ShapeBorder>.SelectList(((IList<ShapeBorder>)borders).Reverse(),((border) => border.ToString())))
);
}
}

10
com.unity.uiwidgets/Runtime/painting/gradient.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.external;
using Unity.UIWidgets.ui;

D.assert(colors.Count >= 2, () => "colors list must have at least two colors");
float separation = 1.0f / (colors.Count - 1);
return Enumerable.Range(0, colors.Count).Select(i => i * separation).ToList();
return LinqUtils<float, int>.SelectList(Enumerable.Range(0, colors.Count), (i => i * separation));
}
public abstract Shader createShader(Rect rect, TextDirection? textDirection = null);

return new LinearGradient(
begin: begin,
end: end,
colors: colors.Select(color => Color.lerp(null, color, factor)).ToList(),
colors: LinqUtils<Color>.SelectList(colors,(color => Color.lerp(null, color, factor))),
stops: stops,
tileMode: tileMode
);

return new RadialGradient(
center: center,
radius: radius,
colors: colors.Select(color => Color.lerp(null, color, factor)).ToList(),
colors: LinqUtils<Color>.SelectList(colors,(color => Color.lerp(null, color, factor))),
stops: stops,
tileMode: tileMode
);

center: center,
startAngle: startAngle,
endAngle: endAngle,
colors: colors.Select(color => Color.lerp(null, color, factor)).ToList(),
colors: LinqUtils<Color>.SelectList(colors,(color => Color.lerp(null, color, factor))),
stops: stops,
tileMode: tileMode
);

8
com.unity.uiwidgets/Runtime/painting/image_provider.cs


using System.IO;
using System.Text;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.editor2;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;

public readonly float scale;
public override Future<MemoryImage> obtainKey(ImageConfiguration configuration) {
return Future.value(FutureOr.value(this)).to<MemoryImage>();
return new SynchronousFuture<MemoryImage>(this);
//Future.value(FutureOr.value(this)).to<MemoryImage>();
}
public override ImageStreamCompleter load(MemoryImage key, DecoderCallback decode) {

public readonly AssetBundle bundle;
public override Future<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
return Future.value(FutureOr.value(new AssetBundleImageKey(
return new SynchronousFuture<AssetBundleImageKey>(new AssetBundleImageKey(
))).to<AssetBundleImageKey>();
));
}
public bool Equals(ExactAssetImage other) {

4
com.unity.uiwidgets/Runtime/painting/image_resolution.cs


AssetBundleImageKey key;
var cache = AssetBundleCache.instance.get(configuration.bundle);
if (cache.TryGetValue(assetConfig, out key)) {
return Future.value(FutureOr.value(key)).to<AssetBundleImageKey>();
return new SynchronousFuture<AssetBundleImageKey>(key);
}
AssetBundle chosenBundle = bundle ? bundle : configuration.bundle;

return Future.value(FutureOr.value(key)).to<AssetBundleImageKey>();
return new SynchronousFuture<AssetBundleImageKey>(key);
}
internal string _chooseVariant(string main, ImageConfiguration config, List<string> candidates) {

14
com.unity.uiwidgets/Runtime/painting/image_stream.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;

return;
}
var localListeners = _listeners.Select(l => l).ToList();
var localListeners = LinqUtils<ImageStreamListener>.SelectList(_listeners,(l => l));
foreach (var listener in localListeners) {
try {
listener.onImage(image, false);

informationCollector: informationCollector,
silent: silent
);
var localErrorListeners = _listeners
.Select(l => l.onError)
.Where(l => l != null)
.ToList();
var localErrorListeners = LinqUtils<ImageErrorListener>.WhereList(
LinqUtils<ImageErrorListener,ImageStreamListener>.SelectList(_listeners, (l => l.onError)),
(l => l != null));
if (localErrorListeners.isEmpty()) {
UIWidgetsError.reportError(_currentError);
}

1
com.unity.uiwidgets/Runtime/painting/shader_warmup.cs


using System.Collections.Generic;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.painting {

18
com.unity.uiwidgets/Runtime/painting/text_span.cs


using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.ui;

if (children == null) {
return new List<DiagnosticsNode>();
}
return children.Select((child) => {
if (child != null) {
return child.toDiagnosticsNode();
}
else {
return DiagnosticsNode.message("<null child>");
}
}).ToList();
return LinqUtils<DiagnosticsNode, InlineSpan>.SelectList(children,((child) => {
if (child != null) {
return child.toDiagnosticsNode();
}
else {
return DiagnosticsNode.message("<null child>");
}
}));
}

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() {

9
com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

trailingGarbage -= 1;
}
_keepAliveBucket.Values.Where(child => {
LinqUtils<RenderBox>.WhereList(_keepAliveBucket.Values, (child => {
}).ToList().ForEach(_childManager.removeChild);
})).ForEach(_childManager.removeChild);
D.assert(_keepAliveBucket.Values.Where(child => {
D.assert(LinqUtils<RenderBox>.WhereList(_keepAliveBucket.Values, (child => {
}).ToList().isEmpty());
})).isEmpty());
});
}

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


using developer;
using Unity.UIWidgets.async;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.engine2;
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;
});

}));
}
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");
_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;
schedulerPhase = SchedulerPhase.midFrameMicrotasks;
D.assert(_schedulerPhase == SchedulerPhase.midFrameMicrotasks);
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;
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;
}
}

1
com.unity.uiwidgets/Runtime/services/asset_bundle.cs


using System.Collections.Generic;
using System.Text;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.editor2;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;

3
com.unity.uiwidgets/Runtime/ui2/painting.cs


using AOT;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using UnityEngine;
using Unity.UIWidgets.ui;

? PaintingUtils._encodeColorList(colors)
: null;
ushort[] encodedIndices = indices != null
? indices.Select(i => (ushort) i).ToArray()
? LinqUtils<ushort, int>.SelectArray(indices, (i => (ushort) i))
: null;
fixed (float* encodedPositionsPtr = encodedPositions, encodedTextureCoordinatesPtr =

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

1
com.unity.uiwidgets/Runtime/ui2/window.cs


using System.Runtime.InteropServices;
using AOT;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.editor2;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;

3
com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.gen.cs


using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unity.UIWidgets.external;
namespace Unity.UIWidgets.foundation {
public class DiagnosticableTreeMixinChangeNotifier : ChangeNotifier, DiagnosticableTreeMixin {

DiagnosticPropertiesBuilder builder = new DiagnosticPropertiesBuilder();
debugFillProperties(builder);
result.Append(string.Join(joiner,
builder.properties.Where(n => !n.isFiltered(minLevel)).Select(n => n.ToString()).ToArray())
LinqUtils<string,DiagnosticsNode>.SelectList(LinqUtils<DiagnosticsNode>.WhereList(builder.properties, (n => !n.isFiltered(minLevel))),(n => n.ToString())))
);
shallowString = result.ToString();
return true;

3
com.unity.uiwidgets/Runtime/widgets/DiagnosticableTree.mixin.njk


using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unity.UIWidgets.external;
namespace Unity.UIWidgets.foundation {
{% macro DiagnosticableTreeMixin(with) %}

DiagnosticPropertiesBuilder builder = new DiagnosticPropertiesBuilder();
debugFillProperties(builder);
result.Append(string.Join(joiner,
builder.properties.Where(n => !n.isFiltered(minLevel)).Select(n => n.ToString()).ToArray())
LinqUtils<string,DiagnosticsNode>.SelectList(LinqUtils<DiagnosticsNode>.WhereList(builder.properties, (n => !n.isFiltered(minLevel))),(n => n.ToString())))
);
shallowString = result.ToString();
return true;

21
com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.gen.cs


using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.external;
namespace Unity.UIWidgets.widgets {
public class DirectionalFocusTraversalPolicyMixinFocusTraversalPolicy : FocusTraversalPolicy, DirectionalFocusTraversalPolicyMixin {

public override void changedScope(FocusNode node = null, FocusScopeNode oldScope = null) {
base.changedScope(node: node, oldScope: oldScope);
if (oldScope != null) {
var delEntries = _policyData[oldScope]?.history?.Where((_DirectionalPolicyDataEntry entry)=> {
var delEntries = LinqUtils<_DirectionalPolicyDataEntry>.WhereList( _policyData[oldScope]?.history , ((_DirectionalPolicyDataEntry entry)=> {
});
}));
foreach (var delEntry in delEntries) {
_policyData[oldScope]?.history?.Remove(delEntry);
}

IEnumerable<FocusNode> result = new List<FocusNode>();
switch (direction) {
case TraversalDirection.left:
result = sorted.Where((FocusNode node) => node.rect != target && node.rect.center.dx <= target.left);
result = LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => node.rect != target && node.rect.center.dx <= target.left));
result = sorted.Where((FocusNode node) => node.rect != target && node.rect.center.dx >= target.right);
result = LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => node.rect != target && node.rect.center.dx >= target.right));
break;
case TraversalDirection.up:
case TraversalDirection.down:

FocusTravesalUtils.mergeSort<FocusNode>(sorted, compare: (FocusNode a, FocusNode b) => a.rect.center.dy.CompareTo(b.rect.center.dy));
switch (direction) {
case TraversalDirection.up:
return sorted.Where((FocusNode node) => node.rect != target && node.rect.center.dy <= target.top);
return LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => node.rect != target && node.rect.center.dy <= target.top));
return sorted.Where((FocusNode node) => node.rect != target && node.rect.center.dy >= target.bottom);
return LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => node.rect != target && node.rect.center.dy >= target.bottom));
case TraversalDirection.left:
case TraversalDirection.right:
break;

nearestScope.traversalDescendants
);
if (focusedScrollable != null && !focusedScrollable.position.atEdge()) {
IEnumerable<FocusNode> filteredEligibleNodes = eligibleNodes.Where((FocusNode node) => Scrollable.of(node.context) == focusedScrollable);
IEnumerable<FocusNode> filteredEligibleNodes = LinqUtils<FocusNode>.WhereList(eligibleNodes,((FocusNode node) => Scrollable.of(node.context) == focusedScrollable));
if (filteredEligibleNodes.Count() !=0) {
eligibleNodes = filteredEligibleNodes;
}

sorted = sorted.ToList();
}
Rect band = Rect.fromLTRB(focusedChild.rect.left, float.NegativeInfinity, focusedChild.rect.right, float.PositiveInfinity);
IEnumerable<FocusNode> inBand = sorted.Where((FocusNode node) => !node.rect.intersect(band).isEmpty);
IEnumerable<FocusNode> inBand = LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => !node.rect.intersect(band).isEmpty));
if (inBand.Count() !=0) {
found = inBand.First();
break;

case TraversalDirection.left:
eligibleNodes = _sortAndFilterHorizontally(direction, focusedChild.rect, nearestScope);
if (focusedScrollable != null && !focusedScrollable.position.atEdge()) {
IEnumerable<FocusNode> filteredEligibleNodes = eligibleNodes.Where((FocusNode node) => Scrollable.of(node.context) == focusedScrollable);
IEnumerable<FocusNode> filteredEligibleNodes = LinqUtils<FocusNode>.WhereList(eligibleNodes,((FocusNode node) => Scrollable.of(node.context) == focusedScrollable));
if (filteredEligibleNodes.Count()!=0) {
eligibleNodes = filteredEligibleNodes;
}

//sorted = sorted.reversed.toList();
}
band = Rect.fromLTRB(float.NegativeInfinity, focusedChild.rect.top, float.PositiveInfinity, focusedChild.rect.bottom);
inBand = sorted.Where((FocusNode node) => !node.rect.intersect(band).isEmpty);
inBand = LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => !node.rect.intersect(band).isEmpty));
if (inBand.Count()!=0) {
found = inBand.First();
break;

21
com.unity.uiwidgets/Runtime/widgets/DirectionalFocusTraversalPolicy.mixin.njk


using System.Linq;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.external;
namespace Unity.UIWidgets.widgets {
{% macro DirectionalFocusTraversalPolicyMixin(with) %}

public override void changedScope(FocusNode node = null, FocusScopeNode oldScope = null) {
base.changedScope(node: node, oldScope: oldScope);
if (oldScope != null) {
var delEntries = _policyData[oldScope]?.history?.Where((_DirectionalPolicyDataEntry entry)=> {
var delEntries = LinqUtils<_DirectionalPolicyDataEntry>.WhereList( _policyData[oldScope]?.history , ((_DirectionalPolicyDataEntry entry)=> {
});
}));
foreach (var delEntry in delEntries) {
_policyData[oldScope]?.history?.Remove(delEntry);
}

IEnumerable<FocusNode> result = new List<FocusNode>();
switch (direction) {
case TraversalDirection.left:
result = sorted.Where((FocusNode node) => node.rect != target && node.rect.center.dx <= target.left);
result = LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => node.rect != target && node.rect.center.dx <= target.left));
result = sorted.Where((FocusNode node) => node.rect != target && node.rect.center.dx >= target.right);
result = LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => node.rect != target && node.rect.center.dx >= target.right));
break;
case TraversalDirection.up:
case TraversalDirection.down:

FocusTravesalUtils.mergeSort<FocusNode>(sorted, compare: (FocusNode a, FocusNode b) => a.rect.center.dy.CompareTo(b.rect.center.dy));
switch (direction) {
case TraversalDirection.up:
return sorted.Where((FocusNode node) => node.rect != target && node.rect.center.dy <= target.top);
return LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => node.rect != target && node.rect.center.dy <= target.top));
return sorted.Where((FocusNode node) => node.rect != target && node.rect.center.dy >= target.bottom);
return LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => node.rect != target && node.rect.center.dy >= target.bottom));
case TraversalDirection.left:
case TraversalDirection.right:
break;

nearestScope.traversalDescendants
);
if (focusedScrollable != null && !focusedScrollable.position.atEdge()) {
IEnumerable<FocusNode> filteredEligibleNodes = eligibleNodes.Where((FocusNode node) => Scrollable.of(node.context) == focusedScrollable);
IEnumerable<FocusNode> filteredEligibleNodes = LinqUtils<FocusNode>.WhereList(eligibleNodes,((FocusNode node) => Scrollable.of(node.context) == focusedScrollable));
if (filteredEligibleNodes.Count() !=0) {
eligibleNodes = filteredEligibleNodes;
}

sorted = sorted.ToList();
}
Rect band = Rect.fromLTRB(focusedChild.rect.left, float.NegativeInfinity, focusedChild.rect.right, float.PositiveInfinity);
IEnumerable<FocusNode> inBand = sorted.Where((FocusNode node) => !node.rect.intersect(band).isEmpty);
IEnumerable<FocusNode> inBand = LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => !node.rect.intersect(band).isEmpty));
if (inBand.Count() !=0) {
found = inBand.First();
break;

case TraversalDirection.left:
eligibleNodes = _sortAndFilterHorizontally(direction, focusedChild.rect, nearestScope);
if (focusedScrollable != null && !focusedScrollable.position.atEdge()) {
IEnumerable<FocusNode> filteredEligibleNodes = eligibleNodes.Where((FocusNode node) => Scrollable.of(node.context) == focusedScrollable);
IEnumerable<FocusNode> filteredEligibleNodes = LinqUtils<FocusNode>.WhereList(eligibleNodes,((FocusNode node) => Scrollable.of(node.context) == focusedScrollable));
if (filteredEligibleNodes.Count()!=0) {
eligibleNodes = filteredEligibleNodes;
}

//sorted = sorted.reversed.toList();
}
band = Rect.fromLTRB(float.NegativeInfinity, focusedChild.rect.top, float.PositiveInfinity, focusedChild.rect.bottom);
inBand = sorted.Where((FocusNode node) => !node.rect.intersect(band).isEmpty);
inBand = LinqUtils<FocusNode>.WhereList(sorted,((FocusNode node) => !node.rect.intersect(band).isEmpty));
if (inBand.Count()!=0) {
found = inBand.First();
break;

606
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 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: context1, 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) {
result = new WidgetInspector(

}
//Fix Me !!
//TODO: the following line is a work-around for some potential TextDirection bug
//In the home page of the Shrine sample, the positions of the buttons are not correct, which is
//determined by the TextDirection of some widget. we should fix it!
result = new Directionality(child: result, TextDirection.ltr);
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();
}

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


);
}
void updateRenderObject(BuildContext context, RenderMouseRegion renderObject) {
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
RenderMouseRegion _renderObject = (RenderMouseRegion) renderObject;
renderObject.onEnter = widget.onEnter;
renderObject.onHover = widget.onHover;
renderObject.onExit = owner.getHandleExit();
renderObject.opaque = widget.opaque;
_renderObject.onEnter = widget.onEnter;
_renderObject.onHover = widget.onHover;
_renderObject.onExit = owner.getHandleExit();
_renderObject.opaque = widget.opaque;
}
}

20
com.unity.uiwidgets/Runtime/widgets/focus_manager.cs


using System.Linq;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.cupertino;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

public override List<DiagnosticsNode> debugDescribeChildren() {
int count = 1;
return _children.Select((FocusNode child)=> {
return child.toDiagnosticsNode(name: $"Child {count++}");
}).ToList();
return LinqUtils<DiagnosticsNode, FocusNode>.SelectList(_children, (FocusNode child) => {
return child.toDiagnosticsNode(name: $"Child {count++}");
});
}
public override string toStringShort() {//override

}
List<string> childList = new List<string>();
_focusedChildren.Reverse();
childList = _focusedChildren.Select((FocusNode child)=> {
return child.toStringShort();
}).ToList();
childList = LinqUtils<string,FocusNode>.SelectList(_focusedChildren, (FocusNode child) => {
return child.toStringShort();
});
properties.add(new EnumerableProperty<string>("focusedChildren", childList, defaultValue: new List<string>()));
}
}

_dirtyNodes.Add(_primaryFocus);
}
}
D.assert(FocusManagerUtils._focusDebug($"Notifying {_dirtyNodes.Count} dirty nodes:",
_dirtyNodes.ToList().Select((FocusNode node) => {
D.assert(FocusManagerUtils._focusDebug($"Notifying {_dirtyNodes.Count} dirty nodes:",
LinqUtils<string,FocusNode>.SelectList(_dirtyNodes, ((FocusNode node) => {
}).ToList()));
}))
));
foreach ( FocusNode node in _dirtyNodes) {
node._notify();
}

13
com.unity.uiwidgets/Runtime/widgets/focus_traversal.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

public static TextDirection _findDirectionality(BuildContext context) {
return (context.getElementForInheritedWidgetOfExactType<Directionality>().widget as Directionality).textDirection;
}
public static TextDirection commonDirectionalityOf(List<_ReadingOrderSortData> list) {
IEnumerable<HashSet<Directionality>> allAncestors = list.Select((_ReadingOrderSortData member) => new HashSet<Directionality>(member.directionalAncestors));
public static TextDirection commonDirectionalityOf(List<_ReadingOrderSortData> list) {
IEnumerable<HashSet<Directionality>> allAncestors = LinqUtils<HashSet<Directionality>, _ReadingOrderSortData>.SelectList(list, ((_ReadingOrderSortData member) => new HashSet<Directionality>(member.directionalAncestors)));
HashSet<Directionality> common = null;
foreach ( HashSet<Directionality> ancestorSet in allAncestors) {
common = common ?? ancestorSet;

Rect _rect;
Rect rect {
get {if (_rect == null) {
foreach(Rect rect in members.Select(
foreach(Rect rect in LinqUtils<Rect,_ReadingOrderSortData>.SelectList(members,
(_ReadingOrderSortData data) => data.rect)){
_rect = _rect ?? rect;
_rect = _rect.expandToInclude(rect);

List<_ReadingOrderSortData> inBand(_ReadingOrderSortData current, IEnumerable<_ReadingOrderSortData> _candidates) {
Rect band = Rect.fromLTRB(float.NegativeInfinity, current.rect.top, float.PositiveInfinity, current.rect.bottom);
return _candidates.Where((_ReadingOrderSortData item)=> {
return LinqUtils<_ReadingOrderSortData>.WhereList(_candidates,((_ReadingOrderSortData item)=> {
}).ToList();
}));
}
List<_ReadingOrderSortData> inBandOfTop = inBand(topmost, candidates);
D.assert(topmost.rect.isEmpty || inBandOfTop.isNotEmpty());

);
return a.order.CompareTo(b.order);
});
return ordered.Select((_OrderedFocusInfo info) => info.node).Concat(unordered);
return LinqUtils<FocusNode,_OrderedFocusInfo>.SelectList(ordered,((_OrderedFocusInfo info) => info.node)).Concat(unordered);
}
}

17
com.unity.uiwidgets/Runtime/widgets/framework.cs


using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;

if (keys.isNotEmpty()) {
var keyStringCount = new Dictionary<string, int>();
foreach (string key in keys.Select(key => key.ToString())) {
foreach (string key in LinqUtils<string, GlobalKey>.SelectList(keys,(key => key.ToString()))) {
if (keyStringCount.ContainsKey(key)) {
keyStringCount[key] += 1;
}

var elements = _debugElementsThatWillNeedToBeRebuiltDueToGlobalKeyShenanigans.Keys;
var elementStringCount = new Dictionary<string, int>();
foreach (string element in elements.Select(element => element.ToString())) {
foreach (string element in LinqUtils<string, Element>.SelectList(elements,(element => element.ToString()))) {
if (elementStringCount.ContainsKey(element)) {
elementStringCount[element] += 1;
}

public static DiagnosticsNode describeElements(string name, IEnumerable<Element> elements) {
return new DiagnosticsBlock(
name: name,
children: elements.Select((Element element) => new DiagnosticsProperty<Element>("", element))
.ToList<DiagnosticsNode>(),
children: LinqUtils<DiagnosticsNode, Element>.SelectList(elements,((Element element) => new DiagnosticsProperty<Element>("", element))),
allowTruncate: true
);
}

properties.add(new FlagProperty("dirty", value: dirty, ifTrue: "dirty"));
if (_dependencies != null && _dependencies.isNotEmpty()) {
List<DiagnosticsNode> diagnosticsDependencies = _dependencies
.Select((InheritedElement element) =>
element.widget.toDiagnosticsNode(style: DiagnosticsTreeStyle.sparse))
.ToList();
List<DiagnosticsNode> diagnosticsDependencies = LinqUtils<DiagnosticsNode, InheritedElement>
.SelectList(_dependencies, ((InheritedElement element) =>
element.widget.toDiagnosticsNode(style: DiagnosticsTreeStyle.sparse)));
properties.add(new DiagnosticsProperty<List<DiagnosticsNode>>("dependencies", diagnosticsDependencies));
}
}

}
protected IEnumerable<Element> children {
get { return _children.Where((child) => !_forgottenChildren.Contains(child)); }
get { return LinqUtils<Element>.WhereList(_children,((child) => !_forgottenChildren.Contains(child))); }
}
List<Element> _children;

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


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.rendering;

properties.add(DiagnosticsNode.message("DISPOSED"));
}
else {
List<string> gestures = _recognizers.Values.Select(recognizer => recognizer.debugDescription)
.ToList();
List<string> gestures = LinqUtils<string, GestureRecognizer>.SelectList(_recognizers.Values, (recognizer => recognizer.debugDescription));
properties.add(new EnumerableProperty<string>("gestures", gestures, ifEmpty: "<none>"));
properties.add(new EnumerableProperty<GestureRecognizer>("recognizers", _recognizers.Values,
level: DiagnosticLevel.fine));

5
com.unity.uiwidgets/Runtime/widgets/heroes.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

&& flight._proxyAnimation.isDismissed;
}
List<_HeroFlight> invalidFlights = _flights.Values
.Where(isInvalidFlight)
.ToList();
List<_HeroFlight> invalidFlights = LinqUtils<_HeroFlight>.WhereList(_flights.Values, isInvalidFlight);
foreach ( _HeroFlight flight in invalidFlights) {
flight._handleAnimationUpdate(AnimationStatus.dismissed);
}

289
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,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new EnumProperty<ImageRepeat>("repeat", value: repeat, defaultValue: ImageRepeat.noRepeat));
properties.add(new DiagnosticsProperty<Rect>("centerSlice", value: centerSlice,
properties.add(new EnumProperty<ImageRepeat>("repeat", repeat, defaultValue: ImageRepeat.noRepeat));
properties.add(new DiagnosticsProperty<Rect>("centerSlice", centerSlice,
properties.add(new EnumProperty<FilterQuality>("filterQuality", value: filterQuality,
properties.add(new EnumProperty<FilterQuality>("filterQuality", filterQuality,
foundation_.kNullDefaultValue));
properties.add(new FlagProperty("matchTextDirection", value: matchTextDirection, ifTrue: "match text direction"));
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>(
//TODO: why refactoring this code? we need a PR to fix it!
/*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));
}
}
}

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


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;

}
if (pendingList == null) {
return Future.value(output).to<Dictionary<Type, object>>();
return new SynchronousFuture<Dictionary<Type, object>>(output);
return Future.wait<object>(pendingList.Select(p => p.futureValue))
return Future.wait<object>(LinqUtils<Future<object>, _Pending>.SelectList(pendingList, (p => p.futureValue)))
.then(values => {
var list = (List<object>)values;

26
com.unity.uiwidgets/Runtime/widgets/navigator.cs


using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.external;
using Unity.UIWidgets.external.simplejson;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

public virtual Future<RoutePopDisposition> willPop() {
return Future.value(isFirst
? RoutePopDisposition.bubble
: RoutePopDisposition.pop).to<RoutePopDisposition>();
? RoutePopDisposition.bubble
: RoutePopDisposition.pop).to<RoutePopDisposition>();
}
public virtual bool willHandlePopInternally {

if (initialRoute != null) {
_history.AddRange(
widget.onGenerateInitialRoutes(
LinqUtils<_RouteEntry,Route>.SelectList(
widget.onGenerateInitialRoutes(
widget.initialRoute ?? Navigator.defaultRouteName
).Select((Route route) =>
new _RouteEntry(
route,
initialState: _RouteLifecycle.add
)
)
);
widget.initialRoute ?? Navigator.defaultRouteName
), (Route route) =>
new _RouteEntry(
route,
initialState: _RouteLifecycle.add
)
)
);
}
D.assert(!_debugLocked);
D.assert(() => {

public Future<bool> maybePop<T>(T result = default(T)) {
///asyn
_RouteEntry lastEntry = null; //_history.Where(_RouteEntry.isPresentPredicate);
_RouteEntry lastEntry = null;
foreach (_RouteEntry routeEntry in _history) {
if (_RouteEntry.isPresentPredicate(routeEntry)) {
lastEntry = routeEntry;

3
com.unity.uiwidgets/Runtime/widgets/page_storage.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.widgets {

}
public override string ToString() {
return $"StorageEntryIdentifier({string.Join(":", keys.Select(x => x.ToString()).ToArray())})";
return $"StorageEntryIdentifier({string.Join(":", LinqUtils<string, PageStorageKey>.SelectList(keys, (x => x.ToString())))})";
}
public bool Equals(_StorageEntryIdentifier other) {

2
com.unity.uiwidgets/Runtime/widgets/routes.cs


foreach (WillPopCallback callback in _willPopCallbacks) {
callback.Invoke().then(v => result = !(bool)v);
if (result) {
return Future.value(RoutePopDisposition.doNotPop).to<RoutePopDisposition>();
return Future.value(RoutePopDisposition.doNotPop).to<RoutePopDisposition>();
}
}
return base.willPop();

2
com.unity.uiwidgets/Runtime/widgets/scroll_position.cs


}
break;
}
if (target == pixels) {
if (foundation_.FloatEqual(target,pixels)) {
return Future.value();
}

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


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.external;
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 = LinqUtils<string, LogicalKeyboardKey>.SelectList(sortedKeys, (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);
//FIX ME !
//Since we process key event produced by Unity instead of raw input info (physical key) from os directly,
//we cannot handle the shortcut key press as in original flutter code
//TODO: however, we need find out a way to make this work in another way
return false;
/*
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 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 readonly string debugLabel;
public override State createState() {
return new _ShortcutsState();
}
public readonly ShortcutManager manager;
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
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 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 override State createState() {
return new _ShortcutsState();
}
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; }
}
public override void dispose() {
_internalManager?.dispose();
base.dispose();
}
ShortcutManager _internalManager;
public override void initState() {
base.initState();
if (widget.manager == null) {
_internalManager = new ShortcutManager();
public ShortcutManager manager {
get { return widget.manager ?? _internalManager; }
manager.shortcuts = widget.shortcuts;
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget((Shortcuts)oldWidget);
if (widget.manager != ((Shortcuts)oldWidget).manager) {
if (widget.manager != null) {
public override void dispose() {
_internalManager = null;
} else {
_internalManager = _internalManager?? new ShortcutManager();
}
base.dispose();
manager.shortcuts = widget.shortcuts;
}
public bool _handleOnKey(FocusNode node, RawKeyEvent _event)
{
if (node.context == null) {
return false;
public override void initState() {
base.initState();
if (widget.manager == null) {
_internalManager = new ShortcutManager();
}
manager.shortcuts = widget.shortcuts;
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 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();
}
}
manager.shortcuts = widget.shortcuts;
}
public bool _handleOnKey(FocusNode node, RawKeyEvent _event) {
if (node.context == null) {
return false;
}
return manager.handleKeypress(context: node.context, rawKeyEvent: _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);
}
}
}

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


}
public override void debugVisitOnstageChildren(ElementVisitor visitor) {
_childElements.Values.Where(child => {
LinqUtils<Element>.WhereList(_childElements.Values, (child => {
SliverMultiBoxAdaptorParentData parentData =
(SliverMultiBoxAdaptorParentData) child.renderObject.parentData;
float itemExtent = 0;

parentData.layoutOffset < renderObject.constraints.scrollOffset + renderObject.constraints.remainingPaintExtent &&
parentData.layoutOffset + itemExtent > renderObject.constraints.scrollOffset;
}).ToList().ForEach(e => visitor(e));
})).ForEach(e => visitor(e));
}
}

7
com.unity.uiwidgets/Runtime/widgets/viewport.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;

) : base(key: key, children: slivers) {
D.assert(offset != null);
D.assert(slivers != null);
D.assert(center == null || slivers.Where((Widget child) => child.key == center).Count() == 1);
D.assert(center == null || LinqUtils<Widget>.WhereList(slivers,((Widget child) => child.key == center)).Count() == 1);
D.assert(cacheExtentStyle != null);
D.assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null);
this.axisDirection = axisDirection;

}
public override void debugVisitOnstageChildren(ElementVisitor visitor) {
children.Where(e => {
LinqUtils<Element>.WhereList(children, (e => {
}).ToList().ForEach(e => visitor(e));
})).ForEach(e => visitor(e));
}
}

27
com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs


using System.Linq;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.external;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

name: name,
callback:
((IDictionary<string, string> parameters) => {
var result = Future.value(FutureOr.value(new Dictionary<string, object>(){{"result", callback}})).to<IDictionary<string, object>>();
var result = Future.value(FutureOr.value(new Dictionary<string, object>(){{"result", callback}})).to<IDictionary<string, object>>();
return result;
})
);

) {
registerServiceExtension(
name: name,
callback: (IDictionary<string, string> parameters) =>{
callback: (IDictionary<string, string> parameters) => {
var result = Future.value(FutureOr.value((new Dictionary<string, object>{{"result", callback(parameters["objectGroup"])}}))).to<IDictionary<string, object>>();
return result;
}

path = _getElementParentChain((Element)value, groupName);
else
throw new UIWidgetsError(new List<DiagnosticsNode>{new ErrorSummary($"Cannot get parent chain for node of type {value.GetType()}")});
return path.Select(
(_DiagnosticsPathNode node) =>
return LinqUtils<Dictionary<string, object>, _DiagnosticsPathNode>.SelectList(
path,((_DiagnosticsPathNode node) =>
).ToList();
));
}
Dictionary<string, object> _pathNodeToJson(_DiagnosticsPathNode pathNode, InspectorSerializationDelegate _delegate) {
if (pathNode == null)

}
}
if (isElement && isWidgetCreationTracked()) {
List<DiagnosticsNode> localNodes = nodes.Where((DiagnosticsNode node) =>
_isValueCreatedByLocalProject(node.value)).ToList();
List<DiagnosticsNode> localNodes = LinqUtils<DiagnosticsNode>.WhereList(nodes,(DiagnosticsNode node) =>
_isValueCreatedByLocalProject(node.value));
//return nodes.take(maxDescendentsTruncatableNode).toList();
List<DiagnosticsNode> results = new List<DiagnosticsNode>();
for (int i = 0; i < maxDescendentsTruncatableNode; i++) {

}
public override List<DiagnosticsNode> filterProperties(List<DiagnosticsNode> properties, DiagnosticsNode owner) {
bool createdByLocalProject = _nodesCreatedByLocalProject.Contains(owner);
return properties.Where((DiagnosticsNode node)=>{
return LinqUtils<DiagnosticsNode>.WhereList(properties,(DiagnosticsNode node)=>{
}).ToList();
});
}
public override List<DiagnosticsNode> truncateNodesList(List<DiagnosticsNode> nodes, DiagnosticsNode owner) {
if (maxDescendentsTruncatableNode >= 0 &&

}
if (parameterLocations != null) {
json["parameterLocations"] = parameterLocations.Select(
(_Location location) => location.toJsonMap()).ToList();
json["parameterLocations"] =
LinqUtils<object, _Location>.SelectList(
parameterLocations,((_Location location) => location.toJsonMap()));
}
return json;

113
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/HoverSample.cs


using Unity.UIWidgets.engine2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using ui_ = Unity.UIWidgets.widgets.ui_;
using uiwidgets;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.material;
using Color = Unity.UIWidgets.ui.Color;
namespace UIWidgetsSample
{
/**
*
* STILL NOT WORKING, THERE SHOULD BE A BUG. FIX IT !!!!
*
*/
public class HoverSample : UIWidgetsPanel
{
protected void OnEnable()
{
base.OnEnable();
}
protected override void main()
{
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new MaterialApp(
debugShowCheckedModeBanner: false,
title: "Flutter Demo",
home: new Scaffold(
appBar: new AppBar(title: new Text("good")),
body: new Center(
child: new MyStatefulWidget()
)
)
);
}
}
class MyStatefulWidget : StatefulWidget
{
public MyStatefulWidget(Key key = null) : base(key: key)
{
}
public override State createState() => new _MyStatefulWidgetState();
}
class _MyStatefulWidgetState : State<MyStatefulWidget>
{
Color textColor = Colors.blue;
int _enterCounter = 0;
int _exitCounter = 0;
float x = 0.0f;
float y = 0.0f;
void _incrementEnter(PointerEvent details)
{
UnityEngine.Debug.Log("enter");
setState(() => { _enterCounter++; });
}
void _incrementExit(PointerEvent details)
{
setState(() =>
{
textColor = Colors.blue;
_exitCounter++;
});
}
void _updateLocation(PointerEvent details)
{
setState(() =>
{
textColor = Colors.red;
x = details.position.dx;
y = details.position.dy;
});
}
public override Widget build(BuildContext context)
{
return new MouseRegion(
onEnter: _incrementEnter,
onHover: _updateLocation,
onExit: _incrementExit,
child: new FlatButton(
color: Colors.white,
textColor: Colors.teal[700], //when hovered text color change
shape: new RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
side: new BorderSide(
color: Colors.teal[700]
)
),
onPressed: () => { },
child: new Text("Log in", style: new TextStyle(color: textColor))
)
);
}
}
}
}

40
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample/NetWorkImageSample.cs


using System.Collections;
using System.Collections.Generic;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.material;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace UIWidgetsSample
{
public class NetWorkImageSample : UIWidgetsPanel
{
protected override void main()
{
ui_.runApp(new MaterialApp(
showPerformanceOverlay: false,
home: new NetWorkeImageWidget()));
}
class NetWorkeImageWidget : StatelessWidget {
public override Widget build(BuildContext context) {
var title = "NetWork Image";
return new MaterialApp(
title: title,
home: new Scaffold(
appBar: new AppBar(
title: new Text(title)
),
body: Image.network("https://picsum.photos/250?image=2")
)
);
}
}
}
}

85
com.unity.uiwidgets/Runtime/external/LinqUtils.cs


using System.Collections.Generic;
namespace Unity.UIWidgets.external
{
public static class LinqUtils<T, S>
{
public delegate T CreateItem(S item);
public delegate bool FilterDict(S value);
public static List<T> SelectList(IEnumerable<S> items, CreateItem createItem)
{
if (items == null)
return null;
var results = new List<T>();
foreach (var item in items) results.Add(createItem(item));
return results;
}
public static T[] SelectArray(List<S> items, CreateItem createItem)
{
if (items == null)
return null;
var itemCount = items.Count;
var results = new T[itemCount];
for (var i= 0; i < itemCount; i++)
{
results[i] = createItem(items[i]);
}
return results;
}
public static Dictionary<T, S> SelectDictionary(IEnumerable<S> items, CreateItem createItem)
{
if (items == null)
return null;
var results = new Dictionary<T, S>();
foreach (var item in items) results.Add(createItem(item), item);
return results;
}
public static Dictionary<T, S> WhereDictionary(Dictionary<T, S> items, FilterDict filterDict)
{
if (items == null)
return null;
var results = new Dictionary<T, S>();
foreach (var item in items)
if (filterDict(item.Value))
results.Add(item.Key, item.Value);
return results;
}
}
public static class LinqUtils<T>
{
public delegate T CreateItem(T item);
public delegate bool FilterItem(T item);
public static List<T> SelectList(IEnumerable<T> items, CreateItem createItem)
{
if (items == null)
return null;
var results = new List<T>();
foreach (var item in items) results.Add(createItem(item));
return results;
}
public static List<T> WhereList(IEnumerable<T> items, FilterItem filterItem)
{
if (items == null)
return null;
var results = new List<T>();
foreach (var item in items)
if (filterItem(item))
results.Add(item);
return results;
}
}
}
正在加载...
取消
保存