Skip to content

Instantly share code, notes, and snippets.

@truongsinh
Created August 6, 2020 02:05
Show Gist options
  • Save truongsinh/02b996e6b3dd6af564e9341ed1d455b7 to your computer and use it in GitHub Desktop.
Save truongsinh/02b996e6b3dd6af564e9341ed1d455b7 to your computer and use it in GitHub Desktop.
step 3 add autofill to the rest
diff --git a/lib/main.dart b/lib/main.dart
index 4f1704b..526ac61 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -65,15 +65,18 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
},
),
if (!isSameAddress)
- Column(
+ AutofillGroup(
+ child: Column(
children: [
TextFormField(
+ autofillHints: [AutofillHints.streetAddressLine1],
decoration: const InputDecoration(
labelText: 'Billing address 1',
hintText: 'Number and street',
),
),
TextFormField(
+ autofillHints: [AutofillHints.streetAddressLine2],
decoration: const InputDecoration(
labelText: 'Billing address 2',
hintText: '(optional) APT number, c/o',
@@ -81,17 +84,27 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
),
],
),
+ ),
+ AutofillGroup(
+ child: Column(
+ children: [
TextFormField(
+ autofillHints: [AutofillHints.creditCardNumber],
decoration: const InputDecoration(
labelText: 'Credit Card #',
),
),
TextFormField(
+ autofillHints: [AutofillHints.creditCardSecurityCode],
decoration: const InputDecoration(
labelText: 'CCV',
),
),
+ ],
+ ),
+ ),
TextFormField(
+ autofillHints: [AutofillHints.telephoneNumber],
decoration: const InputDecoration(
labelText: 'Contact Phone Number',
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment