1// Copyright 2018 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5import 'package:flutter/material.dart'; 6 7import 'text_field_constants.dart'; 8 9export 'text_field_constants.dart'; 10 11/// A page with a normal text field and a password field. 12class TextFieldPage extends StatefulWidget { 13 @override 14 State<StatefulWidget> createState() => _TextFieldPageState(); 15} 16 17class _TextFieldPageState extends State<TextFieldPage> { 18 final TextEditingController _normalController = TextEditingController(); 19 final TextEditingController _passwordController = TextEditingController(); 20 final Key normalTextFieldKey = const ValueKey<String>(normalTextFieldKeyValue); 21 final Key passwordTextFieldKey = const ValueKey<String>(passwordTextFieldKeyValue); 22 23 @override 24 Widget build(BuildContext context) { 25 return Scaffold( 26 appBar: AppBar(leading: const BackButton(key: ValueKey<String>('back'))), 27 body: Material( 28 child: Column(children: <Widget>[ 29 TextField( 30 key: normalTextFieldKey, 31 controller: _normalController, 32 autofocus: false, 33 ), 34 const Spacer(), 35 TextField( 36 key: passwordTextFieldKey, 37 controller: _passwordController, 38 obscureText: true, 39 autofocus: false, 40 ), 41 ], 42 ), 43 )); 44 } 45} 46