Merge pull request #1971 from pylaligand/operator
Added a few operators to the Velocity class.
diff --git a/packages/flutter/lib/src/gestures/velocity_tracker.dart b/packages/flutter/lib/src/gestures/velocity_tracker.dart
index 27fe9b4..fe2ca13 100644
--- a/packages/flutter/lib/src/gestures/velocity_tracker.dart
+++ b/packages/flutter/lib/src/gestures/velocity_tracker.dart
@@ -218,6 +218,16 @@
/// The number of pixels per second of velocity in the x and y directions.
final Offset pixelsPerSecond;
+ Velocity operator -() => new Velocity(pixelsPerSecond: -pixelsPerSecond);
+ Velocity operator -(Velocity other) {
+ return new Velocity(
+ pixelsPerSecond: pixelsPerSecond - other.pixelsPerSecond);
+ }
+ Velocity operator +(Velocity other) {
+ return new Velocity(
+ pixelsPerSecond: pixelsPerSecond + other.pixelsPerSecond);
+ }
+
bool operator ==(dynamic other) {
if (other is! Velocity)
return false;