Revert "Implement Double Tap Handling in TextField and Editable" (#22051)
* Revert "Revert "Add RichText support to find.text" (#22046)" This reverts commit8e70421913. * Revert "Implement Double Tap Handling in TextField and Editable (#21264)" This reverts commit02e87334dd.
This commit is contained in:
@@ -496,11 +496,6 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
|
||||
_cancelCurrentSplash();
|
||||
}
|
||||
|
||||
void _handleDoubleTap() {
|
||||
_renderEditable.handleDoubleTap();
|
||||
_confirmCurrentSplash();
|
||||
}
|
||||
|
||||
void _handleLongPress() {
|
||||
_renderEditable.handleLongPress();
|
||||
_confirmCurrentSplash();
|
||||
@@ -619,7 +614,6 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
|
||||
onTapDown: _handleTapDown,
|
||||
onTap: _handleTap,
|
||||
onTapCancel: _handleTapCancel,
|
||||
onDoubleTap: _handleDoubleTap,
|
||||
onLongPress: _handleLongPress,
|
||||
excludeFromSemantics: true,
|
||||
child: child,
|
||||
|
||||
@@ -32,10 +32,6 @@ enum SelectionChangedCause {
|
||||
/// of the cursor) to change.
|
||||
tap,
|
||||
|
||||
/// The user tapped twice in quick succession on the text and that caused
|
||||
/// the selection (or the location of the cursor) to change.
|
||||
doubleTap,
|
||||
|
||||
/// The user long-pressed the text and that caused the selection (or the
|
||||
/// location of the cursor) to change.
|
||||
longPress,
|
||||
@@ -172,8 +168,6 @@ class RenderEditable extends RenderBox {
|
||||
_tap = TapGestureRecognizer(debugOwner: this)
|
||||
..onTapDown = _handleTapDown
|
||||
..onTap = _handleTap;
|
||||
_doubleTap = DoubleTapGestureRecognizer(debugOwner: this)
|
||||
..onDoubleTap = _handleDoubleTap;
|
||||
_longPress = LongPressGestureRecognizer(debugOwner: this)
|
||||
..onLongPress = _handleLongPress;
|
||||
}
|
||||
@@ -191,7 +185,7 @@ class RenderEditable extends RenderBox {
|
||||
|
||||
/// If true [handleEvent] does nothing and it's assumed that this
|
||||
/// renderer will be notified of input gestures via [handleTapDown],
|
||||
/// [handleTap], [handleDoubleTap], and [handleLongPress].
|
||||
/// [handleTap], and [handleLongPress].
|
||||
///
|
||||
/// The default value of this property is false.
|
||||
bool ignorePointer;
|
||||
@@ -1028,7 +1022,6 @@ class RenderEditable extends RenderBox {
|
||||
bool hitTestSelf(Offset position) => true;
|
||||
|
||||
TapGestureRecognizer _tap;
|
||||
DoubleTapGestureRecognizer _doubleTap;
|
||||
LongPressGestureRecognizer _longPress;
|
||||
|
||||
@override
|
||||
@@ -1038,7 +1031,6 @@ class RenderEditable extends RenderBox {
|
||||
assert(debugHandleEvent(event, entry));
|
||||
if (event is PointerDownEvent && onSelectionChanged != null) {
|
||||
_tap.addPointer(event);
|
||||
_doubleTap.addPointer(event);
|
||||
_longPress.addPointer(event);
|
||||
}
|
||||
}
|
||||
@@ -1078,25 +1070,6 @@ class RenderEditable extends RenderBox {
|
||||
handleTap();
|
||||
}
|
||||
|
||||
/// If [ignorePointer] is false (the default) then this method is called by
|
||||
/// the internal gesture recognizer's [DoubleTapGestureRecognizer.onDoubleTap]
|
||||
/// callback.
|
||||
///
|
||||
/// When [ignorePointer] is true, an ancestor widget must respond to long
|
||||
/// press events by calling this method.
|
||||
void handleDoubleTap() {
|
||||
_layoutText(constraints.maxWidth);
|
||||
assert(_lastTapDownPosition != null);
|
||||
if (onSelectionChanged != null) {
|
||||
final TextPosition position = _textPainter.getPositionForOffset(globalToLocal(_lastTapDownPosition));
|
||||
onSelectionChanged(_selectWordAtOffset(position), this, SelectionChangedCause.doubleTap);
|
||||
}
|
||||
}
|
||||
void _handleDoubleTap() {
|
||||
assert(!ignorePointer);
|
||||
handleDoubleTap();
|
||||
}
|
||||
|
||||
/// If [ignorePointer] is false (the default) then this method is called by
|
||||
/// the internal gesture recognizer's [LongPressRecognizer.onLongPress]
|
||||
/// callback.
|
||||
|
||||
@@ -179,7 +179,6 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.tap(find.widgetWithText(TextField, 'TextField 2'));
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
|
||||
expect(
|
||||
focusNodes.indexOf(focusNodes.singleWhere((FocusNode node) => node.hasFocus)),
|
||||
@@ -190,7 +189,6 @@ void main() {
|
||||
await tester.pump();
|
||||
|
||||
await tester.tap(find.widgetWithText(TextField, 'TextField 1'));
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
|
||||
expect(
|
||||
focusNodes.indexOf(focusNodes.singleWhere((FocusNode node) => node.hasFocus)),
|
||||
|
||||
@@ -164,7 +164,7 @@ void main() {
|
||||
delegate: delegate,
|
||||
));
|
||||
await tester.tap(find.byTooltip('Search'));
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Showing suggestions
|
||||
expect(find.text('Suggestions'), findsOneWidget);
|
||||
@@ -173,14 +173,14 @@ void main() {
|
||||
// Typing query Wow
|
||||
delegate.querysForSuggestions.clear();
|
||||
await tester.enterText(find.byType(TextField), 'Wow');
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(delegate.query, 'Wow');
|
||||
expect(delegate.querysForSuggestions, <String>['Wow']);
|
||||
expect(delegate.querysForResults, hasLength(0));
|
||||
|
||||
await tester.tap(find.text('Suggestions'));
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Showing Results
|
||||
expect(find.text('Suggestions'), findsNothing);
|
||||
@@ -195,7 +195,7 @@ void main() {
|
||||
|
||||
// Taping search field to go back to suggestions
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
textField = tester.widget(find.byType(TextField));
|
||||
expect(textField.focusNode.hasFocus, isTrue);
|
||||
@@ -206,7 +206,7 @@ void main() {
|
||||
expect(delegate.querysForResults, <String>['Wow']);
|
||||
|
||||
await tester.enterText(find.byType(TextField), 'Foo');
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(delegate.query, 'Foo');
|
||||
expect(delegate.querysForSuggestions, <String>['Wow', 'Wow', 'Foo']);
|
||||
@@ -214,7 +214,7 @@ void main() {
|
||||
|
||||
// Go to results again
|
||||
await tester.tap(find.text('Suggestions'));
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Suggestions'), findsNothing);
|
||||
expect(find.text('Results'), findsOneWidget);
|
||||
|
||||
@@ -6,8 +6,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
const Duration doubleTapTimeout = Duration(milliseconds: 300);
|
||||
|
||||
testWidgets('Request focus shows keyboard', (WidgetTester tester) async {
|
||||
final FocusNode focusNode = FocusNode();
|
||||
|
||||
@@ -73,7 +71,7 @@ void main() {
|
||||
expect(tester.testTextInput.isVisible, isFalse);
|
||||
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.idle();
|
||||
|
||||
expect(tester.testTextInput.isVisible, isTrue);
|
||||
|
||||
@@ -82,7 +80,7 @@ void main() {
|
||||
expect(tester.testTextInput.isVisible, isFalse);
|
||||
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.idle();
|
||||
|
||||
expect(tester.testTextInput.isVisible, isTrue);
|
||||
|
||||
@@ -115,17 +113,17 @@ void main() {
|
||||
builder: (BuildContext context) => const SimpleDialog(title: Text('Dialog')),
|
||||
);
|
||||
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(tester.testTextInput.isVisible, isFalse);
|
||||
|
||||
Navigator.of(tester.element(find.text('Dialog'))).pop();
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(tester.testTextInput.isVisible, isFalse);
|
||||
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.idle();
|
||||
|
||||
expect(tester.testTextInput.isVisible, isTrue);
|
||||
|
||||
@@ -226,7 +224,7 @@ void main() {
|
||||
|
||||
expect(tester.testTextInput.isVisible, isFalse);
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.idle();
|
||||
expect(tester.testTextInput.isVisible, isTrue);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -121,32 +121,32 @@ void main() {
|
||||
cancelCount = 0;
|
||||
|
||||
await tester.tap(find.byKey(textField1));
|
||||
await tester.pumpAndSettle(Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
expect(confirmCount, 1);
|
||||
expect(cancelCount, 0);
|
||||
|
||||
// textField1 already has the focus, no new splash
|
||||
await tester.tap(find.byKey(textField1));
|
||||
await tester.pumpAndSettle(Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
expect(confirmCount, 1);
|
||||
expect(cancelCount, 0);
|
||||
|
||||
// textField2 gets the focus and a splash
|
||||
await tester.tap(find.byKey(textField2));
|
||||
await tester.pumpAndSettle(Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
expect(confirmCount, 2);
|
||||
expect(cancelCount, 0);
|
||||
|
||||
// Tap outside of textField1's editable. It still gets focus and splash.
|
||||
await tester.tapAt(tester.getTopLeft(find.byKey(textField1)));
|
||||
await tester.pumpAndSettle(Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
expect(confirmCount, 3);
|
||||
expect(cancelCount, 0);
|
||||
|
||||
// Tap in the center of textField2's editable. It still gets the focus
|
||||
// and the splash. There is no splash cancel.
|
||||
await tester.tap(find.byKey(textField2));
|
||||
await tester.pumpAndSettle(Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
expect(confirmCount, 4);
|
||||
expect(cancelCount, 0);
|
||||
});
|
||||
|
||||
@@ -118,7 +118,6 @@ void main() {
|
||||
final MockClipboard mockClipboard = MockClipboard();
|
||||
SystemChannels.platform.setMockMethodCallHandler(mockClipboard.handleMethodCall);
|
||||
|
||||
const Duration doubleTapTimeout = Duration(milliseconds: 300);
|
||||
const String kThreeLines =
|
||||
'First line of text is '
|
||||
'Second line goes until '
|
||||
@@ -399,13 +398,13 @@ void main() {
|
||||
final int tapIndex = testValue.indexOf('e');
|
||||
final Offset ePos = textOffsetToPosition(tester, tapIndex);
|
||||
await tester.tapAt(ePos);
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(controller.selection.baseOffset, tapIndex);
|
||||
expect(controller.selection.extentOffset, tapIndex);
|
||||
});
|
||||
|
||||
testWidgets('Can long press to select a word', (WidgetTester tester) async {
|
||||
testWidgets('Can long press to select', (WidgetTester tester) async {
|
||||
final TextEditingController controller = TextEditingController();
|
||||
|
||||
await tester.pumpWidget(
|
||||
@@ -435,40 +434,6 @@ void main() {
|
||||
expect(controller.selection.extentOffset, testValue.indexOf('f')+1);
|
||||
});
|
||||
|
||||
testWidgets('Can double tap to select a word', (WidgetTester tester) async {
|
||||
final TextEditingController controller = TextEditingController();
|
||||
|
||||
await tester.pumpWidget(
|
||||
overlay(
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
const String testValue = 'abc def ghi';
|
||||
await tester.enterText(find.byType(TextField), testValue);
|
||||
expect(controller.value.text, testValue);
|
||||
await skipPastScrollingAnimation(tester);
|
||||
|
||||
expect(controller.selection.isCollapsed, true);
|
||||
|
||||
// Long press the 'e' to select 'def'.
|
||||
final Offset ePos = textOffsetToPosition(tester, testValue.indexOf('e'));
|
||||
final TestGesture firstTapGesture = await tester.startGesture(ePos);
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
await firstTapGesture.up();
|
||||
await tester.pump();
|
||||
final TestGesture secondTapGesture = await tester.startGesture(ePos);
|
||||
await tester.pump();
|
||||
await secondTapGesture.up();
|
||||
await tester.pump();
|
||||
|
||||
// 'def' is selected.
|
||||
expect(controller.selection.baseOffset, testValue.indexOf('d'));
|
||||
expect(controller.selection.extentOffset, testValue.indexOf('f')+1);
|
||||
});
|
||||
|
||||
testWidgets('Can drag handles to change selection', (WidgetTester tester) async {
|
||||
final TextEditingController controller = TextEditingController();
|
||||
|
||||
@@ -547,7 +512,7 @@ void main() {
|
||||
|
||||
// Tap the selection handle to bring up the "paste / select all" menu.
|
||||
await tester.tapAt(textOffsetToPosition(tester, testValue.indexOf('e')));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 200)); // skip past the frame where the opacity is zero
|
||||
RenderEditable renderEditable = findRenderEditable(tester);
|
||||
List<TextSelectionPoint> endpoints = globalize(
|
||||
@@ -555,7 +520,7 @@ void main() {
|
||||
renderEditable,
|
||||
);
|
||||
await tester.tapAt(endpoints[0].point + const Offset(1.0, 1.0));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 200)); // skip past the frame where the opacity is zero
|
||||
|
||||
// SELECT ALL should select all the text.
|
||||
@@ -571,7 +536,7 @@ void main() {
|
||||
|
||||
// Tap again to bring back the menu.
|
||||
await tester.tapAt(textOffsetToPosition(tester, testValue.indexOf('e')));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 200)); // skip past the frame where the opacity is zero
|
||||
renderEditable = findRenderEditable(tester);
|
||||
endpoints = globalize(
|
||||
@@ -579,7 +544,7 @@ void main() {
|
||||
renderEditable,
|
||||
);
|
||||
await tester.tapAt(endpoints[0].point + const Offset(1.0, 1.0));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 200)); // skip past the frame where the opacity is zero
|
||||
|
||||
// PASTE right before the 'e'.
|
||||
@@ -605,7 +570,7 @@ void main() {
|
||||
|
||||
// Tap the selection handle to bring up the "paste / select all" menu.
|
||||
await tester.tapAt(textOffsetToPosition(tester, testValue.indexOf('e')));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 200)); // skip past the frame where the opacity is zero
|
||||
final RenderEditable renderEditable = findRenderEditable(tester);
|
||||
final List<TextSelectionPoint> endpoints = globalize(
|
||||
@@ -613,7 +578,7 @@ void main() {
|
||||
renderEditable,
|
||||
);
|
||||
await tester.tapAt(endpoints[0].point + const Offset(1.0, 1.0));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
// Toolbar should fade in. Starting at 0% opacity.
|
||||
final Element target = tester.element(find.text('SELECT ALL'));
|
||||
@@ -1097,7 +1062,7 @@ void main() {
|
||||
|
||||
// Focus the Input. The prefix should still display.
|
||||
await tester.tap(find.byKey(secondKey));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('Prefix'), findsOneWidget);
|
||||
expect(find.text('Suffix'), findsOneWidget);
|
||||
@@ -1149,7 +1114,7 @@ void main() {
|
||||
expect(getOpacity(tester, find.text('Hint')), 1.0);
|
||||
|
||||
await tester.tap(find.byKey(secondKey));
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Focus the Input. The hint, prefix, and suffix should appear
|
||||
expect(getOpacity(tester, find.text('Prefix')), 1.0);
|
||||
@@ -1215,7 +1180,7 @@ void main() {
|
||||
|
||||
// Focus the input. The label, prefix, and suffix should appear.
|
||||
await tester.tap(find.byKey(secondKey));
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(getOpacity(tester, find.text('Prefix')), 1.0);
|
||||
expect(getOpacity(tester, find.text('Suffix')), 1.0);
|
||||
@@ -1264,7 +1229,7 @@ void main() {
|
||||
// Focus the Input. The label should start animating upwards.
|
||||
await tester.tap(find.byKey(secondKey));
|
||||
await tester.idle();
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 50));
|
||||
|
||||
Offset newPos = tester.getTopLeft(find.text('Second'));
|
||||
@@ -1399,7 +1364,7 @@ void main() {
|
||||
|
||||
// Initial state with null controller.
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
expect(tester.testTextInput.editingState['text'], isEmpty);
|
||||
|
||||
// Update the controller from null to controller1.
|
||||
@@ -1537,7 +1502,7 @@ void main() {
|
||||
await skipPastScrollingAnimation(tester);
|
||||
|
||||
await tester.tapAt(textOffsetToPosition(tester, '123'.indexOf('2')));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 200)); // skip past the frame where the opacity is zero
|
||||
final RenderEditable renderEditable = findRenderEditable(tester);
|
||||
final List<TextSelectionPoint> endpoints = globalize(
|
||||
@@ -1545,7 +1510,7 @@ void main() {
|
||||
renderEditable,
|
||||
);
|
||||
await tester.tapAt(endpoints[0].point + const Offset(1.0, 1.0));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 200)); // skip past the frame where the opacity is zero
|
||||
|
||||
Clipboard.setData(const ClipboardData(text: '一4二\n5三6'));
|
||||
@@ -1641,7 +1606,7 @@ void main() {
|
||||
expect(controller1.selection, isNot(equals(TextRange.empty)));
|
||||
|
||||
await tester.tap(find.byKey(key2));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
expect(controller1.selection, equals(TextRange.empty));
|
||||
});
|
||||
|
||||
@@ -1858,7 +1823,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
sendKeyEventWithCode(22, true, true, false); // RIGHT_ARROW keydown, SHIFT_ON
|
||||
expect(controller.selection.extentOffset - controller.selection.baseOffset, 1);
|
||||
@@ -1871,7 +1836,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.pumpAndSettle();
|
||||
sendKeyEventWithCode(22, true, true, true); // RIGHT_ARROW keydown SHIFT_ON, CONTROL_ON
|
||||
|
||||
@@ -1887,7 +1852,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
sendKeyEventWithCode(20, true, true, false); // DOWN_ARROW keydown
|
||||
await tester.pumpAndSettle();
|
||||
@@ -1910,7 +1875,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
sendKeyEventWithCode(22, true, false, false); // RIGHT_ARROW keydown
|
||||
@@ -1997,7 +1962,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Select the first 5 characters
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
@@ -2067,7 +2032,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Select the first 5 characters
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
@@ -2130,7 +2095,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Select All
|
||||
sendKeyEventWithCode(_kAKeyCode, true, false, true); // keydown control A
|
||||
@@ -2176,7 +2141,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Delete
|
||||
for (int i = 0; i < 6; i += 1) {
|
||||
@@ -2246,7 +2211,7 @@ void main() {
|
||||
|
||||
await tester.idle();
|
||||
await tester.tap(find.byType(TextField).first);
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
sendKeyEventWithCode(22, true, true, false); // RIGHT_ARROW keydown
|
||||
@@ -2333,7 +2298,7 @@ void main() {
|
||||
const String testValue = 'a big house';
|
||||
await tester.enterText(find.byType(TextField).first, testValue);
|
||||
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
sendKeyEventWithCode(22, true, true, false); // RIGHT_ARROW keydown
|
||||
@@ -2348,7 +2313,7 @@ void main() {
|
||||
|
||||
await tester.enterText(find.byType(TextField).last, testValue);
|
||||
|
||||
await tester.pumpAndSettle(doubleTapTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
for (int i = 0; i < 5; i += 1) {
|
||||
sendKeyEventWithCode(22, true, true, false); // RIGHT_ARROW keydown
|
||||
@@ -2378,7 +2343,7 @@ void main() {
|
||||
|
||||
// Tap the selection handle to bring up the "paste / select all" menu.
|
||||
await tester.tapAt(textOffsetToPosition(tester, 0));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 200)); // skip past the frame where the opacity is
|
||||
|
||||
// Confirm that the selection was updated.
|
||||
@@ -2485,7 +2450,7 @@ void main() {
|
||||
), ignoreTransform: true, ignoreRect: true));
|
||||
|
||||
await tester.tap(find.byKey(key));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(semantics, hasSemantics(TestSemantics.root(
|
||||
children: <TestSemantics>[
|
||||
@@ -2598,7 +2563,7 @@ void main() {
|
||||
|
||||
// Focus the text field
|
||||
await tester.tap(find.byKey(key));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(semantics, hasSemantics(TestSemantics.root(
|
||||
children: <TestSemantics>[
|
||||
@@ -2672,7 +2637,7 @@ void main() {
|
||||
|
||||
// Focus the text field
|
||||
await tester.tap(find.byKey(key));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
const int inputFieldId = 1;
|
||||
|
||||
@@ -2904,7 +2869,7 @@ void main() {
|
||||
), ignoreTransform: true, ignoreRect: true));
|
||||
|
||||
await tester.tap(find.byType(TextField));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(semantics, hasSemantics(TestSemantics.root(
|
||||
children: <TestSemantics>[
|
||||
|
||||
@@ -20,7 +20,6 @@ void main() {
|
||||
final FocusScopeNode focusScopeNode = FocusScopeNode();
|
||||
const TextStyle textStyle = TextStyle();
|
||||
const Color cursorColor = Color.fromARGB(0xFF, 0xFF, 0x00, 0x00);
|
||||
const Duration doubleTapTimeout = Duration(milliseconds: 300);
|
||||
|
||||
setUp(() {
|
||||
debugResetSemanticsIdCounter();
|
||||
@@ -54,7 +53,6 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
@@ -121,7 +119,6 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
@@ -285,7 +282,6 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
@@ -315,7 +311,6 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
@@ -346,7 +341,6 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
@@ -379,7 +373,6 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
@@ -410,7 +403,6 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
@@ -441,7 +433,6 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
@@ -617,7 +608,7 @@ void main() {
|
||||
// Select EditableText to give it focus.
|
||||
final Finder textFinder = find.byKey(editableTextKey);
|
||||
await tester.tap(textFinder);
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
assert(focusNode.hasFocus);
|
||||
|
||||
@@ -654,7 +645,7 @@ void main() {
|
||||
// Select EditableText to give it focus.
|
||||
final Finder textFinder = find.byKey(editableTextKey);
|
||||
await tester.tap(textFinder);
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
assert(focusNode.hasFocus);
|
||||
|
||||
@@ -698,7 +689,7 @@ void main() {
|
||||
// Select EditableText to give it focus.
|
||||
final Finder textFinder = find.byKey(editableTextKey);
|
||||
await tester.tap(textFinder);
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
assert(focusNode.hasFocus);
|
||||
|
||||
@@ -742,7 +733,7 @@ void main() {
|
||||
// Select EditableText to give it focus.
|
||||
final Finder textFinder = find.byKey(editableTextKey);
|
||||
await tester.tap(textFinder);
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
assert(focusNode.hasFocus);
|
||||
|
||||
@@ -847,7 +838,7 @@ void main() {
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.idle();
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(
|
||||
semantics,
|
||||
@@ -1488,7 +1479,7 @@ void main() {
|
||||
|
||||
await _buildApp(controls, tester);
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
expect(
|
||||
semantics,
|
||||
@@ -1574,7 +1565,7 @@ void main() {
|
||||
when(controls.canPaste(any)).thenReturn(true);
|
||||
await _buildApp(controls, tester);
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.pump(doubleTapTimeout);
|
||||
await tester.pump();
|
||||
|
||||
final SemanticsOwner owner = tester.binding.pipelineOwner.semanticsOwner;
|
||||
const int expectedNodeId = 4;
|
||||
|
||||
Reference in New Issue
Block a user