[O] Cleanup (#23530)
* Improve documentation
* Potential performance win in hit testing
Rather than copying the list every time we access `path`, this just
exposes it as an `Iterable`. People who want to copy it can use
`toList()`.
(This isn't a breaking change since code that expects a `List` is
still going to get one.)
* Enforce the Oxford Comma.
diff --git a/packages/flutter/lib/src/foundation/debug.dart b/packages/flutter/lib/src/foundation/debug.dart
index b8e526c..1f6854a 100644
--- a/packages/flutter/lib/src/foundation/debug.dart
+++ b/packages/flutter/lib/src/foundation/debug.dart
@@ -63,8 +63,13 @@
}
}
-/// Arguments to whitelist [Timeline] events in order to be shown in the
-/// developer centric version of the Observatory Timeline.
+/// Argument passed to [Timeline] events in order to cause those events to be
+/// shown in the developer-centric version of the Observatory Timeline.
+///
+/// See also:
+///
+/// * [Timeline.startSync], which typically takes this value as its `arguments`
+/// argument.
const Map<String, String> timelineWhitelistArguments = <String, String>{
'mode': 'basic'
};
diff --git a/packages/flutter/lib/src/gestures/hit_test.dart b/packages/flutter/lib/src/gestures/hit_test.dart
index df45811..e2be1db 100644
--- a/packages/flutter/lib/src/gestures/hit_test.dart
+++ b/packages/flutter/lib/src/gestures/hit_test.dart
@@ -66,7 +66,7 @@
/// The first entry in the path is the most specific, typically the one at
/// the leaf of tree being hit tested. Event propagation starts with the most
/// specific (i.e., first) entry and proceeds in order through the path.
- List<HitTestEntry> get path => List<HitTestEntry>.unmodifiable(_path);
+ Iterable<HitTestEntry> get path => _path;
final List<HitTestEntry> _path;
/// Add a [HitTestEntry] to the path.
diff --git a/packages/flutter/lib/src/gestures/scale.dart b/packages/flutter/lib/src/gestures/scale.dart
index e381a4b..441260f 100644
--- a/packages/flutter/lib/src/gestures/scale.dart
+++ b/packages/flutter/lib/src/gestures/scale.dart
@@ -140,10 +140,10 @@
/// Recognizes a scale gesture.
///
/// [ScaleGestureRecognizer] tracks the pointers in contact with the screen and
-/// calculates their focal point, indicated scale and rotation. When a focal pointer is
-/// established, the recognizer calls [onStart]. As the focal point, scale, rotation
-/// change, the recognizer calls [onUpdate]. When the pointers are no longer in
-/// contact with the screen, the recognizer calls [onEnd].
+/// calculates their focal point, indicated scale, and rotation. When a focal
+/// pointer is established, the recognizer calls [onStart]. As the focal point,
+/// scale, rotation change, the recognizer calls [onUpdate]. When the pointers
+/// are no longer in contact with the screen, the recognizer calls [onEnd].
class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
/// Create a gesture recognizer for interactions intended for scaling content.
ScaleGestureRecognizer({ Object debugOwner }) : super(debugOwner: debugOwner);
diff --git a/packages/flutter/lib/src/widgets/spacer.dart b/packages/flutter/lib/src/widgets/spacer.dart
index dc7fea1..8c8e5a2 100644
--- a/packages/flutter/lib/src/widgets/spacer.dart
+++ b/packages/flutter/lib/src/widgets/spacer.dart
@@ -14,8 +14,8 @@
/// [Flex.mainAxisAlignment] on a flex container that contains a [Spacer] to
/// [MainAxisAlignment.spaceAround], [MainAxisAlignment.spaceBetween], or
/// [MainAxisAlignment.spaceEvenly] will not have any visible effect: the
-/// [Spacer] has taken up all of the additional space, so there is none left to
-/// redistribute.
+/// [Spacer] has taken up all of the additional space, therefore there is none
+/// left to redistribute.
///
/// ## Sample code
///
@@ -59,10 +59,7 @@
Widget build(BuildContext context) {
return Expanded(
flex: flex,
- child: const SizedBox(
- height: 0.0,
- width: 0.0,
- ),
+ child: const SizedBox.shrink(),
);
}
}