From baf86869b14a2a944f015ec20763719b5f911955 Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Tue, 28 Jun 2022 14:02:39 -0700 Subject: [PATCH] Consistently capitalize Endpoint (not EndPoint) (#106706) --- .../lib/src/widgets/selectable_region.dart | 4 +-- .../lib/src/widgets/text_selection.dart | 28 +++++++++---------- .../test/widgets/text_selection_test.dart | 12 ++++---- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/flutter/lib/src/widgets/selectable_region.dart b/packages/flutter/lib/src/widgets/selectable_region.dart index a60dddd38cf1..d0681872f202 100644 --- a/packages/flutter/lib/src/widgets/selectable_region.dart +++ b/packages/flutter/lib/src/widgets/selectable_region.dart @@ -514,7 +514,7 @@ class _SelectableRegionState extends State with TextSelectionD onEndHandleDragStart: _handleSelectionEndHandleDragStart, onEndHandleDragUpdate: _handleSelectionEndHandleDragUpdate, onEndHandleDragEnd: (DragEndDetails details) => _stopSelectionEndEdgeUpdate(), - selectionEndPoints: points, + selectionEndpoints: points, selectionControls: widget.selectionControls, selectionDelegate: this, clipboardStatus: null, @@ -550,7 +550,7 @@ class _SelectableRegionState extends State with TextSelectionD ..lineHeightAtStart = start?.lineHeight ?? end!.lineHeight ..endHandleType = end?.handleType ?? TextSelectionHandleType.right ..lineHeightAtEnd = end?.lineHeight ?? start!.lineHeight - ..selectionEndPoints = points; + ..selectionEndpoints = points; } /// Shows the selection handles. diff --git a/packages/flutter/lib/src/widgets/text_selection.dart b/packages/flutter/lib/src/widgets/text_selection.dart index 807e4972b872..410aa3dac32c 100644 --- a/packages/flutter/lib/src/widgets/text_selection.dart +++ b/packages/flutter/lib/src/widgets/text_selection.dart @@ -258,7 +258,7 @@ class TextSelectionOverlay { onEndHandleDragStart: _handleSelectionEndHandleDragStart, onEndHandleDragUpdate: _handleSelectionEndHandleDragUpdate, toolbarVisible: _effectiveToolbarVisibility, - selectionEndPoints: const [], + selectionEndpoints: const [], selectionControls: selectionControls, selectionDelegate: selectionDelegate, clipboardStatus: clipboardStatus, @@ -373,7 +373,7 @@ class TextSelectionOverlay { ) ..lineHeightAtEnd = _getEndGlyphHeight() // Update selection toolbar metrics. - ..selectionEndPoints = renderObject.getEndpointsForSelection(_selection) + ..selectionEndpoints = renderObject.getEndpointsForSelection(_selection) ..toolbarLocation = renderObject.lastSecondaryTapDownPosition; } @@ -589,7 +589,7 @@ class SelectionOverlay { this.onEndHandleDragUpdate, this.onEndHandleDragEnd, this.toolbarVisible, - required List selectionEndPoints, + required List selectionEndpoints, required this.selectionControls, required this.selectionDelegate, required this.clipboardStatus, @@ -603,7 +603,7 @@ class SelectionOverlay { _lineHeightAtStart = lineHeightAtStart, _endHandleType = endHandleType, _lineHeightAtEnd = lineHeightAtEnd, - _selectionEndPoints = selectionEndPoints, + _selectionEndpoints = selectionEndpoints, _toolbarLocation = toolbarLocation { final OverlayState? overlay = Overlay.of(context, rootOverlay: true); assert( @@ -721,13 +721,13 @@ class SelectionOverlay { final ValueListenable? toolbarVisible; /// The text selection positions of selection start and end. - List get selectionEndPoints => _selectionEndPoints; - List _selectionEndPoints; - set selectionEndPoints(List value) { - if (!listEquals(_selectionEndPoints, value)) { + List get selectionEndpoints => _selectionEndpoints; + List _selectionEndpoints; + set selectionEndpoints(List value) { + if (!listEquals(_selectionEndpoints, value)) { _markNeedsBuild(); } - _selectionEndPoints = value; + _selectionEndpoints = value; } /// Debugging information for explaining why the [Overlay] is required. @@ -800,7 +800,7 @@ class SelectionOverlay { /// The location of where the toolbar should be drawn in relative to the /// location of [toolbarLayerLink]. /// - /// If this is null, the toolbar is drawn based on [selectionEndPoints] and + /// If this is null, the toolbar is drawn based on [selectionEndpoints] and /// the rect of render object of [context]. /// /// This is useful for displaying toolbars at the mouse right-click locations @@ -988,19 +988,19 @@ class SelectionOverlay { renderBox.localToGlobal(renderBox.size.bottomRight(Offset.zero)), ); - final bool isMultiline = selectionEndPoints.last.point.dy - selectionEndPoints.first.point.dy > + final bool isMultiline = selectionEndpoints.last.point.dy - selectionEndpoints.first.point.dy > lineHeightAtEnd / 2; // If the selected text spans more than 1 line, horizontally center the toolbar. // Derived from both iOS and Android. final double midX = isMultiline ? editingRegion.width / 2 - : (selectionEndPoints.first.point.dx + selectionEndPoints.last.point.dx) / 2; + : (selectionEndpoints.first.point.dx + selectionEndpoints.last.point.dx) / 2; final Offset midpoint = Offset( midX, // The y-coordinate won't be made use of most likely. - selectionEndPoints.first.point.dy - lineHeightAtStart, + selectionEndpoints.first.point.dy - lineHeightAtStart, ); return Directionality( @@ -1012,7 +1012,7 @@ class SelectionOverlay { editingRegion: editingRegion, selectionControls: selectionControls, midpoint: midpoint, - selectionEndpoints: selectionEndPoints, + selectionEndpoints: selectionEndpoints, visibility: toolbarVisible, selectionDelegate: selectionDelegate, clipboardStatus: clipboardStatus, diff --git a/packages/flutter/test/widgets/text_selection_test.dart b/packages/flutter/test/widgets/text_selection_test.dart index bf04f41bd3c2..fba6e2532613 100644 --- a/packages/flutter/test/widgets/text_selection_test.dart +++ b/packages/flutter/test/widgets/text_selection_test.dart @@ -1041,7 +1041,7 @@ void main() { clipboardStatus: FakeClipboardStatusNotifier(), selectionDelegate: FakeTextSelectionDelegate(), selectionControls: selectionControls, - selectionEndPoints: const [], + selectionEndpoints: const [], toolbarLayerLink: toolbarLayerLink, ); } @@ -1055,7 +1055,7 @@ void main() { selectionOverlay ..startHandleType = TextSelectionHandleType.left ..endHandleType = TextSelectionHandleType.right - ..selectionEndPoints = const [ + ..selectionEndpoints = const [ TextSelectionPoint(Offset(10, 10), TextDirection.ltr), TextSelectionPoint(Offset(20, 20), TextDirection.ltr), ]; @@ -1100,7 +1100,7 @@ void main() { selectionOverlay ..startHandleType = TextSelectionHandleType.collapsed ..endHandleType = TextSelectionHandleType.collapsed - ..selectionEndPoints = const [ + ..selectionEndpoints = const [ TextSelectionPoint(Offset(10, 10), TextDirection.ltr), TextSelectionPoint(Offset(20, 20), TextDirection.ltr), ]; @@ -1122,7 +1122,7 @@ void main() { ..lineHeightAtStart = 10.0 ..endHandleType = TextSelectionHandleType.right ..lineHeightAtEnd = 11.0 - ..selectionEndPoints = const [ + ..selectionEndpoints = const [ TextSelectionPoint(Offset(10, 10), TextDirection.ltr), TextSelectionPoint(Offset(20, 20), TextDirection.ltr), ]; @@ -1159,7 +1159,7 @@ void main() { ..lineHeightAtStart = 10.0 ..endHandleType = TextSelectionHandleType.right ..lineHeightAtEnd = 11.0 - ..selectionEndPoints = const [ + ..selectionEndpoints = const [ TextSelectionPoint(Offset(10, 10), TextDirection.ltr), TextSelectionPoint(Offset(20, 20), TextDirection.ltr), ]; @@ -1206,7 +1206,7 @@ void main() { ..lineHeightAtStart = 10.0 ..endHandleType = TextSelectionHandleType.right ..lineHeightAtEnd = 11.0 - ..selectionEndPoints = const [ + ..selectionEndpoints = const [ TextSelectionPoint(Offset(10, 10), TextDirection.ltr), TextSelectionPoint(Offset(20, 20), TextDirection.ltr), ];