您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

140 行
4.8 KiB

using System.Collections.Generic;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.rendering;
namespace Unity.UIWidgets.widgets {
public abstract class ScrollNotification : ViewportNotificationMixinLayoutChangedNotification {
protected ScrollNotification(
ScrollMetrics metrics = null,
BuildContext context = null
) {
this.metrics = metrics;
this.context = context;
}
public readonly ScrollMetrics metrics;
public readonly BuildContext context;
protected override void debugFillDescription(List<string> description) {
base.debugFillDescription(description);
description.Add(this.metrics.ToString());
}
public static bool defaultScrollNotificationPredicate(ScrollNotification notification) {
return notification.depth == 0;
}
}
public class ScrollStartNotification : ScrollNotification {
public ScrollStartNotification(
ScrollMetrics metrics = null,
BuildContext context = null,
DragStartDetails dragDetails = null
) : base(metrics: metrics, context: context) {
this.dragDetails = dragDetails;
}
public readonly DragStartDetails dragDetails;
protected override void debugFillDescription(List<string> description) {
base.debugFillDescription(description);
if (this.dragDetails != null) {
description.Add(this.dragDetails.ToString());
}
}
}
public class ScrollUpdateNotification : ScrollNotification {
public ScrollUpdateNotification(
ScrollMetrics metrics = null,
BuildContext context = null,
DragUpdateDetails dragDetails = null,
double scrollDelta = 0
) : base(metrics: metrics, context: context) {
this.dragDetails = dragDetails;
this.scrollDelta = scrollDelta;
}
public readonly DragUpdateDetails dragDetails;
public readonly double scrollDelta;
protected override void debugFillDescription(List<string> description) {
base.debugFillDescription(description);
description.Add($"scrollDelta: {this.scrollDelta}");
if (this.dragDetails != null) {
description.Add(this.dragDetails.ToString());
}
}
}
public class OverscrollNotification : ScrollNotification {
public OverscrollNotification(
ScrollMetrics metrics = null,
BuildContext context = null,
DragUpdateDetails dragDetails = null,
double overscroll = 0,
double velocity = 0
) : base(metrics: metrics, context: context) {
this.dragDetails = dragDetails;
this.overscroll = overscroll;
this.velocity = velocity;
}
public readonly DragUpdateDetails dragDetails;
public readonly double overscroll;
public readonly double velocity;
protected override void debugFillDescription(List<string> description) {
base.debugFillDescription(description);
description.Add($"overscroll: {this.overscroll:F1}");
description.Add($"velocity: {this.velocity:F1}");
if (this.dragDetails != null) {
description.Add(this.dragDetails.ToString());
}
}
}
public class ScrollEndNotification : ScrollNotification {
public ScrollEndNotification(
ScrollMetrics metrics = null,
BuildContext context = null,
DragEndDetails dragDetails = null,
double overscroll = 0,
double velocity = 0
) : base(metrics: metrics, context: context) {
this.dragDetails = dragDetails;
}
public readonly DragEndDetails dragDetails;
protected override void debugFillDescription(List<string> description) {
base.debugFillDescription(description);
if (this.dragDetails != null) {
description.Add(this.dragDetails.ToString());
}
}
}
public class UserScrollNotification : ScrollNotification {
public UserScrollNotification(
ScrollMetrics metrics = null,
BuildContext context = null,
ScrollDirection direction = ScrollDirection.idle
) : base(metrics: metrics, context: context) {
this.direction = direction;
}
public readonly ScrollDirection direction;
protected override void debugFillDescription(List<string> description) {
base.debugFillDescription(description);
description.Add($"direction: {this.direction}");
}
}
public delegate bool ScrollNotificationPredicate(ScrollNotification notification);
}