Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
flutter_screenutil
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Mounir Bouaiche
2023-06-11 22:32:30 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e786c4300fcf7d1c927a7411e9a08647d5ecd274
e786c430
1 parent
782f1975
Add some methods to extensions
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
10 deletions
lib/src/screen_util.dart
lib/src/size_extension.dart
lib/src/screen_util.dart
View file @
e786c43
...
...
@@ -227,18 +227,31 @@ class ScreenUtil {
double
setSp
(
num
fontSize
)
=>
fontSizeResolver
?.
call
(
fontSize
,
_instance
)
??
fontSize
*
scaleText
;
Widget
setVerticalSpacing
(
num
height
)
=>
SizedBox
(
height:
setHeight
(
height
));
SizedBox
setVerticalSpacing
(
num
height
)
=>
SizedBox
(
height:
setHeight
(
height
));
Widget
setVerticalSpacingFromWidth
(
num
height
)
=>
SizedBox
setVerticalSpacingFromWidth
(
num
height
)
=>
SizedBox
(
height:
setWidth
(
height
));
Widget
setHorizontalSpacing
(
num
width
)
=>
SizedBox
(
width:
setWidth
(
width
));
SizedBox
setHorizontalSpacing
(
num
width
)
=>
SizedBox
(
width:
setWidth
(
width
));
Widget
setHorizontalSpacingRadius
(
num
width
)
=>
SizedBox
setHorizontalSpacingRadius
(
num
width
)
=>
SizedBox
(
width:
radius
(
width
));
Widget
setVerticalSpacingRadius
(
num
height
)
=>
SizedBox
setVerticalSpacingRadius
(
num
height
)
=>
SizedBox
(
height:
radius
(
height
));
SizedBox
setHorizontalSpacingDiameter
(
num
width
)
=>
SizedBox
(
width:
diameter
(
width
));
SizedBox
setVerticalSpacingDiameter
(
num
height
)
=>
SizedBox
(
height:
diameter
(
height
));
SizedBox
setHorizontalSpacingDiagonal
(
num
width
)
=>
SizedBox
(
width:
diagonal
(
width
));
SizedBox
setVerticalSpacingDiagonal
(
num
height
)
=>
SizedBox
(
height:
diagonal
(
height
));
}
extension
on
MediaQueryData
?
{
...
...
lib/src/size_extension.dart
View file @
e786c43
...
...
@@ -14,6 +14,12 @@ extension SizeExtension on num {
///[ScreenUtil.radius]
double
get
r
=>
ScreenUtil
().
radius
(
this
);
///[ScreenUtil.diagonal]
double
get
dg
=>
ScreenUtil
().
diagonal
(
this
);
///[ScreenUtil.diameter]
double
get
dm
=>
ScreenUtil
().
diameter
(
this
);
///[ScreenUtil.setSp]
double
get
sp
=>
ScreenUtil
().
setSp
(
this
);
...
...
@@ -36,22 +42,38 @@ extension SizeExtension on num {
double
get
sh
=>
ScreenUtil
().
screenHeight
*
this
;
///[ScreenUtil.setHeight]
Widget
get
verticalSpace
=>
ScreenUtil
().
setVerticalSpacing
(
this
);
SizedBox
get
verticalSpace
=>
ScreenUtil
().
setVerticalSpacing
(
this
);
///[ScreenUtil.setVerticalSpacingFromWidth]
Widget
get
verticalSpaceFromWidth
=>
SizedBox
get
verticalSpaceFromWidth
=>
ScreenUtil
().
setVerticalSpacingFromWidth
(
this
);
///[ScreenUtil.setWidth]
Widget
get
horizontalSpace
=>
ScreenUtil
().
setHorizontalSpacing
(
this
);
SizedBox
get
horizontalSpace
=>
ScreenUtil
().
setHorizontalSpacing
(
this
);
///[ScreenUtil.radius]
Widget
get
horizontalSpaceRadius
=>
SizedBox
get
horizontalSpaceRadius
=>
ScreenUtil
().
setHorizontalSpacingRadius
(
this
);
///[ScreenUtil.radius]
Widget
get
verticalSpacingRadius
=>
SizedBox
get
verticalSpacingRadius
=>
ScreenUtil
().
setVerticalSpacingRadius
(
this
);
///[ScreenUtil.diameter]
SizedBox
get
horizontalSpaceDiameter
=>
ScreenUtil
().
setHorizontalSpacingDiameter
(
this
);
///[ScreenUtil.diameter]
SizedBox
get
verticalSpacingDiameter
=>
ScreenUtil
().
setVerticalSpacingDiameter
(
this
);
///[ScreenUtil.diagonal]
SizedBox
get
horizontalSpaceDiagonal
=>
ScreenUtil
().
setHorizontalSpacingDiagonal
(
this
);
///[ScreenUtil.diagonal]
SizedBox
get
verticalSpacingDiagonal
=>
ScreenUtil
().
setVerticalSpacingDiagonal
(
this
);
}
extension
EdgeInsetsExtension
on
EdgeInsets
{
...
...
@@ -63,6 +85,20 @@ extension EdgeInsetsExtension on EdgeInsets {
left:
left
.
r
,
);
EdgeInsets
get
dm
=>
copyWith
(
top:
top
.
dm
,
bottom:
bottom
.
dm
,
right:
right
.
dm
,
left:
left
.
dm
,
);
EdgeInsets
get
dg
=>
copyWith
(
top:
top
.
dg
,
bottom:
bottom
.
dg
,
right:
right
.
dg
,
left:
left
.
dg
,
);
EdgeInsets
get
w
=>
copyWith
(
top:
top
.
w
,
bottom:
bottom
.
w
,
...
...
@@ -106,6 +142,10 @@ extension RaduisExtension on Radius {
/// Creates adapt Radius using r [SizeExtension].
Radius
get
r
=>
Radius
.
elliptical
(
x
.
r
,
y
.
r
);
Radius
get
dm
=>
Radius
.
elliptical
(
x
.
dm
,
y
.
dm
);
Radius
get
dg
=>
Radius
.
elliptical
(
x
.
dg
,
y
.
dg
);
Radius
get
w
=>
Radius
.
elliptical
(
x
.
w
,
y
.
w
);
Radius
get
h
=>
Radius
.
elliptical
(
x
.
h
,
y
.
h
);
...
...
Please
register
or
login
to post a comment