diff --git a/packages/flutter/lib/src/services/text_input.dart b/packages/flutter/lib/src/services/text_input.dart index a06f7e3e1fc..15ab9f1f8c1 100644 --- a/packages/flutter/lib/src/services/text_input.dart +++ b/packages/flutter/lib/src/services/text_input.dart @@ -174,14 +174,17 @@ class TextInputType { /// [TYPE_TEXT_VARIATION_POSTAL_ADDRESS](https://developer.android.com/reference/android/text/InputType#TYPE_TEXT_VARIATION_POSTAL_ADDRESS). static const TextInputType streetAddress = TextInputType._(9); + /// Prevent the OS from showing the on-screen virtual keyboard. + static const TextInputType none = TextInputType._(10); + /// All possible enum values. static const List values = [ - text, multiline, number, phone, datetime, emailAddress, url, visiblePassword, name, streetAddress, + text, multiline, number, phone, datetime, emailAddress, url, visiblePassword, name, streetAddress, none, ]; // Corresponding string name for each of the [values]. static const List _names = [ - 'text', 'multiline', 'number', 'phone', 'datetime', 'emailAddress', 'url', 'visiblePassword', 'name', 'address', + 'text', 'multiline', 'number', 'phone', 'datetime', 'emailAddress', 'url', 'visiblePassword', 'name', 'address', 'none', ]; // 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 71aa1d2a466..ca5b626c613 100644 --- a/packages/flutter/test/services/text_input_test.dart +++ b/packages/flutter/test/services/text_input_test.dart @@ -154,6 +154,7 @@ void main() { expect(TextInputType.visiblePassword.toString(), 'TextInputType(name: TextInputType.visiblePassword, signed: null, decimal: null)'); 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(text == number, false); expect(number == number2, true); @@ -181,6 +182,7 @@ void main() { expect(TextInputType.visiblePassword.index, 7); expect(TextInputType.name.index, 8); expect(TextInputType.streetAddress.index, 9); + expect(TextInputType.none.index, 10); expect(TextEditingValue.empty.toString(), 'TextEditingValue(text: \u2524\u251C, selection: ${const TextSelection.collapsed(offset: -1)}, composing: ${TextRange.empty})');