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
f85630b1
Unverified
Commit
f85630b1
authored
Jul 03, 2019
by
Dan Field
Committed by
GitHub
Jul 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix RenderFittedBox when child.size.isEmpty (#35487)
parent
05b4c675
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
3 deletions
+39
-3
object.dart
packages/flutter/lib/src/rendering/object.dart
+1
-1
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+2
-2
proxy_box_test.dart
packages/flutter/test/rendering/proxy_box_test.dart
+17
-0
clip_test.dart
packages/flutter/test/widgets/clip_test.dart
+19
-0
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
f85630b1
...
...
@@ -3614,7 +3614,7 @@ class _SemanticsGeometry {
assert
(
transform
!=
null
);
if
(
rect
==
null
)
return
null
;
if
(
rect
.
isEmpty
)
if
(
rect
.
isEmpty
||
transform
.
isZero
()
)
return
Rect
.
zero
;
return
MatrixUtils
.
inverseTransformRect
(
transform
,
rect
);
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
f85630b1
...
...
@@ -2311,7 +2311,7 @@ class RenderFittedBox extends RenderProxyBox {
@override
bool
hitTestChildren
(
BoxHitTestResult
result
,
{
Offset
position
})
{
if
(
size
.
isEmpty
)
if
(
size
.
isEmpty
||
child
?.
size
?.
isEmpty
==
true
)
return
false
;
_updatePaintData
();
return
result
.
addWithPaintTransform
(
...
...
@@ -2325,7 +2325,7 @@ class RenderFittedBox extends RenderProxyBox {
@override
void
applyPaintTransform
(
RenderBox
child
,
Matrix4
transform
)
{
if
(
size
.
isEmpty
)
{
if
(
size
.
isEmpty
||
child
.
size
.
isEmpty
)
{
transform
.
setZero
();
}
else
{
_updatePaintData
();
...
...
packages/flutter/test/rendering/proxy_box_test.dart
View file @
f85630b1
...
...
@@ -15,6 +15,23 @@ import '../flutter_test_alternative.dart';
import
'rendering_tester.dart'
;
void
main
(
)
{
test
(
'RenderFittedBox handles applying paint transform and hit-testing with empty size'
,
()
{
final
RenderFittedBox
fittedBox
=
RenderFittedBox
(
child:
RenderCustomPaint
(
preferredSize:
Size
.
zero
,
painter:
TestCallbackPainter
(
onPaint:
()
{}),
),
);
layout
(
fittedBox
,
phase:
EnginePhase
.
flushSemantics
);
final
Matrix4
transform
=
Matrix4
.
identity
();
fittedBox
.
applyPaintTransform
(
fittedBox
.
child
,
transform
);
expect
(
transform
,
Matrix4
.
zero
());
final
BoxHitTestResult
hitTestResult
=
BoxHitTestResult
();
expect
(
fittedBox
.
hitTestChildren
(
hitTestResult
),
isFalse
);
});
test
(
'RenderFittedBox does not paint with empty sizes'
,
()
{
bool
painted
;
RenderFittedBox
makeFittedBox
(
Size
size
)
{
...
...
packages/flutter/test/widgets/clip_test.dart
View file @
f85630b1
...
...
@@ -61,6 +61,25 @@ class _UpdateCountedClipPath extends ClipPath {
}
void
main
(
)
{
testWidgets
(
'ClipRect with a FittedBox child sized to zero works with semantics'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
ClipRect
(
child:
FittedBox
(
child:
SizedBox
.
fromSize
(
size:
Size
.
zero
,
child:
Semantics
(
image:
true
,
label:
'Image'
,
),
),
),
),
),
);
expect
(
find
.
byType
(
FittedBox
),
findsOneWidget
);
});
testWidgets
(
'ClipRect updates clipBehavior in updateRenderObject'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
_UpdateCountedClipRect
());
...
...
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