Skip to content

Commit cdbb1e6

Browse files
Move Widget Inspector service extensions from DevTools to Flutter (#113861)
1 parent bd5ab24 commit cdbb1e6

File tree

4 files changed

+753
-63
lines changed

4 files changed

+753
-63
lines changed

packages/flutter/lib/src/widgets/service_extensions.dart

Lines changed: 79 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ enum WidgetInspectorServiceExtensions {
111111
///
112112
/// * [WidgetInspectorService.initServiceExtensions], where the service
113113
/// extension is registered.
114-
/// * [WidgetInspectorService._reportStructuredError], which is the error
115-
/// reporter that will be used when this service extension is enabled.
116114
structuredErrors,
117115

118116
/// Name of service extension that, when called, will change the value of
@@ -126,38 +124,24 @@ enum WidgetInspectorServiceExtensions {
126124
/// extension is registered.
127125
show,
128126

129-
/// Name of service extension that, when called, changes the value of
130-
/// [WidgetInspectorService._trackRebuildDirtyWidgets], which determines
127+
/// Name of service extension that, when called, determines
131128
/// whether a callback is invoked for every dirty [Widget] built each frame.
132129
///
133-
/// This service extension is only supported if
134-
/// [WidgetInspectorService._widgetCreationTracked] is true.
135-
///
136130
/// See also:
137131
///
138132
/// * [debugOnRebuildDirtyWidget], which is the nullable callback that is
139133
/// called for every dirty widget built per frame
140-
/// * [WidgetInspectorService._onRebuildWidget], which is the callback we
141-
/// assign to [debugOnRebuildDirtyWidget] when this service extension is set
142-
/// to true.
143134
/// * [WidgetInspectorService.initServiceExtensions], where the service
144135
/// extension is registered.
145136
trackRebuildDirtyWidgets,
146137

147-
/// Name of service extension that, when called, changes the value of
148-
/// [WidgetInspectorService._trackRepaintWidgets], which determines whether
138+
/// Name of service extension that, when called, determines whether
149139
/// a callback is invoked for every [RenderObject] painted each frame.
150140
///
151-
/// This service extension is only supported if
152-
/// [WidgetInspectorService._widgetCreationTracked] is true.
153-
///
154141
/// See also:
155142
///
156143
/// * [debugOnProfilePaint], which is the nullable callback that is called for
157144
/// every dirty widget built per frame
158-
/// * [WidgetInspectorService._onPaint], which is the callback we
159-
/// assign to [debugOnRebuildDirtyWidget] when this service extension is set
160-
/// to true.
161145
/// * [WidgetInspectorService.initServiceExtensions], where the service
162146
/// extension is registered.
163147
trackRepaintWidgets,
@@ -237,6 +221,8 @@ enum WidgetInspectorServiceExtensions {
237221
/// service extension calls.
238222
/// * [WidgetInspectorService.removePubRootDirectories], which should be used
239223
/// to remove directories.
224+
/// * [WidgetInspectorService.pubRootDirectories], which should be used
225+
/// to return the active list of directories.
240226
/// * [WidgetInspectorService.initServiceExtensions], where the service
241227
/// extension is registered.
242228
addPubRootDirectories,
@@ -251,10 +237,28 @@ enum WidgetInspectorServiceExtensions {
251237
/// service extension calls.
252238
/// * [WidgetInspectorService.addPubRootDirectories], which should be used
253239
/// to add directories.
240+
/// * [WidgetInspectorService.pubRootDirectories], which should be used
241+
/// to return the active list of directories.
254242
/// * [WidgetInspectorService.initServiceExtensions], where the service
255243
/// extension is registered.
256244
removePubRootDirectories,
257245

246+
/// Name of service extension that, when called, will return the list of
247+
/// directories that are considered part of the local project
248+
/// for the Widget inspector summary tree.
249+
///
250+
/// See also:
251+
///
252+
/// * [WidgetInspectorService.pubRootDirectories], the method that this
253+
/// service extension calls.
254+
/// * [WidgetInspectorService.addPubRootDirectories], which should be used
255+
/// to add directories.
256+
/// * [WidgetInspectorService.removePubRootDirectories], which should be used
257+
/// to remove directories.
258+
/// * [WidgetInspectorService.initServiceExtensions], where the service
259+
/// extension is registered.
260+
getPubRootDirectories,
261+
258262
/// Name of service extension that, when called, will set the
259263
/// [WidgetInspector] selection to the object matching the specified id and
260264
/// will return whether the selection was changed.
@@ -273,8 +277,6 @@ enum WidgetInspectorServiceExtensions {
273277
///
274278
/// See also:
275279
///
276-
/// * [WidgetInspectorService._getParentChain], the method that this service
277-
/// extension calls.
278280
/// * [WidgetInspectorService.getParentChain], which returns a json encoded
279281
/// String representation of this data.
280282
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -287,8 +289,6 @@ enum WidgetInspectorServiceExtensions {
287289
///
288290
/// See also:
289291
///
290-
/// * [WidgetInspectorService._getProperties], the method that this service
291-
/// extension calls.
292292
/// * [WidgetInspectorService.getProperties], which returns a json encoded
293293
/// String representation of this data.
294294
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -301,8 +301,6 @@ enum WidgetInspectorServiceExtensions {
301301
///
302302
/// See also:
303303
///
304-
/// * [WidgetInspectorService._getChildren], the method that this service
305-
/// extension calls.
306304
/// * [WidgetInspectorService.getChildren], which returns a json encoded
307305
/// String representation of this data.
308306
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -315,8 +313,6 @@ enum WidgetInspectorServiceExtensions {
315313
///
316314
/// See also:
317315
///
318-
/// * [WidgetInspectorService._getChildrenSummaryTree], the method that this
319-
/// service extension calls.
320316
/// * [WidgetInspectorService.getChildrenSummaryTree], which returns a json
321317
/// encoded String representation of this data.
322318
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -329,8 +325,6 @@ enum WidgetInspectorServiceExtensions {
329325
///
330326
/// See also:
331327
///
332-
/// * [WidgetInspectorService._getChildrenDetailsSubtree], the method that
333-
/// this service extension calls.
334328
/// * [WidgetInspectorService.getChildrenDetailsSubtree], which returns a json
335329
/// encoded String representation of this data.
336330
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -342,8 +336,6 @@ enum WidgetInspectorServiceExtensions {
342336
///
343337
/// See also:
344338
///
345-
/// * [WidgetInspectorService._getRootWidget], the method that this service
346-
/// extension calls.
347339
/// * [WidgetInspectorService.getRootWidget], which returns a json encoded
348340
/// String representation of this data.
349341
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -355,8 +347,6 @@ enum WidgetInspectorServiceExtensions {
355347
///
356348
/// See also:
357349
///
358-
/// * [WidgetInspectorService._getRootRenderObject], the method that this
359-
/// service extension calls.
360350
/// * [WidgetInspectorService.getRootRenderObject], which returns a json
361351
/// encoded String representation of this data.
362352
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -369,14 +359,26 @@ enum WidgetInspectorServiceExtensions {
369359
///
370360
/// See also:
371361
///
372-
/// * [WidgetInspectorService._getRootWidgetSummaryTree], the method that this
373-
/// service extension calls.
374362
/// * [WidgetInspectorService.getRootWidgetSummaryTree], which returns a json
375363
/// encoded String representation of this data.
376364
/// * [WidgetInspectorService.initServiceExtensions], where the service
377365
/// extension is registered.
378366
getRootWidgetSummaryTree,
379367

368+
/// Name of service extension that, when called, will return the
369+
/// [DiagnosticsNode] data for the root [Element] of the summary tree with
370+
/// text previews included.
371+
///
372+
/// The summary tree only includes [Element]s that were created by user code.
373+
/// Text previews will only be available for [Element]s with a corresponding
374+
/// [RenderObject] of type [RenderParagraph].
375+
///
376+
/// See also:
377+
///
378+
/// * [WidgetInspectorService.initServiceExtensions], where the service
379+
/// extension is registered.
380+
getRootWidgetSummaryTreeWithPreviews,
381+
380382
/// Name of service extension that, when called, will return the details
381383
/// subtree, which includes properties, rooted at the [DiagnosticsNode] object
382384
/// matching the specified id and the having a size matching the specified
@@ -397,8 +399,6 @@ enum WidgetInspectorServiceExtensions {
397399
///
398400
/// See also:
399401
///
400-
/// * [WidgetInspectorService._getSelectedRenderObject], the method that this
401-
/// service extension calls.
402402
/// * [WidgetInspectorService.getSelectedRenderObject], which returns a json
403403
/// encoded String representation of this data.
404404
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -410,8 +410,6 @@ enum WidgetInspectorServiceExtensions {
410410
///
411411
/// See also:
412412
///
413-
/// * [WidgetInspectorService._getSelectedWidget], the method that this
414-
/// service extension calls.
415413
/// * [WidgetInspectorService.getSelectedWidget], which returns a json
416414
/// encoded String representation of this data.
417415
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -428,8 +426,6 @@ enum WidgetInspectorServiceExtensions {
428426
///
429427
/// See also:
430428
///
431-
/// * [WidgetInspectorService._getSelectedSummaryWidget], the method that this
432-
/// service extension calls.
433429
/// * [WidgetInspectorService.getSelectedSummaryWidget], which returns a json
434430
/// encoded String representation of this data.
435431
/// * [WidgetInspectorService.initServiceExtensions], where the service
@@ -459,4 +455,47 @@ enum WidgetInspectorServiceExtensions {
459455
/// * [WidgetInspectorService.initServiceExtensions], where the service
460456
/// extension is registered.
461457
screenshot,
458+
459+
/// Name of service extension that, when called, will return the
460+
/// [DiagnosticsNode] data for the currently selected [Element] and will
461+
/// include information about the [Element]'s layout properties.
462+
///
463+
/// See also:
464+
///
465+
/// * [WidgetInspectorService.initServiceExtensions], where the service
466+
/// extension is registered.
467+
getLayoutExplorerNode,
468+
469+
/// Name of service extension that, when called, will set the [FlexFit] value
470+
/// for the [FlexParentData] of the [RenderObject] matching the specified
471+
/// `id`, passed as an argument.
472+
///
473+
/// See also:
474+
///
475+
/// * [WidgetInspectorService.initServiceExtensions], where the service
476+
/// extension is registered.
477+
setFlexFit,
478+
479+
/// Name of service extension that, when called, will set the flex value
480+
/// for the [FlexParentData] of the [RenderObject] matching the specified
481+
/// `id`, passed as an argument.
482+
///
483+
/// See also:
484+
///
485+
/// * [WidgetInspectorService.initServiceExtensions], where the service
486+
/// extension is registered.
487+
setFlexFactor,
488+
489+
/// Name of service extension that, when called, will set the
490+
/// [MainAxisAlignment] and [CrossAxisAlignment] values for the [RenderFlex]
491+
/// matching the specified `id`, passed as an argument.
492+
///
493+
/// The [MainAxisAlignment] and [CrossAxisAlignment] values will be passed as
494+
/// arguments `mainAxisAlignment` and `crossAxisAlignment`, respectively.
495+
///
496+
/// See also:
497+
///
498+
/// * [WidgetInspectorService.initServiceExtensions], where the service
499+
/// extension is registered.
500+
setFlexProperties,
462501
}

0 commit comments

Comments
 (0)