mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Send text selection rects to engine on iPhone (#113048)
This commit is contained in:
parent
00f36b6466
commit
af2d5bc5ca
@ -63,10 +63,6 @@ const Duration _kCursorBlinkHalfPeriod = Duration(milliseconds: 500);
|
||||
// is shown in an obscured text field.
|
||||
const int _kObscureShowLatestCharCursorTicks = 3;
|
||||
|
||||
// The minimum width of an iPad screen. The smallest iPad is currently the
|
||||
// iPad Mini 6th Gen according to ios-resolution.com.
|
||||
const double _kIPadWidth = 1488.0;
|
||||
|
||||
/// A controller for an editable text field.
|
||||
///
|
||||
/// Whenever the user modifies a text field with an associated
|
||||
@ -3144,10 +3140,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
||||
if (defaultTargetPlatform != TargetPlatform.iOS) {
|
||||
return;
|
||||
}
|
||||
// This is to avoid sending selection rects on non-iPad devices.
|
||||
if (WidgetsBinding.instance.window.physicalSize.shortestSide < _kIPadWidth) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String text = renderEditable.text?.toPlainText(includeSemanticsLabels: false) ?? '';
|
||||
final List<Rect> firstSelectionBoxes = renderEditable.getBoxesForSelection(const TextSelection(baseOffset: 0, extentOffset: 1));
|
||||
|
||||
@ -4624,6 +4624,10 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('selection rects are sent when they change', (WidgetTester tester) async {
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
// Ensure selection rects are sent on iPhone (using SE 3rd gen size)
|
||||
tester.binding.window.physicalSizeTestValue = const Size(750.0, 1334.0);
|
||||
|
||||
final List<MethodCall> log = <MethodCall>[];
|
||||
SystemChannels.textInput.setMockMethodCallHandler((MethodCall methodCall) async {
|
||||
log.add(methodCall);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user