Android visible password input type support (#36695)
Android devices can now use the VisibleText input keyboard type.
This commit is contained in:
parent
c8be195e95
commit
b2497822e8
@ -96,14 +96,19 @@ class TextInputType {
|
||||
/// Requests a keyboard with ready access to the "/" and "." keys.
|
||||
static const TextInputType url = TextInputType._(6);
|
||||
|
||||
/// Optimize for passwords that are visible to the user.
|
||||
///
|
||||
/// Requests a keyboard with ready access to both letters and numbers.
|
||||
static const TextInputType visiblePassword = TextInputType._(7);
|
||||
|
||||
/// All possible enum values.
|
||||
static const List<TextInputType> values = <TextInputType>[
|
||||
text, multiline, number, phone, datetime, emailAddress, url,
|
||||
text, multiline, number, phone, datetime, emailAddress, url, visiblePassword,
|
||||
];
|
||||
|
||||
// Corresponding string name for each of the [values].
|
||||
static const List<String> _names = <String>[
|
||||
'text', 'multiline', 'number', 'phone', 'datetime', 'emailAddress', 'url',
|
||||
'text', 'multiline', 'number', 'phone', 'datetime', 'emailAddress', 'url', 'visiblePassword',
|
||||
];
|
||||
|
||||
// Enum value name, this is what enum.toString() would normally return.
|
||||
|
@ -268,6 +268,39 @@ void main() {
|
||||
equals('TextInputAction.newline'));
|
||||
});
|
||||
|
||||
testWidgets('visiblePassword keyboard is requested when set explicitly', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
MediaQuery(
|
||||
data: const MediaQueryData(devicePixelRatio: 1.0),
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: FocusScope(
|
||||
node: focusScopeNode,
|
||||
autofocus: true,
|
||||
child: EditableText(
|
||||
controller: controller,
|
||||
backgroundCursorColor: Colors.grey,
|
||||
focusNode: focusNode,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
style: textStyle,
|
||||
cursorColor: cursorColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.byType(EditableText));
|
||||
await tester.showKeyboard(find.byType(EditableText));
|
||||
controller.text = 'test';
|
||||
await tester.idle();
|
||||
expect(tester.testTextInput.editingState['text'], equals('test'));
|
||||
expect(tester.testTextInput.setClientArgs['inputType']['name'],
|
||||
equals('TextInputType.visiblePassword'));
|
||||
expect(tester.testTextInput.setClientArgs['inputAction'],
|
||||
equals('TextInputAction.done'));
|
||||
});
|
||||
|
||||
testWidgets('selection overlay will update when text grow bigger', (WidgetTester tester) async {
|
||||
final TextEditingController controller = TextEditingController.fromValue(
|
||||
const TextEditingValue(
|
||||
|
Loading…
x
Reference in New Issue
Block a user