diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index eb8d91a542..890b4933f4 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -194,14 +194,24 @@ class TextInputType { /// Prevent the OS from showing the on-screen virtual keyboard. static const TextInputType none = TextInputType._(10); + /// Optimized for web searches. + /// + /// Requests a keyboard that includes keys useful for web searches as well as URLs. + /// + /// On iOS, requests a default keyboard with ready access to the "." key. In contrast to + /// [url], a space bar is available. + /// + /// On Android this is remapped to the [url] keyboard type as it always shows a space bar. + static const TextInputType webSearch = TextInputType._(11); + /// All possible enum values. static const List values = [ - text, multiline, number, phone, datetime, emailAddress, url, visiblePassword, name, streetAddress, none, + text, multiline, number, phone, datetime, emailAddress, url, visiblePassword, name, streetAddress, none, webSearch, ]; // Corresponding string name for each of the [values]. static const List _names = [ - 'text', 'multiline', 'number', 'phone', 'datetime', 'emailAddress', 'url', 'visiblePassword', 'name', 'address', 'none', + 'text', 'multiline', 'number', 'phone', 'datetime', 'emailAddress', 'url', 'visiblePassword', 'name', 'address', 'none', 'webSearch', ]; // Enum value name, this is what enum.toString() would normally return. diff --git a/packages/flutter/test/services/text_input_test.dart b/packages/flutter/test/services/text_input_test.dart index 215e9dc0c1..f369272d56 100644 --- a/packages/flutter/test/services/text_input_test.dart +++ b/packages/flutter/test/services/text_input_test.dart @@ -348,6 +348,7 @@ void main() { expect(TextInputType.name.toString(), 'TextInputType(name: TextInputType.name, signed: null, decimal: null)'); expect(TextInputType.streetAddress.toString(), 'TextInputType(name: TextInputType.address, signed: null, decimal: null)'); expect(TextInputType.none.toString(), 'TextInputType(name: TextInputType.none, signed: null, decimal: null)'); + expect(TextInputType.webSearch.toString(), 'TextInputType(name: TextInputType.webSearch, signed: null, decimal: null)'); expect(text == number, false); expect(number == number2, true); @@ -376,6 +377,7 @@ void main() { expect(TextInputType.name.index, 8); expect(TextInputType.streetAddress.index, 9); expect(TextInputType.none.index, 10); + expect(TextInputType.webSearch.index, 11); expect(TextEditingValue.empty.toString(), 'TextEditingValue(text: \u2524\u251C, selection: ${const TextSelection.collapsed(offset: -1)}, composing: ${TextRange.empty})');