Skip to content

Commit 99c24dd

Browse files
author
Mounir Bouaiche
committed
Add scale factors: diagonal & diameter
1 parent 5365100 commit 99c24dd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/src/screen_util.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ class ScreenUtil {
207207
///Adapt according to the smaller of width or height
208208
double radius(num r) => r * min(scaleWidth, scaleHeight);
209209

210+
/// Adapt according to the both width and height
211+
double diagonal(num d) => d * scaleHeight * scaleWidth;
212+
213+
/// Adapt according to the maximum value of scale width and scale height
214+
double diameter(num d) => d * max(scaleWidth, scaleHeight);
215+
210216
///字体大小适配方法
211217
///- [fontSize] UI设计上字体的大小,单位dp.
212218
///Font size adaptation method

0 commit comments

Comments
 (0)