diff --git a/packages/flutter/lib/src/cupertino/search_field.dart b/packages/flutter/lib/src/cupertino/search_field.dart index 348132406f..ac868801bc 100644 --- a/packages/flutter/lib/src/cupertino/search_field.dart +++ b/packages/flutter/lib/src/cupertino/search_field.dart @@ -122,6 +122,7 @@ class CupertinoSearchTextField extends StatefulWidget { this.focusNode, this.smartQuotesType, this.smartDashesType, + this.enableIMEPersonalizedLearning = true, this.autofocus = false, this.onTap, this.autocorrect = true, @@ -311,6 +312,9 @@ class CupertinoSearchTextField extends StatefulWidget { /// * 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 @@ class _CupertinoSearchTextFieldState extends State 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 548ab8a96d..34f5cb7aa9 100644 --- a/packages/flutter/test/cupertino/search_field_test.dart +++ b/packages/flutter/test/cupertino/search_field_test.dart @@ -624,4 +624,19 @@ void main() { 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); + }); }