Skip to content

Commit

Permalink
Remove dead code from utils.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
imaNNeo committed Jan 10, 2025
1 parent 7ccc1ca commit 867d89b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 48 deletions.
14 changes: 0 additions & 14 deletions lib/src/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ class Utils {
/// Converts radians to degrees
double degrees(double radians) => radians * _radians2Degrees;

/// Returns a default size based on the screen size
/// that is a 70% scaled square based on the screen.
Size getDefaultSize(Size screenSize) {
Size resultSize;
if (screenSize.width < screenSize.height) {
resultSize = Size(screenSize.width, screenSize.width);
} else if (screenSize.height < screenSize.width) {
resultSize = Size(screenSize.height, screenSize.height);
} else {
resultSize = Size(screenSize.width, screenSize.height);
}
return resultSize * 0.7;
}

/// Forward the view base on its degree
double translateRotatedPosition(double size, double degree) {
return (size / 4) * math.sin(radians(degree.abs()));
Expand Down
34 changes: 0 additions & 34 deletions test/utils/utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,6 @@ void main() {
expect(Utils().degrees(1.2), closeTo(68.7549, tolerance));
});

test('test default size', () {
expect(
Utils().getDefaultSize(const Size(1080, 1920)).width,
closeTo(756, tolerance),
);
expect(
Utils().getDefaultSize(const Size(1080, 1920)).height,
closeTo(756, tolerance),
);

expect(
Utils().getDefaultSize(const Size(728, 1080)).width,
closeTo(509.6, tolerance),
);
expect(
Utils().getDefaultSize(const Size(728, 1080)).height,
closeTo(509.6, tolerance),
);

expect(
Utils().getDefaultSize(const Size(2560, 1600)).width,
closeTo(1120, tolerance),
);
expect(
Utils().getDefaultSize(const Size(2560, 1600)).height,
closeTo(1120, tolerance),
);

expect(
Utils().getDefaultSize(const Size(1000, 1000)).width,
closeTo(700, tolerance),
);
});

test('translate rotated position', () {
expect(Utils().translateRotatedPosition(100, 90), 25);
expect(Utils().translateRotatedPosition(100, 0), 0);
Expand Down

0 comments on commit 867d89b

Please sign in to comment.