From 5066750063944a27d1cf7d33e6b4ba0ee4885131 Mon Sep 17 00:00:00 2001 From: Jacob Richman Date: Tue, 22 Aug 2017 16:06:22 -0700 Subject: [PATCH] Add comments to 3 methods that were missing comments. (#11737) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add comments to 3 methods that were missing comments. Fix out of order (getter, private field, setter) tuple * Code review fix. --- .../flutter/lib/src/widgets/widget_inspector.dart | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/widgets/widget_inspector.dart b/packages/flutter/lib/src/widgets/widget_inspector.dart index 5b59d431bb..73de17807f 100644 --- a/packages/flutter/lib/src/widgets/widget_inspector.dart +++ b/packages/flutter/lib/src/widgets/widget_inspector.dart @@ -247,28 +247,34 @@ class _WidgetInspectorState extends State class InspectorSelection { /// Render objects that are candidates to be selected. /// - /// Tools may wish to iterate through the list of candidates + /// Tools may wish to iterate through the list of candidates. List get candidates => _candidates; - + List _candidates = []; set candidates(List value) { _candidates = value; index = 0; } - List _candidates = []; - /// Index within the list of candidates that is currently selected. int index = 0; + /// Set the selection to empty. void clear() { _candidates = []; index = 0; } + /// Selected render object from the [candidates] list. + /// + /// Setting [candidates] or calling [clear] resets the selection. + /// + /// Returns null if the selection is invalid. RenderObject get current { return candidates != null && index < candidates.length ? candidates[index] : null; } + /// Whether the selected render object is attached to the tree or has gone + /// out of scope. bool get active => current != null && current.attached; }