浏览代码

code review + fix

/main
xingwei.zhu 6 年前
当前提交
599d0e3e
共有 23 个文件被更改,包括 289 次插入240 次删除
  1. 25
      Runtime/material/arc.cs
  2. 14
      Runtime/material/drawer.cs
  3. 13
      Runtime/material/expansion_panel.cs
  4. 12
      Runtime/material/expansion_tile.cs
  5. 3
      Runtime/material/icon_button.cs
  6. 2
      Runtime/material/icons.cs
  7. 55
      Runtime/material/list_tile.cs
  8. 12
      Runtime/material/material.cs
  9. 29
      Runtime/material/mergeable_material.cs
  10. 192
      Runtime/material/shadows.cs
  11. 6
      Runtime/material/tooltip.cs
  12. 10
      Runtime/material/utils.cs
  13. 6
      Runtime/painting/geometry.cs
  14. 4
      Runtime/rendering/animated_size.cs
  15. 10
      Runtime/rendering/list_body.cs
  16. 13
      Runtime/rendering/proxy_box.cs
  17. 4
      Runtime/utils/axis_direction.cs
  18. 6
      Runtime/widgets/animated_cross_fade.cs
  19. 84
      Runtime/widgets/basic.cs
  20. 7
      Runtime/widgets/implicit_animations.cs
  21. 3
      Runtime/widgets/safe_area.cs
  22. 16
      Runtime/widgets/single_child_scroll_view.cs
  23. 3
      Runtime/widgets/transitions.cs

25
Runtime/material/arc.cs


this._center = new Offset(this.end.dx + this._radius * (this.begin.dx - this.end.dx).sign(),
this.end.dy);
if (this.begin.dx < this.end.dx) {
this._beginAngle = sweepAngle();
this._beginAngle = sweepAngle() * (this.begin.dy - this.end.dy).sign();
}
else {
this._beginAngle = Math.PI + sweepAngle() * (this.end.dy - this.begin.dy).sign();
this._endAngle = Math.PI;
}
}
else {

if (this._dirty) {
this._initialze();
;
}
return this._center;

double? _endAngle;
new public Offset begin {
public new Offset begin {
get { return base.begin; }
set {
if (value != base.begin) {

}
}
new public Offset end {
public new Offset end {
get { return base.end; }
set {
if (value != base.end) {

return Offset.zero;
}
MaterialPointArcTween beginArc {
public MaterialPointArcTween beginArc {
get {
if (this.begin == null) {
return null;

this._initialize();
;
}
return this._beginArc;

MaterialPointArcTween _beginArc;
MaterialPointArcTween endArc {
public MaterialPointArcTween endArc {
get {
if (this.end == null) {
return null;

MaterialPointArcTween _endArc;
new public Rect begin {
public new Rect begin {
get { return base.begin; }
set {
if (value != base.begin) {

}
}
new public Rect end {
public new Rect end {
get { return base.end; }
set {
if (value != base.end) {

MaterialPointArcTween _centerArc;
new public Rect begin {
public new Rect begin {
get { return base.begin; }
set {
if (value != base.begin) {

}
}
new public Rect end {
public new Rect end {
get { return base.end; }
set {
if (value != base.end) {

public override Rect lerp(double t) {
if (this._dirty) {
this._initialize();
;
}
if (t == 0.0) {

14
Runtime/material/drawer.cs


this.setState(() => { });
}
void _ensureHistoryEntry() {
if (this._historyEntry == null) {

this._controller.setValue(this._controller.value + delta);
bool opened = this._controller.value > 0.5 ? true : false;
bool opened = this._controller.value > 0.5;
if (opened != this._previouslyOpened && this.widget.drawerCallback != null) {
this.widget.drawerCallback(opened);
}

}
}
void open() {
public void open() {
this._controller.fling(velocity: 1.0);
if (this.widget.drawerCallback != null) {
this.widget.drawerCallback(true);

void close() {
public void close() {
this._controller.fling(velocity: -1.0);
if (this.widget.drawerCallback != null) {
this.widget.drawerCallback(false);

child: new RepaintBoundary(
child: new Stack(
children: new List<Widget> {
new GestureDetector(
onTap: this.close,
child: new Container(
color: this._color.evaluate(this._controller)
)
),
new Align(
alignment: this._drawerOuterAlignment,
child: new Align(

13
Runtime/material/expansion_panel.cs


using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.Networking;
namespace Unity.UIWidgets.material {
class _SaltedKey<S, V> : LocalKey {

List<ExpansionPanel> children = null,
ExpansionPanelCallback expansionCallback = null,
TimeSpan? animationDuration = null,
object initialOpenPanelValue = null) : base(key: key){
object initialOpenPanelValue = null) : base(key: key) {
this.children = children ?? new List<ExpansionPanel>();
this.expansionCallback = expansionCallback;
this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;

ExpansionPanelCallback expansionCallback = null,
TimeSpan? animationDuration = null,
object initialOpenPanelValue = null) {
children = children ?? new List<ExpansionPanelRadio>();
children: new List<ExpansionPanel>(children),
children: children.Cast<ExpansionPanel>().ToList(),
expansionCallback: expansionCallback,
animationDuration: animationDuration,
initialOpenPanelValue: initialOpenPanelValue

public readonly TimeSpan animationDuration;
//todo xingwei.zhu: make them readonly
public readonly bool _allowOnlyOnePanelOpen;
public readonly object initialOpenPanelValue;

}
public override void didUpdateWidget(StatefulWidget oldWidget) {
base.didUpdateWidget(oldWidget);
base.didUpdateWidget(_oldWidget);
if (this.widget._allowOnlyOnePanelOpen) {
D.assert(this._allIdentifierUnique(), "All object identifiers are not unique!");
foreach (ExpansionPanelRadio newChild in this.widget.children) {

constraints: new BoxConstraints(
minHeight: ExpansionPanelUtils._kPanelHeaderCollapsedHeight),
child: child.headerBuilder(
context, this._isChildExpanded(index))
context,
this._isChildExpanded(index))
)
)
),

12
Runtime/material/expansion_tile.cs


leading: this.widget.leading,
title: new DefaultTextStyle(
style: Theme.of(this.context).textTheme.subhead.copyWith(color: titleColor),
child: this.widget.title),
child: this.widget.title
),
//todo xingwei.zhu: add Icons.expand_more
child: null)
child: new Icon(Icons.expand_more)
)
)
),
new ClipRect(

return new AnimatedBuilder(
animation: this._controller.view,
builder: this._buildChildren,
child: closed
? null
: new Column(
children: this.widget.children));
child: closed ? null : new Column(children: this.widget.children));
}
}
}

3
Runtime/material/icon_button.cs


VoidCallback onPressed = null,
string tooltip = null) : base(key: key) {
D.assert(icon != null);
this.iconSize = iconSize;
this.padding = padding ?? EdgeInsets.all(8.0);
this.alignment = alignment ?? Alignment.center;

public override Widget build(BuildContext context) {
D.assert(MaterialDebug.debugCheckHasMaterial(context));
Color currentColor = null;
Color currentColor;
if (this.onPressed != null) {
currentColor = this.color;
}

2
Runtime/material/icons.cs


namespace Unity.UIWidgets.material {
public static class Icons {
public static IconData expand_more = new IconData(0xe5cf, fontFamily: "Material Icons");
public static readonly IconData expand_more = new IconData(0xe313, fontFamily: "Material Icons");
}
}

55
Runtime/material/list_tile.cs


public readonly bool selected;
Color _iconColor(ThemeData theme, ListTileTheme tileTheme) {
if (!this.enabled) {
return theme.disabledColor;

Widget titleText = new AnimatedDefaultTextStyle(
style: titleStyle,
duration: Constants.kThemeChangeDuration,
child: this.title ?? new SizedBox());
child: this.title ?? new SizedBox()
);
Widget subtitleText = null;
TextStyle subtitleStyle = null;

}
EdgeInsets _defaultContentPadding = EdgeInsets.symmetric(horizontal: 16.0);
EdgeInsets resolvedContentPadding = _defaultContentPadding;
EdgeInsets resolvedContentPadding =
this.contentPadding ?? tileTheme?.contentPadding ?? _defaultContentPadding;
return new InkWell(
onTap: this.enabled ? this.onTap : null,

isThreeLine: this.isThreeLine,
titleBaselineType: titleStyle.textBaseline,
subtitleBaselineType: subtitleStyle?.textBaseline
))
)
)
);
}
}

public override RenderObject createRenderObject(BuildContext context) {
return new _RenderListTile(
isThreeLine: this.isThreeLine,
isDense: this.isDense,
titleBaselineType: this.titleBaselineType,
subtitleBaselineType: this.subtitleBaselineType
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
_RenderListTile _renderObject = (_RenderListTile) renderObject;
_renderObject.isThreeLine = this.isThreeLine;
_renderObject.isDense = this.isDense;
_renderObject.titleBaselineType = this.titleBaselineType;
_renderObject.subtitleBaselineType = this.subtitleBaselineType;
}
}

readonly Dictionary<_ListTileSlot, Element> slotToChild = new Dictionary<_ListTileSlot, Element>();
readonly Dictionary<Element, _ListTileSlot> childToSlot = new Dictionary<Element, _ListTileSlot>();
new public _ListTile widget {
public new _ListTile widget {
new public _RenderListTile renderObject {
public new _RenderListTile renderObject {
get { return (_RenderListTile) base.renderObject; }
}

D.assert(child is RenderBox);
D.assert(this.renderObject.childToSlot.Keys.Contains(child));
_ListTileSlot slot = this.renderObject.childToSlot[(RenderBox) child];
this._updateRenderObject(null, this class="p">.renderObject.childToSlot[(RenderBox) child]);
this._updateRenderObject(null, slot);
D.assert(!this.renderObject.childToSlot.Keys.Contains(child));
D.assert(!this.renderObject.slotToChild.Keys.Contains(slot));
}

D.assert(isDense != null);
D.assert(isThreeLine != null);
D.assert(titleBaselineType != null);
this._isDense = isDense ?? false;
this._isThreeLine = isThreeLine ?? false;
this._titleBaselineType = titleBaselineType ?? TextBaseline.alphabetic;
this._subtitleBaselineType = subtitleBaselineType;
const double _horizonalTitleGrap = 16.0;
const double _horizontalTitleGap = 16.0;
const double _minVerticalPadding = 4.0;

bool _isThreeLine;
public TextBaseline titleBaseLineType {
public TextBaseline titleBaselineType {
get { return this._titleBaselineType; }
set {
if (this._titleBaselineType == value) {

TextBaseline _titleBaselineType;
public TextBaseline subtitleBaselineType {
public TextBaseline? subtitleBaselineType {
get { return this._subtitleBaselineType; }
set {
if (this._subtitleBaselineType == value) {

}
}
TextBaseline _subtitleBaselineType;
TextBaseline? _subtitleBaselineType;
public override void attach(object owner) {
base.attach(owner);

protected override double computeMinIntrinsicWidth(double height) {
double leadingWidth = this.leading != null
? Math.Max(this.leading.getMinIntrinsicWidth(height), _minLeadingWidth) + _horizonalTitleGrap
? Math.Max(this.leading.getMinIntrinsicWidth(height), _minLeadingWidth) + _horizontalTitleGap
: 0.0;
return leadingWidth + Math.Max(_minWidth(this.title, height), _minWidth(this.subtitle, height)) +
_maxWidth(this.trailing, height);

double leadingWidth = this.leading != null
? Math.Max(this.leading.getMinIntrinsicWidth(height), _minLeadingWidth) + _horizonalTitleGrap
? Math.Max(this.leading.getMaxIntrinsicWidth(height), _minLeadingWidth) + _horizontalTitleGap
: 0.0;
return leadingWidth + Math.Max(_maxWidth(this.title, height), _maxWidth(this.subtitle, height)) +
_maxWidth(this.trailing, height);

Size leadingSize = _layoutBox(this.leading, looseConstraints);
Size trailingSize = _layoutBox(this.trailing, looseConstraints);
double titleStart = hasLeading ? Math.Max(_minLeadingWidth, leadingSize.width) + _horizonalTitleGrap : 0.0;
double titleStart = hasLeading ? Math.Max(_minLeadingWidth, leadingSize.width) + _horizontalTitleGap : 0.0;
width: tileWidth - titleStart - (hasTrailing ? trailingSize.width + _horizonalTitleGrap : 0.0));
width: tileWidth - titleStart - (hasTrailing ? trailingSize.width + _horizontalTitleGap : 0.0));
Size titleSize = _layoutBox(this.title, textConstraints);
Size subtitleSize = _layoutBox(this.subtitle, textConstraints);

titleY = (tileHeight - titleSize.height) / 2.0;
}
else {
titleY = titleBaseline - _boxBaseline(this.title, this.titleBaseLineType);
subtitleY = subtitleBaseline - _boxBaseline(this.subtitle, this.subtitleBaselineType);
D.assert(this.subtitleBaselineType != null);
titleY = titleBaseline - _boxBaseline(this.title, this.titleBaselineType);
subtitleY = subtitleBaseline -
_boxBaseline(this.subtitle, this.subtitleBaselineType ?? TextBaseline.alphabetic);
tileHeight = this._defaultTileHeight;
double titleOverlap = titleY + titleSize.height - subtitleY;

12
Runtime/material/material.cs


using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;

}
static Widget _transparentInterior(ShapeBorder shape, Clip clipBehavior, Widget contents) {
static Widget _transparentInterior(
ShapeBorder shape = null,
Clip? clipBehavior = null,
Widget contents = null) {
_ShapeBorderPaint child = new _ShapeBorderPaint(
child: contents,
shape: shape);

}
clipBehavior: clipBehavior
);
clipBehavior: clipBehavior ?? Clip.none
);
}

29
Runtime/material/mergeable_material.cs


this._children = new List<MergeableMaterialItem>();
this._children.AddRange(this.widget.children);
for (int i = 0; i < this._children.Count; i += 1) {
for (int i = 0; i < this._children.Count; i++) {
if (this._children[i] is MaterialGap) {
this._initGap((MaterialGap) this._children[i]);
this._animationTuples[this._children[i].key].controller.setValue(1.0);

}
public override void dispose() {
foreach (var child in this._children) {
foreach (MergeableMaterialItem child in this._children) {
if (child is MaterialGap) {
this._animationTuples[child.key].controller.dispose();
}

}
public override void didUpdateWidget(StatefulWidget oldWidget) {
MergeableMaterial _oldWidget = (MergeableMaterial) oldWidget;
base.didUpdateWidget(_oldWidget);
base.didUpdateWidget(oldWidget);
MergeableMaterial _oldWidget = (MergeableMaterial) oldWidget;
foreach (var child in _oldWidget.children) {
foreach (MergeableMaterialItem child in _oldWidget.children) {
foreach (var child in this.widget.children) {
foreach (MergeableMaterialItem child in this.widget.children) {
newKeys.Add(child.key);
}

MaterialConstantsUtils.kMaterialEdges[MaterialType.card].bottomLeft);
D.assert(MaterialConstantsUtils.kMaterialEdges[MaterialType.card].topLeft ==
MaterialConstantsUtils.kMaterialEdges[MaterialType.card].bottomRight);
startRadius = Radius.lerp(Radius.zero, cardRadius,
startRadius = Radius.lerp(
Radius.zero,
cardRadius,
endRadius = Radius.lerp(Radius.zero, cardRadius,
endRadius = Radius.lerp(
Radius.zero,
cardRadius,
this._animationTuples[this._children[index + 1].key].endAnimation.value);
}

List<Widget> widgets = new List<Widget>();
List<Widget> slices = new List<Widget>();
int i = 0;
int i;
for (i = 0; i < this._children.Count; i++) {
if (this._children[i] is MaterialGap) {

List<Widget> children = null,
Axis mainAxis = Axis.vertical,
List<MergeableMaterialItem> items = null,
List<BoxShadow> boxShadows = null) : base(children: children, mainAxis: mainAxis) {
List<BoxShadow> boxShadows = null
) : base(children: children, mainAxis: mainAxis) {
this.items = items;
this.boxShadows = boxShadows;
}

public _RenderMergeableMaterialListBody(
List<RenderBox> children = null,
AxisDirection axisDirection = AxisDirection.down,
List<BoxShadow> boxShadows = null) : base(children: children, axisDirection: axisDirection) {
List<BoxShadow> boxShadows = null
) : base(children: children, axisDirection: axisDirection) {
this.boxShadows = boxShadows;
}

192
Runtime/material/shadows.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.material {
public static Color _kKeyUmbraOpacity = new Color(0x33000000); // alpha = 0.2
public static Color _kKeyPenumbraOpacity = new Color(0x24000000); // alpha = 0.14
public static Color _kAmbientShadowOpacity = new Color(0x1F000000); // alpha = 0.12
static readonly Color _kKeyUmbraOpacity = new Color(0x33000000); // alpha = 0.2
static readonly Color _kKeyPenumbraOpacity = new Color(0x24000000); // alpha = 0.14
static readonly Color _kAmbientShadowOpacity = new Color(0x1F000000); // alpha = 0.12
public static Dictionary<int, List<BoxShadow>> kElevationToShadow = new Dictionary<int, List<BoxShadow>> {
{
1, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 2.0), blurRadius: 1.0, spreadRadius: -1.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 1.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 3.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
2, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 1.0, spreadRadius: -2.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 2.0), blurRadius: 2.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 5.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
3, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 3.0, spreadRadius: -2.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 4.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 8.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
4, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 2.0), blurRadius: 4.0, spreadRadius: -1.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 4.0), blurRadius: 5.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 10.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
6, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 5.0, spreadRadius: -1.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 6.0), blurRadius: 10.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 18.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
8, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 5.0), blurRadius: 5.0, spreadRadius: -3.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 8.0), blurRadius: 10.0, spreadRadius: 1.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 14.0, spreadRadius: 2.0,
color: _kAmbientShadowOpacity)
}
}, {
9, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 5.0), blurRadius: 6.0, spreadRadius: -3.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 9.0), blurRadius: 12.0, spreadRadius: 1.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 16.0, spreadRadius: 2.0,
color: _kAmbientShadowOpacity)
}
}, {
12, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 7.0), blurRadius: 8.0, spreadRadius: -4.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 12.0), blurRadius: 17.0, spreadRadius: 2.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 5.0), blurRadius: 22.0, spreadRadius: 4.0,
color: _kAmbientShadowOpacity)
}
}, {
16, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 8.0), blurRadius: 10.0, spreadRadius: -5.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 16.0), blurRadius: 24.0, spreadRadius: 2.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 6.0), blurRadius: 30.0, spreadRadius: 5.0,
color: _kAmbientShadowOpacity)
}
}, {
24, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 11.0), blurRadius: 15.0, spreadRadius: -7.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 24.0), blurRadius: 38.0, spreadRadius: 3.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 9.0), blurRadius: 46.0, spreadRadius: 8.0,
color: _kAmbientShadowOpacity)
public static readonly Dictionary<int, List<BoxShadow>> kElevationToShadow =
new Dictionary<int, List<BoxShadow>> {
{
1, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 2.0), blurRadius: 1.0, spreadRadius: -1.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 1.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 3.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
2, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 1.0, spreadRadius: -2.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 2.0), blurRadius: 2.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 5.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
3, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 3.0, spreadRadius: -2.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 4.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 8.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
4, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 2.0), blurRadius: 4.0, spreadRadius: -1.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 4.0), blurRadius: 5.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 10.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
6, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 5.0, spreadRadius: -1.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 6.0), blurRadius: 10.0, spreadRadius: 0.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 1.0), blurRadius: 18.0, spreadRadius: 0.0,
color: _kAmbientShadowOpacity)
}
}, {
8, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 5.0), blurRadius: 5.0, spreadRadius: -3.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 8.0), blurRadius: 10.0, spreadRadius: 1.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 14.0, spreadRadius: 2.0,
color: _kAmbientShadowOpacity)
}
}, {
9, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 5.0), blurRadius: 6.0, spreadRadius: -3.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 9.0), blurRadius: 12.0, spreadRadius: 1.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 3.0), blurRadius: 16.0, spreadRadius: 2.0,
color: _kAmbientShadowOpacity)
}
}, {
12, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 7.0), blurRadius: 8.0, spreadRadius: -4.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 12.0), blurRadius: 17.0, spreadRadius: 2.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 5.0), blurRadius: 22.0, spreadRadius: 4.0,
color: _kAmbientShadowOpacity)
}
}, {
16, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 8.0), blurRadius: 10.0, spreadRadius: -5.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 16.0), blurRadius: 24.0, spreadRadius: 2.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 6.0), blurRadius: 30.0, spreadRadius: 5.0,
color: _kAmbientShadowOpacity)
}
}, {
24, new List<BoxShadow> {
new BoxShadow(offset: new Offset(0.0, 11.0), blurRadius: 15.0, spreadRadius: -7.0,
color: _kKeyUmbraOpacity),
new BoxShadow(offset: new Offset(0.0, 24.0), blurRadius: 38.0, spreadRadius: 3.0,
color: _kKeyPenumbraOpacity),
new BoxShadow(offset: new Offset(0.0, 9.0), blurRadius: 46.0, spreadRadius: 8.0,
color: _kAmbientShadowOpacity)
}
}
};
};
}
}

6
Runtime/material/tooltip.cs


EdgeInsets padding = null,
double verticalOffset = 24.0,
bool preferBelow = true,
Widget child = null) : base(key: key) {
Widget child = null
) : base(key: key) {
D.assert(message != null);
this.message = message;
this.height = height;

Animation<double> animation = null,
Offset target = null,
double? verticalOffset = null,
bool? preferBelow = null) : base(key: key) {
bool? preferBelow = null
) : base(key: key) {
this.message = message;
this.height = height;
this.padding = padding;

10
Runtime/material/utils.cs


public static class ArcUtils {
public const double _kOnAxisDelta = 2.0;
public static List<_Diagonal> _allDiagonals = new List<_Diagonal> {
public static readonly List<_Diagonal> _allDiagonals = new List<_Diagonal> {
new _Diagonal(_CornerId.topLeft, _CornerId.bottomRight),
new _Diagonal(_CornerId.bottomRight, _CornerId.topLeft),
new _Diagonal(_CornerId.topRight, _CornerId.bottomLeft),

}
public static class ExpansionTileUtils {
public static TimeSpan _kExpand = new TimeSpan(0, 0, 0, 0, 200);
public static readonly TimeSpan _kExpand = new TimeSpan(0, 0, 0, 0, 200);
}
public static class ExpansionPanelUtils {

public const double _kWidth = 304.0;
public const double _kEdgeDragWidth = 20.0;
public const double _kMinFlingVelocity = 365.0;
public static TimeSpan _kBaseSettleDuration = new TimeSpan(0, 0, 0, 0, 246);
public static readonly TimeSpan _kBaseSettleDuration = new TimeSpan(0, 0, 0, 0, 246);
public static TimeSpan _kFadeDuration = new TimeSpan(0, 0, 0, 0, 200);
public static TimeSpan _kShowDuration = new TimeSpan(0, 0, 0, 0, 1500);
public static readonly TimeSpan _kFadeDuration = new TimeSpan(0, 0, 0, 0, 200);
public static readonly TimeSpan _kShowDuration = new TimeSpan(0, 0, 0, 0, 1500);
}
}

6
Runtime/painting/geometry.cs


bool fitsBelow = target.dy + verticalOffset + childSize.height <= size.height - margin;
bool fitsAbove = target.dy - verticalOffset - childSize.height >= margin;
bool tooltipBelow = (preferBelow ?? true) ? fitsBelow || !fitsAbove : !(fitsAbove || !fitsBelow);
double y = 0.0;
bool tooltipBelow = (preferBelow ?? true) ? (fitsBelow || !fitsAbove) : !(fitsAbove || !fitsBelow);
double y;
if (tooltipBelow) {
y = Math.Min(target.dy + verticalOffset, size.height - margin);
}

double x = 0.0;
double x;
if (size.width - margin * 2.0 < childSize.width) {
x = (size.width - childSize.width) / 2.0;
}

4
Runtime/rendering/animated_size.cs


) : base(child: child, alignment: alignment ?? Alignment.center) {
D.assert(vsync != null);
D.assert(duration != null);
curve = curve ?? Curves.linear;
this._vsync = vsync;
this._controller = new AnimationController(

AnimationController _controller;
CurvedAnimation _animation;
SizeTween _sizeTween = new SizeTween();
readonly SizeTween _sizeTween = new SizeTween();
bool _hasVisualOverflow;
double _lastValue;

}
}
}
void _layoutUnstable() {
if (this._sizeTween.end != this.child.size) {

10
Runtime/rendering/list_body.cs


public class ListBodyParentData : ContainerParentDataMixinBoxParentData<RenderBox> {
}
delegate double __ChildSizingFunction(RenderBox child);

double mainAxisExtent = 0.0;
RenderBox child = this.firstChild;
BoxConstraints innerConstraints = null;
double position = 0.0;
BoxConstraints innerConstraints;
double position;
switch (this.axisDirection) {
case AxisDirection.right:

return this._getIntrinsicCrossAxis((RenderBox child) => child.getMinIntrinsicWidth(height));
}
D.assert(false);
return 0.0;
}

return this._getIntrinsicCrossAxis((RenderBox child) => child.getMaxIntrinsicWidth(height));
}
D.assert(false);
return 0.0;
}

return this._getIntrinsicCrossAxis((RenderBox child) => child.getMinIntrinsicHeight(width));
}
D.assert(false);
return 0.0;
}

return this._getIntrinsicCrossAxis((RenderBox child) => child.getMaxIntrinsicHeight(width));
}
D.assert(false);
return 0.0;
}

13
Runtime/rendering/proxy_box.cs


public RenderClipRect(
RenderBox child = null,
CustomClipper<Rect> clipper = null,
Clip clipBehavior = Clip.antiAlias) : base(
Clip clipBehavior = Clip.antiAlias
) : base(
child: child,
clipper: clipper,
clipBehavior: clipBehavior) {

get { return Offset.zero & this.size; }
}
public override bool hitTest(HitTestResult result, Offset position) {
public override bool hitTest(HitTestResult result, Offset position = null) {
if (this._clipper != null) {
this._updateClip();
D.assert(this._clip != null);

) : base(child: child, clipper: clipper, clipBehavior: clipBehavior) {
D.assert(clipBehavior != Clip.none);
}
protected override Path _defaultClip {
get {
var path = new Path();

public override void paint(PaintingContext context, Offset offset) {
if (this.child != null) {
this._updateClip();
//todo: xingwei.zhu pushClipPath()
//todo:xingwei.zhu pushClipPath()
// context.pushClipPath(this.needsCompositing, offset, Offset.zero & this.size,
// this._clip, base.paint, clipBehavior: this.clipBehavior);
base.paint(context, offset);

// this.color.alpha != 0xFF,
// );
// }
Paint paint = new Paint {color = this.color, style = PaintingStyle.fill};
canvas.drawPath(offsetPath, paint);
context.clipPathAndPaint(offsetPath, this.clipBehavior,

4
Runtime/utils/axis_direction.cs


using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.utils {
public class AxisDirectionUtils {
public static class AxisDirectionUtils {
public static AxisDirection? getAxisDirectionFromAxisReverseAndDirectionality(
BuildContext context,
Axis axis,

return reverse ? AxisDirection.right : AxisDirection.left;
return reverse ? AxisDirection.left : AxisDirection.right;
case Axis.vertical:
return reverse ? AxisDirection.up : AxisDirection.down;
}

6
Runtime/widgets/animated_cross_fade.cs


new Positioned(
key: topChildKey,
child: topChild)
});
}
);
}
public override State createState() {

duration: this.widget.duration,
curve: this.widget.sizeCurve,
vsync: this,
child: this.widget.layoutBuilder(topChild, topKey, bottomChild, bottomKey
)
child: this.widget.layoutBuilder(topChild, topKey, bottomChild, bottomKey)
)
);
}

84
Runtime/widgets/basic.cs


Key key = null,
CustomClipper<Rect> clipper = null,
Clip clipBehavior = Clip.hardEdge,
Widget child = null) : base(key: key, child: child) {
Widget child = null
) : base(key: key, child: child) {
this.clipper = clipper;
this.clipBehavior = clipBehavior;
}

public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<CustomClipper<Rect>>("clipper", this.clipper, defaultValue: null));
}
}
public class ClipPath : SingleChildRenderObjectWidget {
public ClipPath(
Key key = null,
CustomClipper<Path> clipper = null,
Clip clipBehavior = Clip.antiAlias,
Widget child = null
) : base(key: key, child: child) {
this.clipper = clipper;
this.clipBehavior = clipBehavior;
}
public readonly CustomClipper<Path> clipper;
public readonly Clip clipBehavior;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderClipPath(clipper: this.clipper, clipBehavior: this.clipBehavior);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
RenderClipPath _renderObject = (RenderClipPath) renderObject;
_renderObject.clipper = this.clipper;
}
public override void didUnmountRenderObject(RenderObject renderObject) {
RenderClipPath _renderObject = (RenderClipPath) renderObject;
_renderObject.clipper = null;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<CustomClipper<Path>>("clipper", this.clipper, defaultValue: null));
}
}

Key key = null,
Axis mainAxis = Axis.vertical,
bool reverse = false,
List<Widget> children = null) : base(key: key, children: children ?? new List<Widget>()) {
List<Widget> children = null
) : base(key: key, children: children ?? new List<Widget>()) {
this.mainAxis = mainAxis;
this.reverse = reverse;
}

}
}
public class ClipPath : SingleChildRenderObjectWidget {
public ClipPath(
Key key = null,
CustomClipper<Path> clipper = null,
Clip clipBehavior = Clip.antiAlias,
Widget child = null) : base(key: key, child: child) {
this.clipper = clipper;
this.clipBehavior = clipBehavior;
}
public readonly CustomClipper<Path> clipper;
public readonly Clip clipBehavior;
public override RenderObject createRenderObject(BuildContext context) {
return new RenderClipPath(clipper: this.clipper, clipBehavior: this.clipBehavior);
}
public override void updateRenderObject(BuildContext context, RenderObject renderObject) {
RenderClipPath _renderObject = (RenderClipPath) renderObject;
_renderObject.clipper = this.clipper;
}
public override void didUnmountRenderObject(RenderObject renderObject) {
RenderClipPath _renderObject = (RenderClipPath) renderObject;
_renderObject.clipper = null;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties);
properties.add(new DiagnosticsProperty<CustomClipper<Path>>("clipper", this.clipper, defaultValue: null));
}
}
public class PhysicalModel : SingleChildRenderObjectWidget {
public PhysicalModel(

7
Runtime/widgets/implicit_animations.cs


Border end = null) : base(begin: begin, end: end) {
}
public override Border lerp(double t) {
return Border.lerp(this.begin, this.end, t);
}

Matrix3 end = null) : base(begin: begin, end: end) {
}
//todo: xingwei.zhu implement full matrix3 lerp
//todo:xingwei.zhu implement full matrix3 lerp
public override Matrix3 lerp(double t) {
D.assert(this.begin != null);
D.assert(this.end != null);

Curve curve = null,
TimeSpan? duration = null
) : base(key: key, curve: curve ?? Curves.linear, duration: duration) {
D.assert(duration != null);
D.assert(margin == null || margin.isNonNegative);
D.assert(padding == null || padding.isNonNegative);
D.assert(decoration == null || decoration.debugAssertIsValid());

ColorTween _shadowColor;
protected override void forEachTween(ITweenVisitor visitor) {
this._borderRadius = (BorderRadiusTween) visitor.visit(this, this._borderRadius,
this.widget.borderRadius,
this._borderRadius = (BorderRadiusTween) visitor.visit(this, this._borderRadius, this.widget.borderRadius,
(BorderRadius value) => new BorderRadiusTween(begin: value));
this._elevation = (DoubleTween) visitor.visit(this, this._elevation, this.widget.elevation,
(double value) => new DoubleTween(begin: value, end: value));

3
Runtime/widgets/safe_area.cs


bool right = true,
bool bottom = true,
EdgeInsets mininum = null,
Widget child = null) : base(key: key) {
Widget child = null
) : base(key: key) {
D.assert(child != null);
this.left = left;
this.top = top;

16
Runtime/widgets/single_child_scroll_view.cs


public readonly Widget child;
AxisDirection? _getDirection(BuildContext context) {
AxisDirection _getDirection(BuildContext context) {
this.reverse);
this.reverse) ?? AxisDirection.down;
AxisDirection axisDirection = this._getDirection(context) ?? AxisDirection.down;
AxisDirection axisDirection = this._getDirection(context);
Widget contents = this.child;
if (this.padding != null) {
contents = new Padding(

}
public readonly AxisDirection axisDirection;
public readonly ViewportOffset offset;

return this.size.height;
}
D.assert(false);
return 0.0;
}
}

return Math.Max(0.0, this.child.size.height - this.size.height);
}
D.assert(false);
return 0.0;
}
}

protected override bool hitTestChildren(HitTestResult result, Offset position = null) {
if (this.child != null) {
Offset transformed = position + -this._paintOffset;
Offset transformed = position + (-this._paintOffset);
return this.child.hitTest(result, position: transformed);
}

double targetMainAxisExtent = 0.0;
double mainAxisExtent = 0.0;
D.assert(this.axisDirection != null);
switch (this.axisDirection) {
case AxisDirection.up:
mainAxisExtent = this.size.height;

}
public override void showOnScreen(
RenderObject descendant,
Rect rect,
RenderObject descendant = null,
Rect rect = null,
TimeSpan? duration = null,
Curve curve = null
) {

3
Runtime/widgets/transitions.cs


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

正在加载...
取消
保存