Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46bd24d

Browse files
Renzo-OlivaresRenzo Olivares
authored andcommitted
Remove ExtendSelectionByPageIntent (flutter#182642)
This API was added in flutter#105497 but never used. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. Co-authored-by: Renzo Olivares <[email protected]>
1 parent 8f3f76f commit 46bd24d

2 files changed

Lines changed: 0 additions & 56 deletions

File tree

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

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5444,52 +5444,6 @@ class EditableTextState extends State<EditableText>
54445444
_scrollController.jumpTo(destination);
54455445
}
54465446

5447-
/// Extend the selection down by page if the `forward` parameter is true, or
5448-
/// up by page otherwise.
5449-
void _extendSelectionByPage(ExtendSelectionByPageIntent intent) {
5450-
if (widget.maxLines == 1) {
5451-
return;
5452-
}
5453-
5454-
final TextSelection nextSelection;
5455-
final Rect extentRect = renderEditable.getLocalRectForCaret(_value.selection.extent);
5456-
final state = _scrollableKey.currentState as ScrollableState?;
5457-
final double increment = ScrollAction.getDirectionalIncrement(
5458-
state!,
5459-
ScrollIntent(
5460-
direction: intent.forward ? AxisDirection.down : AxisDirection.up,
5461-
type: ScrollIncrementType.page,
5462-
),
5463-
);
5464-
final ScrollPosition position = _scrollController.position;
5465-
if (intent.forward) {
5466-
if (_value.selection.extentOffset >= _value.text.length) {
5467-
return;
5468-
}
5469-
final nextExtentOffset = Offset(extentRect.left, extentRect.top + increment);
5470-
final double height = position.maxScrollExtent + renderEditable.size.height;
5471-
final TextPosition nextExtent = nextExtentOffset.dy + position.pixels >= height
5472-
? TextPosition(offset: _value.text.length)
5473-
: renderEditable.getPositionForPoint(renderEditable.localToGlobal(nextExtentOffset));
5474-
nextSelection = _value.selection.copyWith(extentOffset: nextExtent.offset);
5475-
} else {
5476-
if (_value.selection.extentOffset <= 0) {
5477-
return;
5478-
}
5479-
final nextExtentOffset = Offset(extentRect.left, extentRect.top + increment);
5480-
final TextPosition nextExtent = nextExtentOffset.dy + position.pixels <= 0
5481-
? const TextPosition(offset: 0)
5482-
: renderEditable.getPositionForPoint(renderEditable.localToGlobal(nextExtentOffset));
5483-
nextSelection = _value.selection.copyWith(extentOffset: nextExtent.offset);
5484-
}
5485-
5486-
bringIntoView(nextSelection.extent);
5487-
userUpdateTextEditingValue(
5488-
_value.copyWith(selection: nextSelection),
5489-
SelectionChangedCause.keyboard,
5490-
);
5491-
}
5492-
54935447
void _updateSelection(UpdateSelectionIntent intent) {
54945448
assert(
54955449
intent.newSelection.start <= intent.currentTextEditingValue.text.length,
@@ -5598,9 +5552,6 @@ class EditableTextState extends State<EditableText>
55985552
ignoreNonCollapsedSelection: false,
55995553
),
56005554
),
5601-
ExtendSelectionByPageIntent: _makeOverridable(
5602-
CallbackAction<ExtendSelectionByPageIntent>(onInvoke: _extendSelectionByPage),
5603-
),
56045555
ExtendSelectionToNextWordBoundaryIntent: _makeOverridable(
56055556
_UpdateTextSelectionAction<ExtendSelectionToNextWordBoundaryIntent>(
56065557
this,

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,6 @@ class ScrollToDocumentBoundaryIntent extends DirectionalTextEditingIntent {
267267
const ScrollToDocumentBoundaryIntent({required bool forward}) : super(forward);
268268
}
269269

270-
/// Scrolls up or down by page depending on the [forward] parameter.
271-
/// Extends the selection up or down by page based on the [forward] parameter.
272-
class ExtendSelectionByPageIntent extends DirectionalTextEditingIntent {
273-
/// Creates a [ExtendSelectionByPageIntent].
274-
const ExtendSelectionByPageIntent({required bool forward}) : super(forward);
275-
}
276-
277270
/// An [Intent] to select everything in the field.
278271
class SelectAllTextIntent extends Intent {
279272
/// Creates an instance of [SelectAllTextIntent].

0 commit comments

Comments
 (0)