Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 972cc2d

Browse files
author
Yuncong Zhang
committed
Implement nested scroll view.
1 parent 9fa0936 commit 972cc2d

File tree

9 files changed

+1526
-4
lines changed

9 files changed

+1526
-4
lines changed

Runtime/painting/paint_utilities.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Unity.UIWidgets.foundation;
2+
using Unity.UIWidgets.ui;
3+
using UnityEngine;
4+
using Canvas = Unity.UIWidgets.ui.Canvas;
5+
6+
namespace Unity.UIWidgets.painting {
7+
public static class PaintingUtilities {
8+
public static void paintZigZag(Canvas canvas, Paint paint, Offset start, Offset end, int zigs, float width) {
9+
D.assert(MathUtils.isFinite(zigs));
10+
D.assert(zigs > 0);
11+
canvas.save();
12+
canvas.translate(start.dx, start.dy);
13+
end = end - start;
14+
canvas.rotate(Mathf.Atan2(end.dy, end.dx));
15+
float length = end.distance;
16+
float spacing = length / (zigs * 2.0f);
17+
Path path = new Path();
18+
path.moveTo(0.0f, 0.0f);
19+
for (int index = 0; index < zigs; index += 1) {
20+
float x = (index * 2.0f + 1.0f) * spacing;
21+
float y = width * ((index % 2.0f) * 2.0f - 1.0f);
22+
path.lineTo(x, y);
23+
}
24+
25+
path.lineTo(length, 0.0f);
26+
canvas.drawPath(path, paint);
27+
canvas.restore();
28+
}
29+
}
30+
}

Runtime/painting/paint_utilities.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/rendering/sliver_fill.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected override float estimateMaxScrollOffset(SliverConstraints constraints,
6969

7070
public class RenderSliverFillRemaining : RenderSliverSingleBoxAdapter {
7171
public RenderSliverFillRemaining(
72-
RenderBox child
72+
RenderBox child = null
7373
) : base(child: child) {
7474
}
7575

0 commit comments

Comments
 (0)