mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Smart quote/dash configuration support in iOS (flutter/engine#13863)
Support for UITextSmartDashesType and UITextSmartQuotesType in iOS
This commit is contained in:
parent
db71c6507c
commit
533f607e6a
@ -159,6 +159,8 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) {
|
||||
@property(nonatomic) UIKeyboardType keyboardType;
|
||||
@property(nonatomic) UIReturnKeyType returnKeyType;
|
||||
@property(nonatomic, getter=isSecureTextEntry) BOOL secureTextEntry;
|
||||
@property(nonatomic) UITextSmartQuotesType smartQuotesType API_AVAILABLE(ios(11.0));
|
||||
@property(nonatomic) UITextSmartDashesType smartDashesType API_AVAILABLE(ios(11.0));
|
||||
|
||||
@property(nonatomic, assign) id<FlutterTextInputDelegate> textInputDelegate;
|
||||
|
||||
@ -193,6 +195,10 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) {
|
||||
_keyboardType = UIKeyboardTypeDefault;
|
||||
_returnKeyType = UIReturnKeyDone;
|
||||
_secureTextEntry = NO;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_smartQuotesType = UITextSmartQuotesTypeYes;
|
||||
_smartDashesType = UITextSmartDashesTypeYes;
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
@ -764,6 +770,18 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) {
|
||||
_activeView.keyboardType = ToUIKeyboardType(inputType);
|
||||
_activeView.returnKeyType = ToUIReturnKeyType(configuration[@"inputAction"]);
|
||||
_activeView.autocapitalizationType = ToUITextAutoCapitalizationType(configuration);
|
||||
if (@available(iOS 11.0, *)) {
|
||||
NSString* smartDashesType = configuration[@"smartDashesType"];
|
||||
// This index comes from the SmartDashesType enum in the framework.
|
||||
bool smartDashesIsDisabled = smartDashesType && [smartDashesType isEqualToString:@"0"];
|
||||
_activeView.smartDashesType =
|
||||
smartDashesIsDisabled ? UITextSmartDashesTypeNo : UITextSmartDashesTypeYes;
|
||||
NSString* smartQuotesType = configuration[@"smartQuotesType"];
|
||||
// This index comes from the SmartQuotesType enum in the framework.
|
||||
bool smartQuotesIsDisabled = smartQuotesType && [smartQuotesType isEqualToString:@"0"];
|
||||
_activeView.smartQuotesType =
|
||||
smartQuotesIsDisabled ? UITextSmartQuotesTypeNo : UITextSmartQuotesTypeYes;
|
||||
}
|
||||
if ([keyboardAppearance isEqualToString:@"Brightness.dark"]) {
|
||||
_activeView.keyboardAppearance = UIKeyboardAppearanceDark;
|
||||
} else if ([keyboardAppearance isEqualToString:@"Brightness.light"]) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user