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

Commit

Permalink
Expose enableIMEPersonalizedLearning on CupertinoSearchTextField (#11…
Browse files Browse the repository at this point in the history
…9439)
  • Loading branch information
moffatman committed Feb 1, 2023
1 parent 3894d24 commit a752c2f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/flutter/lib/src/cupertino/search_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -311,6 +312,9 @@ class CupertinoSearchTextField extends StatefulWidget {
/// * <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
Expand Down Expand Up @@ -453,6 +457,7 @@ class _CupertinoSearchTextFieldState extends State<CupertinoSearchTextField>
autocorrect: widget.autocorrect,
smartQuotesType: widget.smartQuotesType,
smartDashesType: widget.smartDashesType,
enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning,
textInputAction: TextInputAction.search,
);
}
Expand Down
15 changes: 15 additions & 0 deletions packages/flutter/test/cupertino/search_field_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

0 comments on commit a752c2f

Please sign in to comment.