浏览代码

Merge pull request #191 from UnityTech/yczhang

Implement nested scroll view.
/main
GitHub 6 年前
当前提交
57cebb4b
共有 9 个文件被更改,包括 1073 次插入4 次删除
  1. 2
      Runtime/rendering/sliver_fill.cs
  2. 2
      Runtime/widgets/scroll_activity.cs
  3. 6
      Runtime/widgets/scroll_position.cs
  4. 2
      Runtime/widgets/scroll_view.cs
  5. 12
      Runtime/widgets/sliver.cs
  6. 30
      Runtime/painting/paint_utilities.cs
  7. 11
      Runtime/painting/paint_utilities.cs.meta
  8. 1001
      Runtime/widgets/nested_scroll_view.cs
  9. 11
      Runtime/widgets/nested_scroll_view.cs.meta

2
Runtime/rendering/sliver_fill.cs


public class RenderSliverFillRemaining : RenderSliverSingleBoxAdapter {
public RenderSliverFillRemaining(
RenderBox child
RenderBox child = null
) : base(child: child) {
}

2
Runtime/widgets/scroll_activity.cs


}
}
protected bool applyMoveTo(float value) {
protected virtual bool applyMoveTo(float value) {
return this.del.setPixels(value) == 0.0;
}

6
Runtime/widgets/scroll_position.cs


ScrollContext context = null,
bool keepScrollOffset = true,
ScrollPosition oldPosition = null,
string debugLabel = null
string debugLabel = null,
object coordinator = null
) {
D.assert(physics != null);
D.assert(context != null);

this.context = context;
this.keepScrollOffset = keepScrollOffset;
this.debugLabel = debugLabel;
this._coordinator = coordinator;
if (oldPosition != null) {
this.absorb(oldPosition);

public readonly bool keepScrollOffset;
public readonly string debugLabel;
internal readonly object _coordinator;
public float minScrollExtent {
get { return this._minScrollExtent.Value; }

2
Runtime/widgets/scroll_view.cs


protected abstract List<Widget> buildSlivers(BuildContext context);
protected Widget buildViewport(
protected virtual Widget buildViewport(
BuildContext context,
ViewportOffset offset,
AxisDirection axisDirection,

12
Runtime/widgets/sliver.cs


}
}
class SliverFillRemaining : SingleChildRenderObjectWidget {
public SliverFillRemaining(
Key key = null,
Widget child = null
) : base(key: key, child: child) {
}
public override RenderObject createRenderObject(BuildContext context) {
return new RenderSliverFillRemaining();
}
}
public class KeepAlive : ParentDataWidget<SliverMultiBoxAdaptorWidget> {
public KeepAlive(
Key key = null,

30
Runtime/painting/paint_utilities.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
namespace Unity.UIWidgets.painting {
public static class PaintingUtilities {
public static void paintZigZag(Canvas canvas, Paint paint, Offset start, Offset end, int zigs, float width) {
D.assert(MathUtils.isFinite(zigs));
D.assert(zigs > 0);
canvas.save();
canvas.translate(start.dx, start.dy);
end = end - start;
canvas.rotate(Mathf.Atan2(end.dy, end.dx));
float length = end.distance;
float spacing = length / (zigs * 2.0f);
Path path = new Path();
path.moveTo(0.0f, 0.0f);
for (int index = 0; index < zigs; index += 1) {
float x = (index * 2.0f + 1.0f) * spacing;
float y = width * ((index % 2.0f) * 2.0f - 1.0f);
path.lineTo(x, y);
}
path.lineTo(length, 0.0f);
canvas.drawPath(path, paint);
canvas.restore();
}
}
}

11
Runtime/painting/paint_utilities.cs.meta


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

1001
Runtime/widgets/nested_scroll_view.cs
文件差异内容过多而无法显示
查看文件

11
Runtime/widgets/nested_scroll_view.cs.meta


fileFormatVersion: 2
guid: 7a5e5cc5f271e42a4828cef9cad020ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存