@@ -188,6 +188,77 @@ def get_render_tree(
188
188
189
189
Returns:
190
190
List[Optional[Dict]]: A list of dictionaries or None values representing the render tree.
191
+
192
+ The result is a nested list of dictionaries representing each widget and its properties,
193
+ such as type, key, size, attribute, state, visual information, and hierarchy.
194
+
195
+ The example widget includes the following code, which is rendered as part of the widget tree:
196
+ ```dart
197
+ Semantics(
198
+ key: const Key('add_activity_semantics'),
199
+ label: 'add_activity_button',
200
+ button: true,
201
+ child: FloatingActionButton.small(
202
+ key: const Key('add_activity_button'),
203
+ tooltip: 'add_activity_button',
204
+ heroTag: 'add',
205
+ backgroundColor: const Color(0xFF2E2E3A),
206
+ onPressed: null,
207
+ child: Icon(
208
+ Icons.add,
209
+ size: 16,
210
+ color: Colors.amber.shade200.withOpacity(0.5),
211
+ semanticLabel: 'Add icon',
212
+ ),
213
+ ),
214
+ ),
215
+ ```
216
+ Example execute command:
217
+ >>> flutter_command = FlutterCommand(driver) # noqa
218
+ >>> flutter_command.get_render_tree(widget_type='Semantics', key='add_activity_semantics')
219
+ output >> [
220
+ {
221
+ "type": "Semantics",
222
+ "elementType": "SingleChildRenderObjectElement",
223
+ "description": "Semantics-[<'add_activity_semantics'>]",
224
+ "depth": 0,
225
+ "key": "[<'add_activity_semantics'>]",
226
+ "attributes": {
227
+ "semanticsLabel": "add_activity_button"
228
+ },
229
+ "visual": {},
230
+ "state": {},
231
+ "rect": {
232
+ "x": 0,
233
+ "y": 0,
234
+ "width": 48,
235
+ "height": 48
236
+ },
237
+ "children": [
238
+ {
239
+ "type": "FloatingActionButton",
240
+ "elementType": "StatelessElement",
241
+ "description": "FloatingActionButton-[<'add_activity_button'>]",
242
+ "depth": 1,
243
+ "key": "[<'add_activity_button'>]",
244
+ "attributes": {},
245
+ "visual": {},
246
+ "state": {},
247
+ "rect": {
248
+ "x": 0,
249
+ "y": 0,
250
+ "width": 48,
251
+ "height": 48
252
+ },
253
+ "children": [
254
+ {...},
255
+ "children": [...]
256
+ }
257
+ ]
258
+ }
259
+ ]
260
+ }
261
+ ]
191
262
"""
192
263
opts = {}
193
264
if widget_type is not None :
0 commit comments