Skip to content

Commit 54409b0

Browse files
flarLouiseHsu
authored andcommitted
Stabilize hybrid_android_views_integration_test rendering tree (flutter#130751)
Fixes: flutter#130738 A widget was added to explicitly and intentionally overlap the PlatformView so that the rendering tree of Views would always have an underlay and an overlay to match the test expectations.
1 parent bdbb2c0 commit 54409b0

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

dev/integration_tests/hybrid_android_views/lib/nested_view_event_page.dart

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,30 @@ class NestedViewEventBodyState extends State<NestedViewEventBody> {
5151
children: <Widget>[
5252
SizedBox(
5353
height: 300,
54-
child: showPlatformView ?
55-
AndroidPlatformView(
56-
key: const ValueKey<String>('PlatformView'),
57-
viewType: 'simple_view',
58-
onPlatformViewCreated: onPlatformViewCreated,
59-
useHybridComposition: useHybridComposition,
60-
) : null,
54+
child: Stack(
55+
alignment: Alignment.topCenter,
56+
children: <Widget>[
57+
if (showPlatformView)
58+
AndroidPlatformView(
59+
key: const ValueKey<String>('PlatformView'),
60+
viewType: 'simple_view',
61+
onPlatformViewCreated: onPlatformViewCreated,
62+
useHybridComposition: useHybridComposition,
63+
),
64+
// The overlapping widget stabilizes the view tree by ensuring
65+
// that there is widget content on top of the platform view.
66+
// Without this widget, we rely on the UI elements down below
67+
// to "incidentally" draw on top of the PlatformView which
68+
// is not a reliable behavior as we eliminate non-visible
69+
// rendering operations throughout the framework and engine.
70+
const Positioned(
71+
top: 50,
72+
child: Text('overlapping widget',
73+
style: TextStyle(color: Colors.yellow),
74+
),
75+
),
76+
],
77+
),
6178
),
6279
if (_lastTestStatus != _LastTestStatus.pending) _statusWidget(),
6380
if (viewChannel != null) ... <Widget>[

0 commit comments

Comments
 (0)