浏览代码

longpressup support

/main
xingwei.zhu 5 年前
当前提交
e8375480
共有 3 个文件被更改,包括 12 次插入19 次删除
  1. 2
      Runtime/gestures/long_press.cs
  2. 6
      Runtime/widgets/gesture_detector.cs
  3. 23
      Samples/UIWidgetSample/LongPressSample.cs

2
Runtime/gestures/long_press.cs


Offset _longPressOrigin;
TimeSpan? _longPressStartTimestamp;
public GestureLongPressDragStartCallback onLongPressStart;
public GestureLongPressDragUpdateCallback onLongPressDragUpdate;

6
Runtime/widgets/gesture_detector.cs


throw new UIWidgetsError(
"Incorrect GestureDetector arguments.\n" +
"Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan. Just use the scale gesture recognizer."
);
);
string recognizer = havePan ? "pan" : "scale";
if (haveVerticalDrag && haveHorizontalDrag) {
throw new UIWidgetsError(

);
}
}
if (haveLongPress && haveLongPressDrag) {
throw new UIWidgetsError(
"Incorrect GestureDetector arguments.\n" +

23
Samples/UIWidgetSample/LongPressSample.cs


using Unity.UIWidgets.animation;
using Unity.UIWidgets.engine;
public class LongPressSample: UIWidgetsSamplePanel {
protected override Widget createWidget() {
public class LongPressSample : UIWidgetsSamplePanel {
protected override Widget createWidget() {
return new WidgetsApp(
home: new LongPressSampleWidget(),
pageRouteBuilder: this.pageRouteBuilder);

public class LongPressSampleWidget: StatefulWidget {
public class LongPressSampleWidget : StatefulWidget {
public override State createState() {
return new _LongPressSampleWidgetState();
}

public override Widget build(BuildContext context) {
return new GestureDetector(
onLongPressDragStart: (value) => {
Debug.Log($"Long Press Drag Start: {value}");
},
onLongPressDragUpdate: (value) => {
Debug.Log($"Long Press Drag Update: {value}");
},
onLongPressDragUp: (value) => {
Debug.Log($"Long Press Drag Up: {value}");
},
onLongPressDragStart: (value) => { Debug.Log($"Long Press Drag Start: {value}"); },
onLongPressDragUpdate: (value) => { Debug.Log($"Long Press Drag Update: {value}"); },
onLongPressDragUp: (value) => { Debug.Log($"Long Press Drag Up: {value}"); },
onLongPressUp: () => { Debug.Log($"Long Press Up"); },
onLongPress: () => { Debug.Log($"Long Press"); },
child: new Center(
child: new Container(
width: 200,

正在加载...
取消
保存