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
e9c1c162
Unverified
Commit
e9c1c162
authored
Jul 19, 2021
by
Michael Goderbauer
Committed by
GitHub
Jul 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix null child for FittedBox (#86662)
parent
1edd9126
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
13 deletions
+31
-13
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+13
-13
fitted_box_test.dart
packages/flutter/test/widgets/fitted_box_test.dart
+18
-0
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
e9c1c162
...
...
@@ -2651,21 +2651,21 @@ class RenderFittedBox extends RenderProxyBox {
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
size
.
isEmpty
||
child
!.
size
.
isEmpty
)
if
(
child
==
null
||
size
.
isEmpty
||
child
!.
size
.
isEmpty
)
return
;
_updatePaintData
();
if
(
child
!=
null
)
{
if
(
_hasVisualOverflow
!
&&
clipBehavior
!=
Clip
.
none
)
layer
=
context
.
pushClipRect
(
needsCompositing
,
offset
,
Offset
.
zero
&
size
,
_paintChildWithTransform
,
oldLayer:
layer
is
ClipRectLayer
?
layer
!
as
ClipRectLayer
:
null
,
clipBehavior:
clipBehavior
,
);
else
layer
=
_paintChildWithTransform
(
context
,
offset
);
assert
(
child
!=
null
);
if
(
_hasVisualOverflow
!
&&
clipBehavior
!=
Clip
.
none
)
{
layer
=
context
.
pushClipRect
(
needsCompositing
,
offset
,
Offset
.
zero
&
size
,
_paintChildWithTransform
,
oldLayer:
layer
is
ClipRectLayer
?
layer
!
as
ClipRectLayer
:
null
,
clipBehavior:
clipBehavior
,
);
}
else
{
layer
=
_paintChildWithTransform
(
context
,
offset
);
}
}
...
...
packages/flutter/test/widgets/fitted_box_test.dart
View file @
e9c1c162
...
...
@@ -589,6 +589,24 @@ void main() {
expect
(
outsideBox
.
size
.
height
,
50.0
);
});
testWidgets
(
'FittedBox without child does not throw'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
Center
(
child:
SizedBox
(
width:
200.0
,
height:
200.0
,
child:
FittedBox
(),
),
),
);
expect
(
find
.
byType
(
FittedBox
),
findsOneWidget
);
// Tapping it also should not throw.
await
tester
.
tap
(
find
.
byType
(
FittedBox
),
warnIfMissed:
false
);
expect
(
tester
.
takeException
(),
isNull
);
});
}
List
<
Type
>
getLayers
()
{
...
...
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