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
2024-05-30 18:03:20 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
179aa72ea4b3010a794167a4f7d7c15338f3cfd1
179aa72e
1 parent
f9651f83
Add ability to exclude widgets from from rebuild list
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
lib/src/screenutil_init.dart
lib/src/screenutil_init.dart
View file @
179aa72
...
...
@@ -75,6 +75,7 @@ class ScreenUtilInit extends StatefulWidget {
this
.
useInheritedMediaQuery
=
false
,
this
.
ensureScreenSize
=
false
,
this
.
responsiveWidgets
,
this
.
excludeWidgets
,
this
.
fontSizeResolver
=
FontSizeResolvers
.
width
,
})
:
super
(
key:
key
);
...
...
@@ -90,6 +91,7 @@ class ScreenUtilInit extends StatefulWidget {
/// The [Size] of the device in the design draft, in dp
final
Size
designSize
;
final
Iterable
<
String
>?
responsiveWidgets
;
final
Iterable
<
String
>?
excludeWidgets
;
@override
State
<
ScreenUtilInit
>
createState
()
=>
_ScreenUtilInitState
();
...
...
@@ -98,6 +100,7 @@ class ScreenUtilInit extends StatefulWidget {
class
_ScreenUtilInitState
extends
State
<
ScreenUtilInit
>
with
WidgetsBindingObserver
{
final
_canMarkedToBuild
=
HashSet
<
String
>();
final
_excludedWidgets
=
HashSet
<
String
>();
MediaQueryData
?
_mediaQueryData
;
final
_binding
=
WidgetsBinding
.
instance
;
final
_screenSizeCompleter
=
Completer
<
void
>();
...
...
@@ -137,6 +140,7 @@ class _ScreenUtilInitState extends State<ScreenUtilInit>
void
_markNeedsBuildIfAllowed
(
Element
el
)
{
final
widgetName
=
el
.
widget
.
runtimeType
.
toString
();
if
(
_excludedWidgets
.
contains
(
widgetName
))
return
;
final
allowed
=
widget
is
SU
||
_canMarkedToBuild
.
contains
(
widgetName
)
||
!(
widgetName
.
startsWith
(
'_'
)
||
flutterWidgets
.
contains
(
widgetName
));
...
...
Please
register
or
login
to post a comment