File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -4433,7 +4433,7 @@ class _SemanticsGeometry {
4433
4433
/// by this object can be dropped from the semantics tree without losing
4434
4434
/// semantics information.
4435
4435
bool get dropFromTree {
4436
- return _rect.isEmpty;
4436
+ return _rect.isEmpty || _transform. isZero () ;
4437
4437
}
4438
4438
4439
4439
/// Whether the [SemanticsNode] annotated with the geometric information
Original file line number Diff line number Diff line change @@ -1632,6 +1632,33 @@ void main() {
1632
1632
textDirection: TextDirection .ltr,
1633
1633
));
1634
1634
});
1635
+
1636
+ testWidgets ('Semantics with zero transform gets dropped' , (WidgetTester tester) async {
1637
+ // Regression test for https://github.com/flutter/flutter/issues/110671.
1638
+ // Construct a widget tree that will end up with a fitted box that applies
1639
+ // a zero transform because it does not actually draw its children.
1640
+ // Assert that this subtree gets dropped (the root node has no children).
1641
+ await tester.pumpWidget (Column (
1642
+ children: < Widget > [
1643
+ SizedBox (
1644
+ height: 0 ,
1645
+ width: 500 ,
1646
+ child: FittedBox (
1647
+ child: SizedBox (
1648
+ height: 55 ,
1649
+ width: 266 ,
1650
+ child: SingleChildScrollView (child: Column ()),
1651
+ ),
1652
+ ),
1653
+ ),
1654
+ ],
1655
+ ));
1656
+
1657
+ final SemanticsNode node = RendererBinding .instance.renderView.debugSemantics! ;
1658
+
1659
+ expect (node.transform, null ); // Make sure the zero transform didn't end up on the root somehow.
1660
+ expect (node.childrenCount, 0 );
1661
+ });
1635
1662
}
1636
1663
1637
1664
class CustomSortKey extends OrdinalSortKey {
You can’t perform that action at this time.
0 commit comments