Skip to content

Commit d0dd45f

Browse files
chrisbobbegnprice
authored andcommitted
login [nfc]: Pull out emailField local, to help indentation
1 parent 85b6eeb commit d0dd45f

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

lib/widgets/login.dart

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,24 @@ class _EmailPasswordLoginPageState extends State<EmailPasswordLoginPage> {
184184
@override
185185
Widget build(BuildContext context) {
186186
assert(!PerAccountStoreWidget.debugExistsOf(context));
187+
188+
final emailField = TextFormField(
189+
key: _emailKey,
190+
autofillHints: const [AutofillHints.email],
191+
keyboardType: TextInputType.emailAddress,
192+
// TODO(upstream?): Apparently pressing "next" doesn't count
193+
// as user interaction, and validation isn't done.
194+
autovalidateMode: AutovalidateMode.onUserInteraction,
195+
validator: (value) {
196+
if (value == null || value.trim().isEmpty) {
197+
return 'Please enter your email.';
198+
}
199+
// TODO(#35): validate is in the shape of an email
200+
return null;
201+
},
202+
textInputAction: TextInputAction.next,
203+
decoration: const InputDecoration(labelText: 'Email address'));
204+
187205
return Scaffold(
188206
appBar: AppBar(title: const Text('Log in'),
189207
bottom: _inProgress
@@ -198,23 +216,7 @@ class _EmailPasswordLoginPageState extends State<EmailPasswordLoginPage> {
198216
child: Form(
199217
child: AutofillGroup(
200218
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
201-
TextFormField(
202-
key: _emailKey,
203-
autofillHints: const [AutofillHints.email],
204-
keyboardType: TextInputType.emailAddress,
205-
// TODO(upstream?): Apparently pressing "next" doesn't count
206-
// as user interaction, and validation isn't done.
207-
autovalidateMode: AutovalidateMode.onUserInteraction,
208-
validator: (value) {
209-
if (value == null || value.trim().isEmpty) {
210-
return 'Please enter your email.';
211-
}
212-
// TODO(#35): validate is in the shape of an email
213-
return null;
214-
},
215-
textInputAction: TextInputAction.next,
216-
decoration: const InputDecoration(
217-
labelText: 'Email address')),
219+
emailField,
218220
const SizedBox(height: 8),
219221
TextFormField(
220222
key: _passwordKey,

0 commit comments

Comments
 (0)