Line data Source code
1 : import 'dart:math'; 2 : import 'dart:ui'; 3 : 4 : import 'vector2.dart'; 5 : 6 : export 'dart:ui' show Offset; 7 : 8 : extension OffsetExtension on Offset { 9 : /// Creates an [Vector2] from the [Offset] 10 44 : Vector2 toVector2() => Vector2(dx, dy); 11 : 12 : /// Creates a [Size] from the [Offset] 13 0 : Size toSize() => Size(dx, dy); 14 : 15 : /// Creates a [Point] from the [Offset] 16 0 : Point toPoint() => Point(dx, dy); 17 : 18 : /// Creates a [Rect] starting in origin and going the [Offset] 19 0 : Rect toRect() => Rect.fromLTWH(0, 0, dx, dy); 20 : }