浏览代码

fix readonly + format issues

/main
xingwei.zhu 6 年前
当前提交
04a79c3a
共有 2 个文件被更改,包括 23 次插入32 次删除
  1. 3
      Runtime/gestures/multidrag.cs
  2. 52
      Runtime/widgets/drag_target.cs

3
Runtime/gestures/multidrag.cs


this.initialPosition = initialPosition;
}
public readonly Offset initialPosition;
readonly VelocityTracker _velocityTracker = new VelocityTracker();

public override void addPointer(PointerDownEvent pEvent) {
D.assert(this._pointers != null);
D.assert(pEvent.pointer != null);
D.assert(pEvent.position != null);
D.assert(!this._pointers.ContainsKey(pEvent.pointer));

void _handleEvent(PointerEvent pEvent) {
D.assert(this._pointers != null);
D.assert(pEvent.pointer != null);
D.assert(pEvent.timeStamp != null);
D.assert(pEvent.position != null);
D.assert(this._pointers.ContainsKey(pEvent.pointer));

52
Runtime/widgets/drag_target.cs


public class Draggable<T> : StatefulWidget {
public Draggable(
T data,
Widget child,
Widget feedback,
Widget child = null,
Widget feedback = null,
Axis? axis = null,
Widget childWhenDragging = null,
Offset feedbackOffset = null,

public class LongPressDraggable<T> : Draggable<T> {
readonly bool hapticFeedbackOnStart;
Widget child,
Widget feedback,
Key key = null,
Widget child = null,
Widget feedback = null,
Key key = null,
Widget childWhenDragging = null,
Offset feedbackOffset = null,
DragAnchor dragAnchor = DragAnchor.child,

DragEndCallback onDragEnd = null,
VoidCallback onDragCompleted = null,
bool hapticFeedbackOnStart = true
VoidCallback onDragCompleted = null
) : base(
key: key,
child: child,

onDragEnd: onDragEnd,
onDragCompleted: onDragCompleted
) {
this.hapticFeedbackOnStart = hapticFeedbackOnStart;
}
public override GestureRecognizer createRecognizer(GestureMultiDragStartCallback onStart) {

if (result != null && this.hapticFeedbackOnStart) {
//HapticFeedback.selectionClick();
}
return result;
}
};

public class DraggableDetails {
public DraggableDetails(
Velocity velocity,
Offset offset,
bool wasAccepted = false
bool wasAccepted = false,
Velocity velocity = null,
Offset offset = null
) {
D.assert(velocity != null);
D.assert(offset != null);

}
public bool wasAccepted;
public readonly bool wasAccepted;
public Velocity velocity;
public readonly Velocity velocity;
public Offset offset;
public readonly Offset offset;
DragTargetBuilder<T> builder,
DragTargetBuilder<T> builder = null,
D.assert(builder != null);
this.builder = builder;
this.onWillAccept = onWillAccept;
this.onAccept = onAccept;

public DragTargetBuilder<T> builder;
public readonly DragTargetBuilder<T> builder;
public DragTargetWillAccept<T> onWillAccept;
public readonly DragTargetWillAccept<T> onWillAccept;
public DragTargetAccept<T> onAccept;
public readonly DragTargetAccept<T> onAccept;
public DragTargetLeave<T> onLeave;
public readonly DragTargetLeave<T> onLeave;
public override State createState() {
return new _DragTargetState<T>();

readonly List<_DragTargetState<T>> _enteredTargets = new List<_DragTargetState<T>>();
OverlayEntry _entry;
Offset _lastOffset;
Offset _lastOffset;
OverlayEntry _entry;
public void update(DragUpdateDetails details) {
this._position += this._restrictAxis(details.delta);

正在加载...
取消
保存