Expose enableIMEPersonalizedLearning on CupertinoSearchTextField (#119439)
diff --git a/packages/flutter/lib/src/cupertino/search_field.dart b/packages/flutter/lib/src/cupertino/search_field.dart
index 3481324..ac86880 100644
--- a/packages/flutter/lib/src/cupertino/search_field.dart
+++ b/packages/flutter/lib/src/cupertino/search_field.dart
@@ -122,6 +122,7 @@
this.focusNode,
this.smartQuotesType,
this.smartDashesType,
+ this.enableIMEPersonalizedLearning = true,
this.autofocus = false,
this.onTap,
this.autocorrect = true,
@@ -311,6 +312,9 @@
/// * <https://developer.apple.com/documentation/uikit/uitextinputtraits>
final SmartDashesType? smartDashesType;
+ /// {@macro flutter.services.TextInputConfiguration.enableIMEPersonalizedLearning}
+ final bool enableIMEPersonalizedLearning;
+
/// Disables the text field when false.
///
/// Text fields in disabled states have a light grey background and don't
@@ -453,6 +457,7 @@
autocorrect: widget.autocorrect,
smartQuotesType: widget.smartQuotesType,
smartDashesType: widget.smartDashesType,
+ enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning,
textInputAction: TextInputAction.search,
);
}
diff --git a/packages/flutter/test/cupertino/search_field_test.dart b/packages/flutter/test/cupertino/search_field_test.dart
index 548ab8a..34f5cb7 100644
--- a/packages/flutter/test/cupertino/search_field_test.dart
+++ b/packages/flutter/test/cupertino/search_field_test.dart
@@ -624,4 +624,19 @@
final CupertinoTextField textField = tester.widget(find.byType(CupertinoTextField));
expect(textField.smartDashesType, SmartDashesType.disabled);
});
+
+ testWidgets('enableIMEPersonalizedLearning is properly forwarded to the inner text field', (WidgetTester tester) async {
+ await tester.pumpWidget(
+ const CupertinoApp(
+ home: Center(
+ child: CupertinoSearchTextField(
+ enableIMEPersonalizedLearning: false,
+ ),
+ ),
+ ),
+ );
+
+ final CupertinoTextField textField = tester.widget(find.byType(CupertinoTextField));
+ expect(textField.enableIMEPersonalizedLearning, false);
+ });
}