Files
flame/lib/src/extensions/size.dart
Renan ccee9a466b Move files to src and comply with the dart package layout convention (#621)
* 👌 Use `Offset` type directly in `JoystickAction.update` calculations (#631)

* Move files to src and comply with the dart package layout convention

* Fixing widgets example

Co-authored-by: Serge Matveenko <lig@countzero.co>
Co-authored-by: Erick Zanardo <erickzanardoo@gmail.com>
2021-01-20 09:05:43 -03:00

21 lines
487 B
Dart

import 'dart:math';
import 'dart:ui';
import 'vector2.dart';
export 'dart:ui' show Size;
extension SizeExtension on Size {
/// Creates an [Offset] from the [Size]
Offset toOffset() => Offset(width, height);
/// Creates a [Vector2] from the [Size]
Vector2 toVector2() => Vector2(width, height);
/// Creates a [Point] from the [Size]
Point toPoint() => Point(width, height);
/// Creates a [Rect] from the [Size]
Rect toRect() => Rect.fromLTWH(0, 0, width, height);
}