Skip to content

Commit

Permalink
Consistently capitalize Endpoint (not EndPoint) (#106706)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmc authored Jun 28, 2022
1 parent bbdf617 commit baf8686
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/widgets/selectable_region.dart
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ class _SelectableRegionState extends State<SelectableRegion> with TextSelectionD
onEndHandleDragStart: _handleSelectionEndHandleDragStart,
onEndHandleDragUpdate: _handleSelectionEndHandleDragUpdate,
onEndHandleDragEnd: (DragEndDetails details) => _stopSelectionEndEdgeUpdate(),
selectionEndPoints: points,
selectionEndpoints: points,
selectionControls: widget.selectionControls,
selectionDelegate: this,
clipboardStatus: null,
Expand Down Expand Up @@ -550,7 +550,7 @@ class _SelectableRegionState extends State<SelectableRegion> 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.
Expand Down
28 changes: 14 additions & 14 deletions packages/flutter/lib/src/widgets/text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class TextSelectionOverlay {
onEndHandleDragStart: _handleSelectionEndHandleDragStart,
onEndHandleDragUpdate: _handleSelectionEndHandleDragUpdate,
toolbarVisible: _effectiveToolbarVisibility,
selectionEndPoints: const <TextSelectionPoint>[],
selectionEndpoints: const <TextSelectionPoint>[],
selectionControls: selectionControls,
selectionDelegate: selectionDelegate,
clipboardStatus: clipboardStatus,
Expand Down Expand Up @@ -373,7 +373,7 @@ class TextSelectionOverlay {
)
..lineHeightAtEnd = _getEndGlyphHeight()
// Update selection toolbar metrics.
..selectionEndPoints = renderObject.getEndpointsForSelection(_selection)
..selectionEndpoints = renderObject.getEndpointsForSelection(_selection)
..toolbarLocation = renderObject.lastSecondaryTapDownPosition;
}

Expand Down Expand Up @@ -589,7 +589,7 @@ class SelectionOverlay {
this.onEndHandleDragUpdate,
this.onEndHandleDragEnd,
this.toolbarVisible,
required List<TextSelectionPoint> selectionEndPoints,
required List<TextSelectionPoint> selectionEndpoints,
required this.selectionControls,
required this.selectionDelegate,
required this.clipboardStatus,
Expand All @@ -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(
Expand Down Expand Up @@ -721,13 +721,13 @@ class SelectionOverlay {
final ValueListenable<bool>? toolbarVisible;

/// The text selection positions of selection start and end.
List<TextSelectionPoint> get selectionEndPoints => _selectionEndPoints;
List<TextSelectionPoint> _selectionEndPoints;
set selectionEndPoints(List<TextSelectionPoint> value) {
if (!listEquals(_selectionEndPoints, value)) {
List<TextSelectionPoint> get selectionEndpoints => _selectionEndpoints;
List<TextSelectionPoint> _selectionEndpoints;
set selectionEndpoints(List<TextSelectionPoint> value) {
if (!listEquals(_selectionEndpoints, value)) {
_markNeedsBuild();
}
_selectionEndPoints = value;
_selectionEndpoints = value;
}

/// Debugging information for explaining why the [Overlay] is required.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -1012,7 +1012,7 @@ class SelectionOverlay {
editingRegion: editingRegion,
selectionControls: selectionControls,
midpoint: midpoint,
selectionEndpoints: selectionEndPoints,
selectionEndpoints: selectionEndpoints,
visibility: toolbarVisible,
selectionDelegate: selectionDelegate,
clipboardStatus: clipboardStatus,
Expand Down
12 changes: 6 additions & 6 deletions packages/flutter/test/widgets/text_selection_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ void main() {
clipboardStatus: FakeClipboardStatusNotifier(),
selectionDelegate: FakeTextSelectionDelegate(),
selectionControls: selectionControls,
selectionEndPoints: const <TextSelectionPoint>[],
selectionEndpoints: const <TextSelectionPoint>[],
toolbarLayerLink: toolbarLayerLink,
);
}
Expand All @@ -1055,7 +1055,7 @@ void main() {
selectionOverlay
..startHandleType = TextSelectionHandleType.left
..endHandleType = TextSelectionHandleType.right
..selectionEndPoints = const <TextSelectionPoint>[
..selectionEndpoints = const <TextSelectionPoint>[
TextSelectionPoint(Offset(10, 10), TextDirection.ltr),
TextSelectionPoint(Offset(20, 20), TextDirection.ltr),
];
Expand Down Expand Up @@ -1100,7 +1100,7 @@ void main() {
selectionOverlay
..startHandleType = TextSelectionHandleType.collapsed
..endHandleType = TextSelectionHandleType.collapsed
..selectionEndPoints = const <TextSelectionPoint>[
..selectionEndpoints = const <TextSelectionPoint>[
TextSelectionPoint(Offset(10, 10), TextDirection.ltr),
TextSelectionPoint(Offset(20, 20), TextDirection.ltr),
];
Expand All @@ -1122,7 +1122,7 @@ void main() {
..lineHeightAtStart = 10.0
..endHandleType = TextSelectionHandleType.right
..lineHeightAtEnd = 11.0
..selectionEndPoints = const <TextSelectionPoint>[
..selectionEndpoints = const <TextSelectionPoint>[
TextSelectionPoint(Offset(10, 10), TextDirection.ltr),
TextSelectionPoint(Offset(20, 20), TextDirection.ltr),
];
Expand Down Expand Up @@ -1159,7 +1159,7 @@ void main() {
..lineHeightAtStart = 10.0
..endHandleType = TextSelectionHandleType.right
..lineHeightAtEnd = 11.0
..selectionEndPoints = const <TextSelectionPoint>[
..selectionEndpoints = const <TextSelectionPoint>[
TextSelectionPoint(Offset(10, 10), TextDirection.ltr),
TextSelectionPoint(Offset(20, 20), TextDirection.ltr),
];
Expand Down Expand Up @@ -1206,7 +1206,7 @@ void main() {
..lineHeightAtStart = 10.0
..endHandleType = TextSelectionHandleType.right
..lineHeightAtEnd = 11.0
..selectionEndPoints = const <TextSelectionPoint>[
..selectionEndpoints = const <TextSelectionPoint>[
TextSelectionPoint(Offset(10, 10), TextDirection.ltr),
TextSelectionPoint(Offset(20, 20), TextDirection.ltr),
];
Expand Down

0 comments on commit baf8686

Please sign in to comment.