This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed
embedding/engine/systemchannels
darwin/ios/framework/Source Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -717,7 +717,8 @@ public enum TextInputType {
717717 EMAIL_ADDRESS ("TextInputType.emailAddress" ),
718718 URL ("TextInputType.url" ),
719719 VISIBLE_PASSWORD ("TextInputType.visiblePassword" ),
720- NONE ("TextInputType.none" );
720+ NONE ("TextInputType.none" ),
721+ WEB_SEARCH ("TextInputType.webSearch" );
721722
722723 static TextInputType fromValue (@ NonNull String encodedName ) throws NoSuchFieldException {
723724 for (TextInputType textInputType : TextInputType .values ()) {
Original file line number Diff line number Diff line change @@ -252,7 +252,8 @@ private static int inputTypeFromTextInputType(
252252 textType |= InputType .TYPE_TEXT_FLAG_MULTI_LINE ;
253253 } else if (type .type == TextInputChannel .TextInputType .EMAIL_ADDRESS ) {
254254 textType |= InputType .TYPE_TEXT_VARIATION_EMAIL_ADDRESS ;
255- } else if (type .type == TextInputChannel .TextInputType .URL ) {
255+ } else if (type .type == TextInputChannel .TextInputType .URL
256+ || type .type == TextInputChannel .TextInputType .WEB_SEARCH ) {
256257 textType |= InputType .TYPE_TEXT_VARIATION_URI ;
257258 } else if (type .type == TextInputChannel .TextInputType .VISIBLE_PASSWORD ) {
258259 textType |= InputType .TYPE_TEXT_VARIATION_VISIBLE_PASSWORD ;
Original file line number Diff line number Diff line change @@ -140,6 +140,9 @@ static UIKeyboardType ToUIKeyboardType(NSDictionary* type) {
140140 if ([inputType isEqualToString: @" TextInputType.visiblePassword" ]) {
141141 return UIKeyboardTypeASCIICapable;
142142 }
143+ if ([inputType isEqualToString: @" TextInputType.webSearch" ]) {
144+ return UIKeyboardTypeWebSearch;
145+ }
143146 return UIKeyboardTypeDefault;
144147}
145148
Original file line number Diff line number Diff line change @@ -307,6 +307,20 @@ - (void)testKeyboardType {
307307 XCTAssertEqual (inputView.keyboardType , UIKeyboardTypeURL);
308308}
309309
310+ - (void )testKeyboardTypeWebSearch {
311+ NSDictionary * config = self.mutableTemplateCopy ;
312+ [config setValue: @{@" name" : @" TextInputType.webSearch" } forKey: @" inputType" ];
313+ [self setClientId: 123 configuration: config];
314+
315+ // Find all the FlutterTextInputViews we created.
316+ NSArray <FlutterTextInputView*>* inputFields = self.installedInputViews ;
317+
318+ FlutterTextInputView* inputView = inputFields[0 ];
319+
320+ // Verify keyboardType is set to the value specified in config.
321+ XCTAssertEqual (inputView.keyboardType , UIKeyboardTypeWebSearch);
322+ }
323+
310324- (void )testVisiblePasswordUseAlphanumeric {
311325 NSDictionary * config = self.mutableTemplateCopy ;
312326 [config setValue: @{@" name" : @" TextInputType.visiblePassword" } forKey: @" inputType" ];
You can’t perform that action at this time.
0 commit comments