TLA Line data Source code
1 : // Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
2 : //
3 : // This file is part of Flipdare's proprietary software and contains
4 : // confidential and copyrighted material. Unauthorised copying,
5 : // modification, distribution, or use of this file is strictly
6 : // prohibited without prior written permission from Flipdare Pty Ltd.
7 : //
8 : // This software includes third-party components licensed under MIT,
9 : // BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
10 : //
11 :
12 : import 'dart:ui';
13 :
14 : extension SizeExt on Size {
15 HIT 3 : int get intWidth => width.toInt();
16 3 : int get intHeight => height.toInt();
17 :
18 4 : bool get isSquare => (width == height);
19 6 : double get min => (width < height) ? width : height;
20 6 : double get max => (width > height) ? width : height;
21 :
22 6 : Size get round => Size(width.roundToDouble(), height.roundToDouble());
23 :
24 1 : bool atLeast(
25 : double value,
26 4 : ) => (width >= value && height >= value) ? true : false;
27 :
28 1 : Size add(double value) {
29 5 : return Size(width + value, height + value);
30 : }
31 :
32 1 : Size subtract(double value) {
33 5 : return Size(width - value, height - value);
34 : }
35 :
36 1 : Size copyWith({double? width, double? height}) {
37 3 : return Size(width ?? this.width, height ?? this.height);
38 : }
39 : }
|