浏览代码

remove sample & update widget

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
57cac2f3
共有 228 个文件被更改,包括 310 次插入4538 次删除
  1. 17
      Samples/UIWidgetsSamples_2019_4/Assets/TextTest.cs
  2. 4
      com.unity.uiwidgets/Runtime/animation/animation_controller.cs
  3. 4
      com.unity.uiwidgets/Runtime/async2/future.cs
  4. 1
      com.unity.uiwidgets/Runtime/foundation/binding.cs
  5. 1
      com.unity.uiwidgets/Runtime/foundation/debug.cs
  6. 70
      com.unity.uiwidgets/Runtime/material/colors.cs
  7. 20
      com.unity.uiwidgets/Runtime/painting/image_provider.cs
  8. 2
      com.unity.uiwidgets/Runtime/painting/image_resolution.cs
  9. 4
      com.unity.uiwidgets/Runtime/painting/image_stream.cs
  10. 7
      com.unity.uiwidgets/Runtime/rendering/viewport_offset.cs
  11. 12
      com.unity.uiwidgets/Runtime/service/clipboard.cs
  12. 4
      com.unity.uiwidgets/Runtime/ui/painting/codec.cs
  13. 1
      com.unity.uiwidgets/Runtime/widgets/animated_switcher.cs
  14. 19
      com.unity.uiwidgets/Runtime/widgets/app.cs
  15. 34
      com.unity.uiwidgets/Runtime/widgets/binding.cs
  16. 12
      com.unity.uiwidgets/Runtime/widgets/dismissible.cs
  17. 9
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs
  18. 7
      com.unity.uiwidgets/Runtime/widgets/focus_manager.cs
  19. 21
      com.unity.uiwidgets/Runtime/widgets/image.cs
  20. 11
      com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs
  21. 42
      com.unity.uiwidgets/Runtime/widgets/localizations.cs
  22. 65
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  23. 10
      com.unity.uiwidgets/Runtime/widgets/nested_scroll_view.cs
  24. 8
      com.unity.uiwidgets/Runtime/widgets/page_view.cs
  25. 105
      com.unity.uiwidgets/Runtime/widgets/routes.cs
  26. 16
      com.unity.uiwidgets/Runtime/widgets/scroll_activity.cs
  27. 8
      com.unity.uiwidgets/Runtime/widgets/scroll_controller.cs
  28. 10
      com.unity.uiwidgets/Runtime/widgets/scroll_position.cs
  29. 6
      com.unity.uiwidgets/Runtime/widgets/scroll_position_with_single_context.cs
  30. 9
      com.unity.uiwidgets/Runtime/widgets/scrollable.cs
  31. 9
      com.unity.uiwidgets/Runtime/widgets/selectable_text.cs
  32. 17
      com.unity.uiwidgets/Runtime/widgets/texture.cs
  33. 10
      com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
  34. 5
      engine/src/lib/ui/window/window.cc
  35. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Editor.meta
  36. 8
      Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta
  37. 8
      Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample.meta
  38. 8
      Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample.meta
  39. 8
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery.meta
  40. 8
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsSample.meta
  41. 8
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsTheatre.meta
  42. 204
      com.unity.uiwidgets/Runtime/material/text_selection.cs
  43. 11
      com.unity.uiwidgets/Runtime/material/text_selection.cs.meta
  44. 11
      com.unity.uiwidgets/Runtime/material/button.cs.meta
  45. 11
      com.unity.uiwidgets/Runtime/material/button_theme.cs.meta
  46. 352
      com.unity.uiwidgets/Runtime/material/color_scheme.cs
  47. 11
      com.unity.uiwidgets/Runtime/material/color_scheme.cs.meta
  48. 11
      com.unity.uiwidgets/Runtime/material/colors.cs.meta
  49. 26
      com.unity.uiwidgets/Runtime/material/constants.cs
  50. 11
      com.unity.uiwidgets/Runtime/material/constants.cs.meta
  51. 11
      com.unity.uiwidgets/Runtime/material/debug.cs.meta
  52. 11
      com.unity.uiwidgets/Runtime/material/ink_decoration.cs.meta
  53. 11
      com.unity.uiwidgets/Runtime/material/ink_highlight.cs.meta
  54. 11
      com.unity.uiwidgets/Runtime/material/ink_splash.cs.meta
  55. 11
      com.unity.uiwidgets/Runtime/material/ink_well.cs.meta
  56. 11
      com.unity.uiwidgets/Runtime/material/material.cs.meta
  57. 11
      com.unity.uiwidgets/Runtime/material/material_button.cs.meta
  58. 371
      com.unity.uiwidgets/Runtime/material/text_theme.cs
  59. 11
      com.unity.uiwidgets/Runtime/material/text_theme.cs.meta
  60. 147
      com.unity.uiwidgets/Runtime/material/theme.cs
  61. 11
      com.unity.uiwidgets/Runtime/material/theme.cs.meta
  62. 11
      com.unity.uiwidgets/Runtime/material/theme_data.cs.meta
  63. 449
      com.unity.uiwidgets/Runtime/material/typography.cs
  64. 11
      com.unity.uiwidgets/Runtime/material/typography.cs.meta
  65. 112
      com.unity.uiwidgets/Runtime/material/scrollbar.cs
  66. 11
      com.unity.uiwidgets/Runtime/material/scrollbar.cs.meta
  67. 425
      com.unity.uiwidgets/Runtime/material/arc.cs
  68. 11
      com.unity.uiwidgets/Runtime/material/arc.cs.meta
  69. 169
      com.unity.uiwidgets/Runtime/material/button.cs
  70. 68
      com.unity.uiwidgets/Runtime/material/button_bar.cs
  71. 11
      com.unity.uiwidgets/Runtime/material/button_bar.cs.meta
  72. 62
      com.unity.uiwidgets/Runtime/material/card.cs
  73. 11
      com.unity.uiwidgets/Runtime/material/card.cs.meta
  74. 95
      com.unity.uiwidgets/Runtime/material/debug.cs
  75. 47
      com.unity.uiwidgets/Runtime/material/divider.cs
  76. 11
      com.unity.uiwidgets/Runtime/material/divider.cs.meta
  77. 325
      com.unity.uiwidgets/Runtime/material/drawer.cs
  78. 11
      com.unity.uiwidgets/Runtime/material/drawer.cs.meta
  79. 76
      com.unity.uiwidgets/Runtime/material/drawer_header.cs
  80. 11
      com.unity.uiwidgets/Runtime/material/drawer_header.cs.meta
  81. 94
      com.unity.uiwidgets/Runtime/material/expand_icon.cs
  82. 11
      com.unity.uiwidgets/Runtime/material/expand_icon.cs.meta
  83. 343
      com.unity.uiwidgets/Runtime/material/expansion_panel.cs
  84. 11
      com.unity.uiwidgets/Runtime/material/expansion_panel.cs.meta
  85. 176
      com.unity.uiwidgets/Runtime/material/expansion_tile.cs
  86. 11
      com.unity.uiwidgets/Runtime/material/expansion_tile.cs.meta
  87. 178
      com.unity.uiwidgets/Runtime/material/flat_button.cs
  88. 11
      com.unity.uiwidgets/Runtime/material/flat_button.cs.meta
  89. 53
      com.unity.uiwidgets/Runtime/material/grid_tile.cs
  90. 11
      com.unity.uiwidgets/Runtime/material/grid_tile.cs.meta
  91. 121
      com.unity.uiwidgets/Runtime/material/icon_button.cs

17
Samples/UIWidgetsSamples_2019_4/Assets/TextTest.cs


using Unity.UIWidgets.async2;
using Unity.UIWidgets.engine2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.ui2;
using Canvas = Unity.UIWidgets.ui2.Canvas;
using Color = Unity.UIWidgets.ui2.Color;
using Paint = Unity.UIWidgets.ui2.Paint;
using ParagraphBuilder = Unity.UIWidgets.ui2.ParagraphBuilder;
using ParagraphConstraints = Unity.UIWidgets.ui2.ParagraphConstraints;
using ParagraphStyle = Unity.UIWidgets.ui2.ParagraphStyle;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Picture = Unity.UIWidgets.ui2.Picture;
using PictureRecorder = Unity.UIWidgets.ui2.PictureRecorder;
using SceneBuilder = Unity.UIWidgets.ui2.SceneBuilder;
using TextBaseline = Unity.UIWidgets.ui2.TextBaseline;
using TextDecoration = Unity.UIWidgets.ui2.TextDecoration;
using TextDecorationStyle = Unity.UIWidgets.ui2.TextDecorationStyle;
using TextPosition = Unity.UIWidgets.ui2.TextPosition;
using Window = Unity.UIWidgets.ui2.Window;
class TextTest : UIWidgetsPanel
{

4
com.unity.uiwidgets/Runtime/animation/animation_controller.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.physics;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Ticker = Unity.UIWidgets.scheduler.Ticker;
using TickerFuture = Unity.UIWidgets.scheduler2.TickerFuture;
using TickerProvider = Unity.UIWidgets.scheduler.TickerProvider;
namespace Unity.UIWidgets.animation {
enum _AnimationDirection {

4
com.unity.uiwidgets/Runtime/async2/future.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.async2 {
public struct FutureOr {

public static implicit operator FutureOr(string v) => value(v);
public static implicit operator FutureOr(byte[] v) => value(v);
public static implicit operator FutureOr(RoutePopDisposition v) => value(v);
public static implicit operator FutureOr(Dictionary<Type, object> v) => value(v);
}
public abstract class Future {

1
com.unity.uiwidgets/Runtime/foundation/binding.cs


using System.Collections;
using System.Collections.Generic;
using developer;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.ui;

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


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

70
com.unity.uiwidgets/Runtime/material/colors.cs


}
);
const long _redPrimaryValue = 0xFFF44336;
const uint _redPrimaryValue = 0xFFF44336;
public static readonly MaterialAccentColor redAccent = new MaterialAccentColor(
_redAccentValue,

}
);
const long _redAccentValue = 0xFFFF5252;
const uint _redAccentValue = 0xFFFF5252;
public static readonly MaterialColor pink = new MaterialColor(
_pinkPrimaryValue,

}
);
const long _pinkPrimaryValue = 0xFFE91E63;
const uint _pinkPrimaryValue = 0xFFE91E63;
public static readonly MaterialAccentColor pinkAccent = new MaterialAccentColor(

}
);
const long _pinkAccentPrimaryValue = 0xFFFF4081;
const uint _pinkAccentPrimaryValue = 0xFFFF4081;
public static readonly MaterialColor purple = new MaterialColor(
_purplePrimaryValue,

}
);
const long _purplePrimaryValue = 0xFF9C27B0;
const uint _purplePrimaryValue = 0xFF9C27B0;
public static readonly MaterialAccentColor purpleAccent = new MaterialAccentColor(
_purpleAccentPrimaryValue,

}
);
const long _purpleAccentPrimaryValue = 0xFFE040FB;
const uint _purpleAccentPrimaryValue = 0xFFE040FB;
public static readonly MaterialColor deepPurple = new MaterialColor(
_deepPurplePrimaryValue,

}
);
const long _deepPurplePrimaryValue = 0xFF673AB7;
const uint _deepPurplePrimaryValue = 0xFF673AB7;
public static readonly MaterialAccentColor deepPurpleAccent = new MaterialAccentColor(
_deepPurpleAccentPrimaryValue,

}
);
const long _deepPurpleAccentPrimaryValue = 0xFF7C4DFF;
const uint _deepPurpleAccentPrimaryValue = 0xFF7C4DFF;
public static readonly MaterialColor indigo = new MaterialColor(

}
);
const long _indigoPrimaryValue = 0xFF3F51B5;
const uint _indigoPrimaryValue = 0xFF3F51B5;
public static readonly MaterialAccentColor indigoAccent = new MaterialAccentColor(
_indigoAccentPrimaryValue,

}
);
const long _indigoAccentPrimaryValue = 0xFF536DFE;
const uint _indigoAccentPrimaryValue = 0xFF536DFE;
public static readonly MaterialColor blue = new MaterialColor(
_bluePrimaryValue,

}
);
const long _bluePrimaryValue = 0xFF2196F3;
const uint _bluePrimaryValue = 0xFF2196F3;
public static readonly MaterialAccentColor blueAccent = new MaterialAccentColor(
_blueAccentPrimaryValue,

}
);
const long _blueAccentPrimaryValue = 0xFF448AFF;
const uint _blueAccentPrimaryValue = 0xFF448AFF;
public static readonly MaterialColor lightBlue = new MaterialColor(
_lightBluePrimaryValue,

}
);
const long _lightBluePrimaryValue = 0xFF03A9F4;
const uint _lightBluePrimaryValue = 0xFF03A9F4;
public static readonly MaterialAccentColor lightBlueAccent = new MaterialAccentColor(
_lightBlueAccentPrimaryValue,

}
);
const long _lightBlueAccentPrimaryValue = 0xFF40C4FF;
const uint _lightBlueAccentPrimaryValue = 0xFF40C4FF;
public static readonly MaterialColor cyan = new MaterialColor(
_cyanPrimaryValue,

}
);
const long _cyanPrimaryValue = 0xFF00BCD4;
const uint _cyanPrimaryValue = 0xFF00BCD4;
public static readonly MaterialAccentColor cyanAccent = new MaterialAccentColor(
_cyanAccentPrimaryValue,

}
);
const long _cyanAccentPrimaryValue = 0xFF18FFFF;
const uint _cyanAccentPrimaryValue = 0xFF18FFFF;
public static readonly MaterialColor teal = new MaterialColor(
_tealPrimaryValue,

}
);
const long _tealPrimaryValue = 0xFF009688;
const uint _tealPrimaryValue = 0xFF009688;
public static readonly MaterialAccentColor tealAccent = new MaterialAccentColor(
_tealAccentPrimaryValue,

}
);
const long _tealAccentPrimaryValue = 0xFF64FFDA;
const uint _tealAccentPrimaryValue = 0xFF64FFDA;
public static readonly MaterialColor green = new MaterialColor(
_greenPrimaryValue,

}
);
const long _greenPrimaryValue = 0xFF4CAF50;
const uint _greenPrimaryValue = 0xFF4CAF50;
public static readonly MaterialAccentColor greenAccent = new MaterialAccentColor(
_greenAccentPrimaryValue,

}
);
const long _greenAccentPrimaryValue = 0xFF69F0AE;
const uint _greenAccentPrimaryValue = 0xFF69F0AE;
public static readonly MaterialColor lightGreen = new MaterialColor(
_lightGreenPrimaryValue,

}
);
const long _lightGreenPrimaryValue = 0xFF8BC34A;
const uint _lightGreenPrimaryValue = 0xFF8BC34A;
public static readonly MaterialAccentColor lightGreenAccent = new MaterialAccentColor(
_lightGreenAccentPrimaryValue,

}
);
const long _lightGreenAccentPrimaryValue = 0xFFB2FF59;
const uint _lightGreenAccentPrimaryValue = 0xFFB2FF59;
public static readonly MaterialColor lime = new MaterialColor(
_limePrimaryValue,

}
);
const long _limePrimaryValue = 0xFFCDDC39;
const uint _limePrimaryValue = 0xFFCDDC39;
public static readonly MaterialAccentColor limeAccent = new MaterialAccentColor(
_limeAccentPrimaryValue,

}
);
const long _limeAccentPrimaryValue = 0xFFEEFF41;
const uint _limeAccentPrimaryValue = 0xFFEEFF41;
public static readonly MaterialColor yellow = new MaterialColor(
_yellowPrimaryValue,

}
);
const long _yellowPrimaryValue = 0xFFFFEB3B;
const uint _yellowPrimaryValue = 0xFFFFEB3B;
public static readonly MaterialAccentColor yellowAccent = new MaterialAccentColor(
_yellowAccentPrimaryValue,

}
);
const long _yellowAccentPrimaryValue = 0xFFFFFF00;
const uint _yellowAccentPrimaryValue = 0xFFFFFF00;
public static readonly MaterialColor amber = new MaterialColor(
_amberPrimaryValue,

}
);
const long _amberPrimaryValue = 0xFFFFC107;
const uint _amberPrimaryValue = 0xFFFFC107;
public static readonly MaterialAccentColor amberAccent = new MaterialAccentColor(
_amberAccentPrimaryValue,

}
);
const long _amberAccentPrimaryValue = 0xFFFFD740;
const uint _amberAccentPrimaryValue = 0xFFFFD740;
public static readonly MaterialColor orange = new MaterialColor(
_orangePrimaryValue,

}
);
const long _orangePrimaryValue = 0xFFFF9800;
const uint _orangePrimaryValue = 0xFFFF9800;
public static readonly MaterialAccentColor orangeAccent = new MaterialAccentColor(
_orangeAccentPrimaryValue,

}
);
const long _orangeAccentPrimaryValue = 0xFFFFAB40;
const uint _orangeAccentPrimaryValue = 0xFFFFAB40;
public static readonly MaterialColor deepOrange = new MaterialColor(
_deepOrangePrimaryValue,

}
);
const long _deepOrangePrimaryValue = 0xFFFF5722;
const uint _deepOrangePrimaryValue = 0xFFFF5722;
public static readonly MaterialAccentColor deepOrangeAccent = new MaterialAccentColor(

}
);
const long _deepOrangeAccentPrimaryValue = 0xFFFF6E40;
const uint _deepOrangeAccentPrimaryValue = 0xFFFF6E40;
public static readonly MaterialColor brown = new MaterialColor(
_brownPrimaryValue,

}
);
const long _brownPrimaryValue = 0xFF795548;
const uint _brownPrimaryValue = 0xFF795548;
public static readonly MaterialColor grey = new MaterialColor(
_greyPrimaryValue,

}
);
const long _greyPrimaryValue = 0xFF9E9E9E;
const uint _greyPrimaryValue = 0xFF9E9E9E;
public static readonly MaterialColor blueGrey = new MaterialColor(
_blueGreyPrimaryValue,

}
);
const long _blueGreyPrimaryValue = 0xFF607D8B;
const uint _blueGreyPrimaryValue = 0xFF607D8B;
public static readonly List<MaterialColor> primaries = new List<MaterialColor> {

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


return stream;
}
public IPromise<bool> evict(ImageCache cache = null, ImageConfiguration configuration = null) {
public Future<bool> evict(ImageCache cache = null, ImageConfiguration configuration = null) {
configuration = configuration ?? ImageConfiguration.empty;
cache = cache ?? PaintingBinding.instance.imageCache;

protected abstract ImageStreamCompleter load(T key);
protected abstract IPromise<T> obtainKey(ImageConfiguration configuration);
protected abstract Future<T> obtainKey(ImageConfiguration configuration);
}
public class AssetBundleImageKey : IEquatable<AssetBundleImageKey> {

);
}
IPromise<Codec> _loadAsync(AssetBundleImageKey key) {
Future<Codec> _loadAsync(AssetBundleImageKey key) {
var coroutine = Window.instance.startCoroutine(_loadAssetAsync(key));
return coroutine.promise.Then(result => {
if (result == null) {

public readonly IDictionary<string, string> headers;
protected override IPromise<NetworkImage> obtainKey(ImageConfiguration configuration) {
protected override Future<NetworkImage> obtainKey(ImageConfiguration configuration) {
return Promise<NetworkImage>.Resolved(this);
}

);
}
IPromise<Codec> _loadAsync(NetworkImage key) {
Future<Codec> _loadAsync(NetworkImage key) {
var coroutine = Window.instance.startCoroutine(_loadBytes(key));
return coroutine.promise.Then(obj => {
if (obj is byte[] bytes) {

public readonly float scale;
protected override IPromise<FileImage> obtainKey(ImageConfiguration configuration) {
protected override Future<FileImage> obtainKey(ImageConfiguration configuration) {
return Promise<FileImage>.Resolved(this);
}

informationCollector: information => { information.AppendLine($"Path: {file}"); });
}
IPromise<Codec> _loadAsync(FileImage key) {
Future<Codec> _loadAsync(FileImage key) {
var coroutine = Window.instance.startCoroutine(_loadBytes(key));
return coroutine.promise.Then(obj => {
if (obj is byte[] bytes) {

public readonly float scale;
protected override IPromise<MemoryImage> obtainKey(ImageConfiguration configuration) {
protected override Future<MemoryImage> obtainKey(ImageConfiguration configuration) {
return Promise<MemoryImage>.Resolved(this);
}

scale: key.scale);
}
IPromise<Codec> _loadAsync(MemoryImage key) {
Future<Codec> _loadAsync(MemoryImage key) {
D.assert(key == this);
return CodecUtils.getCodec(bytes);

public readonly AssetBundle bundle;
protected override IPromise<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
protected override Future<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
return Promise<AssetBundleImageKey>.Resolved(new AssetBundleImageKey(
bundle: bundle ? bundle : configuration.bundle,
name: assetName,

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


public readonly string assetName;
public readonly AssetBundle bundle;
protected override IPromise<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
protected override Future<AssetBundleImageKey> obtainKey(ImageConfiguration configuration) {
AssetImageConfiguration assetConfig = new AssetImageConfiguration(configuration, assetName);
AssetBundleImageKey key;
var cache = AssetBundleCache.instance.get(configuration.bundle);

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


}
public class OneFrameImageStreamCompleter : ImageStreamCompleter {
public OneFrameImageStreamCompleter(IPromise<ImageInfo> image,
public OneFrameImageStreamCompleter(Future<ImageInfo> image,
InformationCollector informationCollector = null) {
D.assert(image != null);

public class MultiFrameImageStreamCompleter : ImageStreamCompleter {
public MultiFrameImageStreamCompleter(
IPromise<Codec> codec,
Future<Codec> codec,
float scale,
InformationCollector informationCollector = null
) {

7
com.unity.uiwidgets/Runtime/rendering/viewport_offset.cs


using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.rendering {

public abstract void correctBy(float correction);
public abstract void jumpTo(float pixels);
public abstract IPromise animateTo(float to, TimeSpan duration, Curve curve);
public abstract Future animateTo(float to, TimeSpan duration, Curve curve);
public virtual IPromise moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
public virtual Future moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
if (duration == null || duration.Value == TimeSpan.Zero) {
jumpTo(to);
return Promise.Resolved();

public override void jumpTo(float pixels) {
}
public override IPromise animateTo(float to, TimeSpan duration, Curve curve) {
public override Future animateTo(float to, TimeSpan duration, Curve curve) {
return Promise.Resolved();
}

12
com.unity.uiwidgets/Runtime/service/clipboard.cs


public static readonly string kTextPlain = "text/plain";
public static IPromise setData(ClipboardData data) {
public static Future setData(ClipboardData data) {
public static IPromise<ClipboardData> getData(string format) {
public static Future<ClipboardData> getData(string format) {
protected abstract IPromise setClipboardData(ClipboardData data);
protected abstract IPromise<ClipboardData> getClipboardData(string format);
protected abstract Future setClipboardData(ClipboardData data);
protected abstract Future<ClipboardData> getClipboardData(string format);
protected override IPromise setClipboardData(ClipboardData data) {
protected override Future setClipboardData(ClipboardData data) {
#if UNITY_WEBGL
UIWidgetsCopyTextToClipboard(data.text);
#else

return Promise.Resolved();
}
protected override IPromise<ClipboardData> getClipboardData(string format) {
protected override Future<ClipboardData> getClipboardData(string format) {
var data = new ClipboardData(text: GUIUtility.systemCopyBuffer);
return Promise<ClipboardData>.Resolved(data);
}

4
com.unity.uiwidgets/Runtime/ui/painting/codec.cs


public static class CodecUtils {
public static IPromise<Codec> getCodec(byte[] bytes) {
public static Future<Codec> getCodec(byte[] bytes) {
if (GifCodec.isGif(bytes)) {
return Promise<Codec>.Resolved(new GifCodec(bytes));
}

return Promise<Codec>.Resolved(new ImageCodec(new Image(texture)));
}
public static IPromise<Codec> getCodec(Image image) {
public static Future<Codec> getCodec(Image image) {
return Promise<Codec>.Resolved(new ImageCodec(image));
}
}

1
com.unity.uiwidgets/Runtime/widgets/animated_switcher.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG.Promises;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;

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


using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

return panel == null ? null : panel.window;
}
#if UNITY_EDITOR
public static Window of(UIWidgetsEditorWindow editorWindow) {
return editorWindow.window;
}
#endif
public override bool updateShouldNotify(InheritedWidget oldWidget) {
D.assert(window == ((WindowProvider) oldWidget).window);
return false;

class _WidgetsAppState : State<WidgetsApp>, WidgetsBindingObserver {
GlobalKey<NavigatorState> _navigator;
public IPromise<bool> didPopRoute() {
public Future<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
return Future<bool>.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
public Future<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
return Future<bool>.value(false).to<bool>();
return Promise<bool>.Resolved(true);
return Future<bool>.value(true).to<bool>();
}
public void didChangeMetrics() {

34
com.unity.uiwidgets/Runtime/widgets/binding.cs


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

void didChangeLocales(List<Locale> locale);
IPromise<bool> didPopRoute();
Future<bool> didPopRoute();
IPromise<bool> didPushRoute(string route);
Future<bool> didPushRoute(string route);
}
public static partial class ui_ {
public static void Each<T>(this IEnumerable<T> source, Action<T> fn) {
foreach (var item in source) {
fn.Invoke(item);
}
}
public static void Each<T>(this IEnumerable<T> source, Action<T, int> fn) {
int index = 0;
foreach (T item in source) {
fn.Invoke(item, index);
index++;
}
}
/// <summary>
/// Convert a variable length argument list of items to an enumerable.
/// </summary>
public static IEnumerable<T> FromItems<T>(params T[] items) {
foreach (var item in items) {
yield return item;
}
}
}
public class WidgetsBinding : RendererBinding {

Application.Quit();
return;
}
_observers[idx].didPopRoute().Then((Action<bool>) _handlePopRouteSub);
_observers[idx].didPopRoute().then_(_handlePopRouteSub);
}
}

12
com.unity.uiwidgets/Runtime/widgets/dismissible.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

namespace Unity.UIWidgets.widgets {
public delegate void DismissDirectionCallback(DismissDirection? direction);
public delegate Promise<bool> ConfirmDismissCallback(DismissDirection? direction);
public delegate Future<bool> ConfirmDismissCallback(DismissDirection? direction);
public enum DismissDirection {
vertical,

}
_dragUnderway = false;
_confirmStartResizeAnimation().Then((value) => {
_confirmStartResizeAnimation().then_((value) => {
if (_moveController.isCompleted && value) {
_startResizeAnimation();
}

void _handleDismissStatusChanged(AnimationStatus status) {
if (status == AnimationStatus.completed && !_dragUnderway) {
_confirmStartResizeAnimation().Then((value) => {
_confirmStartResizeAnimation().then_((value) => {
if (value) {
_startResizeAnimation();
}

}
}
IPromise<bool> _confirmStartResizeAnimation() {
Future<bool> _confirmStartResizeAnimation() {
if (widget.confirmDismiss != null) {
DismissDirection? direction = _dismissDirection;
D.assert(direction != null);

return Promise<bool>.Resolved(true);
return Future<bool>.value(true).to<bool>();
}
void _startResizeAnimation() {

9
com.unity.uiwidgets/Runtime/widgets/editable_text.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;

public void didChangeLocales(List<Locale> locale) {
}
public IPromise<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
public Future<bool> didPopRoute() {
return Future<bool>.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
public Future<bool> didPushRoute(string route) {
return Future<bool>.value(false).to<bool>();
}
void _formatAndSetValue(TextEditingValue value, bool isIMEInput = false) {

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


}
}
public void requestFocus(FocusNode node) {
D.assert(node != null);
// TODO: need update
public void requestFocus(FocusNode node = null) {
// D.assert(node != null);
var focusPath = _manager?._getCurrentFocusPath();
if (_focus == node &&
(_focusPath == focusPath || (focusPath != null && _focusPath != null &&

node._hasKeyboardToken = true;
_setFocus(node);
}
public void autofocus(FocusNode node) {
D.assert(node != null);
if (_focus == null) {

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


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;

);
}
public IPromise precacheImage(
public Future precacheImage(
ImageProvider provider,
BuildContext context,
Size size = null,

var completer = new Promise();
var completer = Completer.create();
completer.Resolve();
stream.removeListener(listener);
if (!completer.isCompleted) {
stream.removeListener(listener);
}
SchedulerBinding.instance.addPostFrameCallback(timeStamp => { stream.removeListener(listener); });
completer.Resolve();
if (!completer.isCompleted) {
completer.complete();
}
stream.removeListener(listener);
if (onError != null) {
onError(exception);

}
stream.addListener(listener, onError: errorListener);
return completer;
return completer.future;
}
}

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


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.physics;

}
}
public IPromise animateToItem(
public Future animateToItem(
return Promise.Resolved();
return null;
List<IPromise> futures = new List<IPromise>();
List<Future> futures = new List<Future>();
foreach (_FixedExtentScrollPosition position in positions) {
futures.Add(position.animateTo(
itemIndex * position.itemExtent,

}
return Promise.All(futures);
return Future.wait<object>(futures);
}
public void jumpToItem(int itemIndex) {

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


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.async2;
public _Pending(LocalizationsDelegate del, IPromise<object> futureValue) {
public _Pending(LocalizationsDelegate del, Future<object> futureValue) {
public readonly IPromise<object> futureValue;
public readonly Future<object> futureValue;
internal static IPromise<Dictionary<Type, object>> _loadAll(Locale locale,
internal static Future<Dictionary<Type, object>> _loadAll(Locale locale,
IEnumerable<LocalizationsDelegate> allDelegates) {
Dictionary<Type, object> output = new Dictionary<Type, object>();
List<_Pending> pendingList = null;

}
foreach (LocalizationsDelegate del in delegates) {
IPromise<object> inputValue = del.load(locale);
Future<WidgetsLocalizations> inputValue = del.load(locale);
IPromise<object> futureValue = inputValue.Then(value => { return completedValue = value; });
Future<object> futureValue = inputValue.then_(value => {
completedValue = value;
return FutureOr.value(completedValue);
}).to<object>();
if (completedValue != null) {
Type type = del.type;
D.assert(!output.ContainsKey(type));

}
if (pendingList == null) {
return Promise<Dictionary<Type, object>>.Resolved(output);
return Future<Dictionary<Type, object>>.value(output).to<Dictionary<Type, object>>();
return Promise<object>.All(pendingList.Select(p => p.futureValue))
.Then(values => {
var list = values.ToList();
return Future<object>.wait<object>(pendingList.Select(p => p.futureValue))
.then(values => {
//TODO : check values is list
var list = (List<object>)values;
D.assert(list.Count == pendingList.Count);
for (int i = 0; i < list.Count; i += 1) {
Type type = pendingList[i].del.type;

return output;
});
}).to<Dictionary<Type, object>>();
}
}

public abstract bool isSupported(Locale locale);
public abstract IPromise<object> load(Locale locale);
public abstract Future<WidgetsLocalizations> load(Locale locale);
public abstract bool shouldReload(LocalizationsDelegate old);

return true;
}
public override IPromise<object> load(Locale locale) {
public override Future<WidgetsLocalizations> load(Locale locale) {
return DefaultWidgetsLocalizations.load(locale);
}

public DefaultWidgetsLocalizations() {
}
public static IPromise<object> load(Locale locale) {
return Promise<object>.Resolved(new DefaultWidgetsLocalizations());
public static Future<WidgetsLocalizations> load(Locale locale) {
return new SynchronousFuture<WidgetsLocalizations>(new DefaultWidgetsLocalizations());
}
public static readonly LocalizationsDelegate<WidgetsLocalizations> del = new _WidgetsLocalizationsDelegate();

}
Dictionary<Type, object> typeToResources = null;
IPromise<Dictionary<Type, object>> typeToResourcesFuture = _Pending._loadAll(locale, delegates)
.Then(value => { return typeToResources = value; });
Future<Dictionary<Type, object>> typeToResourcesFuture = _Pending._loadAll(locale, delegates)
.then(value => { return FutureOr.value(typeToResources = (Dictionary<Type, object>)value); }).to<Dictionary<Type, object>>();
if (typeToResources != null) {
_typeToResources = typeToResources;

// WidgetsBinding.instance.deferFirstFrameReport();
typeToResourcesFuture.Then(value => {
typeToResourcesFuture.then(value => {
// WidgetsBinding.instance.allowFirstFrameReport();
if (!mounted) {
return;

_typeToResources = value;
_typeToResources = (Dictionary<Type, object>)value;
_locale = locale;
});
});

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


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using RSG.Promises;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using SchedulerBinding = Unity.UIWidgets.scheduler.SchedulerBinding;
using SchedulerPhase = Unity.UIWidgets.scheduler.SchedulerPhase;
namespace Unity.UIWidgets.widgets {
public delegate Route RouteFactory(RouteSettings settings);

public delegate IPromise<bool> WillPopCallback();
public delegate Future<bool> WillPopCallback();
public enum RoutePopDisposition {
pop,

}
protected internal virtual TickerFuture didPush() {
return TickerFutureImpl.complete();
var future = TickerFuture.complete();
future.then(o => {
navigator?.focusScopeNode?.requestFocus();
});
return future;
public virtual IPromise<RoutePopDisposition> willPop() {
return Promise<RoutePopDisposition>.Resolved(isFirst
public virtual Future<RoutePopDisposition> willPop() {
return Future<RoutePopDisposition>.value(isFirst
: RoutePopDisposition.pop);
: RoutePopDisposition.pop).to<RoutePopDisposition>();
}
public virtual bool willHandlePopInternally {

get { return null; }
}
public IPromise<object> popped {
get { return _popCompleter; }
public Future popped {
get { return _popCompleter.future; }
internal readonly Promise<object> _popCompleter = new Promise<object>();
internal readonly Completer _popCompleter = Completer.create();
protected internal virtual bool didPop(object result) {
didComplete(result);

protected internal virtual void didComplete(object result) {
_popCompleter.Resolve(result);
_popCompleter.complete(FutureOr.value(result ?? currentResult));
}
protected internal virtual void didPopNext(Route nextRoute) {

public static readonly string defaultRouteName = "/";
public static IPromise<object> pushNamed(BuildContext context, string routeName, object arguments = null) {
public static Future pushNamed(BuildContext context, string routeName, object arguments = null) {
public static IPromise<object> pushReplacementNamed(BuildContext context, string routeName,
public static Future pushReplacementNamed(BuildContext context, string routeName,
public static IPromise<object> popAndPushNamed(BuildContext context, string routeName, object result = null,
public static Future popAndPushNamed(BuildContext context, string routeName, object result = null,
public static IPromise<object> pushNamedAndRemoveUntil(BuildContext context, string newRouteName,
public static Future pushNamedAndRemoveUntil(BuildContext context, string newRouteName,
public static IPromise<object> push(BuildContext context, Route route) {
public static Future push(BuildContext context, Route route) {
public static IPromise<object> pushReplacement(BuildContext context, Route newRoute, object result = null) {
public static Future pushReplacement(BuildContext context, Route newRoute, object result = null) {
public static IPromise<object> pushAndRemoveUntil(BuildContext context, Route newRoute,
public static Future pushAndRemoveUntil(BuildContext context, Route newRoute,
RoutePredicate predicate) {
return of(context).pushAndRemoveUntil(newRoute, predicate);
}

return navigator != null && navigator.canPop();
}
public static IPromise<bool> maybePop(BuildContext context, object result = null) {
public static Future<bool> maybePop(BuildContext context, object result = null) {
return of(context).maybePop(result);
}

return route;
}
public IPromise<object> pushNamed(string routeName, object arguments = null) {
public Future pushNamed(string routeName, object arguments = null) {
public IPromise<object> pushReplacementNamed(string routeName, object result = null, object arguments = null) {
public Future pushReplacementNamed(string routeName, object result = null, object arguments = null) {
public IPromise<object> popAndPushNamed(string routeName, object result = null, object arguments = null) {
public Future popAndPushNamed(string routeName, object result = null, object arguments = null) {
public IPromise<object> pushNamedAndRemoveUntil(string newRouteName, RoutePredicate predicate,
public Future pushNamedAndRemoveUntil(string newRouteName, RoutePredicate predicate,
public IPromise<object> push(Route route) {
public Future push(Route route) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

_cancelActivePointers();
}
public IPromise<object> pushReplacement(Route newRoute, object result = null) {
public Future pushReplacement(Route newRoute, object result = null) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

return newRoute.popped;
}
public IPromise<object> pushAndRemoveUntil(Route newRoute, RoutePredicate predicate) {
public Future pushAndRemoveUntil(Route newRoute, RoutePredicate predicate) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

return _history.Count > 1 || _history[0].willHandlePopInternally;
}
public IPromise<bool> maybePop(object result = null) {
public Future<bool> maybePop(object result = null) {
return route.willPop().Then(disposition => {
return route.willPop().then_(disposition => {
if (disposition != RoutePopDisposition.bubble && mounted) {
if (disposition == RoutePopDisposition.pop) {
pop(result);

}
return false;
});
}).to<bool>();
}
public bool pop(object result = null) {

10
com.unity.uiwidgets/Runtime/widgets/nested_scroll_view.cs


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

_outerPosition.updateCanDrag(maxInnerExtent);
}
public IPromise animateTo(float to,
public Future animateTo(float to,
TimeSpan duration,
Curve curve
) {

curve
);
List<IPromise> resultFutures = new List<IPromise> {outerActivity.done};
List<Future> resultFutures = new List<Future> {outerActivity.done};
beginActivity(
outerActivity,
(_NestedScrollPosition position) => {

return innerActivity;
}
);
return Promise.All(resultFutures);
return Future.wait<object>(resultFutures);
}
public void jumpTo(float to) {

return null;
}
public override IPromise animateTo(float to,
public override Future animateTo(float to,
TimeSpan duration,
Curve curve
) {

8
com.unity.uiwidgets/Runtime/widgets/page_view.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

}
}
public IPromise animateToPage(int page, TimeSpan duration, Curve curve) {
public Future animateToPage(int page, TimeSpan duration, Curve curve) {
_PagePosition position = (_PagePosition) this.position;
return position.animateTo(
position.getPixelsFromPage(page),

position.jumpTo(position.getPixelsFromPage(page));
}
public IPromise nextPage(TimeSpan duration, Curve curve) {
public Future nextPage(TimeSpan duration, Curve curve) {
public IPromise previousPage(TimeSpan duration, Curve curve) {
public Future previousPage(TimeSpan duration, Curve curve) {
return animateToPage(page.round() - 1, duration: duration, curve: curve);
}

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


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {

) : base(settings) {
}
public IPromise<object> completed {
get { return _transitionCompleter; }
public Future completed {
get { return _transitionCompleter.future; }
internal readonly Promise<object> _transitionCompleter = new Promise<object>();
internal readonly Completer _transitionCompleter = Completer.create();
public virtual TimeSpan transitionDuration { get; }

internal AnimationController _controller;
public virtual AnimationController createAnimationController() {
D.assert(_transitionCompleter.CurState == PromiseState.Pending,
D.assert(!_transitionCompleter.isCompleted,
() => $"Cannot reuse a {GetType()} after disposing it.");
TimeSpan duration = transitionDuration;
D.assert(duration >= TimeSpan.Zero);

}
public virtual Animation<float> createAnimation() {
D.assert(_transitionCompleter.CurState == PromiseState.Pending,
D.assert(!_transitionCompleter.isCompleted,
() => $"Cannot reuse a {GetType()} after disposing it.");
D.assert(_controller != null);
return _controller.view;

protected internal override void dispose() {
D.assert(!_transitionCompleter.isCompleted, () => $"Cannot dispose a {GetType()} twice.");
_controller?.dispose();
_transitionCompleter.Resolve(_result);
_transitionCompleter.complete(FutureOr.value(_result));
base.dispose();
}

}
}
public override IPromise<RoutePopDisposition> willPop() {
public override Future<RoutePopDisposition> willPop() {
return Promise<RoutePopDisposition>.Resolved(RoutePopDisposition.pop);
return Future<RoutePopDisposition>.value(RoutePopDisposition.pop).to<RoutePopDisposition>();
}
return base.willPop();

public override Widget build(BuildContext context) {
_page = _page ?? new RepaintBoundary(
key: widget.route._subtreeKey, // immutable
child: new Builder(
builder: (BuildContext _context) => widget.route.buildPage(
_context,
widget.route.animation,
widget.route.secondaryAnimation
))
);
key: widget.route._subtreeKey, // immutable
child: new Builder(
builder: (BuildContext _context) => widget.route.buildPage(
_context,
widget.route.animation,
widget.route.secondaryAnimation
))
);
return new _ModalScopeStatus(
route: widget.route,

}
public abstract class ModalRoute : LocalHistoryRouteTransitionRoute {
protected ModalRoute() {}
protected ModalRoute(RouteSettings settings) : base(settings) { }
protected ModalRoute() {
}
protected ModalRoute(RouteSettings settings) : base(settings) {
}
public static Color _kTransparent = new Color(0x00000000);

readonly List<WillPopCallback> _willPopCallbacks = new List<WillPopCallback>();
public override IPromise<RoutePopDisposition> willPop() {
public override Future<RoutePopDisposition> willPop() {
var callbacks = new List<WillPopCallback>(_willPopCallbacks);
Promise<RoutePopDisposition> result = new Promise<RoutePopDisposition>();
Action<int> fn = null;
fn = (int index) => {
if (index < callbacks.Count) {
callbacks[index]().Then((pop) => {
if (!pop) {
result.Resolve(RoutePopDisposition.doNotPop);
}
else {
fn(index + 1);
}
});
bool result = false;
foreach (WillPopCallback callback in _willPopCallbacks) {
callback.Invoke().then(v => result = !(bool)v);
if (result) {
return Future<RoutePopDisposition>.value(RoutePopDisposition.doNotPop).to<RoutePopDisposition>();
else {
base.willPop().Then((pop) => result.Resolve(pop));
}
};
fn(0);
return result;
}
return base.willPop();
// var callbacks = new List<WillPopCallback>(_willPopCallbacks);
// Promise<RoutePopDisposition> result = new Promise<RoutePopDisposition>();
// Action<int> fn = null;
// fn = (int index) => {
// if (index < callbacks.Count) {
// callbacks[index]().Then((pop) => {
// if (!pop) {
// result.Resolve(RoutePopDisposition.doNotPop);
// }
// else {
// fn(index + 1);
// }
// });
// }
// else {
// base.willPop().Then((pop) => result.Resolve(pop));
// }
// };
// fn(0);
// return result;
}
public void addScopedWillPopCallback(WillPopCallback callback) {

Widget _buildModalScope(BuildContext context) {
return _modalScopeCache = _modalScopeCache ?? new _ModalScope(
key: _scopeKey,
route: this
// _ModalScope calls buildTransitions() and buildChild(), defined above
);
key: _scopeKey,
route: this
// _ModalScope calls buildTransitions() and buildChild(), defined above
);
}
public override ICollection<OverlayEntry> createOverlayEntries() {

}
public static class DialogUtils {
public static IPromise<object> showGeneralDialog(
public static Future<object> showGeneralDialog(
BuildContext context = null,
RoutePageBuilder pageBuilder = null,
bool barrierDismissible = false,

barrierColor: barrierColor,
transitionDuration: transitionDuration,
transitionBuilder: transitionBuilder
));
)).to<object>();
}
}

16
com.unity.uiwidgets/Runtime/widgets/scroll_activity.cs


using System;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

);
_controller.addListener(_tick);
_controller.animateWith(simulation).Then(() => _end());
_controller.animateWith(simulation).then(o => _end());
}
public override float velocity {

D.assert(duration > TimeSpan.Zero);
D.assert(curve != null);
_completer = new Promise();
_completer = Completer.create();
_controller = AnimationController.unbounded(
value: from,
debugLabel: GetType().ToString(),

_controller.animateTo(to, duration: duration, curve: curve)
.Then(() => _end());
.then(o => _end());
readonly Promise _completer;
readonly Completer _completer;
public IPromise done {
get { return _completer; }
public Future done {
get { return _completer.future; }
}
public override float velocity {

}
public override void dispose() {
_completer.Resolve();
_completer.complete();
_controller.dispose();
base.dispose();
}

8
com.unity.uiwidgets/Runtime/widgets/scroll_controller.cs


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

}
public IPromise animateTo(float to,
public Future animateTo(float to,
List<IPromise> animations = CollectionUtils.CreateRepeatedList<IPromise>(null, _positions.Count);
List<Future> animations = CollectionUtils.CreateRepeatedList<Future>(null, _positions.Count);
return Promise.All(animations);
return Future.wait<object>(animations);
}
public void jumpTo(float value) {

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


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

activity.applyNewDimensions();
}
public IPromise ensureVisible(RenderObject renderObject,
public Future ensureVisible(RenderObject renderObject,
float alignment = 0.0f,
TimeSpan? duration = null,
Curve curve = null

minScrollExtent, maxScrollExtent);
if (target == pixels) {
return Promise.Resolved();
return Future.value();
return Promise.Resolved();
return Future.value();
}
curve = curve ?? Curves.ease;

public readonly ValueNotifier<bool> isScrollingNotifier = new ValueNotifier<bool>(false);
public override IPromise moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
public override Future moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
if (clamp) {
to = to.clamp(minScrollExtent, maxScrollExtent);
}

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


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

didUpdateScrollDirection(value);
}
public override IPromise animateTo(float to,
public override Future animateTo(float to,
return Promise.Resolved();
return Future.value();
}
DrivenScrollActivity activity = new DrivenScrollActivity(

9
com.unity.uiwidgets/Runtime/widgets/scrollable.cs


using System;
using System.Collections.Generic;
using System.Linq;
using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;

return widget == null ? null : widget.scrollable;
}
public static IPromise ensureVisible(BuildContext context,
public static Future ensureVisible(BuildContext context,
float alignment = 0.0f,
TimeSpan? duration = null,
Curve curve = null

List<IPromise> futures = new List<IPromise>();
List<Future> futures = new List<Future>();
ScrollableState scrollable = of(context);
while (scrollable != null) {

}
if (futures.isEmpty() || duration == TimeSpan.Zero) {
return Promise.Resolved();
return Future.value();
}
if (futures.Count == 1) {

return Promise.All(futures);
return Future.wait<object>(futures);
}
}

9
com.unity.uiwidgets/Runtime/widgets/selectable_text.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;

public void didChangeLocales(List<Locale> locale) {
}
public IPromise<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
public Future<bool> didPopRoute() {
return Future<bool>.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
public Future<bool> didPushRoute(string route) {
return Future<bool>.value(false).to<bool>();
}
void _handleTapDown(TapDownDetails details) {

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


using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;

public static void textureFrameAvailable(Window instance = null) {
if (instance == null) {
WindowAdapter.windowAdapters.ForEach(w => w.scheduleFrame(false));
} else {
// TODO: check whether following is needed
// instance.scheduleFrame(false);
}
}
// TODO: check whether following is needed
// public static void textureFrameAvailable(Window instance = null) {
// if (instance == null) {
// WindowAdapter.windowAdapters.ForEach(w => w.scheduleFrame(false));
// } else {
// instance.scheduleFrame(false);
// }
// }
public Texture(Key key = null, UnityEngine.Texture texture = null) : base(key: key) {
D.assert(texture != null);

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


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

public void didChangeLocales(List<Locale> locale) {
}
public IPromise<bool> didPopRoute() {
return Promise<bool>.Resolved(false);
public Future<bool> didPopRoute() {
return Future.value(false).to<bool>();
public IPromise<bool> didPushRoute(string route) {
return Promise<bool>.Resolved(false);
public Future<bool> didPushRoute(string route) {
return Future.value(false).to<bool>();
}
void _selectionChangedCallback() {

5
engine/src/lib/ui/window/window.cc


ptr->client()->Render(scene);
}
// TODO: ComputePlatformResolvedLocale
UIWIDGETS_API(void) Window_computePlatformResolvedLocale(Window* ptr, Scene* scene) {
ptr->client()->Render(scene);
}
} // namespace
WindowClient::~WindowClient() {}

8
Samples/UIWidgetsSamples_2019_4/Assets/Editor.meta


fileFormatVersion: 2
guid: 0ae90c343ee0e4f7daf768fe6383340f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/MaterialSample.meta


fileFormatVersion: 2
guid: 611706478d8aa410983272ad601895d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/RaycastableSample.meta


fileFormatVersion: 2
guid: 4e70bfdbd732446138a5acef1423b347
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/ReduxSample.meta


fileFormatVersion: 2
guid: 5d9b41f3c48f94f93b5aaf521adbe0bf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery.meta


fileFormatVersion: 2
guid: d5570637d1b25467596ae3c19ff7f0b2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsSample.meta


fileFormatVersion: 2
guid: 3663814d042c44976a72d5fb8a41cdf9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsTheatre.meta


fileFormatVersion: 2
guid: b54f053c2c5d34691b30237abaf17e14
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

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


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
using Transform = Unity.UIWidgets.widgets.Transform;
namespace Unity.UIWidgets.material {
public static class MaterialUtils {
public static readonly TextSelectionControls materialTextSelectionControls =
new _MaterialTextSelectionControls();
internal const float _kHandleSize = 22.0f;
internal const float _kToolbarScreenPadding = 8.0f;
}
class _TextSelectionToolbar : StatelessWidget {
public _TextSelectionToolbar(Key key = null, VoidCallback handleCut = null,
VoidCallback handleCopy = null, VoidCallback handlePaste = null, VoidCallback handleSelectAll = null) : base(key: key) {
this.handleCut = handleCut;
this.handleCopy = handleCopy;
this.handlePaste = handlePaste;
this.handleSelectAll = handleSelectAll;
}
public readonly VoidCallback handleCut;
public readonly VoidCallback handleCopy;
public readonly VoidCallback handlePaste;
public readonly VoidCallback handleSelectAll;
public override Widget build(BuildContext context) {
List<Widget> items = new List<Widget>();
MaterialLocalizations localizations = MaterialLocalizations.of(context);
if (handleCut != null) {
items.Add(new FlatButton(child: new Text(localizations.cutButtonLabel), onPressed: handleCut));
}
if (handleCopy != null) {
items.Add(new FlatButton(child: new Text(localizations.copyButtonLabel), onPressed: handleCopy));
}
if (handlePaste != null) {
items.Add(new FlatButton(child: new Text(localizations.pasteButtonLabel), onPressed: handlePaste));
}
if (handleSelectAll != null) {
items.Add(new FlatButton(child: new Text(localizations.selectAllButtonLabel),
onPressed: handleSelectAll));
}
return new Material(
elevation: 1.0f,
child: new Container(
color: new Color(0xFFEFEFEF),
height: 44.0f, child: new Row(mainAxisSize: MainAxisSize.min, children: items))
);
}
}
class _TextSelectionToolbarLayout : SingleChildLayoutDelegate {
internal _TextSelectionToolbarLayout(Size screenSize = null, Rect globalEditableRegion = null,
Offset position = null) {
this.screenSize = screenSize;
this.globalEditableRegion = globalEditableRegion;
this.position = position;
}
public readonly Size screenSize;
public readonly Rect globalEditableRegion;
public readonly Offset position;
public override BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
return constraints.loosen();
}
public override Offset getPositionForChild(Size size, Size childSize) {
Offset globalPosition = globalEditableRegion.topLeft + position;
float x = globalPosition.dx - childSize.width / 2.0f;
float y = globalPosition.dy - childSize.height;
if (x < MaterialUtils._kToolbarScreenPadding) {
x = MaterialUtils._kToolbarScreenPadding;
}
else if (x + childSize.width > screenSize.width - MaterialUtils._kToolbarScreenPadding) {
x = screenSize.width - childSize.width - MaterialUtils._kToolbarScreenPadding;
}
if (y < MaterialUtils._kToolbarScreenPadding) {
y = MaterialUtils._kToolbarScreenPadding;
}
else if (y + childSize.height > screenSize.height - MaterialUtils._kToolbarScreenPadding) {
y = screenSize.height - childSize.height - MaterialUtils._kToolbarScreenPadding;
}
return new Offset(x, y);
}
public override bool shouldRelayout(SingleChildLayoutDelegate oldDelegate) {
return position != ((_TextSelectionToolbarLayout) oldDelegate).position;
}
}
class _TextSelectionHandlePainter : AbstractCustomPainter {
internal _TextSelectionHandlePainter(Color color) {
this.color = color;
}
public readonly Color color;
public override void paint(Canvas canvas, Size size) {
Paint paint = new Paint();
paint.color = color;
float radius = size.width / 2.0f;
canvas.drawCircle(new Offset(radius, radius), radius, paint);
canvas.drawRect(Rect.fromLTWH(0.0f, 0.0f, radius, radius), paint);
}
public override bool shouldRepaint(CustomPainter oldPainter) {
return color != ((_TextSelectionHandlePainter) oldPainter).color;
}
}
class _MaterialTextSelectionControls : TextSelectionControls {
public override Size handleSize {
get {
return new Size(MaterialUtils._kHandleSize,
MaterialUtils._kHandleSize);
}
}
public override Widget buildToolbar(BuildContext context, Rect globalEditableRegion, Offset position,
TextSelectionDelegate selectionDelegate) {
return new ConstrainedBox(
constraints: BoxConstraints.tight(globalEditableRegion.size),
child: new CustomSingleChildLayout(
layoutDelegate: new _TextSelectionToolbarLayout(
MediaQuery.of(context).size,
globalEditableRegion,
position
),
child: new _TextSelectionToolbar(
handleCut: canCut(selectionDelegate)
? () => handleCut(selectionDelegate)
: (VoidCallback) null,
handleCopy: canCopy(selectionDelegate)
? () => handleCopy(selectionDelegate)
: (VoidCallback) null,
handlePaste: canPaste(selectionDelegate)
? () => handlePaste(selectionDelegate)
: (VoidCallback) null,
handleSelectAll: canSelectAll(selectionDelegate)
? () => handleSelectAll(selectionDelegate)
: (VoidCallback) null
)
)
);
}
public override Widget buildHandle(BuildContext context, TextSelectionHandleType type, float textLineHeight) {
Widget handle = new Padding(
padding: EdgeInsets.only(right: 26.0f, bottom: 26.0f),
child: new SizedBox(
width: MaterialUtils._kHandleSize,
height: MaterialUtils._kHandleSize,
child: new CustomPaint(
painter: new _TextSelectionHandlePainter(
color: Theme.of(context).textSelectionHandleColor
)
)
)
);
switch (type) {
case TextSelectionHandleType.left: // points up-right
return new Transform(
transform: new Matrix4().rotationZ(Mathf.PI / 2),
child: handle
);
case TextSelectionHandleType.right: // points up-left
return handle;
case TextSelectionHandleType.collapsed: // points up
return new Transform(
transform: new Matrix4().rotationZ(Mathf.PI / 4),
child: handle
);
}
return null;
}
}
}

11
com.unity.uiwidgets/Runtime/material/text_selection.cs.meta


fileFormatVersion: 2
guid: 33685d6edaab14322aa1b854fdd7c3e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/button.cs.meta


fileFormatVersion: 2
guid: 5452e0dd1a19646fda9cc8dc0b388ee4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/button_theme.cs.meta


fileFormatVersion: 2
guid: c00e9535ad31f481cbe2b83d490d714d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

352
com.unity.uiwidgets/Runtime/material/color_scheme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.material {
public class ColorScheme : Diagnosticable, IEquatable<ColorScheme> {
public ColorScheme(
Color primary,
Color primaryVariant,
Color secondary,
Color secondaryVariant,
Color surface,
Color background,
Color error,
Color onPrimary,
Color onSecondary,
Color onSurface,
Color onBackground,
Color onError,
Brightness brightness) {
D.assert(primary != null);
D.assert(primaryVariant != null);
D.assert(secondary != null);
D.assert(secondaryVariant != null);
D.assert(surface != null);
D.assert(background != null);
D.assert(error != null);
D.assert(onPrimary != null);
D.assert(onSecondary != null);
D.assert(onSurface != null);
D.assert(onBackground != null);
D.assert(onError != null);
this.primary = primary;
this.primaryVariant = primaryVariant;
this.secondary = secondary;
this.secondaryVariant = secondaryVariant;
this.surface = surface;
this.background = background;
this.error = error;
this.onPrimary = onPrimary;
this.onSecondary = onSecondary;
this.onSurface = onSurface;
this.onBackground = onBackground;
this.onError = onError;
this.brightness = brightness;
}
public static ColorScheme light(
Color primary = null,
Color primaryVariant = null,
Color secondary = null,
Color secondaryVariant = null,
Color surface = null,
Color background = null,
Color error = null,
Color onPrimary = null,
Color onSecondary = null,
Color onSurface = null,
Color onBackground = null,
Color onError = null,
Brightness brightness = Brightness.light
) {
primary = primary ?? new Color(0xFF6200EE);
primaryVariant = primaryVariant ?? new Color(0xFF3700B3);
secondary = secondary ?? new Color(0xFF03DAC6);
secondaryVariant = secondaryVariant ?? new Color(0xFF018786);
surface = surface ?? Colors.white;
background = background ?? Colors.white;
error = error ?? new Color(0xFFB00020);
onPrimary = onPrimary ?? Colors.white;
onSecondary = onSecondary ?? Colors.black;
onSurface = onSurface ?? Colors.black;
onBackground = onBackground ?? Colors.black;
onError = onError ?? Colors.white;
return new ColorScheme(
primary: primary,
primaryVariant: primaryVariant,
secondary: secondary,
secondaryVariant: secondaryVariant,
surface: surface,
background: background,
error: error,
onPrimary: onPrimary,
onSecondary: onSecondary,
onSurface: onSurface,
onBackground: onBackground,
onError: onError,
brightness: brightness
);
}
public static ColorScheme dark(
Color primary = null,
Color primaryVariant = null,
Color secondary = null,
Color secondaryVariant = null,
Color surface = null,
Color background = null,
Color error = null,
Color onPrimary = null,
Color onSecondary = null,
Color onSurface = null,
Color onBackground = null,
Color onError = null,
Brightness brightness = Brightness.dark
) {
primary = primary ?? new Color(0xFFBB86FC);
primaryVariant = primaryVariant ?? new Color(0xFF4B01D0);
secondary = secondary ?? new Color(0xFF03DAC6);
secondaryVariant = secondaryVariant ?? new Color(0xFF03DAC6);
surface = surface ?? Colors.black;
background = background ?? Colors.black;
error = error ?? new Color(0xFFB00020);
onPrimary = onPrimary ?? Colors.black;
onSecondary = onSecondary ?? Colors.black;
onSurface = onSurface ?? Colors.white;
onBackground = onBackground ?? Colors.white;
onError = onError ?? Colors.black;
return new ColorScheme(
primary: primary,
primaryVariant: primaryVariant,
secondary: secondary,
secondaryVariant: secondaryVariant,
surface: surface,
background: background,
error: error,
onPrimary: onPrimary,
onSecondary: onSecondary,
onSurface: onSurface,
onBackground: onBackground,
onError: onError,
brightness: brightness
);
}
public static ColorScheme fromSwatch(
MaterialColor primarySwatch = null,
Color primaryColorDark = null,
Color accentColor = null,
Color cardColor = null,
Color backgroundColor = null,
Color errorColor = null,
Brightness? brightness = Brightness.light) {
D.assert(brightness != null);
primarySwatch = primarySwatch ?? Colors.blue;
bool isDark = brightness == Brightness.dark;
bool primaryIsDark = _brightnessFor(primarySwatch) == Brightness.dark;
Color secondary = accentColor ?? (isDark ? Colors.tealAccent[200] : primarySwatch);
bool secondaryIsDark = _brightnessFor(secondary) == Brightness.dark;
return new ColorScheme(
primary: primarySwatch,
primaryVariant: primaryColorDark ?? (isDark ? Colors.black : primarySwatch[700]),
secondary: secondary,
secondaryVariant: isDark ? Colors.tealAccent[700] : primarySwatch[700],
surface: cardColor ?? (isDark ? Colors.grey[800] : Colors.white),
background: backgroundColor ?? (isDark ? Colors.grey[700] : primarySwatch[200]),
error: errorColor ?? Colors.red[700],
onPrimary: primaryIsDark ? Colors.white : Colors.black,
onSecondary: secondaryIsDark ? Colors.white : Colors.black,
onSurface: isDark ? Colors.white : Colors.black,
onBackground: primaryIsDark ? Colors.white : Colors.black,
onError: isDark ? Colors.black : Colors.white,
brightness: brightness ?? Brightness.light
);
}
static Brightness _brightnessFor(Color color) {
return ThemeData.estimateBrightnessForColor(color);
}
public readonly Color primary;
public readonly Color primaryVariant;
public readonly Color secondary;
public readonly Color secondaryVariant;
public readonly Color surface;
public readonly Color background;
public readonly Color error;
public readonly Color onPrimary;
public readonly Color onSecondary;
public readonly Color onSurface;
public readonly Color onBackground;
public readonly Color onError;
public readonly Brightness brightness;
public ColorScheme copyWith(
Color primary = null,
Color primaryVariant = null,
Color secondary = null,
Color secondaryVariant = null,
Color surface = null,
Color background = null,
Color error = null,
Color onPrimary = null,
Color onSecondary = null,
Color onSurface = null,
Color onBackground = null,
Color onError = null,
Brightness? brightness = null) {
return new ColorScheme(
primary: primary ?? this.primary,
primaryVariant: primaryVariant ?? this.primaryVariant,
secondary: secondary ?? this.secondary,
secondaryVariant: secondaryVariant ?? this.secondaryVariant,
surface: surface ?? this.surface,
background: background ?? this.background,
error: error ?? this.error,
onPrimary: onPrimary ?? this.onPrimary,
onSecondary: onSecondary ?? this.onSecondary,
onSurface: onSurface ?? this.onSurface,
onBackground: onBackground ?? this.onBackground,
onError: onError ?? this.onError,
brightness: brightness ?? this.brightness
);
}
public static ColorScheme lerp(ColorScheme a, ColorScheme b, float t) {
return new ColorScheme(
primary: Color.lerp(a.primary, b.primary, t),
primaryVariant: Color.lerp(a.primaryVariant, b.primaryVariant, t),
secondary: Color.lerp(a.secondary, b.secondary, t),
secondaryVariant: Color.lerp(a.secondaryVariant, b.secondaryVariant, t),
surface: Color.lerp(a.surface, b.surface, t),
background: Color.lerp(a.background, b.background, t),
error: Color.lerp(a.error, b.error, t),
onPrimary: Color.lerp(a.onPrimary, b.onPrimary, t),
onSecondary: Color.lerp(a.onSecondary, b.onSecondary, t),
onSurface: Color.lerp(a.onSurface, b.onSurface, t),
onBackground: Color.lerp(a.onBackground, b.onBackground, t),
onError: Color.lerp(a.onError, b.onError, t),
brightness: t < 0.5 ? a.brightness : b.brightness
);
}
public bool Equals(ColorScheme other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return other.primary == primary
&& other.primaryVariant == primaryVariant
&& other.secondary == secondary
&& other.secondaryVariant == secondaryVariant
&& other.surface == surface
&& other.background == background
&& other.error == error
&& other.onPrimary == onPrimary
&& other.onSecondary == onSecondary
&& other.onSurface == onSurface
&& other.onBackground == onBackground
&& other.onError == onError
&& other.brightness == brightness;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((ColorScheme) obj);
}
public static bool operator ==(ColorScheme left, ColorScheme right) {
return Equals(left, right);
}
public static bool operator !=(ColorScheme left, ColorScheme right) {
return !Equals(left, right);
}
public override int GetHashCode() {
unchecked {
var hashCode = primary.GetHashCode();
hashCode = (hashCode * 397) ^ primaryVariant.GetHashCode();
hashCode = (hashCode * 397) ^ secondary.GetHashCode();
hashCode = (hashCode * 397) ^ secondaryVariant.GetHashCode();
hashCode = (hashCode * 397) ^ surface.GetHashCode();
hashCode = (hashCode * 397) ^ background.GetHashCode();
hashCode = (hashCode * 397) ^ error.GetHashCode();
hashCode = (hashCode * 397) ^ onPrimary.GetHashCode();
hashCode = (hashCode * 397) ^ onSecondary.GetHashCode();
hashCode = (hashCode * 397) ^ onSurface.GetHashCode();
hashCode = (hashCode * 397) ^ onBackground.GetHashCode();
hashCode = (hashCode * 397) ^ onError.GetHashCode();
hashCode = (hashCode * 397) ^ brightness.GetHashCode();
return hashCode;
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
ColorScheme defaultScheme = light();
properties.add(new DiagnosticsProperty<Color>("primary", primary,
defaultValue: defaultScheme.primary));
properties.add(new DiagnosticsProperty<Color>("primaryVariant", primaryVariant,
defaultValue: defaultScheme.primaryVariant));
properties.add(new DiagnosticsProperty<Color>("secondary", secondary,
defaultValue: defaultScheme.secondary));
properties.add(new DiagnosticsProperty<Color>("secondaryVariant", secondaryVariant,
defaultValue: defaultScheme.secondaryVariant));
properties.add(new DiagnosticsProperty<Color>("surface", surface,
defaultValue: defaultScheme.surface));
properties.add(new DiagnosticsProperty<Color>("background", background,
defaultValue: defaultScheme.background));
properties.add(new DiagnosticsProperty<Color>("error", error, defaultValue: defaultScheme.error));
properties.add(new DiagnosticsProperty<Color>("onPrimary", onPrimary,
defaultValue: defaultScheme.onPrimary));
properties.add(new DiagnosticsProperty<Color>("onSecondary", onSecondary,
defaultValue: defaultScheme.onSecondary));
properties.add(new DiagnosticsProperty<Color>("onSurface", onSurface,
defaultValue: defaultScheme.onSurface));
properties.add(new DiagnosticsProperty<Color>("onBackground", onBackground,
defaultValue: defaultScheme.onBackground));
properties.add(new DiagnosticsProperty<Color>("onError", onError,
defaultValue: defaultScheme.onError));
properties.add(new DiagnosticsProperty<Brightness>("brightness", brightness,
defaultValue: defaultScheme.brightness));
}
}
}

11
com.unity.uiwidgets/Runtime/material/color_scheme.cs.meta


fileFormatVersion: 2
guid: a610420b7a8ec44bfa84e81a1e5ff449
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/colors.cs.meta


fileFormatVersion: 2
guid: dfc0e036c07e1441d8dbd3158bb6f923
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

26
com.unity.uiwidgets/Runtime/material/constants.cs


using System;
using Unity.UIWidgets.painting;
namespace Unity.UIWidgets.material {
public static class Constants {
public const float kToolbarHeight = 56.0f;
public const float kBottomNavigationBarHeight = 56.0f;
public const float kTextTabBarHeight = 48.0f;
public static readonly TimeSpan kThemeChangeDuration = new TimeSpan(0, 0, 0, 0, 200);
public const float kRadialReactionRadius = 20.0f;
public static readonly TimeSpan kRadialReactionDuration = new TimeSpan(0, 0, 0, 0, 100);
public const int kRadialReactionAlpha = 0x1F;
public static readonly TimeSpan kTabScrollDuration = new TimeSpan(0, 0, 0, 0, 300);
public static readonly EdgeInsets kTabLabelPadding = EdgeInsets.symmetric(horizontal: 16.0f);
public static readonly EdgeInsets kMaterialListPadding = EdgeInsets.symmetric(vertical: 8.0f);
}
}

11
com.unity.uiwidgets/Runtime/material/constants.cs.meta


fileFormatVersion: 2
guid: 0364fdae877454fb1babca8f67c2561e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/debug.cs.meta


fileFormatVersion: 2
guid: 353f6a1d0791640349fe94187f15ad33
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/ink_decoration.cs.meta


fileFormatVersion: 2
guid: 2aa14ff76c10f4d459b55674f0a2b57f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/ink_highlight.cs.meta


fileFormatVersion: 2
guid: 96f34a8540bb74c7687149b4b2514998
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/ink_splash.cs.meta


fileFormatVersion: 2
guid: 068260026dcf947b0af4c9d7f706ab97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/ink_well.cs.meta


fileFormatVersion: 2
guid: 9a7302f1a187741b88618822daf7a657
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/material.cs.meta


fileFormatVersion: 2
guid: 7c1f7bd49df00452d9a3be75a9e7b213
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/material_button.cs.meta


fileFormatVersion: 2
guid: ea3964e7af24d4b059ac6e10ec862a3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

371
com.unity.uiwidgets/Runtime/material/text_theme.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class TextTheme : Diagnosticable, IEquatable<TextTheme> {
public TextTheme(
TextStyle display4 = null,
TextStyle display3 = null,
TextStyle display2 = null,
TextStyle display1 = null,
TextStyle headline = null,
TextStyle title = null,
TextStyle subhead = null,
TextStyle body2 = null,
TextStyle body1 = null,
TextStyle caption = null,
TextStyle button = null,
TextStyle subtitle = null,
TextStyle overline = null
) {
this.display4 = display4;
this.display3 = display3;
this.display2 = display2;
this.display1 = display1;
this.headline = headline;
this.title = title;
this.subhead = subhead;
this.body2 = body2;
this.body1 = body1;
this.caption = caption;
this.button = button;
this.subtitle = subtitle;
this.overline = overline;
}
public readonly TextStyle display4;
public readonly TextStyle display3;
public readonly TextStyle display2;
public readonly TextStyle display1;
public readonly TextStyle headline;
public readonly TextStyle title;
public readonly TextStyle subhead;
public readonly TextStyle body2;
public readonly TextStyle body1;
public readonly TextStyle caption;
public readonly TextStyle button;
public readonly TextStyle subtitle;
public readonly TextStyle overline;
public TextTheme copyWith(
TextStyle display4 = null,
TextStyle display3 = null,
TextStyle display2 = null,
TextStyle display1 = null,
TextStyle headline = null,
TextStyle title = null,
TextStyle subhead = null,
TextStyle body2 = null,
TextStyle body1 = null,
TextStyle caption = null,
TextStyle button = null,
TextStyle subtitle = null,
TextStyle overline = null
) {
return new TextTheme(
display4: display4 ?? this.display4,
display3: display3 ?? this.display3,
display2: display2 ?? this.display2,
display1: display1 ?? this.display1,
headline: headline ?? this.headline,
title: title ?? this.title,
subhead: subhead ?? this.subhead,
body2: body2 ?? this.body2,
body1: body1 ?? this.body1,
caption: caption ?? this.caption,
button: button ?? this.button,
subtitle: subtitle ?? this.subtitle,
overline: overline ?? this.overline
);
}
public TextTheme merge(TextTheme other) {
if (other == null) {
return this;
}
return copyWith(
display4: display4?.merge(other.display4) ?? other.display4,
display3: display3?.merge(other.display3) ?? other.display3,
display2: display2?.merge(other.display2) ?? other.display2,
display1: display1?.merge(other.display1) ?? other.display1,
headline: headline?.merge(other.headline) ?? other.headline,
title: title?.merge(other.title) ?? other.title,
subhead: subhead?.merge(other.subhead) ?? other.subhead,
body2: body2?.merge(other.body2) ?? other.body2,
body1: body1?.merge(other.body1) ?? other.body1,
caption: caption?.merge(other.caption) ?? other.caption,
button: button?.merge(other.button) ?? other.button,
subtitle: subtitle?.merge(other.subtitle) ?? other.subtitle,
overline: overline?.merge(other.overline) ?? other.overline
);
}
public TextTheme apply(
string fontFamily = null,
float fontSizeFactor = 1.0f,
float fontSizeDelta = 0.0f,
Color displayColor = null,
Color bodyColor = null,
TextDecoration decoration = null,
Color decorationColor = null,
TextDecorationStyle? decorationStyle = null
) {
return new TextTheme(
display4: display4?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
display3: display3?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
display2: display2?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
display1: display1?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
headline: headline?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
title: title?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
subhead: subhead?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
body2: body2?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
body1: body1?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
caption: caption?.apply(
color: displayColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
button: button?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
subtitle: subtitle?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
),
overline: overline?.apply(
color: bodyColor,
decoration: decoration,
decorationColor: decorationColor,
decorationStyle: decorationStyle,
fontFamily: fontFamily,
fontSizeFactor: fontSizeFactor,
fontSizeDelta: fontSizeDelta
)
);
}
public static TextTheme lerp(TextTheme a, TextTheme b, float t) {
return new TextTheme(
display4: TextStyle.lerp(a?.display4, b?.display4, t),
display3: TextStyle.lerp(a?.display3, b?.display3, t),
display2: TextStyle.lerp(a?.display2, b?.display2, t),
display1: TextStyle.lerp(a?.display1, b?.display1, t),
headline: TextStyle.lerp(a?.headline, b?.headline, t),
title: TextStyle.lerp(a?.title, b?.title, t),
subhead: TextStyle.lerp(a?.subhead, b?.subhead, t),
body2: TextStyle.lerp(a?.body2, b?.body2, t),
body1: TextStyle.lerp(a?.body1, b?.body1, t),
caption: TextStyle.lerp(a?.caption, b?.caption, t),
button: TextStyle.lerp(a?.button, b?.button, t),
subtitle: TextStyle.lerp(a?.subtitle, b?.subtitle, t),
overline: TextStyle.lerp(a?.overline, b?.overline, t)
);
}
public bool Equals(TextTheme other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return display4 == other.display4
&& display3 == other.display3
&& display2 == other.display2
&& display1 == other.display1
&& headline == other.headline
&& title == other.title
&& subhead == other.subhead
&& body2 == other.body2
&& body1 == other.body1
&& caption == other.caption
&& button == other.button
&& subtitle == other.subtitle
&& overline == other.overline;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((TextTheme) obj);
}
public static bool operator ==(TextTheme left, TextTheme right) {
return Equals(left, right);
}
public static bool operator !=(TextTheme left, TextTheme right) {
return !Equals(left, right);
}
int? _cachedHashCode = null;
public override int GetHashCode() {
if (_cachedHashCode != null) {
return _cachedHashCode.Value;
}
unchecked {
var hashCode = display4?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ display3?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ display2?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ display1?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ headline?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ title?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ subhead?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ body2?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ body1?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ caption?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ button?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ subtitle?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ overline?.GetHashCode() ?? 0;
_cachedHashCode = hashCode;
return hashCode;
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
TextTheme defaultTheme = new Typography().black;
properties.add(new DiagnosticsProperty<TextStyle>("display4", display4,
defaultValue: defaultTheme.display4));
properties.add(new DiagnosticsProperty<TextStyle>("display3", display3,
defaultValue: defaultTheme.display3));
properties.add(new DiagnosticsProperty<TextStyle>("display2", display2,
defaultValue: defaultTheme.display2));
properties.add(new DiagnosticsProperty<TextStyle>("display1", display1,
defaultValue: defaultTheme.display1));
properties.add(new DiagnosticsProperty<TextStyle>("headline", headline,
defaultValue: defaultTheme.headline));
properties.add(new DiagnosticsProperty<TextStyle>("title", title, defaultValue: defaultTheme.title));
properties.add(
new DiagnosticsProperty<TextStyle>("subhead", subhead, defaultValue: defaultTheme.subhead));
properties.add(new DiagnosticsProperty<TextStyle>("body2", body2, defaultValue: defaultTheme.body2));
properties.add(new DiagnosticsProperty<TextStyle>("body1", body1, defaultValue: defaultTheme.body1));
properties.add(
new DiagnosticsProperty<TextStyle>("caption", caption, defaultValue: defaultTheme.caption));
properties.add(
new DiagnosticsProperty<TextStyle>("button", button, defaultValue: defaultTheme.button));
properties.add(new DiagnosticsProperty<TextStyle>("subtitle)", subtitle,
defaultValue: defaultTheme.subtitle));
properties.add(new DiagnosticsProperty<TextStyle>("overline", overline,
defaultValue: defaultTheme.overline));
}
}
}

11
com.unity.uiwidgets/Runtime/material/text_theme.cs.meta


fileFormatVersion: 2
guid: 48eff72daf6ec48e5805ff0698990499
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

147
com.unity.uiwidgets/Runtime/material/theme.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public static class ThemeUtils {
public static readonly TimeSpan kThemeAnimationDuration = new TimeSpan(0, 0, 0, 0, 200);
}
public class Theme : StatelessWidget {
public Theme(
Key key = null,
ThemeData data = null,
bool isMaterialAppTheme = false,
Widget child = null
) : base(key: key) {
D.assert(child != null);
D.assert(data != null);
this.data = data;
this.isMaterialAppTheme = isMaterialAppTheme;
this.child = child;
}
public readonly ThemeData data;
public readonly bool isMaterialAppTheme;
readonly Widget child;
static readonly ThemeData _kFallbackTheme = ThemeData.fallback();
public static ThemeData of(BuildContext context, bool shadowThemeOnly = false) {
_InheritedTheme inheritedTheme =
(_InheritedTheme) context.inheritFromWidgetOfExactType(typeof(_InheritedTheme));
if (shadowThemeOnly) {
if (inheritedTheme == null || inheritedTheme.theme.isMaterialAppTheme) {
return null;
}
return inheritedTheme.theme.data;
}
MaterialLocalizations localizations = MaterialLocalizations.of(context);
ScriptCategory category = ScriptCategory.englishLike;
ThemeData theme = inheritedTheme?.theme?.data ?? _kFallbackTheme;
return ThemeData.localize(theme, theme.typography.geometryThemeFor(category));
}
public override Widget build(BuildContext context) {
return new _InheritedTheme(
theme: this,
child: new IconTheme(
data: data.iconTheme,
child: child
)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ThemeData>("data", data, showName: false));
}
}
class _InheritedTheme : InheritedWidget {
public _InheritedTheme(
Key key = null,
Theme theme = null,
Widget child = null) : base(key: key, child: child) {
D.assert(theme != null);
D.assert(child != null);
this.theme = theme;
}
public readonly Theme theme;
public override bool updateShouldNotify(InheritedWidget old) {
return theme.data != ((_InheritedTheme) old).theme.data;
}
}
class ThemeDataTween : Tween<ThemeData> {
public ThemeDataTween(
ThemeData begin = null,
ThemeData end = null
) : base(begin: begin, end: end) {
}
public override ThemeData lerp(float t) {
return ThemeData.lerp(begin, end, t);
}
}
class AnimatedTheme : ImplicitlyAnimatedWidget {
public AnimatedTheme(
Key key = null,
ThemeData data = null,
bool isMaterialAppTheme = false,
Curve curve = null,
TimeSpan? duration = null,
Widget child = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration ?? ThemeUtils.kThemeAnimationDuration) {
D.assert(child != null);
D.assert(data != null);
this.data = data;
this.isMaterialAppTheme = isMaterialAppTheme;
this.child = child;
}
public readonly ThemeData data;
public readonly bool isMaterialAppTheme;
public readonly Widget child;
public override State createState() {
return new _AnimatedThemeState();
}
}
class _AnimatedThemeState : AnimatedWidgetBaseState<AnimatedTheme> {
ThemeDataTween _data;
protected override void forEachTween(TweenVisitor visitor) {
_data = (ThemeDataTween) visitor.visit(this, _data, widget.data,
(ThemeData value) => new ThemeDataTween(begin: value));
}
public override Widget build(BuildContext context) {
return new Theme(
isMaterialAppTheme: widget.isMaterialAppTheme,
child: widget.child,
data: _data.evaluate(animation)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder description) {
base.debugFillProperties(description);
description.add(
new DiagnosticsProperty<ThemeDataTween>("data", _data, showName: false, defaultValue: null));
}
}
}

11
com.unity.uiwidgets/Runtime/material/theme.cs.meta


fileFormatVersion: 2
guid: 8aeba6b651be2405387572671ac527f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
com.unity.uiwidgets/Runtime/material/theme_data.cs.meta


fileFormatVersion: 2
guid: 68fb5edae4e8440669205d4e5b27ea30
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

449
com.unity.uiwidgets/Runtime/material/typography.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public enum ScriptCategory {
englishLike,
dense,
tall
}
public class Typography : Diagnosticable {
public Typography(
TextTheme black = null,
TextTheme white = null,
TextTheme englishLike = null,
TextTheme dense = null,
TextTheme tall = null
) {
black = black ?? blackMountainView;
white = white ?? whiteMountainView;
englishLike = englishLike ?? englishLike2014;
dense = dense ?? dense2014;
tall = tall ?? tall2014;
D.assert(black != null);
D.assert(white != null);
D.assert(englishLike != null);
D.assert(dense != null);
D.assert(tall != null);
this.black = black;
this.white = white;
this.englishLike = englishLike;
this.dense = dense;
this.tall = tall;
}
public readonly TextTheme black;
public readonly TextTheme white;
public readonly TextTheme englishLike;
public readonly TextTheme dense;
public readonly TextTheme tall;
public TextTheme geometryThemeFor(ScriptCategory category) {
switch (category) {
case ScriptCategory.englishLike:
return englishLike;
case ScriptCategory.dense:
return dense;
case ScriptCategory.tall:
return tall;
}
return null;
}
public Typography copyWith(
TextTheme black = null,
TextTheme white = null,
TextTheme englishLike = null,
TextTheme dense = null,
TextTheme tall = null) {
return new Typography(
black: black ?? this.black,
white: white ?? this.white,
englishLike: englishLike ?? this.englishLike,
dense: dense ?? this.dense,
tall: tall ?? this.tall);
}
public static Typography lerp(Typography a, Typography b, float t) {
return new Typography(
black: TextTheme.lerp(a.black, b.black, t),
white: TextTheme.lerp(a.white, b.white, t),
englishLike: TextTheme.lerp(a.englishLike, b.englishLike, t),
dense: TextTheme.lerp(a.dense, b.dense, t),
tall: TextTheme.lerp(a.tall, b.tall, t)
);
}
public bool Equals(Typography other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return black == other.black
&& white == other.white
&& englishLike == other.englishLike
&& dense == other.dense
&& tall == other.tall;
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((Typography) obj);
}
public static bool operator ==(Typography left, Typography right) {
return Equals(left, right);
}
public static bool operator !=(Typography left, Typography right) {
return !Equals(left, right);
}
public override int GetHashCode() {
unchecked {
var hashCode = black.GetHashCode();
hashCode = (hashCode * 397) ^ white.GetHashCode();
hashCode = (hashCode * 397) ^ englishLike.GetHashCode();
hashCode = (hashCode * 397) ^ dense.GetHashCode();
hashCode = (hashCode * 397) ^ tall.GetHashCode();
return hashCode;
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
Typography defaultTypography = new Typography();
properties.add(
new DiagnosticsProperty<TextTheme>("black", black, defaultValue: defaultTypography.black));
properties.add(
new DiagnosticsProperty<TextTheme>("white", white, defaultValue: defaultTypography.white));
properties.add(new DiagnosticsProperty<TextTheme>("englishLike", englishLike,
defaultValue: defaultTypography.englishLike));
properties.add(
new DiagnosticsProperty<TextTheme>("dense", dense, defaultValue: defaultTypography.dense));
properties.add(new DiagnosticsProperty<TextTheme>("tall", tall, defaultValue: defaultTypography.tall));
}
public static readonly TextTheme blackMountainView = new TextTheme(
display4: new TextStyle(debugLabel: "blackMountainView display4", fontFamily: "Roboto", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
display3: new TextStyle(debugLabel: "blackMountainView display3", fontFamily: "Roboto", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
display2: new TextStyle(debugLabel: "blackMountainView display2", fontFamily: "Roboto", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
display1: new TextStyle(debugLabel: "blackMountainView display1", fontFamily: "Roboto", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
headline: new TextStyle(debugLabel: "blackMountainView headline", fontFamily: "Roboto", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
title: new TextStyle(debugLabel: "blackMountainView title", fontFamily: "Roboto", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
subhead: new TextStyle(debugLabel: "blackMountainView subhead", fontFamily: "Roboto", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
body2: new TextStyle(debugLabel: "blackMountainView body2", fontFamily: "Roboto", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
body1: new TextStyle(debugLabel: "blackMountainView body1", fontFamily: "Roboto", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
caption: new TextStyle(debugLabel: "blackMountainView caption", fontFamily: "Roboto", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
button: new TextStyle(debugLabel: "blackMountainView button", fontFamily: "Roboto", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
subtitle: new TextStyle(debugLabel: "blackMountainView subtitle", fontFamily: "Roboto", inherit: true,
color: Colors.black, decoration: TextDecoration.none),
overline: new TextStyle(debugLabel: "blackMountainView overline", fontFamily: "Roboto", inherit: true,
color: Colors.black, decoration: TextDecoration.none)
);
public static readonly TextTheme whiteMountainView = new TextTheme(
display4: new TextStyle(debugLabel: "whiteMountainView display4", fontFamily: "Roboto", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
display3: new TextStyle(debugLabel: "whiteMountainView display3", fontFamily: "Roboto", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
display2: new TextStyle(debugLabel: "whiteMountainView display2", fontFamily: "Roboto", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
display1: new TextStyle(debugLabel: "whiteMountainView display1", fontFamily: "Roboto", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
headline: new TextStyle(debugLabel: "whiteMountainView headline", fontFamily: "Roboto", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
title: new TextStyle(debugLabel: "whiteMountainView title", fontFamily: "Roboto", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
subhead: new TextStyle(debugLabel: "whiteMountainView subhead", fontFamily: "Roboto", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
body2: new TextStyle(debugLabel: "whiteMountainView body2", fontFamily: "Roboto", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
body1: new TextStyle(debugLabel: "whiteMountainView body1", fontFamily: "Roboto", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
caption: new TextStyle(debugLabel: "whiteMountainView caption", fontFamily: "Roboto", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
button: new TextStyle(debugLabel: "whiteMountainView button", fontFamily: "Roboto", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
subtitle: new TextStyle(debugLabel: "whiteMountainView subtitle", fontFamily: "Roboto", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
overline: new TextStyle(debugLabel: "whiteMountainView overline", fontFamily: "Roboto", inherit: true,
color: Colors.white, decoration: TextDecoration.none)
);
public static readonly TextTheme blackCupertino = new TextTheme(
display4: new TextStyle(debugLabel: "blackCupertino display4", fontFamily: ".SF UI Display", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
display3: new TextStyle(debugLabel: "blackCupertino display3", fontFamily: ".SF UI Display", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
display2: new TextStyle(debugLabel: "blackCupertino display2", fontFamily: ".SF UI Display", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
display1: new TextStyle(debugLabel: "blackCupertino display1", fontFamily: ".SF UI Display", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
headline: new TextStyle(debugLabel: "blackCupertino headline", fontFamily: ".SF UI Display", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
title: new TextStyle(debugLabel: "blackCupertino title", fontFamily: ".SF UI Display", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
subhead: new TextStyle(debugLabel: "blackCupertino subhead", fontFamily: ".SF UI Text", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
body2: new TextStyle(debugLabel: "blackCupertino body2", fontFamily: ".SF UI Text", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
body1: new TextStyle(debugLabel: "blackCupertino body1", fontFamily: ".SF UI Text", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
caption: new TextStyle(debugLabel: "blackCupertino caption", fontFamily: ".SF UI Text", inherit: true,
color: Colors.black54, decoration: TextDecoration.none),
button: new TextStyle(debugLabel: "blackCupertino button", fontFamily: ".SF UI Text", inherit: true,
color: Colors.black87, decoration: TextDecoration.none),
subtitle: new TextStyle(debugLabel: "blackCupertino subtitle", fontFamily: ".SF UI Text", inherit: true,
color: Colors.black, decoration: TextDecoration.none),
overline: new TextStyle(debugLabel: "blackCupertino overline", fontFamily: ".SF UI Text", inherit: true,
color: Colors.black, decoration: TextDecoration.none)
);
public static readonly TextTheme whiteCupertino = new TextTheme(
display4: new TextStyle(debugLabel: "whiteCupertino display4", fontFamily: ".SF UI Display", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
display3: new TextStyle(debugLabel: "whiteCupertino display3", fontFamily: ".SF UI Display", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
display2: new TextStyle(debugLabel: "whiteCupertino display2", fontFamily: ".SF UI Display", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
display1: new TextStyle(debugLabel: "whiteCupertino display1", fontFamily: ".SF UI Display", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
headline: new TextStyle(debugLabel: "whiteCupertino headline", fontFamily: ".SF UI Display", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
title: new TextStyle(debugLabel: "whiteCupertino title", fontFamily: ".SF UI Display", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
subhead: new TextStyle(debugLabel: "whiteCupertino subhead", fontFamily: ".SF UI Text", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
body2: new TextStyle(debugLabel: "whiteCupertino body2", fontFamily: ".SF UI Text", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
body1: new TextStyle(debugLabel: "whiteCupertino body1", fontFamily: ".SF UI Text", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
caption: new TextStyle(debugLabel: "whiteCupertino caption", fontFamily: ".SF UI Text", inherit: true,
color: Colors.white70, decoration: TextDecoration.none),
button: new TextStyle(debugLabel: "whiteCupertino button", fontFamily: ".SF UI Text", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
subtitle: new TextStyle(debugLabel: "whiteCupertino subtitle", fontFamily: ".SF UI Text", inherit: true,
color: Colors.white, decoration: TextDecoration.none),
overline: new TextStyle(debugLabel: "whiteCupertino overline", fontFamily: ".SF UI Text", inherit: true,
color: Colors.white, decoration: TextDecoration.none)
);
public static readonly TextTheme englishLike2014 = new TextTheme(
display4: new TextStyle(debugLabel: "englishLike display4 2014", inherit: false, fontSize: 112.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
display3: new TextStyle(debugLabel: "englishLike display3 2014", inherit: false, fontSize: 56.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
display2: new TextStyle(debugLabel: "englishLike display2 2014", inherit: false, fontSize: 45.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
display1: new TextStyle(debugLabel: "englishLike display1 2014", inherit: false, fontSize: 34.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
headline: new TextStyle(debugLabel: "englishLike headline 2014", inherit: false, fontSize: 24.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
title: new TextStyle(debugLabel: "englishLike title 2014", inherit: false, fontSize: 20.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
subhead: new TextStyle(debugLabel: "englishLike subhead 2014", inherit: false, fontSize: 16.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
body2: new TextStyle(debugLabel: "englishLike body2 2014", inherit: false, fontSize: 14.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
body1: new TextStyle(debugLabel: "englishLike body1 2014", inherit: false, fontSize: 14.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
caption: new TextStyle(debugLabel: "englishLike caption 2014", inherit: false, fontSize: 12.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
button: new TextStyle(debugLabel: "englishLike button 2014", inherit: false, fontSize: 14.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
subtitle: new TextStyle(debugLabel: "englishLike subtitle 2014", inherit: false, fontSize: 14.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 0.1f),
overline: new TextStyle(debugLabel: "englishLike overline 2014", inherit: false, fontSize: 10.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 1.5f)
);
public static readonly TextTheme englishLike2018 = new TextTheme(
display4: new TextStyle(debugLabel: "englishLike display4 2018", fontSize: 96.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: -1.5f),
display3: new TextStyle(debugLabel: "englishLike display3 2018", fontSize: 60.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: -0.5f),
display2: new TextStyle(debugLabel: "englishLike display2 2018", fontSize: 48.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 0.0f),
display1: new TextStyle(debugLabel: "englishLike display1 2018", fontSize: 34.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 0.25f),
headline: new TextStyle(debugLabel: "englishLike headline 2018", fontSize: 24.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 0.0f),
title: new TextStyle(debugLabel: "englishLike title 2018", fontSize: 20.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic, letterSpacing: 0.15f),
subhead: new TextStyle(debugLabel: "englishLike subhead 2018", fontSize: 16.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic, letterSpacing: 0.15f),
body2: new TextStyle(debugLabel: "englishLike body2 2018", fontSize: 14.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic, letterSpacing: 0.25f),
body1: new TextStyle(debugLabel: "englishLike body1 2018", fontSize: 16.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic, letterSpacing: 0.5f),
button: new TextStyle(debugLabel: "englishLike button 2018", fontSize: 14.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic, letterSpacing: 0.75f),
caption: new TextStyle(debugLabel: "englishLike caption 2018", fontSize: 12.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic, letterSpacing: 0.4f),
subtitle: new TextStyle(debugLabel: "englishLike subtitle 2018", fontSize: 14.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 0.1f),
overline: new TextStyle(debugLabel: "englishLike overline 2018", fontSize: 10.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic, letterSpacing: 1.5f)
);
public static readonly TextTheme dense2014 = new TextTheme(
display4: new TextStyle(debugLabel: "dense display4 2014", inherit: false, fontSize: 112.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
display3: new TextStyle(debugLabel: "dense display3 2014", inherit: false, fontSize: 56.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
display2: new TextStyle(debugLabel: "dense display2 2014", inherit: false, fontSize: 45.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
display1: new TextStyle(debugLabel: "dense display1 2014", inherit: false, fontSize: 34.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
headline: new TextStyle(debugLabel: "dense headline 2014", inherit: false, fontSize: 24.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
title: new TextStyle(debugLabel: "dense title 2014", inherit: false, fontSize: 21.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
subhead: new TextStyle(debugLabel: "dense subhead 2014", inherit: false, fontSize: 17.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
body2: new TextStyle(debugLabel: "dense body2 2014", inherit: false, fontSize: 15.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
body1: new TextStyle(debugLabel: "dense body1 2014", inherit: false, fontSize: 15.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
caption: new TextStyle(debugLabel: "dense caption 2014", inherit: false, fontSize: 13.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
button: new TextStyle(debugLabel: "dense button 2014", inherit: false, fontSize: 15.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
subtitle: new TextStyle(debugLabel: "dense subtitle 2014", inherit: false, fontSize: 15.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic),
overline: new TextStyle(debugLabel: "dense overline 2014", inherit: false, fontSize: 11.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.ideographic)
);
public static readonly TextTheme dense2018 = new TextTheme(
display4: new TextStyle(debugLabel: "dense display4 2018", fontSize: 96.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
display3: new TextStyle(debugLabel: "dense display3 2018", fontSize: 60.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
display2: new TextStyle(debugLabel: "dense display2 2018", fontSize: 48.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
display1: new TextStyle(debugLabel: "dense display1 2018", fontSize: 34.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
headline: new TextStyle(debugLabel: "dense headline 2018", fontSize: 24.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
title: new TextStyle(debugLabel: "dense title 2018", fontSize: 21.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
subhead: new TextStyle(debugLabel: "dense subhead 2018", fontSize: 17.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
body2: new TextStyle(debugLabel: "dense body2 2018", fontSize: 17.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
body1: new TextStyle(debugLabel: "dense body1 2018", fontSize: 15.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
caption: new TextStyle(debugLabel: "dense caption 2018", fontSize: 13.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
button: new TextStyle(debugLabel: "dense button 2018", fontSize: 15.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
subtitle: new TextStyle(debugLabel: "dense subtitle 2018", fontSize: 15.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic),
overline: new TextStyle(debugLabel: "dense overline 2018", fontSize: 11.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.ideographic)
);
public static readonly TextTheme tall2014 = new TextTheme(
display4: new TextStyle(debugLabel: "tall display4 2014", inherit: false, fontSize: 112.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
display3: new TextStyle(debugLabel: "tall display3 2014", inherit: false, fontSize: 56.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
display2: new TextStyle(debugLabel: "tall display2 2014", inherit: false, fontSize: 45.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
display1: new TextStyle(debugLabel: "tall display1 2014", inherit: false, fontSize: 34.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
headline: new TextStyle(debugLabel: "tall headline 2014", inherit: false, fontSize: 24.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
title: new TextStyle(debugLabel: "tall title 2014", inherit: false, fontSize: 21.0f,
fontWeight: FontWeight.w700, textBaseline: TextBaseline.alphabetic),
subhead: new TextStyle(debugLabel: "tall subhead 2014", inherit: false, fontSize: 17.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
body2: new TextStyle(debugLabel: "tall body2 2014", inherit: false, fontSize: 15.0f,
fontWeight: FontWeight.w700, textBaseline: TextBaseline.alphabetic),
body1: new TextStyle(debugLabel: "tall body1 2014", inherit: false, fontSize: 15.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
caption: new TextStyle(debugLabel: "tall caption 2014", inherit: false, fontSize: 13.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
button: new TextStyle(debugLabel: "tall button 2014", inherit: false, fontSize: 15.0f,
fontWeight: FontWeight.w700, textBaseline: TextBaseline.alphabetic),
subtitle: new TextStyle(debugLabel: "tall subtitle 2014", inherit: false, fontSize: 15.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic),
overline: new TextStyle(debugLabel: "tall overline 2014", inherit: false, fontSize: 11.0f,
fontWeight: FontWeight.w400, textBaseline: TextBaseline.alphabetic)
);
public static readonly TextTheme tall2018 = new TextTheme(
display4: new TextStyle(debugLabel: "tall display4 2018", fontSize: 96.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
display3: new TextStyle(debugLabel: "tall display3 2018", fontSize: 60.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
display2: new TextStyle(debugLabel: "tall display2 2018", fontSize: 48.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
display1: new TextStyle(debugLabel: "tall display1 2018", fontSize: 34.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
headline: new TextStyle(debugLabel: "tall headline 2018", fontSize: 24.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
title: new TextStyle(debugLabel: "tall title 2018", fontSize: 21.0f, fontWeight: FontWeight.w700,
textBaseline: TextBaseline.alphabetic),
subhead: new TextStyle(debugLabel: "tall subhead 2018", fontSize: 17.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
body2: new TextStyle(debugLabel: "tall body2 2018", fontSize: 17.0f, fontWeight: FontWeight.w700,
textBaseline: TextBaseline.alphabetic),
body1: new TextStyle(debugLabel: "tall body1 2018", fontSize: 15.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
button: new TextStyle(debugLabel: "tall button 2018", fontSize: 15.0f, fontWeight: FontWeight.w700,
textBaseline: TextBaseline.alphabetic),
caption: new TextStyle(debugLabel: "tall caption 2018", fontSize: 13.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
subtitle: new TextStyle(debugLabel: "tall subtitle 2018", fontSize: 15.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic),
overline: new TextStyle(debugLabel: "tall overline 2018", fontSize: 11.0f, fontWeight: FontWeight.w400,
textBaseline: TextBaseline.alphabetic)
);
}
}

11
com.unity.uiwidgets/Runtime/material/typography.cs.meta


fileFormatVersion: 2
guid: a7dbdefd2b4fd44dd9ff8d23eb224a31
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

112
com.unity.uiwidgets/Runtime/material/scrollbar.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
static class ScrollbarUtils {
public static readonly TimeSpan _kScrollbarFadeDuration = TimeSpan.FromMilliseconds(300);
public static readonly TimeSpan _kScrollbarTimeToFade = TimeSpan.FromMilliseconds(600);
public const float _kScrollbarThickness = 6.0f;
}
public class Scrollbar : StatefulWidget {
public Scrollbar(
Key key = null,
Widget child = null) : base(key: key) {
this.child = child;
}
public readonly Widget child;
public override State createState() {
return new _ScrollbarState();
}
}
public class _ScrollbarState : TickerProviderStateMixin<Scrollbar> {
public ScrollbarPainter _materialPainter;
public TextDirection _textDirection;
public Color _themeColor;
public AnimationController _fadeoutAnimationController;
public Animation<float> _FadeoutOpacityAnimation;
public Timer _fadeoutTimer;
public override void initState() {
base.initState();
_fadeoutAnimationController = new AnimationController(
vsync: this,
duration: ScrollbarUtils._kScrollbarFadeDuration
);
_FadeoutOpacityAnimation = new CurvedAnimation(
parent: _fadeoutAnimationController,
curve: Curves.fastOutSlowIn
);
}
public override void didChangeDependencies() {
base.didChangeDependencies();
ThemeData theme = Theme.of(context);
_themeColor = theme.highlightColor.withOpacity(1.0f);
_textDirection = Directionality.of(context);
_materialPainter = _BuildMaterialScrollbarPainter();
}
public ScrollbarPainter _BuildMaterialScrollbarPainter() {
return new ScrollbarPainter(
color: _themeColor,
textDirection: _textDirection,
thickness: ScrollbarUtils._kScrollbarThickness,
fadeoutOpacityAnimation: _FadeoutOpacityAnimation
);
}
bool _handleScrollNotification(ScrollNotification notification) {
if (notification is ScrollUpdateNotification || notification is OverscrollNotification) {
if (_fadeoutAnimationController.status != AnimationStatus.forward) {
_fadeoutAnimationController.forward();
}
_materialPainter.update(notification.metrics, notification.metrics.axisDirection);
_fadeoutTimer?.cancel();
_fadeoutTimer = Window.instance.run(ScrollbarUtils._kScrollbarTimeToFade, () => {
_fadeoutAnimationController.reverse();
_fadeoutTimer = null;
});
}
return false;
}
public override void dispose() {
_fadeoutAnimationController.dispose();
_fadeoutTimer?.cancel();
_materialPainter?.dispose();
base.dispose();
}
public override Widget build(BuildContext context) {
return new NotificationListener<ScrollNotification>(
onNotification: _handleScrollNotification,
child: new RepaintBoundary(
child: new CustomPaint(
foregroundPainter: _materialPainter,
child: new RepaintBoundary(
child: widget.child
)
)
)
);
}
}
}

11
com.unity.uiwidgets/Runtime/material/scrollbar.cs.meta


fileFormatVersion: 2
guid: d8341e3dbe41a48c1b05857eb0d0f7d9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

425
com.unity.uiwidgets/Runtime/material/arc.cs


using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;
using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.material {
static class ArcUtils {
public const float _kOnAxisDelta = 2.0f;
public static readonly List<_Diagonal> _allDiagonals = new List<_Diagonal> {
new _Diagonal(_CornerId.topLeft, _CornerId.bottomRight),
new _Diagonal(_CornerId.bottomRight, _CornerId.topLeft),
new _Diagonal(_CornerId.topRight, _CornerId.bottomLeft),
new _Diagonal(_CornerId.bottomLeft, _CornerId.topRight)
};
public delegate float _KeyFunc<T>(T input);
public static T _maxBy<T>(List<T> input, _KeyFunc<T> keyFunc) {
T maxValue = default(T);
float? maxKey = null;
foreach (T value in input) {
float key = keyFunc(value);
if (maxKey == null || key > maxKey) {
maxValue = value;
maxKey = key;
}
}
return maxValue;
}
}
public class MaterialPointArcTween : Tween<Offset> {
public MaterialPointArcTween(
Offset begin = null,
Offset end = null) : base(begin: begin, end: end) {
}
bool _dirty = true;
void _initialze() {
D.assert(begin != null);
D.assert(end != null);
Offset delta = end - begin;
float deltaX = delta.dx.abs();
float deltaY = delta.dy.abs();
float distanceFromAtoB = delta.distance;
Offset c = new Offset(end.dx, begin.dy);
float sweepAngle() {
return 2.0f * Mathf.Asin(distanceFromAtoB / (2.0f * _radius));
}
if (deltaX > ArcUtils._kOnAxisDelta && deltaY > ArcUtils._kOnAxisDelta) {
if (deltaX < deltaY) {
_radius = distanceFromAtoB * distanceFromAtoB / (c - begin).distance / 2.0f;
_center = new Offset(end.dx + _radius * (begin.dx - end.dx).sign(),
end.dy);
if (begin.dx < end.dx) {
_beginAngle = sweepAngle() * (begin.dy - end.dy).sign();
_endAngle = 0.0f;
}
else {
_beginAngle = (Mathf.PI + sweepAngle() * (end.dy - begin.dy).sign());
_endAngle = Mathf.PI;
}
}
else {
_radius = distanceFromAtoB * distanceFromAtoB / (c - end).distance / 2.0f;
_center = new Offset(begin.dx,
begin.dy + (end.dy - begin.dy).sign() * _radius);
if (begin.dy < end.dy) {
_beginAngle = -Mathf.PI / 2.0f;
_endAngle = _beginAngle + sweepAngle() * (end.dx - begin.dx).sign();
}
else {
_beginAngle = Mathf.PI / 2.0f;
_endAngle = _beginAngle + sweepAngle() * (begin.dx - end.dx).sign();
}
}
D.assert(_beginAngle != null);
D.assert(_endAngle != null);
}
else {
_beginAngle = null;
_endAngle = null;
}
_dirty = false;
}
public Offset center {
get {
if (begin == null || end == null) {
return null;
}
if (_dirty) {
_initialze();
}
return _center;
}
}
Offset _center;
public float? radius {
get {
if (begin == null || end == null) {
return null;
}
if (_dirty) {
_initialze();
}
return _radius;
}
}
float _radius;
public float? beginAngle {
get {
if (begin == null || end == null) {
return null;
}
if (_dirty) {
_initialze();
}
return _beginAngle;
}
}
float? _beginAngle;
public float? endAngle {
get {
if (begin == null || end == null) {
return null;
}
if (_dirty) {
_initialze();
}
return _endAngle;
}
}
float? _endAngle;
public override Offset begin {
get { return base.begin; }
set {
if (value != base.begin) {
base.begin = value;
_dirty = true;
}
}
}
public override Offset end {
get { return base.end; }
set {
if (value != base.end) {
base.end = value;
_dirty = true;
}
}
}
public override Offset lerp(float t) {
if (_dirty) {
_initialze();
}
if (t == 0.0) {
return begin;
}
if (t == 1.0) {
return end;
}
if (_beginAngle == null || _endAngle == null) {
return Offset.lerp(begin, end, t);
}
float angle = MathUtils.lerpNullableFloat(_beginAngle, _endAngle, t) ?? 0.0f;
float x = Mathf.Cos(angle) * _radius;
float y = Mathf.Sin(angle) * _radius;
return _center + new Offset(x, y);
}
public override string ToString() {
return GetType() + "(" + begin + "->" + end + "); center=" + center +
", radius=" + radius + ", beginAngle=" + beginAngle + ", endAngle=" + endAngle;
}
}
public enum _CornerId {
topLeft,
topRight,
bottomLeft,
bottomRight
}
public class _Diagonal {
public _Diagonal(
_CornerId beginId,
_CornerId endId) {
this.beginId = beginId;
this.endId = endId;
}
public readonly _CornerId beginId;
public readonly _CornerId endId;
}
public class MaterialRectArcTween : RectTween {
public MaterialRectArcTween(
Rect begin = null,
Rect end = null) : base(begin: begin, end: end) {
}
bool _dirty = true;
void _initialize() {
D.assert(begin != null);
D.assert(end != null);
Offset centersVector = end.center - begin.center;
_Diagonal diagonal = ArcUtils._maxBy(ArcUtils._allDiagonals,
(_Diagonal d) => _diagonalSupport(centersVector, d));
_beginArc = new MaterialPointArcTween(
begin: _cornerFor(begin, diagonal.beginId),
end: _cornerFor(end, diagonal.beginId));
_endArc = new MaterialPointArcTween(
begin: _cornerFor(begin, diagonal.endId),
end: _cornerFor(end, diagonal.endId));
_dirty = false;
}
float _diagonalSupport(Offset centersVector, _Diagonal diagonal) {
Offset delta = _cornerFor(begin, diagonal.endId) - _cornerFor(begin, diagonal.beginId);
float length = delta.distance;
return centersVector.dx * delta.dx / length + centersVector.dy * delta.dy / length;
}
Offset _cornerFor(Rect rect, _CornerId id) {
switch (id) {
case _CornerId.topLeft: return rect.topLeft;
case _CornerId.topRight: return rect.topRight;
case _CornerId.bottomLeft: return rect.bottomLeft;
case _CornerId.bottomRight: return rect.bottomRight;
}
return Offset.zero;
}
public MaterialPointArcTween beginArc {
get {
if (begin == null) {
return null;
}
if (_dirty) {
_initialize();
}
return _beginArc;
}
}
MaterialPointArcTween _beginArc;
public MaterialPointArcTween endArc {
get {
if (end == null) {
return null;
}
if (_dirty) {
_initialize();
}
return _endArc;
}
}
MaterialPointArcTween _endArc;
public override Rect begin {
get { return base.begin; }
set {
if (value != base.begin) {
base.begin = value;
_dirty = true;
}
}
}
public override Rect end {
get { return base.end; }
set {
if (value != base.end) {
base.end = value;
_dirty = true;
}
}
}
public override Rect lerp(float t) {
if (_dirty) {
_initialize();
}
if (t == 0.0) {
return begin;
}
if (t == 1.0) {
return end;
}
return Rect.fromPoints(_beginArc.lerp(t), _endArc.lerp(t));
}
public override string ToString() {
return GetType() + "(" + begin + "->" + end + ")";
}
}
public class MaterialRectCenterArcTween : RectTween {
public MaterialRectCenterArcTween(
Rect begin = null,
Rect end = null) : base(begin: begin, end: end) {
}
bool _dirty = true;
void _initialize() {
D.assert(begin != null);
D.assert(end != null);
_centerArc = new MaterialPointArcTween(
begin: begin.center,
end: end.center);
_dirty = false;
}
public MaterialPointArcTween centerArc {
get {
if (begin == null || end == null) {
return null;
}
if (_dirty) {
_initialize();
}
return _centerArc;
}
}
MaterialPointArcTween _centerArc;
public override Rect begin {
get { return base.begin; }
set {
if (value != base.begin) {
base.begin = value;
_dirty = true;
}
}
}
public override Rect end {
get { return base.end; }
set {
if (value != base.end) {
base.end = value;
_dirty = true;
}
}
}
public override Rect lerp(float t) {
if (_dirty) {
_initialize();
}
if (t == 0.0) {
return begin;
}
if (t == 1.0) {
return end;
}
Offset center = _centerArc.lerp(t);
float width = MathUtils.lerpFloat(begin.width, end.width, t);
float height = MathUtils.lerpFloat(begin.height, end.height, t);
return Rect.fromLTWH(
(center.dx - width / 2.0f),
(center.dy - height / 2.0f),
width,
height);
}
public override string ToString() {
return GetType() + "(" + begin + "->" + end + "); centerArc=" + centerArc;
}
}
}

11
com.unity.uiwidgets/Runtime/material/arc.cs.meta


fileFormatVersion: 2
guid: c31d4962cd3d8445a8cd357447154970
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

169
com.unity.uiwidgets/Runtime/material/button.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace Unity.UIWidgets.material {
public class RawMaterialButton : StatefulWidget {
public RawMaterialButton(
Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
TextStyle textStyle = null,
Color fillColor = null,
Color highlightColor = null,
Color splashColor = null,
float elevation = 2.0f,
float highlightElevation = 8.0f,
float disabledElevation = 0.0f,
EdgeInsets padding = null,
BoxConstraints constraints = null,
ShapeBorder shape = null,
TimeSpan? animationDuration = null,
Clip clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget child = null) : base(key: key) {
D.assert(elevation >= 0.0);
D.assert(highlightElevation >= 0.0);
D.assert(disabledElevation >= 0.0);
MaterialTapTargetSize _materialTapTargetSize = materialTapTargetSize ?? MaterialTapTargetSize.padded;
shape = shape ?? new RoundedRectangleBorder();
padding = padding ?? EdgeInsets.zero;
constraints = constraints ?? new BoxConstraints(minWidth: 88.0f, minHeight: 36.0f);
TimeSpan _animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
this.onPressed = onPressed;
this.onHighlightChanged = onHighlightChanged;
this.textStyle = textStyle;
this.fillColor = fillColor;
this.highlightColor = highlightColor;
this.splashColor = splashColor;
this.elevation = elevation;
this.highlightElevation = highlightElevation;
this.disabledElevation = disabledElevation;
this.padding = padding;
this.constraints = constraints;
this.shape = shape;
this.animationDuration = _animationDuration;
this.clipBehavior = clipBehavior;
this.materialTapTargetSize = _materialTapTargetSize;
this.child = child;
}
public readonly VoidCallback onPressed;
public readonly ValueChanged<bool> onHighlightChanged;
public readonly TextStyle textStyle;
public readonly Color fillColor;
public readonly Color highlightColor;
public readonly Color splashColor;
public readonly float elevation;
public readonly float highlightElevation;
public readonly float disabledElevation;
public readonly EdgeInsets padding;
public readonly BoxConstraints constraints;
public readonly ShapeBorder shape;
public readonly TimeSpan animationDuration;
public readonly Widget child;
public bool enabled {
get { return onPressed != null; }
}
public readonly MaterialTapTargetSize materialTapTargetSize;
public readonly Clip clipBehavior;
public override State createState() {
return new _RawMaterialButtonState();
}
}
class _RawMaterialButtonState : State<RawMaterialButton> {
bool _highlight = false;
void _handleHighlightChanged(bool value) {
if (_highlight != value) {
setState(() => {
_highlight = value;
if (widget.onHighlightChanged != null) {
widget.onHighlightChanged(value);
}
});
}
}
public override void didUpdateWidget(StatefulWidget _oldWidget) {
RawMaterialButton oldWidget = _oldWidget as RawMaterialButton;
base.didUpdateWidget(oldWidget);
if (_highlight && !widget.enabled) {
_highlight = false;
if (widget.onHighlightChanged != null) {
widget.onHighlightChanged(false);
}
}
}
public override Widget build(BuildContext context) {
float elevation = widget.enabled
? (_highlight ? widget.highlightElevation : widget.elevation)
: widget.disabledElevation;
Widget result = new ConstrainedBox(
constraints: widget.constraints,
child: new Material(
elevation: elevation,
textStyle: widget.textStyle,
shape: widget.shape,
color: widget.fillColor,
type: widget.fillColor == null ? MaterialType.transparency : MaterialType.button,
animationDuration: widget.animationDuration,
clipBehavior: widget.clipBehavior,
child: new InkWell(
onHighlightChanged: _handleHighlightChanged,
splashColor: widget.splashColor,
highlightColor: widget.highlightColor,
onTap: widget.onPressed == null
? (GestureTapCallback) null
: () => {
if (widget.onPressed != null) {
widget.onPressed();
}
},
customBorder: widget.shape,
child: IconTheme.merge(
data: new IconThemeData(color: widget.textStyle?.color),
child: new Container(
padding: widget.padding,
child: new Center(
widthFactor: 1.0f,
heightFactor: 1.0f,
child: widget.child)
)
)
)
)
);
return result;
}
}
}

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


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class ButtonBar : StatelessWidget {
public ButtonBar(
Key key = null,
MainAxisAlignment alignment = MainAxisAlignment.end,
MainAxisSize mainAxisSize = MainAxisSize.max,
List<Widget> children = null
) : base(key: key) {
this.alignment = alignment;
this.mainAxisSize = mainAxisSize;
this.children = children ?? new List<Widget>();
}
public readonly MainAxisAlignment alignment;
public readonly MainAxisSize mainAxisSize;
public readonly List<Widget> children;
public override Widget build(BuildContext context) {
ButtonThemeData buttonTheme = ButtonTheme.of(context);
float paddingUnit = buttonTheme.padding.horizontal / 4.0f;
List<Widget> _children = new List<Widget>();
foreach (Widget _child in children) {
_children.Add(
new Padding(
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
child: _child
)
);
}
Widget child = new Row(
mainAxisAlignment: alignment,
mainAxisSize: mainAxisSize,
children: _children
);
switch (buttonTheme.layoutBehavior) {
case ButtonBarLayoutBehavior.padded:
return new Padding(
padding: EdgeInsets.symmetric(
vertical: 2.0f * paddingUnit,
horizontal: paddingUnit
),
child: child
);
case ButtonBarLayoutBehavior.constrained:
return new Container(
padding: EdgeInsets.symmetric(horizontal: paddingUnit),
constraints: new BoxConstraints(minHeight: 52.0f),
alignment: Alignment.center,
child: child
);
}
D.assert(false);
return null;
}
}
}

11
com.unity.uiwidgets/Runtime/material/button_bar.cs.meta


fileFormatVersion: 2
guid: 2658772190aaa4fa79836ff61595171d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

62
com.unity.uiwidgets/Runtime/material/card.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class Card : StatelessWidget {
public Card(
Key key = null,
Color color = null,
float? elevation = null,
ShapeBorder shape = null,
bool borderOnForeground = true,
EdgeInsets margin = null,
Clip? clipBehavior = null,
Widget child = null) : base(key: key) {
D.assert(elevation == null || elevation >= 0.0f);
this.color = color;
this.elevation = elevation;
this.shape = shape;
this.borderOnForeground = borderOnForeground;
this.margin = margin;
this.clipBehavior = clipBehavior;
this.child = child;
}
public readonly Color color;
public readonly float? elevation;
public readonly ShapeBorder shape;
public readonly bool borderOnForeground;
public readonly Clip? clipBehavior;
public readonly EdgeInsets margin;
public readonly Widget child;
const float _defaultElevation = 1.0f;
const Clip _defaultClipBehavior = Clip.none;
public override Widget build(BuildContext context) {
CardTheme cardTheme = CardTheme.of(context);
return new Container(
margin: margin ?? cardTheme.margin ?? EdgeInsets.all(4.0f),
child: new Material(
type: MaterialType.card,
color: color ?? cardTheme.color ?? Theme.of(context).cardColor,
elevation: elevation ?? cardTheme.elevation ?? _defaultElevation,
shape: shape ?? cardTheme.shape ?? new RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0f))
),
borderOnForeground: borderOnForeground,
clipBehavior: clipBehavior ?? cardTheme.clipBehavior ?? _defaultClipBehavior,
child: child)
);
}
}
}

11
com.unity.uiwidgets/Runtime/material/card.cs.meta


fileFormatVersion: 2
guid: 4f7e63a9f1e7d49e7896665f3c16bbe3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

95
com.unity.uiwidgets/Runtime/material/debug.cs


using System.Collections.Generic;
using System.Text;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public static class MaterialD {
public static bool debugCheckHasMaterial(BuildContext context) {
D.assert(() => {
if (!(context.widget is Material) && context.ancestorWidgetOfExactType(typeof(Material)) == null) {
string message = "No Material widget found.";
message += context.widget.GetType() + " widgets require a Material widget ancestor.";
message += "In material design, most widgets are conceptually \"printed\" on " +
"a sheet of material. In UIWidgets\'s material library, that " +
"material is represented by the Material widget. It is the " +
"Material widget that renders ink splashes, for instance. " +
"Because of this, many material library widgets require that " +
"there be a Material widget in the tree above them.";
message += "To introduce a Material widget, you can either directly " +
"include one, or use a widget that contains Material itself, " +
"such as a Card, Dialog, Drawer, or Scaffold.";
message += "The specific widget that could not find a Material ancestor was:";
message += context.widget.ToString();
List<Widget> ancestors = new List<Widget>();
context.visitAncestorElements((Element element) => {
ancestors.Add(element.widget);
return true;
});
if (ancestors.isNotEmpty()) {
message += "The ancestors of this widget were:";
foreach (Widget ancestor in ancestors) {
message += "\n " + ancestor;
}
} else {
message += "This widget is the root of the tree, so it has no " +
"ancestors, let alone a \"Material\" ancestor.";
}
throw new UIWidgetsError(message);
}
return true;
});
return true;
}
public static bool debugCheckHasMaterialLocalizations(BuildContext context) {
D.assert(() => {
if (Localizations.of<MaterialLocalizations>(context, typeof(MaterialLocalizations)) == null) {
StringBuilder message = new StringBuilder();
message.AppendLine("No MaterialLocalizations found.");
message.AppendLine(
context.widget.GetType() + " widgets require MaterialLocalizations " +
"to be provided by a Localizations widget ancestor.");
message.AppendLine(
"Localizations are used to generate many different messages, labels," +
"and abbreviations which are used by the material library. ");
message.AppendLine(
"To introduce a MaterialLocalizations, either use a " +
" MaterialApp at the root of your application to include them " +
"automatically, or add a Localization widget with a " +
"MaterialLocalizations delegate.");
message.AppendLine(
"The specific widget that could not find a MaterialLocalizations ancestor was:"
);
message.AppendLine(" " + context.widget);
List<Widget> ancestors = new List<Widget>();
context.visitAncestorElements((Element element) => {
ancestors.Add(element.widget);
return true;
});
if (ancestors.isNotEmpty()) {
message.Append("The ancestors of this widget were:");
foreach (Widget ancestor in ancestors) {
message.Append("\n " + ancestor);
}
} else {
message.AppendLine(
"This widget is the root of the tree, so it has no " +
"ancestors, let alone a \"Localizations\" ancestor."
);
}
throw new UIWidgetsError(message.ToString());
}
return true;
});
return true;
}
}
}

47
com.unity.uiwidgets/Runtime/material/divider.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class Divider : StatelessWidget {
public Divider(
Key key = null,
float height = 16.0f,
float indent = 0.0f,
Color color = null) : base(key: key) {
D.assert(height >= 0.0);
this.height = height;
this.indent = indent;
this.color = color;
}
public readonly float height;
public readonly float indent;
public readonly Color color;
public static BorderSide createBorderSide(BuildContext context, Color color = null, float width = 0.0f) {
return new BorderSide(
color: color ?? Theme.of(context).dividerColor,
width: width);
}
public override Widget build(BuildContext context) {
return new SizedBox(
height: height,
child: new Center(
child: new Container(
height: 0.0f,
margin: EdgeInsets.only(indent),
decoration: new BoxDecoration(
border: new Border(
bottom: createBorderSide(context, color: color))
)
)
)
);
}
}
}

11
com.unity.uiwidgets/Runtime/material/divider.cs.meta


fileFormatVersion: 2
guid: defd4aeb126394fa09828fd8ad695931
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

325
com.unity.uiwidgets/Runtime/material/drawer.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace Unity.UIWidgets.material {
static class DrawerUtils {
public const float _kWidth = 304.0f;
public const float _kEdgeDragWidth = 20.0f;
public const float _kMinFlingVelocity = 365.0f;
public static readonly TimeSpan _kBaseSettleDuration = new TimeSpan(0, 0, 0, 0, 246);
}
public enum DrawerAlignment {
start,
end
}
public class Drawer : StatelessWidget {
public Drawer(
Key key = null,
float elevation = 16.0f,
Widget child = null) : base(key: key) {
D.assert(elevation >= 0.0f);
this.elevation = elevation;
this.child = child;
}
public readonly float elevation;
public readonly Widget child;
public override Widget build(BuildContext context) {
return new ConstrainedBox(
constraints: BoxConstraints.expand(width: DrawerUtils._kWidth),
child: new Material(
elevation: elevation,
child: child
)
);
}
}
public delegate void DrawerCallback(bool isOpened);
public class DrawerController : StatefulWidget {
public DrawerController(
GlobalKey key = null,
Widget child = null,
DrawerAlignment? alignment = null,
DrawerCallback drawerCallback = null,
DragStartBehavior dragStartBehavior = DragStartBehavior.start
) : base(key: key) {
D.assert(child != null);
D.assert(alignment != null);
this.child = child;
this.alignment = alignment ?? DrawerAlignment.start;
this.drawerCallback = drawerCallback;
this.dragStartBehavior = dragStartBehavior;
}
public readonly Widget child;
public readonly DrawerAlignment alignment;
public readonly DragStartBehavior? dragStartBehavior;
public readonly DrawerCallback drawerCallback;
public override State createState() {
return new DrawerControllerState();
}
}
public class DrawerControllerState : SingleTickerProviderStateMixin<DrawerController> {
public override void initState() {
base.initState();
_controller = new AnimationController(duration: DrawerUtils._kBaseSettleDuration, vsync: this);
_controller.addListener(_animationChanged);
_controller.addStatusListener(_animationStatusChanged);
}
public override void dispose() {
_historyEntry?.remove();
_controller.dispose();
base.dispose();
}
void _animationChanged() {
setState(() => { });
}
LocalHistoryEntry _historyEntry;
readonly FocusScopeNode _focusScopeNode = new FocusScopeNode();
void _ensureHistoryEntry() {
if (_historyEntry == null) {
ModalRoute route = ModalRoute.of(context);
if (route != null) {
_historyEntry = new LocalHistoryEntry(onRemove: _handleHistoryEntryRemoved);
route.addLocalHistoryEntry(_historyEntry);
FocusScope.of(context).setFirstFocus(_focusScopeNode);
}
}
}
void _animationStatusChanged(AnimationStatus status) {
switch (status) {
case AnimationStatus.forward:
_ensureHistoryEntry();
break;
case AnimationStatus.reverse:
_historyEntry?.remove();
_historyEntry = null;
break;
case AnimationStatus.dismissed:
break;
case AnimationStatus.completed:
break;
}
}
void _handleHistoryEntryRemoved() {
_historyEntry = null;
close();
}
AnimationController _controller;
void _handleDragDown(DragDownDetails details) {
_controller.stop();
_ensureHistoryEntry();
}
void _handleDragCancel() {
if (_controller.isDismissed || _controller.isAnimating) {
return;
}
if (_controller.value < 0.5) {
close();
}
else {
open();
}
}
public readonly GlobalKey _drawerKey = GlobalKey.key();
float _width {
get {
RenderBox box = (RenderBox) _drawerKey.currentContext?.findRenderObject();
if (box != null) {
return box.size.width;
}
return DrawerUtils._kWidth;
}
}
bool _previouslyOpened = false;
void _move(DragUpdateDetails details) {
float delta = (details.primaryDelta ?? 0) / _width;
switch (widget.alignment) {
case DrawerAlignment.start:
break;
case DrawerAlignment.end:
delta = -delta;
break;
}
_controller.setValue(_controller.value + delta);
bool opened = _controller.value > 0.5;
if (opened != _previouslyOpened && widget.drawerCallback != null) {
widget.drawerCallback(opened);
}
_previouslyOpened = opened;
}
void _settle(DragEndDetails details) {
if (_controller.isDismissed) {
return;
}
if (details.velocity.pixelsPerSecond.dx.abs() >= DrawerUtils._kMinFlingVelocity) {
float visualVelocity = details.velocity.pixelsPerSecond.dx / DrawerUtils._kWidth;
switch (widget.alignment) {
case DrawerAlignment.start:
break;
case DrawerAlignment.end:
visualVelocity = -visualVelocity;
break;
}
_controller.fling(velocity: visualVelocity);
}
else if (_controller.value < 0.5) {
close();
}
else {
open();
}
}
public void open() {
_controller.fling(velocity: 1.0f);
if (widget.drawerCallback != null) {
widget.drawerCallback(true);
}
}
public void close() {
_controller.fling(velocity: -1.0f);
if (widget.drawerCallback != null) {
widget.drawerCallback(false);
}
}
ColorTween _color = new ColorTween(begin: Colors.transparent, end: Colors.black54);
GlobalKey _gestureDetectorKey = GlobalKey.key();
Alignment _drawerOuterAlignment {
get {
switch (widget.alignment) {
case DrawerAlignment.start:
return Alignment.centerLeft;
case DrawerAlignment.end:
return Alignment.centerRight;
}
return null;
}
}
Alignment _drawerInnerAlignment {
get {
switch (widget.alignment) {
case DrawerAlignment.start:
return Alignment.centerRight;
case DrawerAlignment.end:
return Alignment.centerLeft;
}
return null;
}
}
Widget _buildDrawer(BuildContext context) {
bool drawerIsStart = widget.alignment == DrawerAlignment.start;
EdgeInsets padding = MediaQuery.of(context).padding;
float dragAreaWidth = drawerIsStart ? padding.left : padding.right;
dragAreaWidth = Mathf.Max(dragAreaWidth, DrawerUtils._kEdgeDragWidth);
if (_controller.status == AnimationStatus.dismissed) {
return new Align(
alignment: _drawerOuterAlignment,
child: new GestureDetector(
key: _gestureDetectorKey,
onHorizontalDragUpdate: _move,
onHorizontalDragEnd: _settle,
behavior: HitTestBehavior.translucent,
dragStartBehavior: widget.dragStartBehavior ?? DragStartBehavior.down,
child: new Container(width: dragAreaWidth)
)
);
}
else {
return new GestureDetector(
key: _gestureDetectorKey,
onHorizontalDragDown: _handleDragDown,
onHorizontalDragUpdate: _move,
onHorizontalDragEnd: _settle,
onHorizontalDragCancel: _handleDragCancel,
dragStartBehavior: widget.dragStartBehavior ?? DragStartBehavior.down,
child: new RepaintBoundary(
child: new Stack(
children: new List<Widget> {
new GestureDetector(
onTap: close,
child: new Container(
color: _color.evaluate(_controller)
)
),
new Align(
alignment: _drawerOuterAlignment,
child: new Align(
alignment: _drawerInnerAlignment,
widthFactor: _controller.value,
child: new RepaintBoundary(
child: new FocusScope(
key: _drawerKey,
node: _focusScopeNode,
child: widget.child)
)
)
)
}
)
)
);
}
}
public override Widget build(BuildContext context) {
return new ListTileTheme(
style: ListTileStyle.drawer,
child: _buildDrawer(context));
}
}
}

11
com.unity.uiwidgets/Runtime/material/drawer.cs.meta


fileFormatVersion: 2
guid: 82ae9917639b741da9df1fe50aeeca67
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

76
com.unity.uiwidgets/Runtime/material/drawer_header.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
static class DrawerHeaderUtils {
public const float _kDrawerHeaderHeight = 160.0f + 1.0f;
}
public class DrawerHeader : StatelessWidget {
public DrawerHeader(
Key key = null,
Decoration decoration = null,
EdgeInsets margin = null,
EdgeInsets padding = null,
TimeSpan? duration = null,
Curve curve = null,
Widget child = null
) : base(key: key) {
D.assert(child != null);
this.decoration = decoration;
this.margin = margin ?? EdgeInsets.only(bottom: 8.0f);
this.padding = padding ?? EdgeInsets.fromLTRB(16.0f, 16.0f, 16.0f, 8.0f);
this.duration = duration ?? new TimeSpan(0, 0, 0, 0, 250);
this.curve = curve ?? Curves.fastOutSlowIn;
this.child = child;
}
public readonly Decoration decoration;
public readonly EdgeInsets padding;
public readonly EdgeInsets margin;
public readonly TimeSpan duration;
public readonly Curve curve;
public readonly Widget child;
public override Widget build(BuildContext context) {
D.assert(MaterialD.debugCheckHasMaterial(context));
ThemeData theme = Theme.of(context);
float statusBarHeight = MediaQuery.of(context).padding.top;
return new Container(
height: statusBarHeight + DrawerHeaderUtils._kDrawerHeaderHeight,
margin: margin,
decoration: new BoxDecoration(
border: new Border(
bottom: Divider.createBorderSide(context)
)
),
child: new AnimatedContainer(
padding: padding.add(EdgeInsets.only(top: statusBarHeight)),
decoration: decoration,
duration: duration,
curve: curve,
child: child == null
? null
: new DefaultTextStyle(
style: theme.textTheme.body2,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: child)
)
)
);
}
}
}

11
com.unity.uiwidgets/Runtime/material/drawer_header.cs.meta


fileFormatVersion: 2
guid: b98e2be2eba264e28b3ca08fa93d0f2a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

94
com.unity.uiwidgets/Runtime/material/expand_icon.cs


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
namespace Unity.UIWidgets.material {
public class ExpandIcon : StatefulWidget {
public ExpandIcon(
Key key = null,
bool isExpanded = false,
float size = 24.0f,
ValueChanged<bool> onPressed = null,
EdgeInsets padding = null) : base(key: key) {
this.isExpanded = isExpanded;
this.size = size;
this.onPressed = onPressed;
this.padding = padding ?? EdgeInsets.all(8.0f);
}
public readonly bool isExpanded;
public readonly float size;
public readonly ValueChanged<bool> onPressed;
public readonly EdgeInsets padding;
public override State createState() {
return new _ExpandIconState();
}
}
public class _ExpandIconState : SingleTickerProviderStateMixin<ExpandIcon> {
AnimationController _controller;
Animation<float> _iconTurns;
static readonly Animatable<float> _iconTurnTween =
new FloatTween(begin: 0.0f, end: 0.5f).chain(new CurveTween(curve: Curves.fastOutSlowIn));
public override void initState() {
base.initState();
_controller = new AnimationController(duration: ThemeUtils.kThemeAnimationDuration, vsync: this);
_iconTurns = _controller.drive(_iconTurnTween);
if (widget.isExpanded) {
_controller.setValue(Mathf.PI);
}
}
public override void dispose() {
_controller.dispose();
base.dispose();
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget(oldWidget);
ExpandIcon _oldWidget = (ExpandIcon) oldWidget;
if (widget.isExpanded != _oldWidget.isExpanded) {
if (widget.isExpanded) {
_controller.forward();
}
else {
_controller.reverse();
}
}
}
void _handlePressed() {
if (widget.onPressed != null) {
widget.onPressed(widget.isExpanded);
}
}
public override Widget build(BuildContext context) {
D.assert(MaterialD.debugCheckHasMaterial(context));
ThemeData theme = Theme.of(context);
return new IconButton(
padding: widget.padding,
color: theme.brightness == Brightness.dark ? Colors.white54 : Colors.black54,
onPressed: widget.onPressed == null ? (VoidCallback) null : _handlePressed,
icon: new RotationTransition(
turns: _iconTurns,
child: new Icon(Icons.expand_more))
);
}
}
}

11
com.unity.uiwidgets/Runtime/material/expand_icon.cs.meta


fileFormatVersion: 2
guid: e4ab856e0b8e94feabef78ecb303733b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

343
com.unity.uiwidgets/Runtime/material/expansion_panel.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
static class ExpansionPanelUtils {
public const float _kPanelHeaderCollapsedHeight = 48.0f;
public const float _kPanelHeaderExpandedHeight = 64.0f;
}
class _SaltedKey<S, V> : LocalKey {
public _SaltedKey(
S salt,
V value) {
this.salt = salt;
this.value = value;
}
public readonly S salt;
public readonly V value;
public bool Equals(_SaltedKey<S, V> other) {
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return other.salt.Equals(salt)
&& other.value.Equals(value);
}
public override bool Equals(object obj) {
if (ReferenceEquals(null, obj)) {
return false;
}
if (ReferenceEquals(this, obj)) {
return true;
}
if (obj.GetType() != GetType()) {
return false;
}
return Equals((_SaltedKey<S, V>) obj);
}
public static bool operator ==(_SaltedKey<S, V> left, _SaltedKey<S, V> right) {
return Equals(left, right);
}
public static bool operator !=(_SaltedKey<S, V> left, _SaltedKey<S, V> right) {
return !Equals(left, right);
}
public override int GetHashCode() {
unchecked {
var hashCode = salt.GetHashCode();
hashCode = (hashCode * 397) ^ value.GetHashCode();
return hashCode;
}
}
public override string ToString() {
string saltString = salt is string ? "<\'" + salt + "\'>" : "<" + salt + ">";
string valueString = value is string ? "<\'" + value + "\'>" : "<" + value + ">";
return "[" + saltString + " " + valueString + "]";
}
}
public delegate void ExpansionPanelCallback(int panelIndex, bool isExpanded);
public delegate Widget ExpansionPanelHeaderBuilder(BuildContext context, bool isExpanded);
public class ExpansionPanel {
public ExpansionPanel(
ExpansionPanelHeaderBuilder headerBuilder = null,
Widget body = null,
bool isExpanded = false,
bool canTapOnHeader = false) {
D.assert(headerBuilder != null);
D.assert(body != null);
this.headerBuilder = headerBuilder;
this.body = body;
this.isExpanded = isExpanded;
this.canTapOnHeader = false;
}
public readonly ExpansionPanelHeaderBuilder headerBuilder;
public readonly Widget body;
public readonly bool isExpanded;
public readonly bool canTapOnHeader;
}
public class ExpansionPanelRadio : ExpansionPanel {
public ExpansionPanelRadio(
object value = null,
ExpansionPanelHeaderBuilder headerBuilder = null,
Widget body = null,
bool canTapOnHeader = false)
: base(body: body, headerBuilder: headerBuilder, canTapOnHeader: canTapOnHeader) {
D.assert(headerBuilder != null);
D.assert(body != null);
D.assert(value != null);
this.value = value;
}
public readonly object value;
}
public class ExpansionPanelList : StatefulWidget {
public ExpansionPanelList(
Key key = null,
List<ExpansionPanel> children = null,
ExpansionPanelCallback expansionCallback = null,
TimeSpan? animationDuration = null) : base(key: key) {
this.children = children ?? new List<ExpansionPanel>();
this.expansionCallback = expansionCallback;
this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
_allowOnlyOnePanelOpen = false;
initialOpenPanelValue = null;
}
ExpansionPanelList(
Key key = null,
List<ExpansionPanel> children = null,
ExpansionPanelCallback expansionCallback = null,
TimeSpan? animationDuration = null,
object initialOpenPanelValue = null) : base(key: key) {
this.children = children ?? new List<ExpansionPanel>();
this.expansionCallback = expansionCallback;
this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
_allowOnlyOnePanelOpen = true;
this.initialOpenPanelValue = initialOpenPanelValue;
}
public static ExpansionPanelList radio(
Key key = null,
List<ExpansionPanelRadio> children = null,
ExpansionPanelCallback expansionCallback = null,
TimeSpan? animationDuration = null,
object initialOpenPanelValue = null) {
children = children ?? new List<ExpansionPanelRadio>();
var radio = new ExpansionPanelList(
key: key,
children: children.Cast<ExpansionPanel>().ToList(),
expansionCallback: expansionCallback,
animationDuration: animationDuration,
initialOpenPanelValue: initialOpenPanelValue
);
return radio;
}
public readonly List<ExpansionPanel> children;
public readonly ExpansionPanelCallback expansionCallback;
public readonly TimeSpan animationDuration;
public readonly bool _allowOnlyOnePanelOpen;
public readonly object initialOpenPanelValue;
public override State createState() {
return new _ExpansionPanelListState();
}
}
public class _ExpansionPanelListState : State<ExpansionPanelList> {
ExpansionPanelRadio _currentOpenPanel;
public override void initState() {
base.initState();
if (widget._allowOnlyOnePanelOpen) {
D.assert(_allIdentifierUnique(), () => "All object identifiers are not unique!");
foreach (ExpansionPanelRadio child in widget.children) {
if (widget.initialOpenPanelValue != null &&
child.value == widget.initialOpenPanelValue) {
_currentOpenPanel = child;
}
}
}
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget(oldWidget);
ExpansionPanelList _oldWidget = (ExpansionPanelList) oldWidget;
if (widget._allowOnlyOnePanelOpen) {
D.assert(_allIdentifierUnique(), () => "All object identifiers are not unique!");
foreach (ExpansionPanelRadio newChild in widget.children) {
if (widget.initialOpenPanelValue != null &&
newChild.value == widget.initialOpenPanelValue) {
_currentOpenPanel = newChild;
}
}
}
else if (_oldWidget._allowOnlyOnePanelOpen) {
_currentOpenPanel = null;
}
}
bool _allIdentifierUnique() {
Dictionary<object, bool> identifierMap = new Dictionary<object, bool>();
foreach (ExpansionPanelRadio child in widget.children) {
identifierMap[child.value] = true;
}
return identifierMap.Count == widget.children.Count;
}
bool _isChildExpanded(int index) {
if (widget._allowOnlyOnePanelOpen) {
ExpansionPanelRadio radioWidget = (ExpansionPanelRadio) widget.children[index];
return _currentOpenPanel?.value == radioWidget.value;
}
return widget.children[index].isExpanded;
}
void _handlePressed(bool isExpanded, int index) {
if (widget.expansionCallback != null) {
widget.expansionCallback(index, isExpanded);
}
if (widget._allowOnlyOnePanelOpen) {
ExpansionPanelRadio pressedChild = (ExpansionPanelRadio) widget.children[index];
for (int childIndex = 0; childIndex < widget.children.Count; childIndex++) {
ExpansionPanelRadio child = (ExpansionPanelRadio) widget.children[childIndex];
if (widget.expansionCallback != null && childIndex != index &&
child.value == _currentOpenPanel?.value) {
widget.expansionCallback(childIndex, false);
}
}
_currentOpenPanel = isExpanded ? null : pressedChild;
}
setState(() => { });
}
public override Widget build(BuildContext context) {
List<MergeableMaterialItem> items = new List<MergeableMaterialItem>();
EdgeInsets kExpandedEdgeInsets = EdgeInsets.symmetric(
vertical: ExpansionPanelUtils._kPanelHeaderExpandedHeight -
ExpansionPanelUtils._kPanelHeaderCollapsedHeight);
for (int index = 0; index < widget.children.Count; index++) {
int expandIndex = index;
if (_isChildExpanded(index) && index != 0 && !_isChildExpanded(index - 1)) {
items.Add(new MaterialGap(
key: new _SaltedKey<BuildContext, int>(context, index * 2 - 1)));
}
ExpansionPanel child = widget.children[index];
Widget headerWidget = child.headerBuilder(
context,
_isChildExpanded(index)
);
Row header = new Row(
children: new List<Widget> {
new Expanded(
child: new AnimatedContainer(
duration: widget.animationDuration,
curve: Curves.fastOutSlowIn,
margin: _isChildExpanded(index) ? kExpandedEdgeInsets : EdgeInsets.zero,
child: new ConstrainedBox(
constraints: new BoxConstraints(
minHeight: ExpansionPanelUtils._kPanelHeaderCollapsedHeight),
child: headerWidget
)
)
),
new Container(
margin: EdgeInsets.fromLTRB(0, 0, 8, 0),
child: new ExpandIcon(
isExpanded: _isChildExpanded(index),
padding: EdgeInsets.all(16.0f),
onPressed: !child.canTapOnHeader
? (ValueChanged<bool>) ((bool isExpanded) => {
_handlePressed(isExpanded, expandIndex);
})
: null
)
)
}
);
items.Add(new MaterialSlice(
key: new _SaltedKey<BuildContext, int>(context, index * 2),
child: new Column(
children: new List<Widget> {
child.canTapOnHeader
? (Widget) new InkWell(
onTap: () =>
_handlePressed(_isChildExpanded(expandIndex), expandIndex),
child: header
)
: header,
new AnimatedCrossFade(
firstChild: new Container(height: 0.0f),
secondChild: child.body,
firstCurve: new Interval(0.0f, 0.6f, curve: Curves.fastOutSlowIn),
secondCurve: new Interval(0.4f, 1.0f, curve: Curves.fastOutSlowIn),
sizeCurve: Curves.fastOutSlowIn,
crossFadeState: _isChildExpanded(index)
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: widget.animationDuration
)
}
)
)
);
if (_isChildExpanded(index) && index != widget.children.Count - 1) {
items.Add(new MaterialGap(
key: new _SaltedKey<BuildContext, int>(context, index * 2 + 1)));
}
}
return new MergeableMaterial(
hasDividers: true,
children: items);
}
}
}

11
com.unity.uiwidgets/Runtime/material/expansion_panel.cs.meta


fileFormatVersion: 2
guid: dcaf0d752807146868207f41db41ccb1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

176
com.unity.uiwidgets/Runtime/material/expansion_tile.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
static class ExpansionTileUtils {
public static readonly TimeSpan _kExpand = new TimeSpan(0, 0, 0, 0, 200);
}
public class ExpansionTile : StatefulWidget {
public ExpansionTile(
Key key = null,
Widget leading = null,
Widget title = null,
Color backgroundColor = null,
ValueChanged<bool> onExpansionChanged = null,
List<Widget> children = null,
Widget trailing = null,
bool initiallyExpanded = false
) : base(key: key) {
D.assert(title != null);
this.leading = leading;
this.title = title;
this.backgroundColor = backgroundColor;
this.onExpansionChanged = onExpansionChanged;
this.children = children ?? new List<Widget>();
this.trailing = trailing;
this.initiallyExpanded = initiallyExpanded;
}
public readonly Widget leading;
public readonly Widget title;
public readonly ValueChanged<bool> onExpansionChanged;
public readonly List<Widget> children;
public readonly Color backgroundColor;
public readonly Widget trailing;
public readonly bool initiallyExpanded;
public override State createState() {
return new _ExpansionTileState();
}
}
public class _ExpansionTileState : SingleTickerProviderStateMixin<ExpansionTile> {
static readonly Animatable<float> _easeOutTween = new CurveTween(curve: Curves.easeOut);
static readonly Animatable<float> _easeInTween = new CurveTween(curve: Curves.easeIn);
static readonly Animatable<float> _halfTween = new FloatTween(begin: 0.0f, end: 0.5f);
readonly ColorTween _borderColorTween = new ColorTween();
readonly ColorTween _headerColorTween = new ColorTween();
readonly ColorTween _iconColorTween = new ColorTween();
readonly ColorTween _backgroundColorTween = new ColorTween();
AnimationController _controller;
Animation<float> _iconTurns;
Animation<float> _heightFactor;
Animation<Color> _borderColor;
Animation<Color> _headerColor;
Animation<Color> _iconColor;
Animation<Color> _backgroundColor;
bool _isExpanded = false;
public override void initState() {
base.initState();
_controller = new AnimationController(duration: ExpansionTileUtils._kExpand, vsync: this);
_heightFactor = _controller.drive(_easeInTween);
_iconTurns = _controller.drive(_halfTween.chain(_easeInTween));
_borderColor = _controller.drive(_borderColorTween.chain(_easeOutTween));
_headerColor = _controller.drive(_headerColorTween.chain(_easeInTween));
_iconColor = _controller.drive(_iconColorTween.chain(_easeInTween));
_backgroundColor = _controller.drive(_backgroundColorTween.chain(_easeOutTween));
_isExpanded = PageStorage.of(context)?.readState(context) == null
? widget.initiallyExpanded
: (bool) PageStorage.of(context)?.readState(context);
if (_isExpanded) {
_controller.setValue(1.0f);
}
}
public override void dispose() {
_controller.dispose();
base.dispose();
}
void _handleTap() {
setState(() => {
_isExpanded = !_isExpanded;
if (_isExpanded) {
_controller.forward();
}
else {
_controller.reverse().Then(() => {
if (!mounted) {
return;
}
setState(() => { });
});
}
PageStorage.of(context)?.writeState(context, _isExpanded);
});
if (widget.onExpansionChanged != null) {
widget.onExpansionChanged(_isExpanded);
}
}
Widget _buildChildren(BuildContext context, Widget child) {
Color borderSideColor = _borderColor.value ?? Colors.transparent;
return new Container(
decoration: new BoxDecoration(
color: _backgroundColor.value ?? Colors.transparent,
border: new Border(
top: new BorderSide(color: borderSideColor),
bottom: new BorderSide(color: borderSideColor))),
child: new Column(
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {
ListTileTheme.merge(
iconColor: _iconColor.value,
textColor: _headerColor.value,
child: new ListTile(
onTap: _handleTap,
leading: widget.leading,
title: widget.title,
trailing: widget.trailing ?? new RotationTransition(
turns: _iconTurns,
child: new Icon(Icons.expand_more)
)
)
),
new ClipRect(
child: new Align(
heightFactor: _heightFactor.value,
child: child)
)
}
)
);
}
public override void didChangeDependencies() {
ThemeData theme = Theme.of(context);
_borderColorTween.end = theme.dividerColor;
_headerColorTween.begin = theme.textTheme.subhead.color;
_headerColorTween.end = theme.accentColor;
_iconColorTween.begin = theme.unselectedWidgetColor;
_iconColorTween.end = theme.accentColor;
_backgroundColorTween.end = widget.backgroundColor;
base.didChangeDependencies();
}
public override Widget build(BuildContext context) {
bool closed = !_isExpanded && _controller.isDismissed;
return new AnimatedBuilder(
animation: _controller.view,
builder: _buildChildren,
child: closed ? null : new Column(children: widget.children));
}
}
}

11
com.unity.uiwidgets/Runtime/material/expansion_tile.cs.meta


fileFormatVersion: 2
guid: dd2974d0b3bb843e782324d1b493fe24
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

178
com.unity.uiwidgets/Runtime/material/flat_button.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class FlatButton : MaterialButton {
public FlatButton(
Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
ButtonTextTheme? textTheme = null,
Color textColor = null,
Color disabledTextColor = null,
Color color = null,
Color disabledColor = null,
Color highlightColor = null,
Color splashColor = null,
Brightness? colorBrightness = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip? clipBehavior = Clip.none,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget child = null) : base(
key: key,
onPressed: onPressed,
onHighlightChanged: onHighlightChanged,
textTheme: textTheme,
textColor: textColor,
disabledTextColor: disabledTextColor,
color: color,
disabledColor: disabledColor,
highlightColor: highlightColor,
splashColor: splashColor,
colorBrightness: colorBrightness,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
materialTapTargetSize: materialTapTargetSize,
child: child) {
}
public static FlatButton icon(
Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
ButtonTextTheme? textTheme = null,
Color textColor = null,
Color disabledTextColor = null,
Color color = null,
Color disabledColor = null,
Color highlightColor = null,
Color splashColor = null,
Brightness? colorBrightness = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip? clipBehavior = null,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget icon = null,
Widget label = null) {
D.assert(icon != null);
D.assert(label != null);
return new _FlatButtonWithIcon(
key: key,
onPressed: onPressed,
onHighlightChanged: onHighlightChanged,
textTheme: textTheme,
textColor: textColor,
disabledTextColor: disabledTextColor,
color: color,
disabledColor: disabledColor,
highlightColor: highlightColor,
splashColor: splashColor,
colorBrightness: colorBrightness,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
materialTapTargetSize: materialTapTargetSize,
icon: icon,
label: label
);
}
public override Widget build(BuildContext context) {
ThemeData theme = Theme.of(context);
ButtonThemeData buttonTheme = ButtonTheme.of(context);
return new RawMaterialButton(
onPressed: onPressed,
onHighlightChanged: onHighlightChanged,
clipBehavior: clipBehavior ?? Clip.none,
fillColor: buttonTheme.getFillColor(this),
textStyle: theme.textTheme.button.copyWith(color: buttonTheme.getTextColor(this)),
highlightColor: buttonTheme.getHighlightColor(this),
splashColor: buttonTheme.getSplashColor(this),
elevation: buttonTheme.getElevation(this),
highlightElevation: buttonTheme.getHighlightElevation(this),
disabledElevation: buttonTheme.getDisabledElevation(this),
padding: buttonTheme.getPadding(this),
constraints: buttonTheme.getConstraints(this),
shape: buttonTheme.getShape(this),
animationDuration: buttonTheme.getAnimationDuration(this),
materialTapTargetSize: buttonTheme.getMaterialTapTargetSize(this),
child: child
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new ObjectFlagProperty<VoidCallback>("onPressed", onPressed, ifNull: "disabled"));
properties.add(new DiagnosticsProperty<ButtonTextTheme?>("textTheme", textTheme, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("textColor", textColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledTextColor", disabledTextColor,
defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("color", color, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("disabledColor", disabledColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("highlightColor", highlightColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Color>("splashColor", splashColor, defaultValue: null));
properties.add(new DiagnosticsProperty<Brightness?>("colorBrightness", colorBrightness,
defaultValue: null));
properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding, defaultValue: null));
properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape, defaultValue: null));
properties.add(new DiagnosticsProperty<MaterialTapTargetSize?>("materialTapTargetSize",
materialTapTargetSize, defaultValue: null));
}
}
class _FlatButtonWithIcon : FlatButton, MaterialButtonWithIconMixin {
public _FlatButtonWithIcon(
Key key = null,
VoidCallback onPressed = null,
ValueChanged<bool> onHighlightChanged = null,
ButtonTextTheme? textTheme = null,
Color textColor = null,
Color disabledTextColor = null,
Color color = null,
Color disabledColor = null,
Color highlightColor = null,
Color splashColor = null,
Brightness? colorBrightness = null,
EdgeInsets padding = null,
ShapeBorder shape = null,
Clip? clipBehavior = null,
MaterialTapTargetSize? materialTapTargetSize = null,
Widget icon = null,
Widget label = null) : base(
key: key,
onPressed: onPressed,
onHighlightChanged: onHighlightChanged,
textTheme: textTheme,
textColor: textColor,
disabledTextColor: disabledTextColor,
color: color,
disabledColor: disabledColor,
highlightColor: highlightColor,
splashColor: splashColor,
colorBrightness: colorBrightness,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
materialTapTargetSize: materialTapTargetSize,
child: new Row(
mainAxisSize: MainAxisSize.min,
children: new List<Widget> {
icon,
new SizedBox(width: 8.0f),
label
}
)) {
D.assert(icon != null);
D.assert(label != null);
}
}
}

11
com.unity.uiwidgets/Runtime/material/flat_button.cs.meta


fileFormatVersion: 2
guid: ad54f63ca420e42518aead08e1b27526
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

53
com.unity.uiwidgets/Runtime/material/grid_tile.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.material {
public class GridTile : StatelessWidget {
public GridTile(
Key key = null,
Widget header = null,
Widget footer = null,
Widget child = null) : base(key: key) {
D.assert(child != null);
this.header = header;
this.footer = footer;
this.child = child;
}
public readonly Widget header;
public readonly Widget footer;
public readonly Widget child;
public override Widget build(BuildContext context) {
if (header == null && footer == null) {
return child;
}
List<Widget> children = new List<Widget> {
Positioned.fill(
child: child)
};
if (header != null) {
children.Add(new Positioned(
top: 0.0f,
left: 0.0f,
right: 0.0f,
child: header));
}
if (footer != null) {
children.Add(new Positioned(
left: 0.0f,
bottom: 0.0f,
right: 0.0f,
child: footer));
}
return new Stack(
children: children);
}
}
}

11
com.unity.uiwidgets/Runtime/material/grid_tile.cs.meta


fileFormatVersion: 2
guid: 8613dcab63f30445c80e76df18408797
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

121
com.unity.uiwidgets/Runtime/material/icon_button.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
namespace Unity.UIWidgets.material {
static class IconButtonUtils {
public const float _kMinButtonSize = 48.0f;
}
public class IconButton : StatelessWidget {
public IconButton(
Key key = null,
float iconSize = 24.0f,
EdgeInsets padding = null,
Alignment alignment = null,
Widget icon = null,
Color color = null,
Color highlightColor = null,
Color splashColor = null,
Color disableColor = null,
VoidCallback onPressed = null,
string tooltip = null) : base(key: key) {
D.assert(icon != null);
this.iconSize = iconSize;
this.padding = padding ?? EdgeInsets.all(8.0f);
this.alignment = alignment ?? Alignment.center;
this.icon = icon;
this.color = color;
this.highlightColor = highlightColor;
this.splashColor = splashColor;
disabledColor = disableColor;
this.onPressed = onPressed;
this.tooltip = tooltip;
}
public readonly float iconSize;
public readonly EdgeInsets padding;
public readonly Alignment alignment;
public readonly Widget icon;
public readonly Color color;
public readonly Color splashColor;
public readonly Color highlightColor;
public readonly Color disabledColor;
public readonly VoidCallback onPressed;
public readonly string tooltip;
public override Widget build(BuildContext context) {
D.assert(MaterialD.debugCheckHasMaterial(context));
Color currentColor;
if (onPressed != null) {
currentColor = color;
}
else {
currentColor = disabledColor ?? Theme.of(context).disabledColor;
}
Widget result = new ConstrainedBox(
constraints: new BoxConstraints(minWidth: IconButtonUtils._kMinButtonSize,
minHeight: IconButtonUtils._kMinButtonSize),
child: new Padding(
padding: padding,
child: new SizedBox(
height: iconSize,
width: iconSize,
child: new Align(
alignment: alignment,
child: IconTheme.merge(
data: new IconThemeData(
size: iconSize,
color: currentColor),
child: icon)
)
)
)
);
if (tooltip != null) {
result = new Tooltip(
message: tooltip,
child: result);
}
return new InkResponse(
onTap: () => {
if (onPressed != null) {
onPressed();
}
},
child: result,
highlightColor: highlightColor ?? Theme.of(context).highlightColor,
splashColor: splashColor ?? Theme.of(context).splashColor,
radius: Mathf.Max(
Material.defaultSplashRadius,
(iconSize + Mathf.Min(padding.horizontal, padding.vertical)) * 0.7f)
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Widget>("icon", icon, showName: false));
properties.add(new ObjectFlagProperty<VoidCallback>("onPressed", onPressed, ifNull: "disabled"));
properties.add(new StringProperty("tooltip", tooltip, defaultValue: null, quoted: false));
}
}
}

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存