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-12 00:52:36 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cd4811ff68f930116dfc16c2e1a1a0a8f411bb83
cd4811ff
1 parent
f1566084
Add ensureScreenSizeAndInit + make init sync
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
lib/src/screen_util.dart
lib/src/screen_util.dart
View file @
cd4811f
...
...
@@ -92,16 +92,13 @@ class ScreenUtil {
}
}
static
Future
<
void
>
configure
({
static
void
configure
({
MediaQueryData
?
data
,
Size
?
designSize
,
bool
?
splitScreenMode
,
bool
?
minTextAdapt
,
bool
?
ensureScreenHasSize
,
FontSizeResolver
?
fontSizeResolver
,
})
async
{
if
(
ensureScreenHasSize
??
false
)
await
ScreenUtil
.
ensureScreenSize
();
})
{
try
{
if
(
data
!=
null
)
_instance
.
_data
=
data
;
...
...
@@ -135,24 +132,40 @@ class ScreenUtil {
}
/// Initializing the library.
static
Future
<
void
>
init
(
static
void
init
(
BuildContext
context
,
{
Size
designSize
=
defaultSize
,
bool
splitScreenMode
=
false
,
bool
minTextAdapt
=
false
,
bool
ensureScreenSize
=
false
,
FontSizeResolver
?
fontSizeResolver
,
})
{
return
configure
(
data:
MediaQuery
.
maybeOf
(
context
),
designSize:
designSize
,
minTextAdapt:
minTextAdapt
,
splitScreenMode:
splitScreenMode
,
ensureScreenHasSize:
ensureScreenSize
,
minTextAdapt:
minTextAdapt
,
fontSizeResolver:
fontSizeResolver
,
);
}
static
Future
<
void
>
ensureScreenSizeAndInit
(
BuildContext
context
,
{
Size
designSize
=
defaultSize
,
bool
splitScreenMode
=
false
,
bool
minTextAdapt
=
false
,
FontSizeResolver
?
fontSizeResolver
,
})
{
return
ScreenUtil
.
ensureScreenSize
().
then
((
_
)
{
return
configure
(
data:
MediaQuery
.
maybeOf
(
context
),
designSize:
designSize
,
minTextAdapt:
minTextAdapt
,
splitScreenMode:
splitScreenMode
,
fontSizeResolver:
fontSizeResolver
,
);
});
}
///获取屏幕方向
///Get screen orientation
Orientation
get
orientation
=>
_orientation
;
...
...
Please
register
or
login
to post a comment