From b6d9411aa1abfac88e866c6c98409e5a4af75867 Mon Sep 17 00:00:00 2001 From: Alabhya Date: Thu, 11 Feb 2021 13:13:07 +0530 Subject: [PATCH] Added Focusnodes in form sample (#707) --- form_app/lib/src/autofill.dart | 8 ++++++++ form_app/lib/src/sign_in_http.dart | 2 ++ form_app/lib/src/validation.dart | 2 ++ 3 files changed, 12 insertions(+) diff --git a/form_app/lib/src/autofill.dart b/form_app/lib/src/autofill.dart index 9e881b860..dc60e0e4a 100644 --- a/form_app/lib/src/autofill.dart +++ b/form_app/lib/src/autofill.dart @@ -31,6 +31,8 @@ class _AutofillDemoState extends State { ...[ Text('This sample demonstrates autofill. '), TextFormField( + autofocus: true, + textInputAction: TextInputAction.next, decoration: InputDecoration( hintText: 'Jane', labelText: 'First Name', @@ -38,6 +40,7 @@ class _AutofillDemoState extends State { autofillHints: [AutofillHints.givenName], ), TextFormField( + textInputAction: TextInputAction.next, decoration: InputDecoration( hintText: 'Doe', labelText: 'Last Name', @@ -46,6 +49,7 @@ class _AutofillDemoState extends State { ), TextField( keyboardType: TextInputType.emailAddress, + textInputAction: TextInputAction.next, decoration: InputDecoration( hintText: 'foo@example.com', labelText: 'Email', @@ -54,6 +58,7 @@ class _AutofillDemoState extends State { ), TextField( keyboardType: TextInputType.phone, + textInputAction: TextInputAction.next, decoration: InputDecoration( hintText: '(123) 456-7890', labelText: 'Telephone', @@ -62,6 +67,7 @@ class _AutofillDemoState extends State { ), TextField( keyboardType: TextInputType.streetAddress, + textInputAction: TextInputAction.next, decoration: InputDecoration( hintText: '123 4th Ave', labelText: 'Street Address', @@ -70,6 +76,7 @@ class _AutofillDemoState extends State { ), TextField( keyboardType: TextInputType.number, + textInputAction: TextInputAction.next, decoration: InputDecoration( hintText: '12345', labelText: 'Postal Code', @@ -77,6 +84,7 @@ class _AutofillDemoState extends State { autofillHints: [AutofillHints.postalCode], ), TextField( + textInputAction: TextInputAction.next, decoration: InputDecoration( hintText: 'United States', labelText: 'Country', diff --git a/form_app/lib/src/sign_in_http.dart b/form_app/lib/src/sign_in_http.dart index fb1574646..c57dab023 100644 --- a/form_app/lib/src/sign_in_http.dart +++ b/form_app/lib/src/sign_in_http.dart @@ -54,6 +54,8 @@ class _SignInHttpDemoState extends State { children: [ ...[ TextFormField( + autofocus: true, + textInputAction: TextInputAction.next, decoration: InputDecoration( filled: true, hintText: 'Your email address', diff --git a/form_app/lib/src/validation.dart b/form_app/lib/src/validation.dart index 122b74185..65df85cc8 100644 --- a/form_app/lib/src/validation.dart +++ b/form_app/lib/src/validation.dart @@ -64,6 +64,8 @@ class _FormValidationDemoState extends State { children: [ // A text field that validates that the text is an adjective. TextFormField( + autofocus: true, + textInputAction: TextInputAction.next, validator: (value) { if (value.isEmpty) { return 'Please enter an adjective.';