Add text field to semantics integration test (#21665)

This commit is contained in:
Jonah Williams
2018-09-11 09:39:41 -07:00
committed by GitHub
parent fa0a857d02
commit fc1b304326
5 changed files with 183 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// The name of the route containing the text field tests.
const String textFieldRoute = 'textField';
/// The string supplied to the [ValueKey] for the normal text field.
const String normalTextFieldKeyValue = 'textFieldNormal';
/// The string supplied to the [ValueKey] for the password text field.
const String passwordTextFieldKeyValue = 'passwordField';

View File

@@ -0,0 +1,45 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'text_field_constants.dart';
export 'text_field_constants.dart';
/// A page with a normal text field and a password field.
class TextFieldPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => new _TextFieldPageState();
}
class _TextFieldPageState extends State<TextFieldPage> {
final TextEditingController _normalController = new TextEditingController();
final TextEditingController _passwordController = new TextEditingController();
final Key normalTextFieldKey = const ValueKey<String>(normalTextFieldKeyValue);
final Key passwordTextFieldKey = const ValueKey<String>(passwordTextFieldKeyValue);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(leading: const BackButton(key: ValueKey<String>('back'))),
body: new Material(
child: new Column(children: <Widget>[
new TextField(
key: normalTextFieldKey,
controller: _normalController,
autofocus: false,
),
const Spacer(),
new TextField(
key: passwordTextFieldKey,
controller: _passwordController,
obscureText: true,
autofocus: false,
),
],
),
));
}
}