浏览代码

Merge branch 'dev_1.17.5' of github.com:Unity-Technologies/com.unity.uiwidgets into fix_runtime_errors

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
64c8fb43
共有 47 个文件被更改,包括 3338 次插入1463 次删除
  1. 4
      com.unity.uiwidgets/Runtime/animation/animation_controller.cs
  2. 23
      com.unity.uiwidgets/Runtime/cupertino/app.cs
  3. 30
      com.unity.uiwidgets/Runtime/foundation/assertions.cs
  4. 27
      com.unity.uiwidgets/Runtime/foundation/diagnostics.cs
  5. 19
      com.unity.uiwidgets/Runtime/painting/alignment.cs
  6. 39
      com.unity.uiwidgets/Runtime/painting/inline_span.cs
  7. 15
      com.unity.uiwidgets/Runtime/painting/placeholder_span.cs
  8. 125
      com.unity.uiwidgets/Runtime/painting/text_span.cs
  9. 18
      com.unity.uiwidgets/Runtime/rendering/animated_size.cs
  10. 3
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  11. 60
      com.unity.uiwidgets/Runtime/rendering/object.cs
  12. 11
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  13. 16
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  14. 3
      com.unity.uiwidgets/Runtime/rendering/sliver.cs
  15. 60
      com.unity.uiwidgets/Runtime/rendering/viewport.cs
  16. 1
      com.unity.uiwidgets/Runtime/scheduler2/binding.cs
  17. 14
      com.unity.uiwidgets/Runtime/service/raw_keyboard.cs
  18. 65
      com.unity.uiwidgets/Runtime/service/system_chrome.cs
  19. 2
      com.unity.uiwidgets/Runtime/ui2/painting.cs
  20. 10
      com.unity.uiwidgets/Runtime/widgets/actions.cs
  21. 19
      com.unity.uiwidgets/Runtime/widgets/animated_cross_fade.cs
  22. 20
      com.unity.uiwidgets/Runtime/widgets/animated_size.cs
  23. 11
      com.unity.uiwidgets/Runtime/widgets/animated_switcher.cs
  24. 177
      com.unity.uiwidgets/Runtime/widgets/app.cs
  25. 581
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  26. 2
      com.unity.uiwidgets/Runtime/widgets/binding.cs
  27. 7
      com.unity.uiwidgets/Runtime/widgets/editable_text.cs
  28. 475
      com.unity.uiwidgets/Runtime/widgets/focus_manager.cs
  29. 144
      com.unity.uiwidgets/Runtime/widgets/focus_scope.cs
  30. 6
      com.unity.uiwidgets/Runtime/widgets/implicit_animations.cs
  31. 109
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  32. 42
      com.unity.uiwidgets/Runtime/widgets/text_selection.cs
  33. 43
      com.unity.uiwidgets/Runtime/widgets/ticker_provider.cs
  34. 109
      com.unity.uiwidgets/Runtime/widgets/transitions.cs
  35. 7
      com.unity.uiwidgets/Runtime/widgets/value_listenable_builder.cs
  36. 25
      com.unity.uiwidgets/Runtime/widgets/viewport.cs
  37. 111
      com.unity.uiwidgets/Runtime/widgets/visibility.cs
  38. 934
      com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
  39. 62
      com.unity.uiwidgets/Runtime/widgets/widget_span.cs
  40. 37
      com.unity.uiwidgets/Runtime/foundation/diagnosticable.mixin.gen.cs
  41. 40
      com.unity.uiwidgets/Runtime/foundation/diagnosticable.mixin.njk
  42. 333
      com.unity.uiwidgets/Runtime/rendering/proxy_sliver.cs
  43. 398
      com.unity.uiwidgets/Runtime/services/keyboard_key.cs
  44. 440
      com.unity.uiwidgets/Runtime/widgets/shortcuts.cs
  45. 38
      com.unity.uiwidgets/Runtime/widgets/title.cs
  46. 65
      com.unity.uiwidgets/Runtime/widgets/tween_animation_builder.cs
  47. 21
      com.unity.uiwidgets/Runtime/widgets/unique_widget.cs

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


public AnimationController(
float? value = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
string debugLabel = null,
float lowerBound = 0.0f,
float upperBound = 1.0f,

_direction = _AnimationDirection.forward;
this.duration = duration;
this.reverseDuration = reverseDuration;
this.debugLabel = debugLabel;
this.lowerBound = lowerBound;
this.upperBound = upperBound;

public TimeSpan? duration;
public TimeSpan? reverseDuration;
Ticker _ticker;
public void resync(TickerProvider vsync) {

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


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

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

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

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

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


}
}
}
class DiagnosticsStackTrace : DiagnosticsBlock {
public DiagnosticsStackTrace(
string name,
IterableFilter<string> stackFilter = null,
bool showSeparator = true
) : base(
name: name,
properties: new List<DiagnosticsNode>(),
style: DiagnosticsTreeStyle.flat,
showSeparator: showSeparator,
allowTruncate: true
) {
}
public DiagnosticsStackTrace(
string name,
string frame,
bool showSeparator = true
) : base(
name: name,
properties: new List<DiagnosticsNode>() {_createStackFrame(frame)},
style: DiagnosticsTreeStyle.whitespace,
showSeparator: showSeparator
) {
}
public static DiagnosticsNode _createStackFrame(string frame) {
return DiagnosticsNode.message(frame, allowWrap: false);
}
}
public class UIWidgetsError : Exception {

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


_maxDescendentsTruncatableNode = maxDescendentsTruncatableNode;
}
readonly int _wrapWidth;
readonly int _wrapWidthProperties;
readonly DiagnosticLevel _minLevel;

return new List<DiagnosticsNode>();
}
}
public class DiagnosticableNode<T> : DiagnosticsNode where T : Diagnosticable {
public class DiagnosticableNode<T> : DiagnosticsNode where T : IDiagnosticable {
T value = null,
T value = default,
DiagnosticsTreeStyle? style = null
) : base(name: name, style: style) {
D.assert(value != null);

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
}
}
public abstract class Diagnosticable {
public interface IDiagnosticable {
string toStringShort();
string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug);
DiagnosticsNode toDiagnosticsNode(
string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse);
void debugFillProperties(DiagnosticPropertiesBuilder properties);
}
public abstract class Diagnosticable : IDiagnosticable {
protected Diagnosticable() {
}

public virtual DiagnosticsNode toDiagnosticsNode(
string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse) {
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse ) {
return new DiagnosticableNode<Diagnosticable>(
name: name, value: this, style: style
);

public override DiagnosticsNode toDiagnosticsNode(
string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse) {
return new DiagnosticableTreeNode(
name: name,

19
com.unity.uiwidgets/Runtime/painting/alignment.cs


public AlignmentGeometry() {
}
float _x { get; }
protected float _x { get; }
float _start { get; }
protected float _start { get; }
float _y { get; }
protected float _y { get; }
// public static AlignmentGeometry add(AlignmentGeometry other) {
// return new _MixedAlignment(

// int get hashCode => hashValues(_x, _start, _y);
}
public class Alignment : IEquatable<Alignment> {
public class Alignment : AlignmentGeometry, IEquatable<Alignment> {
public Alignment(float x, float y) {
this.x = x;
this.y = y;

}
return $"Alignment({x:F1}, {y:F1})";
}
public override Alignment resolve(TextDirection? direction) {
D.assert(direction != null);
switch (direction) {
case TextDirection.rtl:
return new Alignment(_x - _start, _y);
case TextDirection.ltr:
return new Alignment(_x + _start, _y);
}
return null;
}
}
}

39
com.unity.uiwidgets/Runtime/painting/inline_span.cs


public abstract class InlineSpan : DiagnosticableTree, IEquatable<InlineSpan> {
public InlineSpan(
TextStyle style , HoverRecognizer hoverRecognizer
TextStyle style = null
this.hoverRecognizer = hoverRecognizer;
public readonly HoverRecognizer hoverRecognizer;
public bool hasHoverRecognizer {
get {
bool need = false;
visitChildren((text) => {
if (text.hoverRecognizer != null) {
need = true;
return false;
}
return true;
});
return need;
}
}
public abstract void build(ParagraphBuilder builder,
float textScaleFactor = 1, List<PlaceholderDimensions> dimensions = null
);

public InlineSpan getSpanForPosition(TextPosition position) {
public virtual InlineSpan getSpanForPosition(TextPosition position) {
D.assert(debugAssertIsValid());
Accumulator offset = new Accumulator();
InlineSpan result = null;

protected abstract InlineSpan getSpanForPositionVisitor(TextPosition position, Accumulator offset);
public string toPlainText(
bool includeSemanticsLabels = true, bool includePlaceholders = true) {
public virtual string toPlainText(
bool includeSemanticsLabels = true,
bool includePlaceholders = true)
{
StringBuilder buffer = new StringBuilder();
computeToPlainText(buffer, includeSemanticsLabels: includeSemanticsLabels,
includePlaceholders: includePlaceholders);

public abstract void computeSemanticsInformation(List<InlineSpanSemanticsInformation> collector);
public abstract void computeToPlainText(StringBuilder buffer,
bool includeSemanticsLabels = true, bool includePlaceholders = true);
public abstract void computeToPlainText(
StringBuilder buffer,
bool includeSemanticsLabels = true,
bool includePlaceholders = true);
public int? codeUnitAt(int index) {
if (index < 0)

protected abstract int? codeUnitAtVisitor(int index, Accumulator offset);
public bool debugAssertIsValid() => true;
public virtual bool debugAssertIsValid() => true;
public abstract RenderComparison compareTo(InlineSpan other);
void debugFillProperties(DiagnosticPropertiesBuilder properties) {

15
com.unity.uiwidgets/Runtime/painting/placeholder_span.cs


using System.Collections.Generic;
using System.Text;
using JetBrains.Annotations;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.ui;

public PlaceholderSpan(
TextBaseline baseline,
TextStyle style,
PlaceholderAlignment alignment = PlaceholderAlignment.bottom,
HoverRecognizer hoverRecognizer = null
) : base(style: style, hoverRecognizer: hoverRecognizer) {
TextBaseline? baseline = null,
TextStyle style = null,
PlaceholderAlignment alignment = PlaceholderAlignment.bottom
) : base(style: style) {
this.baseline = baseline;
this.alignment = alignment;
}

public TextBaseline baseline;
public TextBaseline? baseline;
public override void computeToPlainText(
StringBuilder buffer,

base.debugFillProperties(properties);
properties.add(new EnumProperty<PlaceholderAlignment>("alignment", alignment, defaultValue: null));
properties.add(new EnumProperty<TextBaseline>("baseline", baseline, defaultValue: null));
properties.add(new EnumProperty<TextBaseline>("baseline", (TextBaseline)baseline, defaultValue: null));
}
}
}

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


public readonly string semanticsLabel;
public TextSpan(
string text = "",
string text = null,
HoverRecognizer hoverRecognizer = null,
string semanticsLabel = null) : base(style: style, hoverRecognizer: hoverRecognizer) {
string semanticsLabel = null
) : base(style: style) {
this.text = text;
this.children = children;
this.recognizer = recognizer;

public override void build(ParagraphBuilder builder, float textScaleFactor = 1.0f,
List<PlaceholderDimensions> dimensions = null) {
public override void build(
ParagraphBuilder builder,
float textScaleFactor = 1.0f,
List<PlaceholderDimensions> dimensions = null
) {
D.assert(debugAssertIsValid());
var hasStyle = style != null;

if (text != null)
builder.addText(text);
if (children != null) {

return null;
}
public override void computeToPlainText(StringBuilder buffer, bool includeSemanticsLabels = true,
bool includePlaceholders = true) {
public override void computeToPlainText(
StringBuilder buffer,
bool includeSemanticsLabels = true,
bool includePlaceholders = true
) {
D.assert(debugAssertIsValid());
if (semanticsLabel != null && includeSemanticsLabels) {
buffer.Append(semanticsLabel);

return null;
}
bool debugAssertIsValid() {
public override bool debugAssertIsValid() {
D.assert(() => {
if (children != null) {
foreach (InlineSpan child in children) {

return result;
}
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((TextSpan) obj);
}
unchecked {
unchecked
{
var hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (text != null ? text.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (children != null ? children.GetHashCode() : 0);

}
}
public bool Equals(InlineSpan otherInline) {
if (ReferenceEquals(null, otherInline)) {
return false;
}
if (ReferenceEquals(this, otherInline)) {
return true;
}
TextSpan other = otherInline as TextSpan;
return Equals(style, other.style) && string.Equals(text, other.text) &&
childEquals(children, other.children) && recognizer == other.recognizer;
}
public static bool operator ==(TextSpan left, TextSpan right) {
return Equals(left, right);
}

}
int childHash() {
unchecked {
var hashCode = 0;
if (children != null) {
foreach (var child in children) {
hashCode = (hashCode * 397) ^ (child != null ? child.GetHashCode() : 0);
}
}
return hashCode;
}
}
static bool childEquals(List<InlineSpan> left, List<InlineSpan> right) {
if (ReferenceEquals(left, right)) {
return true;

return left.SequenceEqual(right);
}
public override string toStringShort() {
return GetType().ToString();
}
properties.defaultDiagnosticsTreeStyle = DiagnosticsTreeStyle.whitespace;
// Properties on style are added as if they were properties directly on
// this TextSpan.
if (style != null) {
style.debugFillProperties(properties);
}
properties.add(
new StringProperty(
"text",
text,
showName: false,
defaultValue: null
)
);
if (style == null && text == null && children == null)
properties.add(DiagnosticsNode.message("(empty)"));
description: recognizer == null ? "" : recognizer.GetType().FullName,
defaultValue: foundation_.kNullDefaultValue
description: recognizer?.GetType()?.ToString(),
defaultValue: null
properties.add(new StringProperty("text", text, showName: false,
defaultValue: foundation_.kNullDefaultValue));
if (style == null && text == null && children == null) {
properties.add(DiagnosticsNode.message("(empty)"));
if (semanticsLabel != null) {
properties.add(new StringProperty("semanticsLabel", semanticsLabel));
}
}

}).ToList();
}
public bool Equals(TextSpan other) {
public bool Equals(TextSpan other)
{
if (ReferenceEquals(null, other)) {
return false;
}

}
return base.Equals(other) && text == other.text && Equals(children, other.children) &&
Equals(recognizer, other.recognizer) && semanticsLabel == other.semanticsLabel;
return base.Equals(other) && text == other.text && Equals(children, other.children) && Equals(recognizer, other.recognizer) && semanticsLabel == other.semanticsLabel;
}
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((TextSpan) obj);
}
}
}

18
com.unity.uiwidgets/Runtime/rendering/animated_size.cs


public RenderAnimatedSize(
TickerProvider vsync = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
Curve curve = null,
Alignment alignment = null,
RenderBox child = null

_vsync = vsync;
_controller = new AnimationController(
vsync: this.vsync,
duration: duration);
duration: duration,
reverseDuration: reverseDuration);
_controller.addListener(() => {
if (_controller.value != _lastValue) {
markNeedsLayout();

}
}
/// The duration of the animation when running in reverse.
public TimeSpan? reverseDuration {
get { return _controller.reverseDuration; }
set {
if (value == _controller.reverseDuration) {
return;
}
_controller.reverseDuration = value;
}
}
public Curve curve {
get { return _animation.curve; }
set {

protected override void performLayout() {
_lastValue = _controller.value;
_hasVisualOverflow = false;
BoxConstraints constraints = this.constraints;
if (child == null || constraints.isTight) {
_controller.stop();
size = _sizeTween.begin = _sizeTween.end = constraints.smallest;

3
com.unity.uiwidgets/Runtime/rendering/layer.cs


});
return scene;
}
Future<ui.Image> toImage(Rect bounds, float pixelRatio = 1.0f)// async
public Future<ui.Image> toImage(Rect bounds, float pixelRatio = 1.0f)// async
{
D.assert(bounds != null);
D.assert(pixelRatio != null);

60
com.unity.uiwidgets/Runtime/rendering/object.cs


public delegate void PaintingContextCallback(PaintingContext context, Offset offset);
public class PaintingContext : ClipContext {
PaintingContext(
public PaintingContext(
ContainerLayer containerLayer = null,
Rect estimatedBounds = null
) {

});
}
public void paintChild(RenderObject child, Offset offset) {
public virtual void paintChild(RenderObject child, Offset offset) {
if (child.isRepaintBoundary) {
stopRecordingIfNeeded();
_compositeChild(child, offset);

childContext.stopRecordingIfNeeded();
}
protected PaintingContext createChildContext(ContainerLayer childLayer, Rect bounds) {
public virtual PaintingContext createChildContext(ContainerLayer childLayer, Rect bounds) {
return new PaintingContext(childLayer, bounds);
}

public void pushOpacity(Offset offset, int alpha, PaintingContextCallback painter) {
pushLayer(new OpacityLayer(alpha: alpha), painter, offset);
}
public OpacityLayer pushOpacity(Offset offset, int alpha, PaintingContextCallback painter, OpacityLayer oldLayer = null) {
OpacityLayer layer = oldLayer ?? new OpacityLayer();
layer.alpha = alpha;
layer.offset = offset;
pushLayer(layer, painter, Offset.zero);
return layer;
}
public override string ToString() {

D.assert(node._relayoutBoundary == node);
return true;
}
// TODO
/*void markNeedsSemanticsUpdate() {
D.assert(!attached || !owner._debugDoingSemantics);
if (!attached || owner._semanticsOwner == null) {
_cachedSemanticsConfiguration = null;
return;
}
bool wasSemanticsBoundary = _semantics != null && _cachedSemanticsConfiguration?.isSemanticBoundary == true;
_cachedSemanticsConfiguration = null;
bool isEffectiveSemanticsBoundary = _semanticsConfiguration.isSemanticBoundary && wasSemanticsBoundary;
RenderObject node = this;
while (!isEffectiveSemanticsBoundary && node.parent is RenderObject) {
if (node != this && node._needsSemanticsUpdate)
break;
node._needsSemanticsUpdate = true;
node = node.parent as RenderObject;
isEffectiveSemanticsBoundary = node._semanticsConfiguration.isSemanticBoundary;
if (isEffectiveSemanticsBoundary && node._semantics == null) {
return;
}
}
if (node != this && _semantics != null && _needsSemanticsUpdate) {
owner._nodesNeedingSemantics.remove(this);
}
if (!node._needsSemanticsUpdate) {
node._needsSemanticsUpdate = true;
if (owner != null) {
D.assert(node._semanticsConfiguration.isSemanticBoundary || node.parent is! RenderObject);
owner._nodesNeedingSemantics.add(node);
owner.requestVisualUpdate();
}
}
}*/
public virtual void markNeedsLayout() {
D.assert(_debugCanPerformMutations);
if (_needsLayout) {

RenderObject child { get; set; }
}
public interface RenderObjectWithChildMixin<ChildType> : RenderObjectWithChildMixin
where ChildType : RenderObject {
new ChildType child { get; set; }
public interface RenderObjectWithChildMixin<ChildType> : RenderObjectWithChildMixin where ChildType : RenderObject {
ChildType child { get; set; }
}
public interface ContainerParentDataMixin<ChildType> where ChildType : RenderObject {

public readonly RenderObject renderObject;
}
public DiagnosticsDebugCreator(object value) :
base(
public DiagnosticsDebugCreator(object value)
: base(
"debugCreator",
value,
level: DiagnosticLevel.hidden

11
com.unity.uiwidgets/Runtime/rendering/paragraph.cs


public class RenderParagraph : RenderBox{
// ContainerRenderObjectMixin<RenderBox, TextParentData>,
//RenderBoxContainerDefaultsMixin<RenderBox, TextParentData>,
//RelayoutWhenSystemFontsChangeMixin
static readonly string _kEllipsis = "\u2026";
bool _softWrap;

_pointerHoverInside = true;
}
void _onPointerExit(PointerEvent evt) {
/*void _onPointerExit(PointerEvent evt) {
}
}*/
void _onPointerHover(PointerEvent evt) {
/*void _onPointerHover(PointerEvent evt) {
_layoutTextWithConstraints(constraints);
Offset offset = globalToLocal(evt.position);
TextPosition position = _textPainter.getPositionForOffset(offset);

(span as TextSpan)?.hoverRecognizer?.OnPointerEnter?.Invoke((PointerHoverEvent) evt);
_previousHoverSpan = span;
}
}
}*/
public override void handleEvent(PointerEvent evt, HitTestEntry entry) {
D.assert(debugHandleEvent(evt, entry));

16
com.unity.uiwidgets/Runtime/rendering/proxy_box.cs


}
protected CustomClipper<T> _clipper;
public override void attach(object owner) {
base.attach(owner);
_clipper?._reclip?.addListener(_markNeedsClip);

protected abstract T _defaultClip { get; }
protected T _clip;
public readonly Clip clipBehavior;
protected Clip _clipBehavior;
public Clip clipBehavior {
get { return _clipBehavior; }
set {
if (_clipBehavior == value) {
return;
}
_clipBehavior = value;
}
}
protected override void performLayout() {
Size oldSize = hasSize ? size : null;
base.performLayout();

3
com.unity.uiwidgets/Runtime/rendering/sliver.cs


_geometry = value;
}
}
SliverGeometry _geometry;
public override Rect paintBounds {

get { return 0.0f; }
}
public bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
public virtual bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
if (mainAxisPosition >= 0.0f && mainAxisPosition < geometry.hitTestExtent &&
crossAxisPosition >= 0.0f && crossAxisPosition < constraints.crossAxisExtent) {
if (hitTestChildren(result, mainAxisPosition: mainAxisPosition,

60
com.unity.uiwidgets/Runtime/rendering/viewport.cs


using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.rendering {
public enum CacheExtentStyle {
/// Treat the [Viewport.cacheExtent] as logical pixels.
pixel,
/// Treat the [Viewport.cacheExtent] as a multiplier of the main axis extent.
viewport,
}
public interface RenderAbstractViewport {
RevealedOffset getOffsetToReveal(RenderObject target, float alignment, Rect rect = null);
RenderObject parent { get; }

AxisDirection axisDirection = AxisDirection.down,
AxisDirection crossAxisDirection = AxisDirection.right,
ViewportOffset offset = null,
float cacheExtent = RenderViewportUtils.defaultCacheExtent
float cacheExtent = RenderViewportUtils.defaultCacheExtent,
CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel
D.assert(axisDirection != null);
D.assert(crossAxisDirection != null);
D.assert(cacheExtentStyle != null);
D.assert(cacheExtent != null || cacheExtentStyle == CacheExtentStyle.pixel);
_cacheExtentStyle = cacheExtentStyle;
}
public new RenderObject parent {

markNeedsLayout();
}
}
public float _calculatedCacheExtent;
public CacheExtentStyle cacheExtentStyle {
get {
return _cacheExtentStyle;
}
set {
D.assert(value != null);
if (value == _cacheExtentStyle) {
return;
}
_cacheExtentStyle = value;
markNeedsLayout();
}
}
CacheExtentStyle _cacheExtentStyle;
public override void attach(object owner) {
base.attach(owner);
_offset.addListener(markNeedsLayout);

float anchor = 0.0f,
List<RenderSliver> children = null,
RenderSliver center = null,
float cacheExtent = RenderViewportUtils.defaultCacheExtent
) : base(axisDirection, crossAxisDirection, offset, cacheExtent) {
float cacheExtent = RenderViewportUtils.defaultCacheExtent,
CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel
) : base(axisDirection, crossAxisDirection, offset, cacheExtent,cacheExtentStyle) {
D.assert(anchor != null);
D.assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null);
if (center == null && firstChild != null) {
_center = firstChild;
}

float reverseDirectionRemainingPaintExtent = centerOffset.clamp(0.0f, mainAxisExtent);
float forwardDirectionRemainingPaintExtent = (mainAxisExtent - centerOffset).clamp(0.0f, mainAxisExtent);
float fullCacheExtent = mainAxisExtent + 2 * cacheExtent;
float centerCacheOffset = centerOffset + cacheExtent;
switch (cacheExtentStyle) {
case CacheExtentStyle.pixel:
_calculatedCacheExtent = cacheExtent;
break;
case CacheExtentStyle.viewport:
_calculatedCacheExtent = mainAxisExtent * cacheExtent;
break;
}
float fullCacheExtent = mainAxisExtent + 2 * _calculatedCacheExtent;
float centerCacheOffset = centerOffset + _calculatedCacheExtent;
float reverseDirectionRemainingCacheExtent = centerCacheOffset.clamp(0.0f, fullCacheExtent);
float forwardDirectionRemainingCacheExtent =
(fullCacheExtent - centerCacheOffset).clamp(0.0f, fullCacheExtent);

growthDirection: GrowthDirection.reverse,
advance: childBefore,
remainingCacheExtent: reverseDirectionRemainingCacheExtent,
cacheOrigin: (mainAxisExtent - centerOffset).clamp(-cacheExtent, 0.0f)
cacheOrigin: (mainAxisExtent - centerOffset).clamp(-_calculatedCacheExtent, 0.0f)
);
if (result != 0.0f) {
return -result;

growthDirection: GrowthDirection.forward,
advance: childAfter,
remainingCacheExtent: forwardDirectionRemainingCacheExtent,
cacheOrigin: centerOffset.clamp(-cacheExtent, 0.0f)
cacheOrigin: centerOffset.clamp(-_calculatedCacheExtent, 0.0f)
);
}

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


_ensureEventLoopCallback();
return entry.completer.future;
}
protected override void unlocked() {
base.unlocked();

14
com.unity.uiwidgets/Runtime/service/raw_keyboard.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.services;
using UnityEngine;
namespace Unity.UIWidgets.service {

public static readonly Dictionary<PhysicalKeyboardKey, LogicalKeyboardKey> _keysPressed = new Dictionary<PhysicalKeyboardKey, LogicalKeyboardKey>();
public HashSet<LogicalKeyboardKey> keysPressed
{
get {
HashSet<LogicalKeyboardKey> keyboardKeys = new HashSet<LogicalKeyboardKey>();
foreach (var value in _keysPressed.Values) {
keyboardKeys.Add(value);
}
return keyboardKeys;
}
}
RawKeyboard() {

65
com.unity.uiwidgets/Runtime/service/system_chrome.cs


using System;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.service {

return !Equals(left, right);
}
}
public class SystemChrome {
/*public static Future setPreferredOrientations(List<DeviceOrientation> orientations) {
return SystemChannels.platform.invokeMethod(
"SystemChrome.setPreferredOrientations",
_stringify(orientations)
);
}
public static Future setApplicationSwitcherDescription(ApplicationSwitcherDescription description){
return SystemChannels.platform.invokeMethod(
"SystemChrome.setApplicationSwitcherDescription",
new Dictionary<string, object>{
{"label",description.label},
{"primaryColor", description.primaryColor},
}
);
}
static Future setEnabledSystemUIOverlays(List<SystemUiOverlay> overlays) {
return SystemChannels.platform.invokeMethod(
"SystemChrome.setEnabledSystemUIOverlays",
_stringify(overlays)
);
}
public static Future restoreSystemUIOverlays() {
return SystemChannels.platform.invokeMethod(
"SystemChrome.restoreSystemUIOverlays",
null
);
}
public static void setSystemUIOverlayStyle(SystemUiOverlayStyle style) {
D.assert(style != null);
if (_pendingStyle != null) {
_pendingStyle = style;
return;
}
if (style == _latestStyle) {
return;
}
_pendingStyle = style;
scheduleMicrotask(()=> {
D.assert(_pendingStyle != null);
if (_pendingStyle != _latestStyle) {
return SystemChannels.platform.invokeMethod(
"SystemChrome.setSystemUIOverlayStyle",
_pendingStyle._toMap()
);
_latestStyle = _pendingStyle;
}
_pendingStyle = null;
});
}*/
public static SystemUiOverlayStyle _pendingStyle;
public static SystemUiOverlayStyle latestStyle {
get {
return _latestStyle;
}
}
static SystemUiOverlayStyle _latestStyle;
}
}

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


}
}
static int getAlphaFromOpacity(float opacity) {
public static int getAlphaFromOpacity(float opacity) {
return (opacity.clamp(0.0f, 1.0f) * 255).round();
}

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


bool enabled = true,
FocusNode focusNode = null,
bool autofocus = false,
//Dictionary<LogicalKeySet, Intent> shortcuts = null,
Dictionary<LogicalKeySet, Intent> shortcuts = null,
Dictionary<LocalKey, ActionFactory> actions = null,
ValueChanged<bool> onShowFocusHighlight = null,
ValueChanged<bool> onShowHoverHighlight = null,

this.enabled = enabled;
this.focusNode = focusNode;
this.autofocus = autofocus;
//this.shortcuts = shortcuts;
this.shortcuts = shortcuts;
this.actions = actions;
this.onShowFocusHighlight = onShowFocusHighlight;
this.onShowHoverHighlight = onShowHoverHighlight;

public readonly Dictionary<LocalKey, ActionFactory> actions;
//public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public readonly ValueChanged<bool> onShowFocusHighlight;

child = new Actions(actions: widget.actions, child: child);
}
/*if (widget.enabled && widget.shortcuts != null && widget.shortcuts.isNotEmpty()) {
if (widget.enabled && widget.shortcuts != null && widget.shortcuts.isNotEmpty()) {
}*/
}
return child;
}
}

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


Alignment alignment = null,
CrossFadeState? crossFadeState = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
AnimatedCrossFadeBuilder layoutBuilder = null
) : base(key: key) {
D.assert(firstChild != null);

this.sizeCurve = sizeCurve ?? Curves.linear;
this.alignment = alignment ?? Alignment.topCenter;
this.crossFadeState = crossFadeState ?? CrossFadeState.showFirst;
this.duration = duration ?? TimeSpan.Zero;
this.duration = duration;
this.reverseDuration = reverseDuration;
this.layoutBuilder = layoutBuilder ?? defaultLayoutBuilder;
}

public readonly CrossFadeState crossFadeState;
public readonly TimeSpan duration;
public readonly TimeSpan? duration;
public readonly TimeSpan? reverseDuration;
public readonly Curve firstCurve;
public readonly Curve secondCurve;

properties.add(new EnumProperty<CrossFadeState>("crossFadeState", crossFadeState));
properties.add(new DiagnosticsProperty<Alignment>("alignment", alignment,
defaultValue: Alignment.topCenter));
properties.add(new IntProperty("duration", duration?.Milliseconds, unit: "ms"));
properties.add(new IntProperty("reverseDuration", reverseDuration?.Milliseconds, unit: "ms", defaultValue: null));
}
}

public override void initState() {
base.initState();
_controller = new AnimationController(duration: widget.duration, vsync: this);
_controller = new AnimationController(
duration: widget.duration,
reverseDuration: widget.reverseDuration,
vsync: this);
if (widget.crossFadeState == CrossFadeState.showSecond) {
_controller.setValue(1.0f);
}

_controller.duration = widget.duration;
}
if (widget.reverseDuration != _oldWidget.reverseDuration)
_controller.reverseDuration = widget.reverseDuration;
if (widget.firstCurve != _oldWidget.firstCurve) {
_firstAnimation = _initAnimation(widget.firstCurve, true);
}

child: new AnimatedSize(
alignment: widget.alignment,
duration: widget.duration,
reverseDuration: widget.reverseDuration,
curve: widget.sizeCurve,
vsync: this,
child: widget.layoutBuilder(topChild, topKey, bottomChild, bottomKey)

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


Alignment alignment = null,
Curve curve = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
D.assert(reverseDuration != null);
this.duration = duration ?? TimeSpan.Zero;
this.duration = duration;
this.reverseDuration = reverseDuration;
this.vsync = vsync;
}

public readonly TimeSpan duration;
public readonly TimeSpan? duration;
public readonly TimeSpan? reverseDuration;
public readonly TickerProvider vsync;
public override RenderObject createRenderObject(BuildContext context) {

reverseDuration: reverseDuration,
curve: curve,
vsync: vsync);
}

_renderObject.alignment = alignment;
_renderObject.duration = duration;
_renderObject.reverseDuration = reverseDuration;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment, defaultValue: Alignment.topCenter));
properties.add(new IntProperty("duration", duration?.Milliseconds, unit: "ms"));
properties.add(new IntProperty("reverseDuration", reverseDuration?.Milliseconds, unit: "ms", defaultValue: null));
}
}
}

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


Key key = null,
Widget child = null,
TimeSpan? duration = null,
TimeSpan? reverseDuration = null,
Curve switchInCurve = null,
Curve switchOutCurve = null,
AnimatedSwitcherTransitionBuilder transitionBuilder = null,

this.layoutBuilder = layoutBuilder ?? defaultLayoutBuilder;
this.child = child;
this.duration = duration;
this.reverseDuration = reverseDuration;
public readonly TimeSpan? reverseDuration;
public readonly Curve switchInCurve;

children: children,
alignment: Alignment.center
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new IntProperty("duration", duration?.Milliseconds, unit: "ms"));
properties.add(new IntProperty("reverseDuration", reverseDuration?.Milliseconds, unit: "ms", defaultValue: null));
}
}

AnimationController controller = new AnimationController(
duration: widget.duration,
reverseDuration:widget.reverseDuration,
vsync: this
);
Animation<float> animation = new CurvedAnimation(

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


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

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

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

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

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

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

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

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

);
}*/
D.assert(() => {
if (WidgetInspectorService.instance.debugShowInspector) {
result = new WidgetInspector(null, result, _InspectorSelectButtonBuilder);
if (widget.debugShowWidgetInspector || WidgetsApp.debugShowWidgetInspectorOverride) {
result = new WidgetInspector(
child: result,
selectButtonBuilder: widget.inspectorSelectButtonBuilder
);
if (widget.debugShowCheckedModeBanner && WidgetsApp.debugAllowBannerOverride) {
result = new CheckedModeBanner(
child: result
);
}
return true;
/*if (widget.debugShowWidgetInspector || WidgetsApp.debugShowWidgetInspectorOverride) {
result = new WidgetInspector(

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

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

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


public readonly TextDirection textDirection;
public static TextDirection of(BuildContext context) {
Directionality widget = context.inheritFromWidgetOfExactType(typeof(Directionality)) as Directionality;
return widget == null ? TextDirection.ltr : widget.textDirection;
Directionality widget = context.dependOnInheritedWidgetOfExactType<Directionality>();
return widget?.textDirection ?? TextDirection.ltr;
}
public override bool updateShouldNotify(InheritedWidget oldWidget) {

bool willChange = false,
Widget child = null
) : base(key: key, child: child) {
D.assert(painter != null || foregroundPainter != null || (!isComplex && !willChange));
size = size ?? Size.zero;
this.size = size;
this.painter = painter;

Clip clipBehavior = Clip.hardEdge,
Widget child = null
) : base(key: key, child: child) {
D.assert(clipBehavior != null);
this.clipper = clipper;
this.clipBehavior = clipBehavior;
}

public readonly Clip clipBehavior;
public override RenderObject createRenderObject(BuildContext context) {
D.assert(clipBehavior != Clip.none);
return new RenderClipRect(
clipper: clipper,
clipBehavior: clipBehavior);

D.assert(clipBehavior != Clip.none);
_renderObject.clipBehavior = clipBehavior;
}
public override void didUnmountRenderObject(RenderObject renderObject) {

public class ClipRRect : SingleChildRenderObjectWidget {
public ClipRRect(
Key key = null,
BorderRadius borderRadius = null,
BorderRadius borderRadius = null,//[!!!]borderRadius = BorderRadius.zero
CustomClipper<RRect> clipper = null,
Clip clipBehavior = Clip.antiAlias,
Widget child = null

public readonly Clip clipBehavior;
public override RenderObject createRenderObject(BuildContext context) {
D.assert(clipBehavior != Clip.none);
D.assert(clipBehavior != Clip.none);
_renderObject.clipBehavior = clipBehavior;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

Clip clipBehavior = Clip.antiAlias,
Widget child = null) : base(key: key, child: child
) {
D.assert(clipBehavior != null);
this.clipper = clipper;
this.clipBehavior = clipBehavior;
}

public readonly Clip clipBehavior;
public override RenderObject createRenderObject(BuildContext context) {
D.assert(clipBehavior != Clip.none);
D.assert(clipBehavior != Clip.none);
renderObject.clipBehavior = clipBehavior;
}
public override void didUnmountRenderObject(RenderObject _renderObject) {

Clip clipBehavior = Clip.antiAlias,
Widget child = null
) : base(key: key, child: child) {
D.assert(clipBehavior != null);
this.clipper = clipper;
this.clipBehavior = clipBehavior;
}

Widget child = null
) {
D.assert(shape != null);
D.assert(clipBehavior != null);
D.assert(clipBehavior != Clip.none);
return new Builder(
key: key,
builder: (BuildContext context) => {

public override RenderObject createRenderObject(BuildContext context) {
D.assert(clipBehavior != Clip.none);
D.assert(clipBehavior != Clip.none);
_renderObject.clipBehavior = clipBehavior;
}

listeners.Add("exit");
if (onHover != null)
listeners.Add("hover");
//properties.add(IterableProperty<string>("listeners", listeners, ifEmpty: "<none>"));
properties.add(new EnumerableProperty<string>("listeners", listeners, ifEmpty: "<none>"));
}
}
void handleExit(PointerExitEvent Event) {
void handleExit(PointerExitEvent _event) {
widget.onExit(Event);
widget.onExit(_event);
if (widget.onExit == null) {
return handleExit;
}
else {
return null;
}
return widget.onExit == null ? null : handleExit;
}
public override Widget build(BuildContext context) {
return new _RawMouseRegion(this);

renderObject.opaque = widget.opaque;
}
}
class _OffstageElement : SingleChildRenderObjectElement {
internal _OffstageElement(Offstage widget) : base(widget) {
}

}
}
public override Type debugTypicalAncestorWidgetClass { get => typeof(Stack); }
public override Type debugTypicalAncestorWidgetClass {
get { return typeof(Stack); }
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

}
}
public override Type debugTypicalAncestorWidgetClass { get => typeof(Flex); }
public override Type debugTypicalAncestorWidgetClass {
get { return typeof(Flex); }
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

Widget child = null) : base(key: key, child: child) {
D.assert(color != null);
D.assert(elevation >= 0.0f);
D.assert(clipBehavior != null);
this.shape = shape;
this.clipBehavior = clipBehavior;
this.borderRadius = borderRadius;

public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
RenderPhysicalModel _renderObject = (RenderPhysicalModel) renderObject;
_renderObject.shape = shape;
_renderObject.clipBehavior = clipBehavior;
_renderObject.borderRadius = borderRadius;
_renderObject.elevation = elevation;
_renderObject.color = color;

properties.add(new EnumProperty<BoxShape>("shape", shape));
properties.add(new DiagnosticsProperty<BorderRadius>("borderRadius", borderRadius));
properties.add(new FloatProperty("elevation", elevation));
properties.add(new DiagnosticsProperty<Color>("color", color));
properties.add(new DiagnosticsProperty<Color>("shadowColor", shadowColor));
properties.add(new ColorProperty("color", color));
properties.add(new ColorProperty("shadowColor", shadowColor));
}
}

base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<CustomClipper<Path>>("clipper", clipper));
properties.add(new FloatProperty("elevation", elevation));
properties.add(new DiagnosticsProperty<Color>("color", color));
properties.add(new DiagnosticsProperty<Color>("shadowColor", shadowColor));
properties.add(new ColorProperty("color", color));
properties.add(new ColorProperty("shadowColor", shadowColor));
}
}

properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding));
}
}
/*public class Flow : MultiChildRenderObjectWidget {
/// Creates a flow layout.
///
/// Wraps each of the given children in a [RepaintBoundary] to avoid
/// repainting the children when the flow repaints.
///
/// The [delegate] argument must not be null.
public Flow(
Key key,
FlowDelegate _delegate,
List<Widget> children = null
)
: base(key: key, children: RepaintBoundary.wrapAll(children)) {
D.assert(_delegate != null);
}
// https://github.com/dart-lang/sdk/issues/29277
/// Creates a flow layout.
///
/// Does not wrap the given children in repaint boundaries, unlike the default
/// constructor. Useful when the child is trivial to paint or already contains
/// a repaint boundary.
///
/// The [delegate] argument must not be null.
Flow.unwrapped(
Key key,
FlowDelegate _delegate,
List<Widget> children = null
) :
base(key: key, children: children) {
D.assert(_delegate != null);
}
/// The delegate that controls the transformation matrices of the children.
public readonly FlowDelegate _delegate;
public override RenderFlow createRenderObject(BuildContext context) => RenderFlow(_delegate: _delegate);
public override void updateRenderObject(BuildContext context, RenderFlow renderObject) {
renderObject._delegate = _delegate;
}
}*/
public class RichText : MultiChildRenderObjectWidget {
public RichText(
Key key = null,

properties.add(new FloatProperty("width", width, defaultValue: foundation_.kNullDefaultValue));
properties.add(new FloatProperty("height", height, defaultValue: foundation_.kNullDefaultValue));
properties.add(new FloatProperty("scale", scale, defaultValue: 1.0f));
properties.add(new DiagnosticsProperty<Color>("color", color,
properties.add(new ColorProperty("color", color,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new EnumProperty<BlendMode>("colorBlendMode", colorBlendMode,
defaultValue: foundation_.kNullDefaultValue));

public static AssetBundle of(BuildContext context) {
DefaultAssetBundle result =
(DefaultAssetBundle) context.inheritFromWidgetOfExactType(typeof(DefaultAssetBundle));
(DefaultAssetBundle) context.dependOnInheritedWidgetOfExactType<DefaultAssetBundle>();
return result?.bundle;
}

}
public class Listener : SingleChildRenderObjectWidget {
public class Listener : StatelessWidget {
public Listener(
Key key = null,
PointerDownEventListener onPointerDown = null,

PointerDragFromEditorReleaseEventListener onPointerDragFromEditorRelease = null,
HitTestBehavior behavior = HitTestBehavior.deferToChild,
Widget child = null
) : base(key: key, child: child) {
) : base(key: key) {
_child = child;
this.onPointerDown = onPointerDown;
this.onPointerMove = onPointerMove;
this.onPointerUp = onPointerUp;

this.onPointerDragFromEditorRelease = onPointerDragFromEditorRelease;
}
public readonly PointerDownEventListener onPointerDown;
public readonly PointerMoveEventListener onPointerMove;

public readonly HitTestBehavior behavior;
public readonly PointerDragFromEditorEnterEventListener onPointerDragFromEditorEnter;
public readonly Widget _child;
public override Widget build(BuildContext context) {
Widget result = _child;
if (onPointerEnter != null ||
onPointerExit != null ||
onPointerHover != null) {
result = new MouseRegion(
onEnter: onPointerEnter,
onExit: onPointerExit,
onHover: onPointerHover,
opaque: false,
child: result
);
}
result = new _PointerListener(
onPointerDown: onPointerDown,
onPointerUp: onPointerUp,
onPointerMove: onPointerMove,
onPointerCancel: onPointerCancel,
onPointerSignal: onPointerSignal,
behavior: behavior,
child: result
);
return result;
}
}
public class _PointerListener : SingleChildRenderObjectWidget {
public _PointerListener(
Key key = null,
PointerDownEventListener onPointerDown = null,
PointerMoveEventListener onPointerMove = null,
PointerUpEventListener onPointerUp = null,
PointerCancelEventListener onPointerCancel = null,
PointerSignalEventListener onPointerSignal = null,
HitTestBehavior behavior = HitTestBehavior.deferToChild,
Widget child = null
) :
base(key: key, child: child) {
D.assert(behavior != null);
}
public readonly PointerDownEventListener onPointerDown;
public readonly PointerMoveEventListener onPointerMove;
public readonly PointerUpEventListener onPointerUp;
public readonly PointerCancelEventListener onPointerCancel;
public readonly PointerSignalEventListener onPointerSignal;
public readonly HitTestBehavior behavior;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderPointerListener(
onPointerDown: onPointerDown,

onPointerSignal: onPointerSignal,
/*onPointerEnter: onPointerEnter,
onPointerExit: onPointerExit,
onPointerHover: onPointerHover,
onPointerScroll: onPointerScroll,
onPointerDragFromEditorEnter: onPointerDragFromEditorEnter,
onPointerDragFromEditorHover: onPointerDragFromEditorHover,
onPointerDragFromEditorExit: onPointerDragFromEditorExit,
onPointerDragFromEditorRelease: onPointerDragFromEditorRelease,*/
behavior: behavior
);
}

renderObject.onPointerUp = onPointerUp;
renderObject.onPointerCancel = onPointerCancel;
renderObject.onPointerSignal = onPointerSignal;
//renderObject.onPointerEnter = onPointerEnter;
//renderObject.onPointerHover = onPointerHover;
//renderObject.onPointerExit = onPointerExit;
//renderObject.onPointerScroll = onPointerScroll;
/*#if UNITY_EDITOR
renderObject.onPointerDragFromEditorEnter = onPointerDragFromEditorEnter;
renderObject.onPointerDragFromEditorHover = onPointerDragFromEditorHover;
renderObject.onPointerDragFromEditorExit = onPointerDragFromEditorExit;
renderObject.onPointerDragFromEditorRelease = onPointerDragFromEditorRelease;
#endif*/
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

listeners.Add("signal");
}
if (onPointerEnter != null) {
listeners.Add("enter");
}
if (onPointerHover != null) {
listeners.Add("hover");
}
if (onPointerExit != null) {
listeners.Add("exit");
}
if (onPointerScroll != null) {
listeners.Add("scroll");
}
#if UNITY_EDITOR
if (onPointerDragFromEditorEnter != null) {
listeners.Add("dragFromEditorEnter");
}
if (onPointerDragFromEditorHover != null) {
listeners.Add("dragFromEditorHover");
}
if (onPointerDragFromEditorExit != null) {
listeners.Add("dragFromEditorExit");
}
if (onPointerDragFromEditorRelease != null) {
listeners.Add("dragFromEditorRelease");
}
#endif
properties.add(new EnumerableProperty<string>("listeners", listeners, ifEmpty: "<none>"));
properties.add(new EnumProperty<HitTestBehavior>("behavior", behavior));
}

}
public readonly bool ignoring;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderIgnorePointer(
ignoring: ignoring

}
}
/*public class Semantics : SingleChildRenderObjectWidget {
public Semantics(
Key key,
Widget child,
bool container = false,
bool explicitChildNodes = false,
bool excludeSemantics = false,
bool enabled,
bool checked,
bool selected,
bool toggled,
bool button,
bool link,
bool header,
bool textField,
bool readOnly,
bool focusable,
bool focused,
bool inMutuallyExclusiveGroup,
bool obscured,
bool multiline,
bool scopesRoute,
bool namesRoute,
bool hidden,
bool image,
bool liveRegion,
int maxValueLength,
int currentValueLength,
string label,
string value,
string increasedValue,
string decreasedValue,
string hint,
string onTapHint,
string onLongPressHint,
TextDirection textDirection,
SemanticsSortKey sortKey,
VoidCallback onTap,
VoidCallback onLongPress,
VoidCallback onScrollLeft,
VoidCallback onScrollRight,
VoidCallback onScrollUp,
VoidCallback onScrollDown,
VoidCallback onIncrease,
VoidCallback onDecrease,
VoidCallback onCopy,
VoidCallback onCut,
VoidCallback onPaste,
VoidCallback onDismiss,
MoveCursorHandler onMoveCursorForwardByCharacter,
MoveCursorHandler onMoveCursorBackwardByCharacter,
SetSelectionHandler onSetSelection,
VoidCallback onDidGainAccessibilityFocus,
VoidCallback onDidLoseAccessibilityFocus,
Dictionary<CustomSemanticsAction, VoidCallback> customSemanticsActions
) : base(key: key, child: child) {
D.assert(container != null);
this.container = container;
this.explicitChildNodes = explicitChildNodes;
this.excludeSemantics = excludeSemantics;
properties = new SemanticsProperties(
enabled: enabled,
checked: checked,
toggled: toggled,
selected: selected,
button: button,
link: link,
header: header,
textField: textField,
readOnly: readOnly,
focusable: focusable,
focused: focused,
inMutuallyExclusiveGroup: inMutuallyExclusiveGroup,
obscured: obscured,
multiline: multiline,
scopesRoute: scopesRoute,
namesRoute: namesRoute,
hidden: hidden,
image: image,
liveRegion: liveRegion,
maxValueLength: maxValueLength,
currentValueLength: currentValueLength,
label: label,
value: value,
increasedValue: increasedValue,
decreasedValue: decreasedValue,
hint: hint,
textDirection: textDirection,
sortKey: sortKey,
onTap: onTap,
onLongPress: onLongPress,
onScrollLeft: onScrollLeft,
onScrollRight: onScrollRight,
onScrollUp: onScrollUp,
onScrollDown: onScrollDown,
onIncrease: onIncrease,
onDecrease: onDecrease,
onCopy: onCopy,
onCut: onCut,
onPaste: onPaste,
onMoveCursorForwardByCharacter: onMoveCursorForwardByCharacter,
onMoveCursorBackwardByCharacter: onMoveCursorBackwardByCharacter,
onDidGainAccessibilityFocus: onDidGainAccessibilityFocus,
onDidLoseAccessibilityFocus: onDidLoseAccessibilityFocus,
onDismiss: onDismiss,
onSetSelection: onSetSelection,
customSemanticsActions: customSemanticsActions,
hintOverrides: onTapHint != null || onLongPressHint != null ?
new SemanticsHintOverrides(
onTapHint: onTapHint,
onLongPressHint: onLongPressHint
) : null
);
}
public readonly SemanticsProperties properties;
public readonly bool container;
public readonly bool explicitChildNodes;
public readonly bool excludeSemantics;
@override
RenderSemanticsAnnotations createRenderObject(BuildContext context) {
return RenderSemanticsAnnotations(
container: container,
explicitChildNodes: explicitChildNodes,
excludeSemantics: excludeSemantics,
enabled: properties.enabled,
checked: properties.checked,
toggled: properties.toggled,
selected: properties.selected,
button: properties.button,
link: properties.link,
header: properties.header,
textField: properties.textField,
readOnly: properties.readOnly,
focusable: properties.focusable,
focused: properties.focused,
liveRegion: properties.liveRegion,
maxValueLength: properties.maxValueLength,
currentValueLength: properties.currentValueLength,
inMutuallyExclusiveGroup: properties.inMutuallyExclusiveGroup,
obscured: properties.obscured,
multiline: properties.multiline,
scopesRoute: properties.scopesRoute,
namesRoute: properties.namesRoute,
hidden: properties.hidden,
image: properties.image,
label: properties.label,
value: properties.value,
increasedValue: properties.increasedValue,
decreasedValue: properties.decreasedValue,
hint: properties.hint,
hintOverrides: properties.hintOverrides,
textDirection: _getTextDirection(context),
sortKey: properties.sortKey,
onTap: properties.onTap,
onLongPress: properties.onLongPress,
onScrollLeft: properties.onScrollLeft,
onScrollRight: properties.onScrollRight,
onScrollUp: properties.onScrollUp,
onScrollDown: properties.onScrollDown,
onIncrease: properties.onIncrease,
onDecrease: properties.onDecrease,
onCopy: properties.onCopy,
onDismiss: properties.onDismiss,
onCut: properties.onCut,
onPaste: properties.onPaste,
onMoveCursorForwardByCharacter: properties.onMoveCursorForwardByCharacter,
onMoveCursorBackwardByCharacter: properties.onMoveCursorBackwardByCharacter,
onMoveCursorForwardByWord: properties.onMoveCursorForwardByWord,
onMoveCursorBackwardByWord: properties.onMoveCursorBackwardByWord,
onSetSelection: properties.onSetSelection,
onDidGainAccessibilityFocus: properties.onDidGainAccessibilityFocus,
onDidLoseAccessibilityFocus: properties.onDidLoseAccessibilityFocus,
customSemanticsActions: properties.customSemanticsActions,
);
}
TextDirection _getTextDirection(BuildContext context) {
if (properties.textDirection != null)
return properties.textDirection;
final bool containsText = properties.label != null || properties.value != null || properties.hint != null;
if (!containsText)
return null;
return Directionality.of(context);
}
@override
void updateRenderObject(BuildContext context, RenderSemanticsAnnotations renderObject) {
renderObject
..container = container
..explicitChildNodes = explicitChildNodes
..excludeSemantics = excludeSemantics
..scopesRoute = properties.scopesRoute
..enabled = properties.enabled
..checked = properties.checked
..toggled = properties.toggled
..selected = properties.selected
..button = properties.button
..link = properties.link
..header = properties.header
..textField = properties.textField
..readOnly = properties.readOnly
..focusable = properties.focusable
..focused = properties.focused
..inMutuallyExclusiveGroup = properties.inMutuallyExclusiveGroup
..obscured = properties.obscured
..multiline = properties.multiline
..hidden = properties.hidden
..image = properties.image
..liveRegion = properties.liveRegion
..maxValueLength = properties.maxValueLength
..currentValueLength = properties.currentValueLength
..label = properties.label
..value = properties.value
..increasedValue = properties.increasedValue
..decreasedValue = properties.decreasedValue
..hint = properties.hint
..hintOverrides = properties.hintOverrides
..namesRoute = properties.namesRoute
..textDirection = _getTextDirection(context)
..sortKey = properties.sortKey
..onTap = properties.onTap
..onLongPress = properties.onLongPress
..onScrollLeft = properties.onScrollLeft
..onScrollRight = properties.onScrollRight
..onScrollUp = properties.onScrollUp
..onScrollDown = properties.onScrollDown
..onIncrease = properties.onIncrease
..onDismiss = properties.onDismiss
..onDecrease = properties.onDecrease
..onCopy = properties.onCopy
..onCut = properties.onCut
..onPaste = properties.onPaste
..onMoveCursorForwardByCharacter = properties.onMoveCursorForwardByCharacter
..onMoveCursorBackwardByCharacter = properties.onMoveCursorForwardByCharacter
..onMoveCursorForwardByWord = properties.onMoveCursorForwardByWord
..onMoveCursorBackwardByWord = properties.onMoveCursorBackwardByWord
..onSetSelection = properties.onSetSelection
..onDidGainAccessibilityFocus = properties.onDidGainAccessibilityFocus
..onDidLoseAccessibilityFocus = properties.onDidLoseAccessibilityFocus
..customSemanticsActions = properties.customSemanticsActions;
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<bool>('container', container));
properties.add(DiagnosticsProperty<SemanticsProperties>('properties', this.properties));
this.properties.debugFillProperties(properties);
}
}
class MergeSemantics extends SingleChildRenderObjectWidget {
/// Creates a widget that merges the semantics of its descendants.
const MergeSemantics({ Key key, Widget child }) : super(key: key, child: child);
@override
RenderMergeSemantics createRenderObject(BuildContext context) => RenderMergeSemantics();
}
class BlockSemantics extends SingleChildRenderObjectWidget {
const BlockSemantics({ Key key, this.blocking = true, Widget child }) : super(key: key, child: child);
/// Whether this widget is blocking semantics of all widget that were painted
/// before it in the same semantic container.
final bool blocking;
@override
RenderBlockSemantics createRenderObject(BuildContext context) => RenderBlockSemantics(blocking: blocking);
@override
void updateRenderObject(BuildContext context, RenderBlockSemantics renderObject) {
renderObject.blocking = blocking;
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<bool>('blocking', blocking));
}
}
class ExcludeSemantics extends SingleChildRenderObjectWidget {
/// Creates a widget that drops all the semantics of its descendants.
const ExcludeSemantics({
Key key,
this.excluding = true,
Widget child,
}) : assert(excluding != null),
super(key: key, child: child);
/// Whether this widget is excluded in the semantics tree.
final bool excluding;
@override
RenderExcludeSemantics createRenderObject(BuildContext context) => RenderExcludeSemantics(excluding: excluding);
@override
void updateRenderObject(BuildContext context, RenderExcludeSemantics renderObject) {
renderObject.excluding = excluding;
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<bool>('excluding', excluding));
}
}
class IndexedSemantics extends SingleChildRenderObjectWidget {
const IndexedSemantics({
Key key,
@required this.index,
Widget child,
}) : assert(index != null),
super(key: key, child: child);
/// The index used to annotate the first child semantics node.
final int index;
@override
RenderIndexedSemantics createRenderObject(BuildContext context) => RenderIndexedSemantics(index: index);
@override
void updateRenderObject(BuildContext context, RenderIndexedSemantics renderObject) {
renderObject.index = index;
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<int>('index', index));
}
}*/
public class KeyedSubtree : StatelessWidget {
public KeyedSubtree(
Key key,

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


_buildOwner = new BuildOwner();
buildOwner.onBuildScheduled = _handleBuildScheduled;
window.onLocaleChanged += handleLocaleChanged;
widgetInspectorService = new WidgetInspectorService(this);
widgetInspectorService = new WidgetInspectorService();
// window.onAccessibilityFeaturesChanged = handleAccessibilityFeaturesChanged;
// SystemChannels.navigation.setMethodCallHandler(_handleNavigationInvocation);

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


_openInputConnection();
}
else {
List<FocusScopeNode> ancestorScopes = FocusScope.ancestorsOf(context);
for (int i = ancestorScopes.Count - 1; i >= 1; i -= 1) {
ancestorScopes[i].setFirstFocus(ancestorScopes[i - 1]);
}
FocusScope.of(context).requestFocus(widget.focusNode);
widget.focusNode.requestFocus();
}
}

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


public static bool _focusDebug(string message, List<string> details = null) {
if (_kDebugFocus) {
//UnityEngine.Debug.Log();
UnityEngine.Debug.Log($"FOCUS: {message}");
if (details != null && details.Count() != 0) {
foreach (string detail in details) {

}
}
public class FocusNode : ChangeNotifier {
//DiagnosticableTreeMixin,
public class FocusNode : ChangeNotifier//DiagnosticableTreeMixin,
{
public FocusNode(
string debugLabel = "",
FocusOnKeyCallback onKey = null,

D.assert(canRequestFocus != null);
_skipTraversal = skipTraversal;
_canRequestFocus = canRequestFocus;
/*_onKey = onKey {
this.debugLabel = debugLabel; ///????
}*/
_onKey = onKey;
this.debugLabel = debugLabel;
}
public bool skipTraversal {

}
}
}
bool _skipTraversal;

get { return _context; }
}
BuildContext _context;
FocusOnKeyCallback onKey {

FocusOnKeyCallback _onKey;
public FocusManager _manager;

get { return _parent; }
}
public FocusNode _parent;

}
public readonly List<FocusNode> _children = new List<FocusNode>();
IEnumerable<FocusNode> traversalChildren {

}
List<FocusNode> nodes = new List<FocusNode>();
foreach (FocusNode node in children) {
if (!node.skipTraversal && node.canRequestFocus)
nodes.Add(node);
}
return nodes;
return children.Where(
(FocusNode node) => !node.skipTraversal && node.canRequestFocus
);
}
}

}
string _debugLabel;
IEnumerable<FocusNode> descendants {
get {
if (_descendants == null) {

IEnumerable<FocusNode> traversalDescendants {
get {
List<FocusNode> nodes = new List<FocusNode>();
foreach (FocusNode node in descendants) {
if (!node.skipTraversal && node.canRequestFocus) {
nodes.Add(node);
}
}
// descendants.where((FocusNode node) => !node.skipTraversal && node.canRequestFocus);
return nodes;
return descendants.Where((FocusNode node) => !node.skipTraversal && node.canRequestFocus);
}
}

get { return FocusManager.instance.highlightMode; }
}
FocusScopeNode nearestScope {
public FocusScopeNode nearestScope {
get { return enclosingScope; }
}

/*bool nextFocus() {
return FocusTraversalGroup.of(context).next(this);
}*
}
bool previousFocus() {

}
public FocusScopeNode nearestScope {
get { return enclosingScope; }
get { return this; }
}
public bool isFirstFocus {

}
public void autofocus(FocusNode node) {
D.assert(FocusManagerUtils._focusDebug("Node autofocusing: $node"));
D.assert(FocusManagerUtils._focusDebug($"Node autofocusing: {node}"));
if (focusedChild == null) {
if (node._parent == null) {
_reparent(node);

primaryFocus = scope.focusedChild;
}
if (primaryFocus == this) {
if (primaryFocus.canRequestFocus) {
_setAsFocusedChildForScope();
_markNextFocus(this);
}
if (primaryFocus.canRequestFocus) {
_setAsFocusedChildForScope();
_markNextFocus(this);
}
primaryFocus._doRequestFocus(findFirstFocus: findFirstFocus);
primaryFocus._doRequestFocus(findFirstFocus: findFirstFocus);
}
}

}
}
/*
public class FocusNode : ChangeNotifier {
internal FocusScopeNode _parent;
internal FocusManager _manager;
internal bool _hasKeyboardToken = false;
public bool hasFocus {
get {
FocusNode node = null;
if (_manager != null) {
node = _manager._currentFocus;
}
return node == this;
}
}
public bool consumeKeyboardToken() {
if (!_hasKeyboardToken) {
return false;
}
_hasKeyboardToken = false;
return true;
}
public void unfocus() {
if (_parent != null) {
_parent._resignFocus(this);
}
D.assert(_parent == null);
D.assert(_manager == null);
}
public override void dispose() {
if (_manager != null) {
_manager._willDisposeFocusNode(this);
}
if (_parent != null) {
_parent._resignFocus(this);
}
D.assert(_parent == null);
D.assert(_manager == null);
base.dispose();
}
internal void _notify() {
notifyListeners();
}
public override string ToString() {
return $"{foundation_.describeIdentity(this)} hasFocus: {hasFocus}";
}
}
public class FocusScopeNode : DiagnosticableTree {
internal FocusManager _manager;
internal FocusScopeNode _parent;
internal FocusScopeNode _nextSibling;
internal FocusScopeNode _previousSibling;
internal FocusScopeNode _firstChild;
internal FocusScopeNode _lastChild;
internal FocusNode _focus;
internal List<FocusScopeNode> _focusPath;
public bool isFirstFocus {
get { return _parent == null || _parent._firstChild == this; }
}
internal List<FocusScopeNode> _getFocusPath() {
List<FocusScopeNode> nodes = new List<FocusScopeNode> {this};
FocusScopeNode node = _parent;
while (node != null && node != _manager?.rootScope) {
nodes.Add(node);
node = node._parent;
}
return nodes;
}
internal void _prepend(FocusScopeNode child) {
D.assert(child != this);
D.assert(child != _firstChild);
D.assert(child != _lastChild);
D.assert(child._parent == null);
D.assert(child._manager == null);
D.assert(child._nextSibling == null);
D.assert(child._previousSibling == null);
D.assert(() => {
var node = this;
while (node._parent != null) {
node = node._parent;
}
D.assert(node != child);
return true;
});
child._parent = this;
child._nextSibling = _firstChild;
if (_firstChild != null) {
_firstChild._previousSibling = child;
}
_firstChild = child;
_lastChild = _lastChild ?? child;
child._updateManager(_manager);
}
void _updateManager(FocusManager manager) {
Action<FocusScopeNode> update = null;
update = (child) => {
if (child._manager == manager) {
return;
}
child._manager = manager;
// We don"t proactively null out the manager for FocusNodes because the
// manager holds the currently active focus node until the end of the
// microtask, even if that node is detached from the focus tree.
if (manager != null && child._focus != null) {
child._focus._manager = manager;
}
child._visitChildren(update);
};
update(this);
}
void _visitChildren(Action<FocusScopeNode> vistor) {
FocusScopeNode child = _firstChild;
while (child != null) {
vistor.Invoke(child);
child = child._nextSibling;
}
}
bool _debugUltimatePreviousSiblingOf(FocusScopeNode child, FocusScopeNode equals) {
while (child._previousSibling != null) {
D.assert(child._previousSibling != child);
child = child._previousSibling;
}
return child == equals;
}
bool _debugUltimateNextSiblingOf(FocusScopeNode child, FocusScopeNode equals) {
while (child._nextSibling != null) {
D.assert(child._nextSibling != child);
child = child._nextSibling;
}
return child == equals;
}
internal void _remove(FocusScopeNode child) {
D.assert(child._parent == this);
D.assert(child._manager == _manager);
D.assert(_debugUltimatePreviousSiblingOf(child, equals: _firstChild));
D.assert(_debugUltimateNextSiblingOf(child, equals: _lastChild));
if (child._previousSibling == null) {
D.assert(_firstChild == child);
_firstChild = child._nextSibling;
}
else {
child._previousSibling._nextSibling = child._nextSibling;
}
if (child._nextSibling == null) {
D.assert(_lastChild == child);
_lastChild = child._previousSibling;
}
else {
child._nextSibling._previousSibling = child._previousSibling;
}
child._previousSibling = null;
child._nextSibling = null;
child._parent = null;
child._updateManager(null);
}
internal void _didChangeFocusChain() {
if (isFirstFocus && _manager != null) {
_manager._markNeedsUpdate();
}
}
// 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 &&
_focusPath.SequenceEqual(focusPath)))) {
return;
}
if (_focus != null) {
_focus.unfocus();
}
node._hasKeyboardToken = true;
_setFocus(node);
}
public void autofocus(FocusNode node) {
D.assert(node != null);
if (_focus == null) {
node._hasKeyboardToken = true;
_setFocus(node);
}
}
public void reparentIfNeeded(FocusNode node) {
D.assert(node != null);
if (node._parent == null || node._parent == this) {
return;
}
node.unfocus();
D.assert(node._parent == null);
if (_focus == null) {
_setFocus(node);
}
}
internal void _setFocus(FocusNode node) {
D.assert(node != null);
D.assert(node._parent == null);
D.assert(_focus == null);
_focus = node;
_focus._parent = this;
_focus._manager = _manager;
_focus._hasKeyboardToken = true;
_didChangeFocusChain();
_focusPath = _getFocusPath();
}
internal void _resignFocus(FocusNode node) {
D.assert(node != null);
if (_focus != node) {
return;
}
_focus._parent = null;
_focus._manager = null;
_focus = null;
_didChangeFocusChain();
}
public void setFirstFocus(FocusScopeNode child) {
D.assert(child != null);
D.assert(child._parent == null || child._parent == this);
if (_firstChild == child) {
return;
}
child.detach();
_prepend(child);
D.assert(child._parent == this);
_didChangeFocusChain();
}
public void reparentScopeIfNeeded(FocusScopeNode child) {
D.assert(child != null);
if (child._parent == null || child._parent == this) {
return;
}
if (child.isFirstFocus) {
setFirstFocus(child);
}
else {
child.detach();
}
}
public void detach() {
_didChangeFocusChain();
if (_parent != null) {
_parent._remove(this);
}
D.assert(_parent == null);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
if (_focus != null) {
properties.add(new DiagnosticsProperty<FocusNode>("focus", _focus));
}
}
public override List<DiagnosticsNode> debugDescribeChildren() {
var children = new List<DiagnosticsNode>();
if (_firstChild != null) {
FocusScopeNode child = _firstChild;
int count = 1;
while (true) {
children.Add(child.toDiagnosticsNode(name: $"child {count}"));
if (child == _lastChild) {
break;
}
child = child._nextSibling;
count += 1;
}
}
return children;
}
}
public class FocusManager {
public FocusManager() {
rootScope._manager = this;
D.assert(rootScope._firstChild == null);
D.assert(rootScope._lastChild == null);
}
public readonly FocusScopeNode rootScope = new FocusScopeNode();
internal readonly FocusScopeNode _noneScope = new FocusScopeNode();
public FocusNode currentFocus {
get { return _currentFocus; }
}
internal FocusNode _currentFocus;
internal void _willDisposeFocusNode(FocusNode node) {
D.assert(node != null);
if (_currentFocus == node) {
_currentFocus = null;
}
}
bool _haveScheduledUpdate = false;
internal void _markNeedsUpdate() {
if (_haveScheduledUpdate) {
return;
}
_haveScheduledUpdate = true;
async_.scheduleMicrotask(() => {
_update();
return null;
});
}
internal FocusNode _findNextFocus() {
FocusScopeNode scope = rootScope;
while (scope._firstChild != null) {
scope = scope._firstChild;
}
return scope._focus;
}
internal void _update() {
_haveScheduledUpdate = false;
var nextFocus = _findNextFocus();
if (_currentFocus == nextFocus) {
return;
}
var previousFocus = _currentFocus;
_currentFocus = nextFocus;
if (previousFocus != null) {
previousFocus._notify();
}
if (_currentFocus != null) {
_currentFocus._notify();
}
}
internal List<FocusScopeNode> _getCurrentFocusPath() {
return _currentFocus?._parent?._getFocusPath();
}
public void focusNone(bool focus) {
if (focus) {
if (_noneScope._parent != null && _noneScope.isFirstFocus) {
return;
}
rootScope.setFirstFocus(_noneScope);
}
else {
if (_noneScope._parent == null) {
return;
}
_noneScope.detach();
}
}
public override string ToString() {
var status = _haveScheduledUpdate ? " UPDATE SCHEDULED" : "";
var indent = " ";
return string.Format("{1}{2}\n{0}currentFocus: {3}\n{4}", indent, foundation_.describeIdentity(this),
status, _currentFocus,
rootScope.toStringDeep(prefixLineOne: indent, prefixOtherLines: indent));
}
}*/

144
com.unity.uiwidgets/Runtime/widgets/focus_scope.cs


}
}
public class FocusScope : StatefulWidget {
public FocusScope(FocusScopeNode node, Widget child, Key key = null, bool autofocus = false) : base(key) {
this.node = node;
this.child = child;
this.autofocus = autofocus;
public class FocusScope : Focus {
public FocusScope(
Key key = null,
FocusScopeNode node = null,
Widget child = null,
bool autofocus = false,
ValueChanged<bool> onFocusChange = null,
bool? canRequestFocus = null,
bool? skipTraversal = null,
FocusOnKeyCallback onKey = null,
string debugLabel = null
) : base(
key: key,
child: child,
focusNode: node,
autofocus: autofocus,
onFocusChange: onFocusChange,
canRequestFocus: canRequestFocus,
skipTraversal: skipTraversal,
onKey: onKey,
debugLabel: debugLabel) {
D.assert(child != null);
D.assert(autofocus != null);
public readonly FocusScopeNode node;
public readonly bool autofocus;
public readonly Widget child;
var scope = (_FocusScopeMarker) context.inheritFromWidgetOfExactType(typeof(_FocusScopeMarker));
if (scope != null && scope.node != null) {
return scope.node;
}
return context.owner.focusManager.rootScope;
}
public static List<FocusScopeNode> ancestorsOf(BuildContext context) {
D.assert(context != null);
List<FocusScopeNode> ancestors = new List<FocusScopeNode> { };
while (true) {
context = context.ancestorInheritedElementForWidgetOfExactType(typeof(_FocusScopeMarker));
if (context == null) {
return ancestors;
}
_FocusScopeMarker scope = (_FocusScopeMarker) context.widget;
ancestors.Add(scope.node);
context.visitAncestorElements((Element parent) => {
context = parent;
return false;
});
}
_FocusMarker marker = context.dependOnInheritedWidgetOfExactType<_FocusMarker>();
return marker?.notifier?.nearestScope ?? context.owner.focusManager.rootScope;
class _FocusScopeState : _FocusState {
public FocusScopeNode _createNode() {
return new FocusScopeNode(
debugLabel: widget.debugLabel,
canRequestFocus: widget.canRequestFocus ?? true,
skipTraversal: widget.skipTraversal ?? false
);
}
public override Widget build(BuildContext context) {
_focusAttachment.reparent();
return new _FocusMarker(
node: focusNode,
child: widget.child);
}
}
class _FocusMarker : InheritedNotifier<FocusNode> {
public _FocusMarker(
Key key = null,
FocusNode node = null,
Widget child = null
) : base(key: key, notifier: node, child: child) {
D.assert(node != null);
D.assert(child != null);
}
}
public class Focus : StatefulWidget {
public Focus(

}
return node;
}
//public static bool isAt(BuildContext context) => Focus.of(context, nullOk: true)?.hasFocus ?? false;
public static bool isAt(BuildContext context) => Focus.of(context, nullOk: true)?.hasFocus ?? false;
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new StringProperty("debugLabel", debugLabel, defaultValue: null));

public class _FocusState : State<Focus> {
FocusNode _internalNode;
public FocusNode focusNode {
get {
return widget.focusNode ?? _internalNode;

base.didUpdateWidget(oldWidget);
D.assert(()=> {
if (((Focus)oldWidget).debugLabel != widget.debugLabel && _internalNode != null) {
_internalNode.debugLabel = widget.debugLabel;
}
return true;
_internalNode.debugLabel = widget.debugLabel;
}
return true;
});
if (((Focus)oldWidget).focusNode == widget.focusNode) {

}
}
/*class _FocusScopeState : State<FocusScope> {
bool _didAutofocus = false;
public override void didChangeDependencies() {
base.didChangeDependencies();
if (!_didAutofocus && widget.autofocus) {
FocusScope.of(context).setFirstFocus(widget.node);
_didAutofocus = true;
}
}
public override void dispose() {
widget.node.detach();
base.dispose();
}
public override Widget build(BuildContext context) {
FocusScope.of(context).reparentScopeIfNeeded(widget.node);
return new _FocusScopeMarker(node: widget.node, child: widget.child);
}
}*/
class _FocusScopeState : _FocusState {
public FocusScopeNode _createNode() {
return new FocusScopeNode(
debugLabel: widget.debugLabel,
canRequestFocus: widget.canRequestFocus ?? true,
skipTraversal: widget.skipTraversal ?? false
);
}
public override Widget build(BuildContext context) {
_focusAttachment.reparent();
return new _FocusMarker(
node: focusNode,
child: widget.child);
}
}
class _FocusMarker : InheritedNotifier<FocusNode> {
public _FocusMarker(
Key key = null,
FocusNode node = null,
Widget child = null
) : base(key: key, notifier: node, child: child) {
D.assert(node != null);
D.assert(child != null);
}
}
}

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


public ImplicitlyAnimatedWidget(
Key key = null,
Curve curve = null,
TimeSpan? duration = null
TimeSpan? duration = null,
VoidCallback onEnd = null
this.onEnd = onEnd;
public readonly VoidCallback onEnd;
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);

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


public abstract override RenderObject createRenderObject(BuildContext context);
}
public class SliverIgnorePointer : SingleChildRenderObjectWidget {
public SliverIgnorePointer(
Key key = null,
bool ignoring = true,
bool? ignoringSemantics = null,
Widget sliver = null
) : base(key: key, child: sliver) {
D.assert(ignoring != null);
this.ignoring = ignoring;
this.ignoringSemantics = ignoringSemantics;
}
public readonly bool ignoring;
public readonly bool? ignoringSemantics;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverIgnorePointer(
ignoring: ignoring,
ignoringSemantics: ignoringSemantics
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverIgnorePointer) renderObject;
((RenderSliverIgnorePointer)renderObject).ignoring = ignoring;
((RenderSliverIgnorePointer)renderObject).ignoringSemantics = ignoringSemantics;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("ignoring", ignoring));
properties.add(new DiagnosticsProperty<bool>("ignoringSemantics", (bool)ignoringSemantics, defaultValue: null));
}
}
public class SliverOffstage : SingleChildRenderObjectWidget {
public SliverOffstage(
Key key = null,
bool offstage = true,
Widget sliver = null) : base(key: key, child: sliver) {
D.assert(offstage != null);
this.offstage = offstage;
}
public readonly bool offstage;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverOffstage(offstage: offstage);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverOffstage) renderObject;
((RenderSliverOffstage)renderObject).offstage = offstage;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("offstage", offstage));
}
public override Element createElement() {
return new _SliverOffstageElement(this);
}
}
public abstract class SliverMultiBoxAdaptorWidget : SliverWithKeepAliveWidget {
protected SliverMultiBoxAdaptorWidget(

public override RenderObject createRenderObject(BuildContext context) {
SliverMultiBoxAdaptorElement element = (SliverMultiBoxAdaptorElement) context;
return new RenderSliverList(childManager: element);
}
}
public class SliverOpacity : SingleChildRenderObjectWidget {
public SliverOpacity(
Key key = null,
float opacity = 0f,
bool alwaysIncludeSemantics = false,
Widget sliver = null) : base(key: key, child: sliver) {
D.assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
D.assert(alwaysIncludeSemantics != null);
this.opacity = opacity;
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
}
public readonly float opacity;
public readonly bool alwaysIncludeSemantics;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverOpacity(
opacity: opacity,
alwaysIncludeSemantics: alwaysIncludeSemantics
);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderSliverOpacity) renderObject;
((RenderSliverOpacity) renderObject).opacity = opacity;
((RenderSliverOpacity) renderObject).alwaysIncludeSemantics = alwaysIncludeSemantics;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<float>("opacity", opacity));
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
}
}
public class _SliverOffstageElement : SingleChildRenderObjectElement {
public _SliverOffstageElement(SliverOffstage widget) : base(widget) {
}
public SliverOffstage widget {
get { return base.widget as SliverOffstage; }
}
public override void debugVisitOnstageChildren(ElementVisitor visitor) {
if (!widget.offstage)
base.debugVisitOnstageChildren(visitor);
}
}

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


public abstract class TextSelectionControls {
public abstract Widget buildHandle(BuildContext context, TextSelectionHandleType type, float textLineHeight);
public abstract Widget buildToolbar(BuildContext context, Rect globalEditableRegion, Offset position,
TextSelectionDelegate selectionDelegate);
public abstract Offset getHandleAnchor(TextSelectionHandleType type, float textLineHeight);
public abstract Widget buildToolbar(
BuildContext context,
Rect globalEditableRegion,
float textLineHeight,
Offset position,
List<TextSelectionPoint> endpoints,
TextSelectionDelegate selectionDelegate
);
public abstract Size getHandleSize(float textLineHeight);
public virtual bool canCut(TextSelectionDelegate selectionDelegate) {
return !selectionDelegate.textEditingValue.selection.isCollapsed;
public virtual bool canCut(TextSelectionDelegate _delegate) {
return _delegate.cutEnabled && !_delegate.textEditingValue.selection.isCollapsed;
public virtual bool canCopy(TextSelectionDelegate selectionDelegate) {
return !selectionDelegate.textEditingValue.selection.isCollapsed;
bool canCopy(TextSelectionDelegate _delegate) {
return _delegate.copyEnabled && !_delegate.textEditingValue.selection.isCollapsed;
public virtual bool canPaste(TextSelectionDelegate selectionDelegate) {
// TODO in flutter: return false when clipboard is empty
return true;
bool canPaste(TextSelectionDelegate _delegate) {
// TODO(goderbauer): return false when clipboard is empty, https://github.com/flutter/flutter/issues/11254
return _delegate.pasteEnabled;
public virtual bool canSelectAll(TextSelectionDelegate selectionDelegate) {
return selectionDelegate.textEditingValue.text.isNotEmpty() &&
selectionDelegate.textEditingValue.selection.isCollapsed;
bool canSelectAll(TextSelectionDelegate _delegate) {
return _delegate.selectAllEnabled
&& _delegate.textEditingValue.text.isNotEmpty()
&& _delegate.textEditingValue.selection.isCollapsed;
public void handleCut(TextSelectionDelegate selectionDelegate) {
TextEditingValue value = selectionDelegate.textEditingValue;

}
public class TextSelectionOverlay {
public TextSelectionOverlay(TextEditingValue value = null,
BuildContext context = null, Widget debugRequiredFor = null,
public TextSelectionOverlay(
TextEditingValue value = null,
BuildContext context = null,
Widget debugRequiredFor = null,
LayerLink layerLink = null,
RenderEditable renderObject = null,
TextSelectionControls selectionControls = null,

43
com.unity.uiwidgets/Runtime/widgets/ticker_provider.cs


using Unity.UIWidgets.scheduler2;
namespace Unity.UIWidgets.widgets {
public class TickerMode : InheritedWidget {
public class TickerMode : StatelessWidget {
: base(key, child) {
: base(key:key) {
D.assert(enabled != null);
this.child = child;
public readonly Widget child;
var widget = (TickerMode) context.inheritFromWidgetOfExactType(typeof(TickerMode));
return widget != null ? widget.enabled : true;
_EffectiveTickerMode widget = context.dependOnInheritedWidgetOfExactType<_EffectiveTickerMode>();
return widget?.enabled ?? true;
public override bool updateShouldNotify(InheritedWidget oldWidget) {
return enabled != ((TickerMode) oldWidget).enabled;
public override Widget build(BuildContext context) {
return new _EffectiveTickerMode(
enabled: enabled && TickerMode.of(context),
child: child
);
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FlagProperty("requested mode", value: enabled, ifTrue: "enabled", ifFalse: "disabled", showName: true));
}
}
public class _EffectiveTickerMode : InheritedWidget {
public _EffectiveTickerMode(
bool enabled,
Key key = null,
Widget child = null) :
base(key: key, child: child) {
D.assert(enabled != null);
this.enabled = enabled;
public readonly bool enabled;
properties.add(new FlagProperty("mode", value: enabled, ifTrue: "enabled", ifFalse: "disabled",
showName: true));
properties.add(new FlagProperty("effective mode", value: enabled, ifTrue: "enabled", ifFalse: "disabled", showName: true));
}
public override bool updateShouldNotify(InheritedWidget oldWidget) {
oldWidget = (_EffectiveTickerMode) oldWidget;
return enabled != ((_EffectiveTickerMode) oldWidget).enabled;
public abstract class SingleTickerProviderStateMixin<T> : State<T>, TickerProvider where T : StatefulWidget {
Ticker _ticker;

109
com.unity.uiwidgets/Runtime/widgets/transitions.cs


namespace Unity.UIWidgets.widgets {
public abstract class AnimatedWidget : StatefulWidget {
public readonly Listenable listenable;
protected AnimatedWidget(Key key = null, Listenable listenable = null) : base(key) {
protected AnimatedWidget(
Key key = null,
Listenable listenable = null
) : base(key) {
D.assert(listenable != null);
this.listenable = listenable;
}

}
public class SlideTransition : AnimatedWidget {
public SlideTransition(Key key = null,
public SlideTransition(
Key key = null,
Widget child = null) : base(key: key, listenable: position) {
Widget child = null
) : base(key: key, listenable: position) {
D.assert(position != null);
this.transformHitTests = transformHitTests;
this.textDirection = textDirection;

protected internal override Widget build(BuildContext context) {
float scaleValue = scale.value;
Matrix4 transform = Matrix4.diagonal3Values(scaleValue, scaleValue, 1);
Matrix4 transform = Matrix4.identity();
transform.scale(scaleValue, scaleValue, 1.0f);
return new Transform(
transform: transform,
alignment: alignment,

Key key = null,
Animation<float> turns = null,
Alignment alignment = null,
Widget child = null) : base(key: key, listenable: turns) {
Widget child = null) :
base(key: key, listenable: turns) {
D.assert(turns != null);
this.alignment = alignment ?? Alignment.center;
this.child = child;

Axis axis = Axis.vertical,
Animation<float> sizeFactor = null,
float axisAlignment = 0.0f,
Widget child = null) : base(key: key, listenable: sizeFactor) {
Widget child = null)
: base(key: key, listenable: sizeFactor) {
D.assert(sizeFactor != null);
this.axis = axis;
this.axisAlignment = axisAlignment;

}
public class FadeTransition : SingleChildRenderObjectWidget {
public FadeTransition(Key key = null, Animation<float> opacity = null,
Widget child = null) : base(key: key, child: child) {
public FadeTransition(
Key key = null,
Animation<float> opacity = null,
bool alwaysIncludeSemantics = false,
Widget child = null
) : base(key: key, child: child) {
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
public readonly bool alwaysIncludeSemantics;
//alwaysIncludeSemantics: alwaysIncludeSemantics
//((RenderAnimatedOpacity) renderObject).alwaysIncludeSemantics = alwaysIncludeSemantics;
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
/*public class SliverFadeTransition : SingleChildRenderObjectWidget {
public SliverFadeTransition(
Animation<float> opacity ,
Key key = null,
bool alwaysIncludeSemantics = false,
Widget sliver = null
) : base(key: key, child: sliver) {
D.assert(opacity != null);
}
public readonly Animation<float> opacity;
public readonly bool alwaysIncludeSemantics;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverAnimatedOpacity(
opacity: opacity,
alwaysIncludeSemantics: alwaysIncludeSemantics
);
}
public override void updateRenderObject(BuildContext context, RenderSliverAnimatedOpacity renderObject) {
renderObject = (RenderSliverAnimatedOpacity) renderObject;
((RenderSliverAnimatedOpacity) renderObject).opacity = opacity;
((RenderSliverAnimatedOpacity) renderObject).alwaysIncludeSemantics = alwaysIncludeSemantics;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<Animation<float>>("opacity", opacity));
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
}
}*/
public RelativeRectTween(RelativeRect begin = null, RelativeRect end = null) : base(begin: begin, end: end) {
public RelativeRectTween(
RelativeRect begin = null,
RelativeRect end = null) : base(begin: begin, end: end) {
}
public override RelativeRect lerp(float t) {

public class PositionedTransition : AnimatedWidget {
public PositionedTransition(
Animation<RelativeRect> rect ,
Animation<RelativeRect> rect = null,
D.assert(child != null);
this.child = child;
}

protected internal override Widget build(BuildContext context) {
return Positioned.fromRelativeRect(
rect: rect.value,

public class RelativePositionedTransition : AnimatedWidget {
public RelativePositionedTransition(
Key key = null,
Animation<Rect> rect = null,
Size size = null,
Widget child = null
Animation<Rect> rect,
Size size,
Widget child ,
Key key = null
) : base(key: key, listenable: rect) {
D.assert(rect != null);
D.assert(size != null);

public class DecoratedBoxTransition : AnimatedWidget {
public DecoratedBoxTransition(
Key key = null,
Animation<Decoration> decoration = null,
DecorationPosition position = DecorationPosition.background,
Widget child = null
Animation<Decoration> decoration ,
Widget child ,
Key key = null,
DecorationPosition position = DecorationPosition.background
) : base(key: key, listenable: decoration) {
D.assert(decoration != null);
D.assert(child != null);

public class AlignTransition : AnimatedWidget {
public AlignTransition(
Animation<Alignment> alignment,
Widget child,
Animation<Alignment> alignment = null,
Widget child = null,
float? widthFactor = null,
float? heightFactor = null
) : base(key: key, listenable: alignment) {

public class DefaultTextStyleTransition : AnimatedWidget {
public DefaultTextStyleTransition(
Animation<TextStyle> style,
Widget child,
Animation<TextStyle> style = null,
Widget child = null,
TextAlign? textAlign = null,
bool softWrap = true,
TextOverflow overflow = TextOverflow.clip,

public class AnimatedBuilder : AnimatedWidget {
public readonly TransitionBuilder builder;
public AnimatedBuilder(Key key = null, Listenable animation = null, TransitionBuilder builder = null,
Widget child = null) :
base(key, animation) {
public AnimatedBuilder(
Listenable animation,
TransitionBuilder builder,
Key key = null,
Widget child = null) : base(key, animation) {
D.assert(builder != null);
D.assert(animation != null);
this.builder = builder;

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


public class ValueListenableBuilder<T> : StatefulWidget {
public ValueListenableBuilder(
ValueListenable<T> valueListenable,
ValueWidgetBuilder<T> builder,
ValueListenable<T> valueListenable ,
ValueWidgetBuilder<T> builder ,
Key key = null,
) {
) : base(key: key) {
D.assert(valueListenable != null);
D.assert(builder != null);
this.valueListenable = valueListenable;

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


ViewportOffset offset = null,
Key center = null,
float? cacheExtent = null,
CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel,
D.assert(center == null || children.Count(child => child.key == center) == 1);
D.assert(slivers != null);
D.assert(center == null || slivers.Where((Widget child) => child.key == center).Count() == 1);
D.assert(cacheExtentStyle != null);
D.assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null);
this.axisDirection = axisDirection;
this.crossAxisDirection = crossAxisDirection;
this.anchor = anchor;

this.cacheExtentStyle = cacheExtentStyle;
}
public readonly AxisDirection axisDirection;

public readonly Key center;
public readonly float? cacheExtent;
public readonly CacheExtentStyle cacheExtentStyle;
public static AxisDirection getDefaultCrossAxisDirection(BuildContext context, AxisDirection axisDirection) {
switch (axisDirection) {

public override RenderObject createRenderObject(BuildContext context) {
return new RenderViewport(
axisDirection: axisDirection,
crossAxisDirection: crossAxisDirection ??
getDefaultCrossAxisDirection(context, axisDirection),
crossAxisDirection: crossAxisDirection ?? getDefaultCrossAxisDirection(context, axisDirection),
cacheExtent: cacheExtent ?? RenderViewportUtils.defaultCacheExtent
);
cacheExtent: cacheExtent ?? RenderViewportUtils.defaultCacheExtent,
cacheExtentStyle: cacheExtentStyle);
renderObject.crossAxisDirection = crossAxisDirection ??
getDefaultCrossAxisDirection(context, axisDirection);
renderObject.crossAxisDirection = crossAxisDirection ?? getDefaultCrossAxisDirection(context, axisDirection);
renderObject.cacheExtentStyle = cacheExtentStyle;
}
public override Element createElement() {

else if (children.isNotEmpty() && children.First().key != null) {
properties.add(new DiagnosticsProperty<Key>("center", children.First().key, tooltip: "implicit"));
}
properties.add(new DiagnosticsProperty<float>("cacheExtent", (float)cacheExtent));
properties.add(new DiagnosticsProperty<CacheExtentStyle>("cacheExtentStyle", cacheExtentStyle));
}
}

ViewportOffset offset = null,
List<Widget> slivers = null
) : base(key: key, children: slivers) {
slivers = slivers ?? new List<Widget>();
this.axisDirection = axisDirection;
this.crossAxisDirection = crossAxisDirection;
this.offset = offset;

111
com.unity.uiwidgets/Runtime/widgets/visibility.cs


bool maintainState = false,
bool maintainAnimation = false,
bool maintainSize = false,
bool maintainSemantics = false,
D.assert(replacement != null);
D.assert(visible != null);
D.assert(maintainState != null);
D.assert(maintainAnimation != null);
D.assert(maintainSize != null);
D.assert(
maintainSize == true || maintainSemantics == false,
()=>"Cannot maintain semantics if size is not maintained."
);
D.assert(maintainSize == true || maintainInteractivity == false,
() => "Cannot maintain interactivity if size is not maintained.");
this.replacement = replacement ?? SizedBox.shrink();

this.maintainAnimation = maintainAnimation;
this.maintainSize = maintainSize;
this.maintainSemantics = maintainSemantics;
this.maintainInteractivity = maintainInteractivity;
}

public readonly bool maintainSize;
public readonly bool maintainSemantics;
public readonly bool maintainInteractivity;
public override Widget build(BuildContext context) {

result = new IgnorePointer(
child: child,
ignoring: !visible
//todo : ignoringSemantics: !visible && !maintainSemantics,
//alwaysIncludeSemantics: maintainSemantics,
D.assert(!maintainSemantics);
if (maintainState) {
Widget result = child;
if (!maintainAnimation) {

offstage: !visible
);
}
D.assert(!maintainAnimation);
D.assert(!maintainState);
return visible ? child : replacement;

properties.add(new FlagProperty("maintainAnimation", value: maintainAnimation,
ifFalse: "maintainAnimation"));
properties.add(new FlagProperty("maintainSize", value: maintainSize, ifFalse: "maintainSize"));
properties.add(new FlagProperty("maintainSemantics", value: maintainSemantics, ifFalse: "maintainSemantics"));
public class SliverVisibility : StatelessWidget {
public SliverVisibility(
Widget sliver,
Widget replacementSliver ,
Key key = null,
bool visible = true,
bool maintainState = false,
bool maintainAnimation = false,
bool maintainSize = false,
bool maintainSemantics = false,
bool maintainInteractivity = false) : base (key: key) {
replacementSliver = replacementSliver ?? new SliverToBoxAdapter();
D.assert(sliver != null);
D.assert(replacementSliver != null);
D.assert(visible != null);
D.assert(maintainState != null);
D.assert(maintainAnimation != null);
D.assert(maintainSize != null);
D.assert(maintainSemantics != null);
D.assert(maintainInteractivity != null);
D.assert(
maintainState == true || maintainAnimation == false,
()=>"Cannot maintain animations if the state is not also maintained."
);
D.assert(
maintainAnimation == true || maintainSize == false,
()=> "Cannot maintain size if animations are not maintained."
);
D.assert(
maintainSize == true || maintainSemantics == false,
()=> "Cannot maintain semantics if size is not maintained."
);
D.assert(
maintainSize == true || maintainInteractivity == false,
()=> "Cannot maintain interactivity if size is not maintained."
);
}
public readonly Widget sliver;
public readonly Widget replacementSliver;
public readonly bool visible;
public readonly bool maintainState;
public readonly bool maintainAnimation;
public readonly bool maintainSize;
public readonly bool maintainSemantics;
public readonly bool maintainInteractivity;
public override Widget build(BuildContext context) {
if (maintainSize) {
Widget result = sliver;
if (!maintainInteractivity) {
result = new SliverIgnorePointer(
sliver: sliver,
ignoring: !visible,
ignoringSemantics: !visible && !maintainSemantics
);
}
return new SliverOpacity(
opacity: visible ? 1.0f : 0.0f,
alwaysIncludeSemantics: maintainSemantics,
sliver: result
);
}
D.assert(!maintainInteractivity);
D.assert(!maintainSemantics);
D.assert(!maintainSize);
if (maintainState) {
Widget result = sliver;
if (!maintainAnimation)
result = new TickerMode(child: sliver, enabled: visible);
return new SliverOffstage(
sliver: result,
offstage: !visible
);
}
D.assert(!maintainAnimation);
D.assert(!maintainState);
return visible ? sliver : replacementSliver;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add( new FlagProperty("visible", value: visible, ifFalse: "hidden", ifTrue: "visible"));
properties.add( new FlagProperty("maintainState", value: maintainState, ifFalse: "maintainState"));
properties.add( new FlagProperty("maintainAnimation", value: maintainAnimation, ifFalse: "maintainAnimation"));
properties.add( new FlagProperty("maintainSize", value: maintainSize, ifFalse: "maintainSize"));
properties.add( new FlagProperty("maintainSemantics", value: maintainSemantics, ifFalse: "maintainSemantics"));
properties.add( new FlagProperty("maintainInteractivity", value: maintainInteractivity, ifFalse: "maintainInteractivity"));
}
}
}

934
com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs
文件差异内容过多而无法显示
查看文件

62
com.unity.uiwidgets/Runtime/widgets/widget_span.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;

namespace Unity.UIWidgets.widgets {
class WidgetSpan : PlaceholderSpan {
class WidgetSpan : PlaceholderSpan,IEquatable<WidgetSpan> {
Widget child,
TextBaseline baseline,
TextStyle style,
Widget child ,
TextBaseline? baseline = null,
TextStyle style = null,
PlaceholderAlignment alignment = PlaceholderAlignment.bottom
) : base(
alignment: alignment,

public override RenderComparison compareTo(InlineSpan other) {
if (this == other)
return RenderComparison.identical;
if (style.GetType() == GetType())
return RenderComparison.layout;
if (child.Equals(typedOther.child) || alignment != typedOther.alignment) {
if (!child.Equals(typedOther.child) || alignment != typedOther.alignment) {
return RenderComparison.layout;
}

}
public override int GetHashCode() {
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (child.GetHashCode());
hashCode = (hashCode * 397) ^ (alignment.GetHashCode());
hashCode = (hashCode * 397) ^ (baseline.GetHashCode());
return hashCode;
unchecked
{
return (base.GetHashCode() * 397) ^ (child != null ? child.GetHashCode() : 0);
}
return true;
}
public bool Equals(WidgetSpan other)
{
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return base.Equals(other) && Equals(child, other.child);
}
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((WidgetSpan) obj);
}
public static bool operator ==(WidgetSpan left, WidgetSpan right) {
return Equals(left, right);
}
public static bool operator !=(WidgetSpan left, WidgetSpan right) {
return !Equals(left, right);
}
public override bool debugAssertIsValid() {
return true;
}
}

37
com.unity.uiwidgets/Runtime/foundation/diagnosticable.mixin.gen.cs


namespace Unity.UIWidgets.foundation {
public class DiagnosticableMixinChangeNotifier : ChangeNotifier, IDiagnosticable {
protected DiagnosticableMixinChangeNotifier() {
}
public virtual string toStringShort() {
return foundation_.describeIdentity(this);
}
public override string ToString() {
return toString();
}
public virtual string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug) {
string fullString = null;
D.assert(() => {
fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine)
.toString(minLevel: minLevel);
return true;
});
return fullString ?? toStringShort();
}
public virtual DiagnosticsNode toDiagnosticsNode(
string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse) {
return new DiagnosticableNode<DiagnosticableMixinChangeNotifier>(
name: name, value: this, style: style
);
}
public virtual void debugFillProperties(DiagnosticPropertiesBuilder properties) {
}
}
}

40
com.unity.uiwidgets/Runtime/foundation/diagnosticable.mixin.njk


namespace Unity.UIWidgets.foundation {
{% macro DiagnosticableMixin(with) %}
{% set className = 'DiagnosticableMixin' + with %}
public class {{className}} : {{with}}, IDiagnosticable {
protected {{className}}() {
}
public virtual string toStringShort() {
return foundation_.describeIdentity(this);
}
public override string ToString() {
return toString();
}
public virtual string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug) {
string fullString = null;
D.assert(() => {
fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine)
.toString(minLevel: minLevel);
return true;
});
return fullString ?? toStringShort();
}
public virtual DiagnosticsNode toDiagnosticsNode(
string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse) {
return new DiagnosticableNode<{{className}}>(
name: name, value: this, style: style
);
}
public virtual void debugFillProperties(DiagnosticPropertiesBuilder properties) {
}
}
{% endmacro %}
{{ DiagnosticableMixin('ChangeNotifier') }}
}

333
com.unity.uiwidgets/Runtime/rendering/proxy_sliver.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.ui;
namespace Unity.UIWidgets.rendering {
public abstract class RenderProxySliver : RenderSliver , RenderObjectWithChildMixin<RenderSliver> {
public RenderProxySliver(RenderSliver child = null) {
this.child = child;
}
RenderSliver _child;
public RenderSliver child {
get { return _child; }
set {
if (_child != null)
dropChild(_child);
_child = value;
if (_child != null)
adoptChild(_child);
}
}
public override void setupParentData(RenderObject child) {
if (!(child.parentData is SliverPhysicalParentData))
child.parentData = new SliverPhysicalParentData();
}
protected override void performLayout() {
D.assert(child != null);
child.layout(constraints, parentUsesSize: true);
geometry = child.geometry;
}
public override void paint(PaintingContext context, Offset offset) {
if (child != null)
context.paintChild(child, offset);
}
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
return child != null
&& child.geometry.hitTestExtent > 0
&& child.hitTest(
result,
mainAxisPosition: mainAxisPosition,
crossAxisPosition: crossAxisPosition);
}
public override float childMainAxisPosition(RenderObject child) {
child = (RenderSliver)child;
D.assert(child != null);
D.assert(child == this.child);
return 0.0f;
}
public override void applyPaintTransform(RenderObject child, Matrix4 transform) {
D.assert(child != null);
SliverPhysicalParentData childParentData = child.parentData as SliverPhysicalParentData;
childParentData.applyPaintTransform(transform);
}
public bool debugValidateChild(RenderObject child) {
D.assert(() => {
if (!(child is RenderSliver)) {
string result = "";
result += new ErrorDescription(
$"A {GetType()} expected a child of type $ChildType but received a " +
$"child of type {child.GetType()}.");
result += new ErrorDescription(
"RenderObjects expect specific types of children because they " +
"coordinate with their children during layout and paint. For " +
"example, a RenderSliver cannot be the child of a RenderBox because " +
"a RenderSliver does not understand the RenderBox layout protocol."
);
result += new ErrorSpacer();
result += new DiagnosticsProperty<dynamic>(
$"The {GetType()} that expected a $ChildType child was created by",
debugCreator,
style: DiagnosticsTreeStyle.errorProperty
);
result += new ErrorSpacer();
result += new DiagnosticsProperty<dynamic>(
$"The {child.GetType()} that did not match the expected child type " +
"was created by",
child.debugCreator,
style: DiagnosticsTreeStyle.errorProperty
);
throw new UIWidgetsError(result);
}
return true;
});
return true;
}
RenderObject RenderObjectWithChildMixin.child {
get { return child; }
set { child = (RenderSliver) value; }
}
}
public class RenderSliverOpacity : RenderProxySliver {
public RenderSliverOpacity(
RenderSliver sliver = null,
float opacity = 1.0f,
bool alwaysIncludeSemantics = false
) : base( child:sliver) {
D.assert(opacity != null && opacity >= 0.0 && opacity <= 1.0);
D.assert(alwaysIncludeSemantics != null);
_opacity = opacity;
_alwaysIncludeSemantics = alwaysIncludeSemantics;
_alpha = ui.Color.getAlphaFromOpacity(opacity);
child = sliver;
}
bool alwaysNeedsCompositing {
get { return child != null && (_alpha != 0 && _alpha != 255);}
}
int _alpha;
public float opacity {
get { return _opacity; }
set {
D.assert(value != null);
D.assert(value >= 0.0 && value <= 1.0);
if (_opacity == value)
return;
bool didNeedCompositing = alwaysNeedsCompositing;
bool wasVisible = _alpha != 0;
_opacity = value;
_alpha = ui.Color.getAlphaFromOpacity(_opacity);
if (didNeedCompositing != alwaysNeedsCompositing)
markNeedsCompositingBitsUpdate();
markNeedsPaint();
//if (wasVisible != (_alpha != 0) && !alwaysIncludeSemantics)
// markNeedsSemanticsUpdate();
}
}
float _opacity;
public bool alwaysIncludeSemantics {
get { return _alwaysIncludeSemantics;}
set {
if (value == _alwaysIncludeSemantics)
return;
_alwaysIncludeSemantics = value;
// markNeedsSemanticsUpdate();
}
}
bool _alwaysIncludeSemantics;
public override void paint(PaintingContext context, Offset offset) {
if (child != null && child.geometry.visible) {
if (_alpha == 0) {
setLayer(null);
return;
}
if (_alpha == 255) {
setLayer(null);
context.paintChild(child, offset);
return;
}
D.assert(needsCompositing);
var opacity = context.pushOpacity(
offset,
_alpha,
base.paint,
oldLayer: layer as OpacityLayer
);
setLayer(opacity);
}
}
/*public override void visitChildrenForSemantics(RenderObject visitor) {
visitor = (RenderObjectVisitor)visitor;
if (child != null && (_alpha != 0 || alwaysIncludeSemantics))
visitor(child);
}*/
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("opacity", opacity));
properties.add(new FlagProperty("alwaysIncludeSemantics", value: alwaysIncludeSemantics, ifTrue: "alwaysIncludeSemantics"));
}
}
public class RenderSliverIgnorePointer : RenderProxySliver {
public RenderSliverIgnorePointer(
RenderSliver sliver = null,
bool ignoring = true,
bool? ignoringSemantics = null
):base(child:sliver){
child = sliver;
D.assert(ignoring != null);
_ignoring = ignoring;
_ignoringSemantics = ignoringSemantics;
}
public bool ignoring {
get { return _ignoring; }
set {
D.assert(value != null);
if (value == _ignoring)
return;
_ignoring = value;
//if (_ignoringSemantics == null || !_ignoringSemantics)
// markNeedsSemanticsUpdate();
}
}
bool _ignoring;
public bool? ignoringSemantics {
get { return _ignoringSemantics; }
set {
if (value == _ignoringSemantics)
return ;
bool oldEffectiveValue = _effectiveIgnoringSemantics;
_ignoringSemantics = value;
//if (oldEffectiveValue != _effectiveIgnoringSemantics)
// markNeedsSemanticsUpdate();
}
}
bool? _ignoringSemantics;
bool _effectiveIgnoringSemantics {
get { return ignoringSemantics ?? ignoring; }
}
public override bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
return !ignoring && base.hitTest(
result,
mainAxisPosition: mainAxisPosition,
crossAxisPosition: crossAxisPosition
);
}
/*public override void visitChildrenForSemantics(RenderObjectVisitor visitor) {
if (child != null && !_effectiveIgnoringSemantics)
visitor(child);
}*/
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("ignoring", ignoring));
properties.add(new DiagnosticsProperty<bool>("ignoringSemantics", _effectiveIgnoringSemantics, description: ignoringSemantics == null ? $"implicitly {_effectiveIgnoringSemantics}" : null));
}
}
public class RenderSliverOffstage : RenderProxySliver {
public RenderSliverOffstage(
RenderSliver sliver = null,
bool offstage = true): base(child:sliver) {
D.assert(offstage != null);
_offstage = offstage;
child = sliver;
}
public bool offstage {
get { return _offstage; }
set {
D.assert(value != null);
if (value == _offstage)
return;
_offstage = value;
markNeedsLayoutForSizedByParentChange();
}
}
bool _offstage;
protected override void performLayout() {
D.assert(child != null);
child.layout(constraints, parentUsesSize: true);
if (!offstage)
geometry = child.geometry;
else
geometry = new SliverGeometry(
scrollExtent: 0.0f,
visible: false,
maxPaintExtent: 0.0f);
}
public override bool hitTest(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
return !offstage && base.hitTest(result, mainAxisPosition: mainAxisPosition, crossAxisPosition: crossAxisPosition);
}
protected override bool hitTestChildren(SliverHitTestResult result, float mainAxisPosition = 0, float crossAxisPosition = 0) {
return !offstage
&& child != null
&& child.geometry.hitTestExtent > 0
&& child.hitTest(
result,
mainAxisPosition: mainAxisPosition,
crossAxisPosition: crossAxisPosition
);
}
public override void paint(PaintingContext context, Offset offset) {
if (offstage)
return;
context.paintChild(child, offset);
}
/*public override void visitChildrenForSemantics(RenderObjectVisitor visitor) {
if (offstage)
return;
base.visitChildrenForSemantics(visitor);
}*/
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<bool>("offstage", offstage));
}
public override List<DiagnosticsNode> debugDescribeChildren() {
if (child == null)
return new List<DiagnosticsNode>();
return new List<DiagnosticsNode>{
child.toDiagnosticsNode(
name: "child",
style: offstage ? DiagnosticsTreeStyle.offstage : DiagnosticsTreeStyle.sparse
),
};
}
}
/*public class RenderSliverAnimatedOpacity : RenderProxySliver ,RenderAnimatedOpacityMixin<RenderSliver>{
public RenderSliverAnimatedOpacity(
Animation<double> opacity = null,
bool alwaysIncludeSemantics = false,
RenderSliver sliver = null
):base(sliver) {
D.assert(opacity != null);
D.assert(alwaysIncludeSemantics != null);
this.opacity = opacity;
this.alwaysIncludeSemantics = alwaysIncludeSemantics;
child = sliver;
}
}*/
}

398
com.unity.uiwidgets/Runtime/services/keyboard_key.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.services
{
public abstract class KeyboardKey : Diagnosticable
{
protected KeyboardKey() { }
}
public class LogicalKeyboardKey : KeyboardKey, IEquatable<LogicalKeyboardKey>
{
public bool Equals(LogicalKeyboardKey other)
{
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return keyId == other.keyId;
}
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((LogicalKeyboardKey) obj);
}
public override int GetHashCode()
{
unchecked
{
int hashCode = (int)keyId;
hashCode = (hashCode * 397) ^ (debugName != null ? debugName.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (keyLabel != null ? keyLabel.GetHashCode() : 0);
return hashCode;
}
}
protected LogicalKeyboardKey(long keyId, string debugName = null, string keyLabel = null) : base()
{
D.assert(keyId != null);
this.keyId = keyId;
this.debugName = debugName;
this.keyLabel = keyLabel;
}
public readonly long keyId;
public readonly string debugName;
public readonly string keyLabel;
public static LogicalKeyboardKey findKeyByKeyId(int keyId) => _knownLogicalKeys[keyId];
public static bool isControlCharacter(string label)
{
if (label.Length > 1)
{
return false;
}
int codeUnit = label[0];
return (codeUnit <= 0x1f && codeUnit >= 0x00) || (codeUnit >= 0x7f && codeUnit <= 0x9f);
}
public bool isAutogenerated
{
get
{
return (keyId & autogeneratedMask) != 0;
}
}
public HashSet<LogicalKeyboardKey> synonyms
{
get {
HashSet<LogicalKeyboardKey> result = new HashSet<LogicalKeyboardKey>();
LogicalKeyboardKey item = _synonyms[this];
if (item == null) {
return result;
}
result.Add(item: item);
return result;
}
}
public static HashSet<LogicalKeyboardKey> collapseSynonyms(HashSet<LogicalKeyboardKey> input)
{
HashSet<LogicalKeyboardKey> result = new HashSet<LogicalKeyboardKey>();
foreach (LogicalKeyboardKey key in input)
{
LogicalKeyboardKey synonym = _synonyms[key];
result.Add(synonym ?? key);
}
return result;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new StringProperty("keyId", keyId.ToString().PadLeft(8,'\0'), showName: true));
properties.add(new StringProperty("keyLabel", keyLabel, showName: true));
properties.add(new StringProperty("debugName", debugName, showName: true, defaultValue: null));
}
/// Mask for the 32-bit value portion of the key code.
///
/// This is used by platform-specific code to generate Flutter key codes.
public static readonly long valueMask = 0x000FFFFFFFF;
/// Mask for the platform prefix portion of the key code.
///
/// This is used by platform-specific code to generate Flutter key codes.
public static readonly long platformMask = 0x0FF00000000;
/// Mask for the auto-generated bit portion of the key code.
///
/// This is used by platform-specific code to generate new Flutter key codes
/// for keys which are not recognized.
public static readonly long autogeneratedMask = 0x10000000000;
/// Mask for the synonym pseudo-keys generated for keys which appear in more
/// than one place on the keyboard.
///
/// IDs in this range are used to represent keys which appear in multiple
/// places on the keyboard, such as the SHIFT, ALT, CTRL, and numeric keypad
/// keys. These key codes will never be generated by the key event system, but
/// may be used in key maps to represent the union of all the keys of each
/// type in order to match them.
///
/// To look up the synonyms that are defined, look in the [synonyms] map.
public static readonly long synonymMask = 0x20000000000;
/// The code prefix for keys which have a Unicode representation.
///
/// This is used by platform-specific code to generate Flutter key codes.
public static readonly long unicodePlane = 0x00000000000;
/// The code prefix for keys which do not have a Unicode representation.
///
/// This is used by platform-specific code to generate Flutter key codes using
/// HID Usage codes.
public static readonly long hidPlane = 0x00100000000;
/// Represents the logical "None" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey none = new LogicalKeyboardKey(0x00100000000, debugName: foundation_.kReleaseMode ? null : "None");
/// Represents the logical "Control Left" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey controlLeft = new LogicalKeyboardKey(0x001000700e0, debugName: foundation_.kReleaseMode ? null : "Control Left");
/// Represents the logical "Shift Left" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey shiftLeft = new LogicalKeyboardKey(0x001000700e1, debugName: foundation_.kReleaseMode ? null : "Shift Left");
/// Represents the logical "Alt Left" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey altLeft = new LogicalKeyboardKey(0x001000700e2, debugName: foundation_.kReleaseMode ? null : "Alt Left");
/// Represents the logical "Meta Left" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey metaLeft = new LogicalKeyboardKey(0x001000700e3, debugName: foundation_.kReleaseMode ? null : "Meta Left");
/// Represents the logical "Control Right" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey controlRight = new LogicalKeyboardKey(0x001000700e4, debugName: foundation_.kReleaseMode ? null : "Control Right");
/// Represents the logical "Shift Right" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey shiftRight = new LogicalKeyboardKey(0x001000700e5, debugName: foundation_.kReleaseMode ? null : "Shift Right");
/// Represents the logical "Alt Right" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey altRight = new LogicalKeyboardKey(0x001000700e6, debugName: foundation_.kReleaseMode ? null : "Alt Right");
/// Represents the logical "Meta Right" key on the keyboard.
///
/// See the function [RawKeyEvent.logicalKey] for more information.
public static readonly LogicalKeyboardKey metaRight = new LogicalKeyboardKey(0x001000700e7, debugName: foundation_.kReleaseMode ? null : "Meta Right");
/// Represents the logical "Shift" key on the keyboard.
///
/// This key represents the union of the keys {shiftLeft, shiftRight} when
/// comparing keys. This key will never be generated directly, its main use is
/// in defining key maps.
public static readonly LogicalKeyboardKey shift = new LogicalKeyboardKey(0x201000700e1, debugName: foundation_.kReleaseMode ? null : "Shift");
/// Represents the logical "Meta" key on the keyboard.
///
/// This key represents the union of the keys {metaLeft, metaRight} when
/// comparing keys. This key will never be generated directly, its main use is
/// in defining key maps.
public static readonly LogicalKeyboardKey meta = new LogicalKeyboardKey(0x201000700e3, debugName: foundation_.kReleaseMode ? null : "Meta");
/// Represents the logical "Alt" key on the keyboard.
///
/// This key represents the union of the keys {altLeft, altRight} when
/// comparing keys. This key will never be generated directly, its main use is
/// in defining key maps.
public static readonly LogicalKeyboardKey alt = new LogicalKeyboardKey(0x201000700e2, debugName: foundation_.kReleaseMode ? null : "Alt");
/// Represents the logical "Control" key on the keyboard.
///
/// This key represents the union of the keys {controlLeft, controlRight} when
/// comparing keys. This key will never be generated directly, its main use is
/// in defining key maps.
public static readonly LogicalKeyboardKey control = new LogicalKeyboardKey(0x201000700e0, debugName: foundation_.kReleaseMode ? null : "Control");
// A list of all predefined constant LogicalKeyboardKeys so they can be
// searched.
public static readonly Dictionary<long, LogicalKeyboardKey> _knownLogicalKeys = new Dictionary<long, LogicalKeyboardKey>{
{0x0100000000, none},
{0x201000700e1, shift},
{0x201000700e3, meta},
{0x201000700e2, alt},
{0x201000700e0, control},
};
// A map of keys to the pseudo-key synonym for that key. Used by getSynonyms.
public static readonly Dictionary<LogicalKeyboardKey, LogicalKeyboardKey> _synonyms = new Dictionary<LogicalKeyboardKey, LogicalKeyboardKey>{
{shiftLeft, shift},
{shiftRight, shift},
{metaLeft, meta},
{metaRight, meta},
{altLeft, alt},
{altRight, alt},
{controlLeft, control},
{controlRight, control},
};
}
public class PhysicalKeyboardKey : KeyboardKey, IEquatable<PhysicalKeyboardKey>
{
protected PhysicalKeyboardKey(int usbHidUsage, string debugName = null)
{
D.assert(usbHidUsage != null);
this.usbHidUsage = usbHidUsage;
this.debugName = debugName;
}
/// The unique USB HID usage ID of this physical key on the keyboard.
///
/// Due to the variations in platform APIs, this may not be the actual HID
/// usage code from the hardware, but a value derived from available
/// information on the platform.
///
/// See <https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf>
/// for the HID usage values and their meanings.
public readonly int usbHidUsage;
/// The debug string to print for this keyboard key, which will be null in
/// release mode.
public readonly string debugName;
/// Finds a known [PhysicalKeyboardKey] that matches the given USB HID usage
/// code.
public static PhysicalKeyboardKey findKeyByCode(int usageCode) => _knownPhysicalKeys[usageCode];
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new StringProperty("usbHidUsage", usbHidUsage.ToString().PadLeft(8,'0'), showName: true));
properties.add(new StringProperty("debugName", debugName, showName: true, defaultValue: null));
}
public bool Equals(PhysicalKeyboardKey other)
{
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return usbHidUsage == other.usbHidUsage;
}
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((PhysicalKeyboardKey) obj);
}
public override int GetHashCode()
{
unchecked
{
return (usbHidUsage * 397) ^ (debugName != null ? debugName.GetHashCode() : 0);
}
}
// Key constants for all keyboard keys in the USB HID specification at the
// time Flutter was built.
/// Represents the location of the "None" key on a generalized keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey none = new PhysicalKeyboardKey(0x00000000, debugName: foundation_.kReleaseMode ? null : "None");
/// Represents the location of the "Control Left" key on a generalized
/// keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey controlLeft = new PhysicalKeyboardKey(0x000700e0, debugName: foundation_.kReleaseMode ? null : "Control Left");
/// Represents the location of the "Shift Left" key on a generalized keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey shiftLeft = new PhysicalKeyboardKey(0x000700e1, debugName: foundation_.kReleaseMode ? null : "Shift Left");
/// Represents the location of the "Alt Left" key on a generalized keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey altLeft = new PhysicalKeyboardKey(0x000700e2, debugName: foundation_.kReleaseMode ? null : "Alt Left");
/// Represents the location of the "Meta Left" key on a generalized keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey metaLeft = new PhysicalKeyboardKey(0x000700e3, debugName: foundation_.kReleaseMode ? null : "Meta Left");
/// Represents the location of the "Control Right" key on a generalized
/// keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey controlRight = new PhysicalKeyboardKey(0x000700e4, debugName: foundation_.kReleaseMode ? null : "Control Right");
/// Represents the location of the "Shift Right" key on a generalized
/// keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey shiftRight = new PhysicalKeyboardKey(0x000700e5, debugName: foundation_.kReleaseMode ? null : "Shift Right");
/// Represents the location of the "Alt Right" key on a generalized keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey altRight = new PhysicalKeyboardKey(0x000700e6, debugName: foundation_.kReleaseMode ? null : "Alt Right");
/// Represents the location of the "Meta Right" key on a generalized keyboard.
///
/// See the function [RawKeyEvent.physicalKey] for more information.
public static readonly PhysicalKeyboardKey metaRight = new PhysicalKeyboardKey(0x000700e7, debugName: foundation_.kReleaseMode ? null : "Meta Right");
public static readonly Dictionary<int, PhysicalKeyboardKey> _knownPhysicalKeys =
new Dictionary<int, PhysicalKeyboardKey>() {
{0x00000000, none},
{0x000700e0, controlLeft},
{0x000700e1, shiftLeft},
{0x000700e2, altLeft},
{0x000700e3, metaLeft},
{0x000700e4, controlRight},
{0x000700e5, shiftRight},
{0x000700e6, altRight},
{0x000700e7, metaRight},
};
}
}

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


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.services;
namespace Unity.UIWidgets.widgets {
public class KeySet<T> : KeyboardKey, IEquatable<KeySet<T>>
{
public KeySet(
T key1,
T key2 = default(T),
T key3 = default(T),
T key4 = default(T)
) {
D.assert(key1 != null);
_keys = new HashSet<T>();
_keys.Add(key1);
int count = 1;
if (key2 != null) {
_keys.Add(key2);
D.assert(() => {
count++;
return true;
});
}
if (key3 != null) {
_keys.Add(key3);
D.assert(() => {
count++;
return true;
});
}
if (key4 != null) {
_keys.Add(key4);
D.assert(() => {
count++;
return true;
});
}
D.assert(_keys.Count == count,
() => "Two or more provided keys are identical. Each key must appear only once.");
}
public KeySet(HashSet<T> keys)
{
D.assert(keys != null);
D.assert(keys.isNotEmpty);
D.assert(!keys.Contains(default(T)));
foreach (var key in keys) {
_keys.Add(key);
}
}
public HashSet<T> keys
{
get { return new HashSet<T>(_keys); }
}
public readonly HashSet<T> _keys;
public static readonly List<int> _tempHashStore3 = new List<int>() {0, 0, 0}; // used to sort exactly 3 keys
public static readonly List<int> _tempHashStore4 = new List<int>() {0, 0, 0, 0}; // used to sort exactly 4 keys
public int _hashCode;
public bool Equals(KeySet<T> other)
{
if (ReferenceEquals(null, other)) {
return false;
}
if (ReferenceEquals(this, other)) {
return true;
}
return Equals(_keys, other._keys) && _hashCode == other._hashCode;
}
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((KeySet<T>) obj);
}
public override int GetHashCode()
{
unchecked
{
if (_hashCode != 0) {
return _hashCode;
}
int length = _keys.Count;
IEnumerator<T> iterator = _keys.GetEnumerator();
// There's always at least one key. Just extract it.
iterator.MoveNext();
int h1 = iterator.GetHashCode();
if (length == 1) {
// Don't do anything fancy if there's exactly one key.
return _hashCode = h1;
}
iterator.MoveNext();
int h2 = iterator.GetHashCode();
if (length == 2) {
// No need to sort if there's two keys, just compare them.
return _hashCode = h1 < h2
? ((h1 != null ? h1.GetHashCode() : 0) * 397) ^ h2.GetHashCode()
: ((h2 != null ? h2.GetHashCode() : 0) * 397) ^ h1.GetHashCode();
}
// Sort key hash codes and feed to hashList to ensure the aggregate
// hash code does not depend on the key order.
List<int> sortedHashes = length == 3
? _tempHashStore3
: _tempHashStore4;
sortedHashes[0] = h1;
sortedHashes[1] = h2;
iterator.MoveNext();
sortedHashes[2] = iterator.GetHashCode();
if (length == 4) {
iterator.MoveNext();
sortedHashes[3] = iterator.GetHashCode();
}
sortedHashes.Sort();
return _hashCode = (_hashCode * 397) ^ (sortedHashes != null ? sortedHashes.GetHashCode() : 0);;
}
}
}
public class LogicalKeySet : KeySet<LogicalKeyboardKey> {
public LogicalKeySet(
LogicalKeyboardKey key1,
LogicalKeyboardKey key2 = default(LogicalKeyboardKey),
LogicalKeyboardKey key3 = default(LogicalKeyboardKey),
LogicalKeyboardKey key4 = default(LogicalKeyboardKey)
) : base(key1: key1, key2: key2, key3: key3, key4: key4){ }
public LogicalKeySet(HashSet<LogicalKeyboardKey> keys) : base(keys) { }
public static readonly HashSet<LogicalKeyboardKey> _modifiers = new HashSet<LogicalKeyboardKey>(){
LogicalKeyboardKey.alt,
LogicalKeyboardKey.control,
LogicalKeyboardKey.meta,
LogicalKeyboardKey.shift,
};
/// Returns a description of the key set that is short and readable.
///
/// Intended to be used in debug mode for logging purposes.
public string debugDescribeKeys() {
List<LogicalKeyboardKey> sortedKeys = keys.ToList();
sortedKeys.Sort(
(LogicalKeyboardKey a, LogicalKeyboardKey b) => {
bool aIsModifier = a.synonyms.isNotEmpty() || _modifiers.Contains(a);
bool bIsModifier = b.synonyms.isNotEmpty() || _modifiers.Contains(b);
if (aIsModifier && !bIsModifier) {
return -1;
} else if (bIsModifier && !aIsModifier) {
return 1;
}
return a.debugName.CompareTo(b.debugName);
}
);
List<string> result = new List<string>();
foreach (var key in sortedKeys) {
result.Add(key.debugName);
}
return string.Join(" + ", result.ToArray());
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<HashSet<LogicalKeyboardKey>>("keys", _keys, description: debugDescribeKeys()));
}
}
public class ShortcutMapProperty : DiagnosticsProperty<Dictionary<LogicalKeySet, Intent>> {
public ShortcutMapProperty(
string name,
Dictionary<LogicalKeySet, Intent> value,
bool showName = true,
Object defaultValue = null,//foundation_.kNoDefaultValue
DiagnosticLevel level = DiagnosticLevel.info,
string description = null
) : base(
name: name,
value: value,
showName: showName,
defaultValue: defaultValue,
level: level,
description: description
)
{
D.assert(showName != null);
D.assert(level != null);
}
protected override string valueToString( TextTreeConfiguration parentConfiguration = null) {
List<string> res = new List<string>();
foreach (var key in value.Keys) {
string temp = "{" + key.debugDescribeKeys() + "}:" + value[key];
res.Add(temp);
}
return string.Join(", ", res);
}
}
public class ShortcutManager : DiagnosticableMixinChangeNotifier {
public ShortcutManager(
Dictionary<LogicalKeySet, Intent> shortcuts = null,
bool modal = false
) {
shortcuts = shortcuts ?? new Dictionary<LogicalKeySet, Intent>();
D.assert(shortcuts != null);
this.modal = modal;
this.shortcuts = shortcuts;
}
/// True if the [ShortcutManager] should not pass on keys that it doesn't
/// handle to any key-handling widgets that are ancestors to this one.
///
/// Setting [modal] to true is the equivalent of always handling any key given
/// to it, even if that key doesn't appear in the [shortcuts] map. Keys that
/// don't appear in the map will be dropped.
public readonly bool modal;
Dictionary<LogicalKeySet, Intent> _shortcuts;
public Dictionary<LogicalKeySet, Intent> shortcuts {
get { return _shortcuts; }
set {
_shortcuts = value;
notifyListeners();
}
}
/// Handles a key pressed `event` in the given `context`.
///
/// The optional `keysPressed` argument provides an override to keys that the
/// [RawKeyboard] reports. If not specified, uses [RawKeyboard.keysPressed]
/// instead.
public bool handleKeypress(
BuildContext context,
RawKeyEvent rawKeyEvent,
LogicalKeySet keysPressed = null
) {
if (!(rawKeyEvent is RawKeyDownEvent)) {
return false;
}
D.assert(context != null);
LogicalKeySet keySet = keysPressed ?? new LogicalKeySet(RawKeyboard.instance.keysPressed);
Intent matchedIntent = _shortcuts[keySet];
if (matchedIntent == null) {
// If there's not a more specific match, We also look for any keys that
// have synonyms in the map. This is for things like left and right shift
// keys mapping to just the "shift" pseudo-key.
HashSet<LogicalKeyboardKey> pseudoKeys = new HashSet<LogicalKeyboardKey>{};
foreach (LogicalKeyboardKey setKey in keySet.keys) {
HashSet<LogicalKeyboardKey> synonyms = setKey.synonyms;
if (synonyms.isNotEmpty()) {
// There currently aren't any synonyms that match more than one key.
pseudoKeys.Add(synonyms.First());
} else {
pseudoKeys.Add(setKey);
}
}
matchedIntent = _shortcuts[new LogicalKeySet(pseudoKeys)];
}
if (matchedIntent != null) {
BuildContext primaryContext = FocusManagerUtils.primaryFocus?.context;
if (primaryContext == null) {
return false;
}
return Actions.invoke(primaryContext, matchedIntent, nullOk: true);
}
return false;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new DiagnosticsProperty<Dictionary<LogicalKeySet, Intent>>("shortcuts", _shortcuts));
properties.add(new FlagProperty("modal", value: modal, ifTrue: "modal", defaultValue: false));
}
}
public class Shortcuts : StatefulWidget {
/// Creates a ActionManager object.
///
/// The [child] argument must not be null.
public Shortcuts(
Key key = null,
ShortcutManager manager = null,
Dictionary<LogicalKeySet, Intent> shortcuts = null,
Widget child = null,
string debugLabel = null
) : base(key: key) {
this.manager = manager;
this.shortcuts = shortcuts;
this.child = child;
this.debugLabel = debugLabel;
}
public readonly ShortcutManager manager;
public readonly Dictionary<LogicalKeySet, Intent> shortcuts;
public readonly Widget child;
public readonly string debugLabel;
public static ShortcutManager of(BuildContext context, bool nullOk = false) {
D.assert(context != null);
_ShortcutsMarker inherited = context.dependOnInheritedWidgetOfExactType<_ShortcutsMarker>();
D.assert(() => {
if (nullOk) {
return true;
}
if (inherited == null) {
throw new UIWidgetsError($"Unable to find a {typeof(Shortcuts)} widget in the context.\n" +
$"{typeof(Shortcuts)}.of()was called with a context that does not contain a " +
$"{typeof(Shortcuts)} widget.\n" +
$"No {typeof(Shortcuts)} ancestor could be found starting from the context that was " +
$"passed to {typeof(Shortcuts)}.of().\n" +
"The context used was:\n" +
$" {context}");
}
return true;
});
return inherited?.notifier;
}
public override State createState() {
return new _ShortcutsState();
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<ShortcutManager>("manager", manager, defaultValue: null));
properties.add(new ShortcutMapProperty("shortcuts", shortcuts, description: debugLabel?.isNotEmpty() ?? false ? debugLabel : null));
}
}
public class _ShortcutsState : State<Shortcuts> {
private ShortcutManager _internalManager;
public ShortcutManager manager {
get { return widget.manager ?? _internalManager; }
}
public override void dispose() {
_internalManager?.dispose();
base.dispose();
}
public override void initState() {
base.initState();
if (widget.manager == null) {
_internalManager = new ShortcutManager();
}
manager.shortcuts = widget.shortcuts;
}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget((Shortcuts)oldWidget);
if (widget.manager != ((Shortcuts)oldWidget).manager) {
if (widget.manager != null) {
_internalManager?.dispose();
_internalManager = null;
} else {
_internalManager = _internalManager?? new ShortcutManager();
}
}
manager.shortcuts = widget.shortcuts;
}
public bool _handleOnKey(FocusNode node, RawKeyEvent _event)
{
if (node.context == null) {
return false;
}
return manager.handleKeypress(node.context, _event) || manager.modal;
}
public override Widget build(BuildContext context) {
return new Focus(
debugLabel: typeof(Shortcuts).ToString(),
canRequestFocus: false,
onKey: _handleOnKey,
child: new _ShortcutsMarker(
manager: manager,
child: widget.child
)
);
}
}
public class _ShortcutsMarker : InheritedNotifier<ShortcutManager> {
public _ShortcutsMarker(
ShortcutManager manager = null,
Widget child = null
) : base(notifier: manager, child: child) {
D.assert(manager != null);
D.assert(child != null);
}
}
}

38
com.unity.uiwidgets/Runtime/widgets/title.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.service;
namespace Unity.UIWidgets.widgets {
class Title : StatelessWidget {
public Title(
Color color,
Key key = null,
string title = "",
Widget child = null
) : base(key: key) {
D.assert(title != null);
D.assert(color != null && color.alpha == 0xFF);
}
public readonly String title;
public readonly Color color;
public readonly Widget child;
public override Widget build(BuildContext context) {
/*SystemChrome.setApplicationSwitcherDescription(
new ApplicationSwitcherDescription(
label: title,
primaryColor: (int)color.value
)
);*/
return child;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new StringProperty("title", title, defaultValue: ""));
//properties.add(new ColorProperty("color", color, defaultValue: null));
}
}
}

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


using System;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
public class TweenAnimationBuilder<T> : ImplicitlyAnimatedWidget {
public TweenAnimationBuilder(
Key key = null,
Tween<T> tween = null,
TimeSpan? duration = null,
Curve curve = null,
ValueWidgetBuilder<T> builder = null,
VoidCallback onEnd = null,
Widget child = null
) : base(key: key, duration: duration, curve: curve, onEnd: onEnd) {
curve = curve ?? Curves.linear;
D.assert(tween != null);
D.assert(curve != null);
D.assert(builder != null);
}
public readonly Tween<T> tween;
public readonly ValueWidgetBuilder<T> builder;
public readonly Widget child;
public override State createState() {
return new _TweenAnimationBuilderState<T>();
}
}
public class _TweenAnimationBuilderState<T> : AnimatedWidgetBaseState<TweenAnimationBuilder<T>> {
Tween<T> _currentTween;
public override void initState() {
_currentTween = widget.tween;
if (_currentTween.begin == null) {
_currentTween.begin = _currentTween.end;
}
base.initState();
if (_currentTween.begin.Equals( _currentTween.end)) {
controller.forward();
}
}
protected override void forEachTween(TweenVisitor visitor) {
D.assert(
widget.tween.end != null,()=>
"Tween provided to TweenAnimationBuilder must have non-null Tween.end value.");
_currentTween = visitor.visit(
this,
_currentTween,
widget.tween.end,
(value) =>{
D.assert(false);
return null; }) as Tween<T>;
}
public override Widget build(BuildContext context) {
return widget.builder(context, _currentTween.evaluate(animation), widget.child);
}
}
}

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


using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.widgets {
public abstract class UniqueWidget<T> :StatefulWidget where T: State<StatefulWidget> {
public UniqueWidget(
GlobalKey<T> key
) : base(key: key) {
D.assert(key != null);
}
public abstract override State createState();
T currentState {
get {
GlobalKey<T> globalKey = key as GlobalKey<T>;
return globalKey.currentState;
}
}
}
}
正在加载...
取消
保存