1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/gestures.dart';
export 'dart:ui' show Point;
class TestPointer {
TestPointer([ this.pointer = 1 ]);
int pointer;
bool isDown = false;
Point location;
PointerDownEvent down(Point newLocation, { Duration timeStamp: const Duration() }) {
assert(!isDown);
isDown = true;
location = newLocation;
return new PointerDownEvent(
timeStamp: timeStamp,
pointer: pointer,
position: location
);
}
PointerMoveEvent move(Point newLocation, { Duration timeStamp: const Duration() }) {
assert(isDown);
Offset delta = newLocation - location;
location = newLocation;
return new PointerMoveEvent(
timeStamp: timeStamp,
pointer: pointer,
position: newLocation,
delta: delta
);
}
PointerUpEvent up({ Duration timeStamp: const Duration() }) {
assert(isDown);
isDown = false;
return new PointerUpEvent(
timeStamp: timeStamp,
pointer: pointer,
position: location
);
}
PointerCancelEvent cancel({ Duration timeStamp: const Duration() }) {
assert(isDown);
isDown = false;
return new PointerCancelEvent(
timeStamp: timeStamp,
pointer: pointer,
position: location
);
}
}