[ios] fix hold and drag spacebar does not move cursor when obscureTex… (#122383)
Fixes #122139 with engine pr [flutter/engine#40216](https://github.com/flutter/engine/pull/40216)
This commit is contained in:
@@ -2681,6 +2681,12 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
|
||||
}
|
||||
}
|
||||
|
||||
if (_hasInputConnection) {
|
||||
if (oldWidget.obscureText != widget.obscureText) {
|
||||
_textInputConnection!.updateConfig(_effectiveAutofillClient.textInputConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
if (widget.style != oldWidget.style) {
|
||||
// The _textInputConnection will pick up the new style when it attaches in
|
||||
// _openInputConnection.
|
||||
|
||||
@@ -3115,6 +3115,42 @@ void main() {
|
||||
expect(tester.testTextInput.setClientArgs!['readOnly'], isFalse);
|
||||
});
|
||||
|
||||
testWidgets('Sends "updateConfig" when obscureText is flipped', (WidgetTester tester) async {
|
||||
bool obscureText = true;
|
||||
late StateSetter setState;
|
||||
final TextEditingController controller = TextEditingController(text: 'Lorem');
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter stateSetter) {
|
||||
setState = stateSetter;
|
||||
return EditableText(
|
||||
obscureText: obscureText,
|
||||
controller: controller,
|
||||
backgroundCursorColor: Colors.grey,
|
||||
focusNode: focusNode,
|
||||
style: textStyle,
|
||||
cursorColor: cursorColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Interact with the field to establish the input connection.
|
||||
final Offset topLeft = tester.getTopLeft(find.byType(EditableText));
|
||||
await tester.tapAt(topLeft + const Offset(0.0, 5.0));
|
||||
await tester.pump();
|
||||
|
||||
expect(tester.testTextInput.setClientArgs!['obscureText'], isTrue);
|
||||
|
||||
setState(() { obscureText = false; });
|
||||
await tester.pump();
|
||||
|
||||
expect(tester.testTextInput.setClientArgs!['obscureText'], isFalse);
|
||||
});
|
||||
|
||||
testWidgets('Fires onChanged when text changes via TextSelectionOverlay', (WidgetTester tester) async {
|
||||
late String changedValue;
|
||||
final Widget widget = MaterialApp(
|
||||
|
||||
Reference in New Issue
Block a user