Skip to content

Commit

Permalink
Add scale factors: diagonal & diameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mounir Bouaiche committed Jun 11, 2023
1 parent 5365100 commit 99c24dd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/src/screen_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ class ScreenUtil {
///Adapt according to the smaller of width or height
double radius(num r) => r * min(scaleWidth, scaleHeight);

/// Adapt according to the both width and height
double diagonal(num d) => d * scaleHeight * scaleWidth;

/// Adapt according to the maximum value of scale width and scale height
double diameter(num d) => d * max(scaleWidth, scaleHeight);

///字体大小适配方法
///- [fontSize] UI设计上字体的大小,单位dp.
///Font size adaptation method
Expand Down

0 comments on commit 99c24dd

Please sign in to comment.