浏览代码

fix wheel_scroll_view bug

/zgh-devtools
xingweizhu 4 年前
当前提交
ee7cbaed
共有 3 个文件被更改,包括 504 次插入369 次删除
  1. 386
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  2. 482
      com.unity.uiwidgets/Runtime/widgets/basic.cs
  3. 5
      com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs

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


opaque,
translucent,
}
RenderBox child = null,
ShaderCallback shaderCallback = null,
RenderBox child = null,
ShaderCallback shaderCallback = null,
) : base(child) {
) : base(child) {
D.assert(shaderCallback != null);
_shaderCallback = shaderCallback;
_blendMode = blendMode;

get {
return base.layer as ShaderMaskLayer;
}
get { return base.layer as ShaderMaskLayer; }
get {
return _shaderCallback;
}
get { return _shaderCallback; }
if (_shaderCallback == value)
if (_shaderCallback == value) {
}
get { return _blendMode;}
get { return _blendMode; }
if (_blendMode == value)
if (_blendMode == value) {
}
get { return child != null;}
get { return child != null; }
D.assert(needsCompositing);
layer = layer ?? new ShaderMaskLayer();
layer.shader = _shaderCallback(Offset.zero & size);
layer.maskRect = offset & size;
layer.blendMode = _blendMode;
context.pushLayer(layer, base.paint, offset);
} else {
layer = null;
D.assert(needsCompositing);
layer = layer ?? new ShaderMaskLayer();
layer.shader = _shaderCallback(Offset.zero & size);
layer.maskRect = offset & size;
layer.blendMode = _blendMode;
context.pushLayer(layer, base.paint, offset);
}
else {
layer = null;
bool alwaysNeedsCompositing {
get;
}
bool alwaysNeedsCompositing { get; }
Animation<float> _opacity {
get;
set;
}
Animation<float> _opacity { get; set; }
void attach(PipelineOwner owner);
void detach();

void debugFillProperties(DiagnosticPropertiesBuilder properties);
}
public abstract class RenderProxyBoxWithHitTestBehavior : RenderProxyBox {
protected RenderProxyBoxWithHitTestBehavior(
HitTestBehavior behavior = HitTestBehavior.deferToChild,

public class RenderAspectRatio : RenderProxyBox {
public RenderAspectRatio(
float aspectRatio,
float aspectRatio,
RenderBox child = null) : base(child) {
_aspectRatio = aspectRatio;
}

if (width.isFinite()) {
height = width / _aspectRatio;
} else {
}
else {
if (width > constraints.maxWidth) {
width = constraints.maxWidth;
height = width / _aspectRatio;

public override void paint(PaintingContext context, Offset offset) {
if (child != null) {
D.assert(needsCompositing);
layer = layer?? new BackdropFilterLayer(_filter);
layer = layer ?? new BackdropFilterLayer(_filter);
} else {
}
else {
layer = null;
}
}

public ShapeBorderClipper(
ShapeBorder shape = null,
TextDirection? textDirection = null
) {
) {
D.assert(shape != null);
this.shape = shape;
this.textDirection = textDirection;

}
public override bool shouldReclip(CustomClipper<Path> oldClipper) {
if (oldClipper.GetType() != typeof(ShapeBorderClipper))
if (oldClipper.GetType() != typeof(ShapeBorderClipper)) {
}
}
}

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

protected Clip _clipBehavior;
public Clip clipBehavior {
get { return _clipBehavior; }
set {

markNeedsPaint();
}
}
protected override void performLayout() {
Size oldSize = hasSize ? size : null;
base.performLayout();

new List<Color> {
new Color(0x00000000),
new Color(0xFFFF00FF),
new Color(0xFFFF00FF),
new Color(0xFFFF00FF),
},
new List<float>{0.25f,0.25f,0.75f,0.75f},
},
new List<float> {0.25f, 0.25f, 0.75f, 0.75f},
TileMode.repeated);
_debugPaint.strokeWidth = 2.0f;
_debugPaint.style = PaintingStyle.stroke;

clipBehavior: clipBehavior,
oldLayer: layer as ClipRectLayer
);
} else {
}
else {
layer = null;
}
}

offset,
_clip.outerRect,
_clip,
base.paint,
clipBehavior: clipBehavior,
base.paint,
clipBehavior: clipBehavior,
} else {
}
else {
layer = null;
}
}

clipBehavior: clipBehavior,
oldLayer: layer as ClipPathLayer
);
} else {
}
else {
layer = null;
}
}

clipBehavior: clipBehavior,
oldLayer: layer as ClipPathLayer
);
} else {
}
else {
layer = null;
}
}

_shape = shape;
_borderRadius = borderRadius;
}
get {
return base.layer as PhysicalModelLayer;
}
get { return base.layer as PhysicalModelLayer; }
set {
if (layer == value) {
return;

paint
);
}
layer = layer?? new PhysicalModelLayer();
layer = layer ?? new PhysicalModelLayer();
layer.clipPath = offsetRRectAsPath;
layer.clipBehavior = clipBehavior;
layer.elevation = paintShadows ? elevation : 0.0f;

layer.debugCreator = debugCreator;
return true;
});
} else {
}
else {
layer = null;
}
}

}
public new PhysicalModelLayer layer {
get {
return base.layer as PhysicalModelLayer;
}
get { return base.layer as PhysicalModelLayer; }
set {
if (layer == value) {
return;

paint.strokeWidth = elevation * 2.0f;
context.canvas.drawPath(
offsetPath,
paint
paint
layer = layer?? new PhysicalModelLayer();
layer = layer ?? new PhysicalModelLayer();
layer.clipPath = offsetPath;
layer.clipBehavior = clipBehavior;
layer.elevation = paintShadows ? elevation : 0.0f;

layer.debugCreator = debugCreator;
return true;
});
} else {
}
else {
layer = null;
}
}

D.assert(() => {
if (debugSaveCount != context.canvas.getSaveCount()) {
throw new UIWidgetsError(new List<DiagnosticsNode>{
new ErrorSummary($"{_decoration.GetType()} painter had mismatching save and restore calls."),
throw new UIWidgetsError(new List<DiagnosticsNode> {
new ErrorSummary(
$"{_decoration.GetType()} painter had mismatching save and restore calls."),
new DiagnosticsProperty<Decoration>("The decoration was", decoration, style: DiagnosticsTreeStyle.errorProperty),
new DiagnosticsProperty<BoxPainter>("The painter was", _painter, style: DiagnosticsTreeStyle.errorProperty),
new DiagnosticsProperty<Decoration>("The decoration was", decoration,
style: DiagnosticsTreeStyle.errorProperty),
new DiagnosticsProperty<BoxPainter>("The painter was", _painter,
style: DiagnosticsTreeStyle.errorProperty),
});
}

public class RenderTransform : RenderProxyBox {
public RenderTransform(
Matrix4 transform ,
Matrix4 transform,
Offset origin = null,
AlignmentGeometry alignment = null,
TextDirection? textDirection = null,

public TextDirection? textDirection {
get { return _textDirection; }
set {
if (_textDirection == value)
if (_textDirection == value) {
}
_textDirection = value;
markNeedsPaint();
//markNeedsSemanticsUpdate();

TextDirection? _textDirection;
TextDirection? _textDirection;
public bool transformHitTests;

base.paint,
oldLayer: layer as TransformLayer
);
} else {
}
else {
base.paint(context, offset + childOffset);
layer = null;
}

properties.add(new DiagnosticsProperty<Offset>("origin", origin));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new DiagnosticsProperty<bool>("transformHitTests", transformHitTests));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection) textDirection,
defaultValue: null));
}
}

if (_resolvedAlignment != null) {
return;
}
_resolvedAlignment = alignment.resolve(textDirection);
}

_markNeedResolution();
}
}
get {
return _textDirection;
}
get { return _textDirection; }
if (_textDirection == value)
if (_textDirection == value) {
}
protected override void performLayout() {
if (child != null) {

result = false;
}
}
D.assert(result);
}
}

return null;
}
}
public override void paint(PaintingContext context, Offset offset) {
if (size.isEmpty || child.size.isEmpty) {
return;

if (child != null) {
if (_hasVisualOverflow == true) {
layer = context.pushClipRect(needsCompositing, offset, Offset.zero & size,
painter: (PaintingContext subContext, Offset subOffset) => { _paintChildWithTransform(subContext, subOffset); },
painter: (PaintingContext subContext, Offset subOffset) => {
_paintChildWithTransform(subContext, subOffset);
},
else{
else {
_paintChildWithTransform(context, offset);
}
}

if (size.isEmpty || child?.size?.isEmpty == true)
if (size.isEmpty || child?.size?.isEmpty == true) {
}
_updatePaintData();
return result.addWithPaintTransform(
transform: _transform,

}
public override void applyPaintTransform(RenderObject child, Matrix4 transform) {
if (size.isEmpty || ((RenderBox)child).size.isEmpty) {
if (size.isEmpty || ((RenderBox) child).size.isEmpty) {
transform.setZero();
}
else {

base.debugFillProperties(properties);
properties.add(new EnumProperty<BoxFit>("fit", fit));
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection) textDirection,
defaultValue: null));
}
}

public delegate void PointerSignalEventListener(PointerSignalEvent evt);
public delegate void PointerScrollEventListener(PointerScrollEvent evt);
/*public class RenderPointerListener : RenderProxyBoxWithHitTestBehavior {
public RenderPointerListener(
PointerDownEventListener onPointerDown = null,

public RenderPointerListener(
PointerDownEventListener onPointerDown = null,
PointerMoveEventListener onPointerMove = null,
PointerUpEventListener onPointerUp =null,
PointerUpEventListener onPointerUp = null,
PointerSignalEventListener onPointerSignal =null,
PointerSignalEventListener onPointerSignal = null,
}
public PointerDownEventListener onPointerDown;

protected override void performResize() {
size = constraints.biggest;
}
onPointerDown(( PointerDownEvent)Event);
onPointerDown((PointerDownEvent) Event);
onPointerMove((PointerMoveEvent)Event);
onPointerMove((PointerMoveEvent) Event);
onPointerUp((PointerUpEvent)Event);
onPointerUp((PointerUpEvent) Event);
onPointerCancel((PointerCancelEvent)Event);
onPointerCancel((PointerCancelEvent) Event);
onPointerSignal((PointerSignalEvent)Event);
onPointerSignal((PointerSignalEvent) Event);
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
//new FlagsSummary<Delegate>()
properties.add(new FlagsSummary<Delegate>(

_opaque = opaque;
_annotationIsActive = false;
_hoverAnnotation = new MouseTrackerAnnotation(
onEnter: _handleEnter,
onHover: _handleHover,
onExit: _handleExit
onEnter: _handleEnter,
onHover: _handleHover,
onExit: _handleExit
get {
return _opaque;
}
get { return _opaque; }
set {
if (_opaque != value) {
_opaque = value;

}
get {
return _onEnter;
}
get { return _onEnter; }
set {
if (_onEnter != value) {
_onEnter = value;

}
PointerEnterEventListener _onEnter;
public void _handleEnter(PointerEnterEvent _event) {
if (_onEnter != null)
_onEnter(_event);
PointerEnterEventListener _onEnter;
public void _handleEnter(PointerEnterEvent _event) {
if (_onEnter != null) {
_onEnter(_event);
}
get {
return _onHover;
}
get { return _onHover; }
set {
if (_onHover != value) {
_onHover = value;

}
PointerHoverEventListener _onHover;
PointerHoverEventListener _onHover;
if (_onHover != null)
if (_onHover != null) {
}
get {
return _onExit;
}
get { return _onExit; }
set {
if (_onExit != value) {
_onExit = value;

}
PointerExitEventListener _onExit;
PointerExitEventListener _onExit;
if (_onExit != null)
if (_onExit != null) {
}
get {
return _hoverAnnotation;
}
get { return _hoverAnnotation; }
public void _markPropertyUpdated( bool mustRepaint ) {
public void _markPropertyUpdated(bool mustRepaint) {
_onEnter != null ||
_onHover != null ||
_onExit != null ||
opaque) && RendererBinding.instance.mouseTracker.mouseIsConnected;
_onEnter != null ||
_onHover != null ||
_onExit != null ||
opaque) && RendererBinding.instance.mouseTracker.mouseIsConnected;
if (mustRepaint)
if (mustRepaint) {
}
}
}
void _setAnnotationIsActive(bool value) {
bool annotationWasActive = _annotationIsActive;
_annotationIsActive = value;

}
}
void _handleUpdatedMouseIsConnected() {
void _handleUpdatedMouseIsConnected() {
owner = (PipelineOwner)owner;
owner = (PipelineOwner) owner;
get {
return base.needsCompositing || _annotationIsActive;
}
get { return base.needsCompositing || _annotationIsActive; }
AnnotatedRegionLayer<MouseTrackerAnnotation> layer = new AnnotatedRegionLayer<MouseTrackerAnnotation>(
_hoverAnnotation,
size: size,
offset: offset,
opaque: opaque // TODO
);
context.pushLayer(layer, base.paint, offset);
} else {
base.paint(context, offset);
AnnotatedRegionLayer<MouseTrackerAnnotation> layer = new AnnotatedRegionLayer<MouseTrackerAnnotation>(
_hoverAnnotation,
size: size,
offset: offset,
opaque: opaque // TODO
);
context.pushLayer(layer, base.paint, offset);
}
else {
base.paint(context, offset);
}
}
"listeners",
new Dictionary<string, Delegate>{
{"enter", onEnter},
{"hover", onHover},
{"exit", onExit},
},
ifEmpty: "<none>"
"listeners",
new Dictionary<string, Delegate> {
{"enter", onEnter},
{"hover", onHover},
{"exit", onExit},
},
ifEmpty: "<none>"
));
properties.add(new DiagnosticsProperty<bool>("opaque", opaque, defaultValue: true));
}

public override bool isRepaintBoundary {
get { return true; }
}
Future<ui.Image> toImage( float pixelRatio = 1.0f) {
Future<Image> toImage(float pixelRatio = 1.0f) {
D.assert(!debugNeedsPaint);
OffsetLayer offsetLayer = layer as OffsetLayer;
return offsetLayer.toImage(Offset.zero & size, pixelRatio: pixelRatio);

public bool absorbing {
get { return _absorbing; }
set {
if (_absorbing == value)
if (_absorbing == value) {
}
_absorbing = value;
}
}

}
}
class RenderIndexedSemantics : RenderProxyBox {
public RenderIndexedSemantics(
RenderBox child = null,
int index = 0
) : base(child: child) {
_index = index;
}
int _index;
public int index {
get { return _index; }
set {
if (value == index) {
return;
}
_index = value;
}
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<int>("index", index));
}
}
public class RenderLeaderLayer : RenderProxyBox {
public RenderLeaderLayer(
LayerLink link = null,

public override void paint(PaintingContext context, Offset offset) {
if (layer == null) {
layer = new LeaderLayer(link: link, offset: offset);
} else {
LeaderLayer leaderLayer = (LeaderLayer)layer;
}
else {
LeaderLayer leaderLayer = (LeaderLayer) layer;
context.pushLayer(layer, base.paint, Offset.zero);
D.assert(layer != null);
}

D.assert(link != null);
this.link = link;
this.showWhenUnlinked = showWhenUnlinked;
this.offset = offset?? Offset.zero;
this.offset = offset ?? Offset.zero;
}
public LayerLink link {

}
public new FollowerLayer layer {
get {
return base.layer as FollowerLayer;
}
get { return base.layer as FollowerLayer; }
if (layer == value)
if (layer == value) {
}
Matrix4 getCurrentTransform() {
return layer?.getLastTransform() ?? Matrix4.identity();
}

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


using System;
using System.Collections.Generic;
using UIWidgets.Runtime.rendering;
using Unity.Jobs.LowLevel.Unsafe;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;

public class Directionality : InheritedWidget {
public Directionality(
Widget child,
TextDirection textDirection ,
TextDirection textDirection,
Key key = null
) : base(key, child) {
this.textDirection = textDirection;

public override bool updateShouldNotify(InheritedWidget oldWidget) {
return textDirection != ((Directionality) oldWidget).textDirection;
}
Key key = null,
float opacity = 0.0f,
Key key = null,
float opacity = 0.0f,
Widget child = null) : base(key, child) {
D.assert(opacity >= 0.0 && opacity <= 1.0);
this.opacity = opacity;

properties.add(new FloatProperty("opacity", opacity));
}
}
public class ShaderMask : SingleChildRenderObjectWidget {
public class ShaderMask : SingleChildRenderObjectWidget {
) : base(key: key, child: child){
) : base(key: key, child: child) {
D.assert(shaderCallback != null);
D.assert(blendMode != null);
this.shaderCallback = shaderCallback;

public readonly ShaderCallback shaderCallback;
public readonly BlendMode blendMode;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderShaderMask(
shaderCallback: shaderCallback,

renderObject = (RenderShaderMask)renderObject;
((RenderShaderMask)renderObject).shaderCallback = shaderCallback;
((RenderShaderMask)renderObject).blendMode = blendMode;
renderObject = (RenderShaderMask) renderObject;
((RenderShaderMask) renderObject).shaderCallback = shaderCallback;
((RenderShaderMask) renderObject).blendMode = blendMode;
}
}

}
}
public class CustomPaint : SingleChildRenderObjectWidget {
public CustomPaint(

Clip clipBehavior = Clip.antiAlias,
Widget child = null
) : base(key: key, child: child) {
this.borderRadius = borderRadius ?? BorderRadius.zero;
this.clipper = clipper;
this.clipBehavior = clipBehavior;

properties.add(new DiagnosticsProperty<CustomClipper<Path>>("clipper", clipper, defaultValue: null));
}
}
public class PhysicalModel : SingleChildRenderObjectWidget {
public PhysicalModel(
Key key = null,

properties.add(new ColorProperty("shadowColor", shadowColor));
}
}
public class PhysicalShape : SingleChildRenderObjectWidget {
public PhysicalShape(
Key key = null,

properties.add(new ColorProperty("shadowColor", shadowColor));
}
}
public class Transform : SingleChildRenderObjectWidget {
public Transform(
Key key = null,

return new Transform(key,
Matrix4.rotationZ(angle),
origin,
alignment,
transformHitTests,
alignment,
transformHitTests,
child);
}

) {
return new Transform(
key,
Matrix4.translationValues(offset.dx, offset.dy, 0.0f),
Matrix4.translationValues(offset.dx, offset.dy, 0.0f),
null,
transformHitTests,
null,
transformHitTests,
child);
}

) {
return new Transform(key,
Matrix4.diagonal3Values(scale, scale, 1.0f),
origin,
alignment ?? Alignment.center,
transformHitTests,
origin,
alignment ?? Alignment.center,
transformHitTests,
child);
}

renderObject.transformHitTests = transformHitTests;
}
}
public class CompositedTransformTarget : SingleChildRenderObjectWidget {
public CompositedTransformTarget(
Key key = null,

properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
}
}
Key key = null,
Key key = null,
bool transformHitTests = true,
bool transformHitTests = true,
Widget child = null) : base(key: key, child: child) {
this.translation = translation;
this.transformHitTests = transformHitTests;

((RenderFractionalTranslation) renderObject).transformHitTests = transformHitTests;
}
}
public class RotatedBox : SingleChildRenderObjectWidget {
public RotatedBox(
Key key = null,

(renderObject as RenderRotatedBox).quarterTurns = quarterTurns ?? 0;
}
}
public class Padding : SingleChildRenderObjectWidget {
public Padding(
Key key = null,

properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding));
}
}
public class Align : SingleChildRenderObjectWidget {
public class Align : SingleChildRenderObjectWidget {
public Align(
Key key = null,
AlignmentGeometry alignment = null,

public class CustomSingleChildLayout : SingleChildRenderObjectWidget {
public CustomSingleChildLayout(
Key key = null,
SingleChildLayoutDelegate layoutDelegate = null,
SingleChildLayoutDelegate layoutDelegate = null,
Widget child = null) : base(key: key, child: child) {
D.assert(layoutDelegate != null);
this.layoutDelegate = layoutDelegate;

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

public class CustomMultiChildLayout : MultiChildRenderObjectWidget {
public CustomMultiChildLayout(
Key key = null,

((RenderCustomMultiChildLayoutBox) renderObject).layoutDelegate = layoutDelegate;
}
}
Key key = null,
float? width = null,
float? height = null,
Key key = null,
float? width = null,
float? height = null,
Widget child = null)
: base(key: key, child: child) {
this.width = width;

public static SizedBox expand(
Key key = null,
Key key = null,
Key key = null,
Key key = null,
Widget child = null) {
return new SizedBox(key, 0, 0, child);
}

constraints, showName: false));
}
}
public class UnconstrainedBox : SingleChildRenderObjectWidget {
public UnconstrainedBox(
Key key = null,

base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new EnumProperty<Axis?>("constrainedAxis", null));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection) textDirection,
defaultValue: null));
}
}

properties.add(new FloatProperty("heightFactor", heightFactor, defaultValue: null));
}
}
public class LimitedBox : SingleChildRenderObjectWidget {
public LimitedBox(
Key key = null,

}
}
public class SizedOverflowBox : SingleChildRenderObjectWidget {
public class SizedOverflowBox : SingleChildRenderObjectWidget {
public SizedOverflowBox(
Key key = null,
Size size = null,

this.alignment = alignment ?? Alignment.center;
}
public readonly AlignmentGeometry alignment;
public readonly Size size;
public readonly AlignmentGeometry alignment;
public readonly Size size;
alignment: alignment,
requestedSize: size,
textDirection: Directionality.of(context)
alignment: alignment,
requestedSize: size,
textDirection: Directionality.of(context)
renderObject = (RenderSizedOverflowBox)renderObject;
renderObject = (RenderSizedOverflowBox) renderObject;
((RenderSizedOverflowBox)renderObject).textDirection = Directionality.of(context);
((RenderSizedOverflowBox) renderObject).textDirection = Directionality.of(context);
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));

public class Offstage : SingleChildRenderObjectWidget {
public Offstage(
Key key = null,
bool offstage = true,
Key key = null,
bool offstage = true,
Widget child = null) : base(key: key, child: child) {
this.offstage = offstage;
}

return new _OffstageElement(this);
}
}
class _OffstageElement : SingleChildRenderObjectElement {
internal _OffstageElement(Offstage widget) : base(widget) {
}

}
}
}
Key key = null,
float? stepWidth = null,
float? stepHeight = null,
Key key = null,
float? stepWidth = null,
float? stepHeight = null,
Widget child = null)
: base(key: key, child: child) {
D.assert(stepWidth == null || stepWidth >= 0.0f);

public readonly TextBaseline? baselineType;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderBaseline(baseline: baseline ?? 0.0f, baselineType: baselineType ?? TextBaseline.alphabetic);
return new RenderBaseline(baseline: baseline ?? 0.0f,
baselineType: baselineType ?? TextBaseline.alphabetic);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObjectRaw) {

}
}
public class SliverToBoxAdapter : SingleChildRenderObjectWidget {
public SliverToBoxAdapter(
Key key = null,

properties.add(new DiagnosticsProperty<EdgeInsets>("padding", padding));
}
}
public class AspectRatio : SingleChildRenderObjectWidget {
public AspectRatio(
Key key = null,

D.assert(aspectRatio != null);
this.aspectRatio = aspectRatio;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new FloatProperty("aspectRatio", aspectRatio));

public class MouseRegion : StatefulWidget {
public class MouseRegion : StatefulWidget {
PointerHoverEventListener onHover= null,
bool opaque = true,
PointerHoverEventListener onHover = null,
bool opaque = true,
) : base(key: key) {
D.assert(opaque != null);
this.onEnter = onEnter;
this.onExit = onExit;
this.onHover = onHover;
this.opaque = opaque;
this.child = child;
) : base(key: key) {
D.assert(opaque != null);
this.onEnter = onEnter;
this.onExit = onExit;
this.onHover = onHover;
this.opaque = opaque;
this.child = child;
}
public readonly PointerEnterEventListener onEnter;

public override State createState() {
return new _MouseRegionState();
}
if (onEnter != null)
listeners.Add("enter");
if (onExit != null)
listeners.Add("exit");
if (onHover != null)
listeners.Add("hover");
if (onEnter != null) {
listeners.Add("enter");
}
if (onExit != null) {
listeners.Add("exit");
}
if (onHover != null) {
listeners.Add("hover");
}
}
public class _MouseRegionState : State<MouseRegion> {
}
public class _MouseRegionState : State<MouseRegion> {
if (widget.onExit != null && mounted)
if (widget.onExit != null && mounted) {
}
return widget.onExit == null ? (PointerExitEventListener) null : handleExit;
}
return widget.onExit == null ? (PointerExitEventListener) null : handleExit;
}
public class _RawMouseRegion : SingleChildRenderObjectWidget {
public class _RawMouseRegion : SingleChildRenderObjectWidget {
onEnter: widget.onEnter,
onHover: widget.onHover,
onExit: owner.getHandleExit(),
opaque: widget.opaque
onEnter: widget.onEnter,
onHover: widget.onHover,
onExit: owner.getHandleExit(),
opaque: widget.opaque
}
void updateRenderObject(BuildContext context, RenderMouseRegion renderObject) {
}
void updateRenderObject(BuildContext context, RenderMouseRegion renderObject) {
MouseRegion widget = owner.widget;
renderObject.onEnter = widget.onEnter;
renderObject.onHover = widget.onHover;

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<AlignmentGeometry>("alignment", alignment));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection)textDirection, defaultValue: null));
properties.add(new EnumProperty<TextDirection>("textDirection", (TextDirection) textDirection,
defaultValue: null));
properties.add(new EnumProperty<StackFit>("fit", fit));
properties.add(new EnumProperty<Overflow>("overflow", overflow));
}

StackFit sizing = StackFit.loose,
int index = 0,
List<Widget> children = null
) : base(key: key, alignment: alignment ?? AlignmentDirectional.topStart, textDirection: textDirection , fit: sizing, children: children) {
) : base(key: key, alignment: alignment ?? AlignmentDirectional.topStart, textDirection: textDirection,
fit: sizing, children: children) {
this.index = index;
}

public class Positioned : ParentDataWidget<StackParentData> {
public Positioned(
Key key = null,
float? left = null,
Key key = null,
float? left = null,
float? right = null,
float? bottom = null,
float? width = null,
float? right = null,
float? bottom = null,
float? width = null,
float? height = null,
Widget child = null) :
base(key, child) {

}
public static Positioned fromRect(
Rect rect = null,
Widget child = null,
Rect rect = null,
Widget child = null,
return new Positioned( key: key,
return new Positioned(key: key,
top: rect.top,
width: rect.width,
top: rect.top,
width: rect.width,
right:null,
bottom:null,
child:child);
right: null,
bottom: null,
child: child);
RelativeRect rect = null,
RelativeRect rect = null,
) {
return new Positioned( key: key, left: rect.left,
top: rect.top,
right: rect.right,
bottom: rect.bottom,
height:null,
width:null,
child:child);
) {
return new Positioned(key: key, left: rect.left,
top: rect.top,
right: rect.right,
bottom: rect.bottom,
height: null,
width: null,
child: child);
Widget child = null,
Widget child = null,
key: key,
key: key,
child:child);
child: child);
float? start = null,
float? start = null,
float? end = null,
float? bottom = null,
float? width = null,
float? end = null,
float? bottom = null,
float? width = null,
) {
) {
float? left = null;
float? right = null;
switch (textDirection) {

break;
}
return new Positioned(
key: key,
left: left,
top: top,
right: right,
bottom: bottom,
return new Positioned(
key: key,
left: left,
top: top,
right: right,
bottom: bottom,
child:child);
child: child);
}
public readonly float? left;

properties.add(new FloatProperty("height", height, defaultValue: null));
}
}
public class PositionedDirectional : StatelessWidget {
public PositionedDirectional(
Key key = null,

public readonly float? width;
public readonly float? height;
public readonly Widget child;
textDirection: Directionality.of(context),
start: start,
top: top,
end: end,
bottom: bottom,
width: width,
height: height,
child: child
textDirection: Directionality.of(context),
start: start,
top: top,
end: end,
bottom: bottom,
width: width,
height: height,
child: child
public class Flex : MultiChildRenderObjectWidget {
public Flex(
Key key = null,

properties.add(new EnumProperty<TextBaseline?>("textBaseline", textBaseline, defaultValue: null));
}
}
public class Row : Flex {
public Row(

}
public static class LayoutUtils {
public static AxisDirection getAxisDirectionFromAxisReverseAndDirectionality(
BuildContext context,

}
/*public class Flow : MultiChildRenderObjectWidget {
public Flow(

renderObject._delegate = _delegate;
}
}*/
TextAlign textAlign = TextAlign.start,
TextAlign textAlign = TextAlign.start,
TextDirection? textDirection = null,
bool softWrap = true,
TextOverflow overflow = TextOverflow.clip,

) : base(key: key, children: _extractChildren(text)) {
D.assert(text != null);
D.assert(maxLines == null || maxLines > 0);
this.text = text;
this.textAlign = textAlign;
this.textDirection = textDirection;

public static List<Widget> _extractChildren(InlineSpan span) {
List<Widget> result = new List<Widget>();
span.visitChildren((InlineSpan span1)=> {
if (span1 is WidgetSpan) {
result.Add(((WidgetSpan)span1).child);
}
return true;
span.visitChildren((InlineSpan span1) => {
if (span1 is WidgetSpan) {
result.Add(((WidgetSpan) span1).child);
}
return true;
public readonly TextAlign textAlign;
public readonly TextDirection? textDirection;
public readonly bool softWrap;
public readonly TextOverflow overflow;
public readonly float textScaleFactor;
public readonly int? maxLines;
public readonly Locale locale;
public readonly StrutStyle strutStyle;
public readonly TextWidthBasis textWidthBasis;
public readonly ui.TextHeightBehavior textHeightBehavior;
public readonly TextAlign textAlign;
public readonly TextDirection? textDirection;
public readonly bool softWrap;
public readonly TextOverflow overflow;
public readonly float textScaleFactor;
public readonly int? maxLines;
public readonly Locale locale;
public readonly StrutStyle strutStyle;
public readonly TextWidthBasis textWidthBasis;
public readonly TextHeightBehavior textHeightBehavior;
return new RenderParagraph(text:text,
textAlign: textAlign,
textDirection: textDirection ?? Directionality.of(context),
softWrap: softWrap,
overflow: overflow,
textScaleFactor: textScaleFactor,
maxLines: maxLines,
strutStyle: strutStyle,
textWidthBasis: textWidthBasis,
textHeightBehavior: textHeightBehavior,
locale: locale ?? Localizations.localeOf(context, nullOk: true)
return new RenderParagraph(text: text,
textAlign: textAlign,
textDirection: textDirection ?? Directionality.of(context),
softWrap: softWrap,
overflow: overflow,
textScaleFactor: textScaleFactor,
maxLines: maxLines,
strutStyle: strutStyle,
textWidthBasis: textWidthBasis,
textHeightBehavior: textHeightBehavior,
locale: locale ?? Localizations.localeOf(context, nullOk: true)
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
renderObject = (RenderParagraph) renderObject;
D.assert(textDirection != null || WidgetsD.debugCheckHasDirectionality(context));

((RenderParagraph) renderObject).softWrap = softWrap;
((RenderParagraph) renderObject).overflow = overflow;
((RenderParagraph) renderObject).textScaleFactor = textScaleFactor;
((RenderParagraph) renderObject).textScaleFactor = textScaleFactor;
((RenderParagraph) renderObject).maxLines = maxLines;
((RenderParagraph) renderObject).strutStyle = strutStyle;
((RenderParagraph) renderObject).textWidthBasis = textWidthBasis;

properties.add( new EnumProperty<TextAlign>("textAlign", textAlign, defaultValue: TextAlign.start));
properties.add( new EnumProperty<TextDirection>("textDirection", textDirection.Value, defaultValue: null));
properties.add( new FlagProperty("softWrap", value: softWrap, ifTrue: "wrapping at box width", ifFalse: "no wrapping except at line break characters", showName: true));
properties.add( new EnumProperty<TextOverflow>("overflow", overflow, defaultValue: TextOverflow.clip));
properties.add( new FloatProperty("textScaleFactor", textScaleFactor, defaultValue: 1.0));
properties.add( new IntProperty("maxLines", maxLines, ifNull: "unlimited"));
properties.add( new EnumProperty<TextWidthBasis>("textWidthBasis", textWidthBasis, defaultValue: TextWidthBasis.parent));
properties.add( new StringProperty("text", text.toPlainText()));
properties.add(new EnumProperty<TextAlign>("textAlign", textAlign, defaultValue: TextAlign.start));
properties.add(new EnumProperty<TextDirection>("textDirection", textDirection.Value, defaultValue: null));
properties.add(new FlagProperty("softWrap", value: softWrap, ifTrue: "wrapping at box width",
ifFalse: "no wrapping except at line break characters", showName: true));
properties.add(new EnumProperty<TextOverflow>("overflow", overflow, defaultValue: TextOverflow.clip));
properties.add(new FloatProperty("textScaleFactor", textScaleFactor, defaultValue: 1.0));
properties.add(new IntProperty("maxLines", maxLines, ifNull: "unlimited"));
properties.add(new EnumProperty<TextWidthBasis>("textWidthBasis", textWidthBasis,
defaultValue: TextWidthBasis.parent));
properties.add(new StringProperty("text", text.toPlainText()));
public class RawImage : LeafRenderObjectWidget {
public RawImage(
Key key = null,

public override RenderObject createRenderObject(BuildContext context) {
TextDirection? textDirection = null;
if ((matchTextDirection || !(alignment is Alignment)))
if ((matchTextDirection || !(alignment is Alignment))) {
}
return new RenderImage(
image: image,
width: width,

repeat: repeat,
centerSlice: centerSlice,
matchTextDirection: matchTextDirection,
textDirection: textDirection,
textDirection: textDirection,
invertColors: invertColors,
filterQuality: filterQuality
);

TextDirection? textDirection = null;
if ((matchTextDirection || !(alignment is Alignment)))
if ((matchTextDirection || !(alignment is Alignment))) {
}
var renderImage = (RenderImage) renderObject;
renderImage.image = image;
renderImage.width = width;

properties.add(new EnumProperty<ImageRepeat>("repeat", repeat, defaultValue: ImageRepeat.noRepeat));
properties.add(new DiagnosticsProperty<Rect>("centerSlice", centerSlice,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new FlagProperty("matchTextDirection", value: matchTextDirection, ifTrue: "match text direction"));
properties.add(new FlagProperty("matchTextDirection", value: matchTextDirection,
ifTrue: "match text direction"));
properties.add(new DiagnosticsProperty<bool>("invertColors", invertColors));
properties.add(new EnumProperty<FilterQuality>("filterMode", filterQuality));
}

DefaultAssetBundle result =
(DefaultAssetBundle) context.dependOnInheritedWidgetOfExactType<DefaultAssetBundle>();
return result?.bundle;
}
public override bool updateShouldNotify(InheritedWidget oldWidget) {

) :base(key: new GlobalObjectKey<State>(renderBox)) {
) : base(key: new GlobalObjectKey<State>(renderBox)) {
public readonly RenderBox renderBox;
public readonly VoidCallback onBuild;

public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
if (onBuild != null)
if (onBuild != null) {
}
}
}

PointerDownEventListener onPointerDown = null,
PointerMoveEventListener onPointerMove = null,
PointerEnterEventListener onPointerEnter = null,//
PointerExitEventListener onPointerExit = null,//
PointerEnterEventListener onPointerEnter = null, //
PointerExitEventListener onPointerExit = null, //
PointerHoverEventListener onPointerHover = null,
PointerUpEventListener onPointerUp = null,
PointerCancelEventListener onPointerCancel = null,

//this.onPointerEnter = onPointerEnter;
this.behavior = behavior;
}
public readonly PointerDownEventListener onPointerDown;

child: result
);
}
result = new _PointerListener(
onPointerDown: onPointerDown,
onPointerUp: onPointerUp,

return result;
}
}
PointerDownEventListener onPointerDown = null,
PointerDownEventListener onPointerDown = null,
PointerMoveEventListener onPointerMove = null,
PointerUpEventListener onPointerUp = null,
PointerCancelEventListener onPointerCancel = null,

) :
base(key: key, child: child) {
base(key: key, child: child) {
D.assert(behavior != null);
this.onPointerDown = onPointerDown;
this.onPointerMove = onPointerMove;

renderObject.onPointerCancel = onPointerCancel;
renderObject.onPointerSignal = onPointerSignal;
renderObject.behavior = behavior;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

public class RepaintBoundary : SingleChildRenderObjectWidget {
public RepaintBoundary(
Key key = null,
Widget child = null) :
Widget child = null) :
base(key: key, child: child) {
}

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

}
}
public class IndexedSemantics : SingleChildRenderObjectWidget {
public IndexedSemantics(
Key key = null,
int index = 0,
Widget child = null
) : base(key: key, child: child) {
this.index = index;
}
public readonly int index;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderIndexedSemantics(index: index);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
var _renderObject = (RenderIndexedSemantics) renderObject;
_renderObject.index = index;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<int>("index", index));
}
}
public class KeyedSubtree : StatelessWidget {
public KeyedSubtree(
Key key = null,

return builder(context);
}
}
public class StatefulBuilder : StatefulWidget {
public StatefulBuilder(
Key key = null,

return new _StatefulBuilderState();
}
}
public class _StatefulBuilderState : State<StatefulBuilder> {
public override Widget build(BuildContext context) {
return widget.builder(context, setState);

Color color = null,
Color color = null,
public override void updateRenderObject(BuildContext context,RenderObject renderObject) {
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
((_RenderColoredBox) renderObject).color = color;
((_RenderColoredBox) renderObject).color = color;
}

: base(behavior: HitTestBehavior.opaque) {
_color = color;
}
public Color color {
public Color color {
get { return _color; }
set {
D.assert(value != null);

_color = value;
markNeedsPaint();
}

public override void paint(PaintingContext context, Offset offset) {
if (size > Size.zero) {
Paint paint = new Paint();

if (child != null) {
context.paintChild(child, offset);
}

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


return null;
}
return new Container(child: children[index]);
return new IndexedSemantics(child: children[index], index: index);
}
public int trueIndexOf(int index) {

RenderListWheelViewport renderObject = this.renderObject;
D.assert(renderObject.debugValidateChild(child));
int slotNum = (int) slot;
if(slotNum >= 1)
renderObject.insert(child as RenderBox, after: _childElements.getOrDefault(slotNum - 1).renderObject as RenderBox);
renderObject.insert(child as RenderBox, after: _childElements.getOrDefault(slotNum - 1)?.renderObject as RenderBox);
D.assert(renderObject == this.renderObject);
}

正在加载...
取消
保存