Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit a752c2f

Browse files
authored
Expose enableIMEPersonalizedLearning on CupertinoSearchTextField (#119439)
1 parent 3894d24 commit a752c2f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

packages/flutter/lib/src/cupertino/search_field.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class CupertinoSearchTextField extends StatefulWidget {
122122
this.focusNode,
123123
this.smartQuotesType,
124124
this.smartDashesType,
125+
this.enableIMEPersonalizedLearning = true,
125126
this.autofocus = false,
126127
this.onTap,
127128
this.autocorrect = true,
@@ -311,6 +312,9 @@ class CupertinoSearchTextField extends StatefulWidget {
311312
/// * <https://developer.apple.com/documentation/uikit/uitextinputtraits>
312313
final SmartDashesType? smartDashesType;
313314

315+
/// {@macro flutter.services.TextInputConfiguration.enableIMEPersonalizedLearning}
316+
final bool enableIMEPersonalizedLearning;
317+
314318
/// Disables the text field when false.
315319
///
316320
/// Text fields in disabled states have a light grey background and don't
@@ -453,6 +457,7 @@ class _CupertinoSearchTextFieldState extends State<CupertinoSearchTextField>
453457
autocorrect: widget.autocorrect,
454458
smartQuotesType: widget.smartQuotesType,
455459
smartDashesType: widget.smartDashesType,
460+
enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning,
456461
textInputAction: TextInputAction.search,
457462
);
458463
}

packages/flutter/test/cupertino/search_field_test.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,4 +624,19 @@ void main() {
624624
final CupertinoTextField textField = tester.widget(find.byType(CupertinoTextField));
625625
expect(textField.smartDashesType, SmartDashesType.disabled);
626626
});
627+
628+
testWidgets('enableIMEPersonalizedLearning is properly forwarded to the inner text field', (WidgetTester tester) async {
629+
await tester.pumpWidget(
630+
const CupertinoApp(
631+
home: Center(
632+
child: CupertinoSearchTextField(
633+
enableIMEPersonalizedLearning: false,
634+
),
635+
),
636+
),
637+
);
638+
639+
final CupertinoTextField textField = tester.widget(find.byType(CupertinoTextField));
640+
expect(textField.enableIMEPersonalizedLearning, false);
641+
});
627642
}

0 commit comments

Comments
 (0)