Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e37ab48b
Unverified
Commit
e37ab48b
authored
Nov 01, 2022
by
fzyzcjy
Committed by
GitHub
Nov 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce debugWithActiveLayoutCleared to avoid duplicated code (#114003)
parent
fb9065fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
28 deletions
+26
-28
object.dart
packages/flutter/lib/src/rendering/object.dart
+26
-28
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
e37ab48b
...
@@ -1591,6 +1591,26 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
...
@@ -1591,6 +1591,26 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
static
RenderObject
?
get
debugActiveLayout
=>
_debugActiveLayout
;
static
RenderObject
?
get
debugActiveLayout
=>
_debugActiveLayout
;
static
RenderObject
?
_debugActiveLayout
;
static
RenderObject
?
_debugActiveLayout
;
/// Set [debugActiveLayout] to null when [inner] callback is called.
/// This is useful when you have to temporarily clear that variable to
/// disable some false-positive checks, such as when computing toStringDeep
/// or using custom trees.
@pragma
(
'vm:prefer-inline'
)
static
T
_withDebugActiveLayoutCleared
<
T
>(
T
Function
()
inner
)
{
RenderObject
?
debugPreviousActiveLayout
;
assert
(()
{
debugPreviousActiveLayout
=
_debugActiveLayout
;
_debugActiveLayout
=
null
;
return
true
;
}());
final
T
result
=
inner
();
assert
(()
{
_debugActiveLayout
=
debugPreviousActiveLayout
;
return
true
;
}());
return
result
;
}
/// Whether the parent render object is permitted to use this render object's
/// Whether the parent render object is permitted to use this render object's
/// size.
/// size.
///
///
...
@@ -3399,22 +3419,11 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
...
@@ -3399,22 +3419,11 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
String
?
prefixOtherLines
=
''
,
String
?
prefixOtherLines
=
''
,
DiagnosticLevel
minLevel
=
DiagnosticLevel
.
debug
,
DiagnosticLevel
minLevel
=
DiagnosticLevel
.
debug
,
})
{
})
{
RenderObject
?
debugPreviousActiveLayout
;
return
_withDebugActiveLayoutCleared
(()
=>
super
.
toStringDeep
(
assert
(()
{
debugPreviousActiveLayout
=
_debugActiveLayout
;
_debugActiveLayout
=
null
;
return
true
;
}());
final
String
result
=
super
.
toStringDeep
(
prefixLineOne:
prefixLineOne
,
prefixLineOne:
prefixLineOne
,
prefixOtherLines:
prefixOtherLines
,
prefixOtherLines:
prefixOtherLines
,
minLevel:
minLevel
,
minLevel:
minLevel
,
);
));
assert
(()
{
_debugActiveLayout
=
debugPreviousActiveLayout
;
return
true
;
}());
return
result
;
}
}
/// Returns a one-line detailed description of the render object.
/// Returns a one-line detailed description of the render object.
...
@@ -3427,18 +3436,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
...
@@ -3427,18 +3436,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
String
joiner
=
', '
,
String
joiner
=
', '
,
DiagnosticLevel
minLevel
=
DiagnosticLevel
.
debug
,
DiagnosticLevel
minLevel
=
DiagnosticLevel
.
debug
,
})
{
})
{
RenderObject
?
debugPreviousActiveLayout
;
return
_withDebugActiveLayoutCleared
(()
=>
super
.
toStringShallow
(
joiner:
joiner
,
minLevel:
minLevel
));
assert
(()
{
debugPreviousActiveLayout
=
_debugActiveLayout
;
_debugActiveLayout
=
null
;
return
true
;
}());
final
String
result
=
super
.
toStringShallow
(
joiner:
joiner
,
minLevel:
minLevel
);
assert
(()
{
_debugActiveLayout
=
debugPreviousActiveLayout
;
return
true
;
}());
return
result
;
}
}
@protected
@protected
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment