mirror of
https://github.com/flutter/samples.git
synced 2025-11-09 06:18:49 +00:00
Add flutter_lints to form_app (#822)
This commit is contained in:
@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
|
||||
// Demonstrates how to use autofill hints. The full list of hints is here:
|
||||
// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/text_editing/autofill_hint.dart
|
||||
class AutofillDemo extends StatefulWidget {
|
||||
const AutofillDemo({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AutofillDemoState createState() => _AutofillDemoState();
|
||||
}
|
||||
@@ -18,36 +20,36 @@ class _AutofillDemoState extends State<AutofillDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Autofill'),
|
||||
title: const Text('Autofill'),
|
||||
),
|
||||
body: Form(
|
||||
key: _formKey,
|
||||
child: Scrollbar(
|
||||
child: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: AutofillGroup(
|
||||
child: Column(
|
||||
children: [
|
||||
...[
|
||||
Text('This sample demonstrates autofill. '),
|
||||
const Text('This sample demonstrates autofill. '),
|
||||
TextFormField(
|
||||
autofocus: true,
|
||||
textInputAction: TextInputAction.next,
|
||||
decoration: InputDecoration(
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Jane',
|
||||
labelText: 'First Name',
|
||||
),
|
||||
autofillHints: [AutofillHints.givenName],
|
||||
autofillHints: const [AutofillHints.givenName],
|
||||
),
|
||||
TextFormField(
|
||||
textInputAction: TextInputAction.next,
|
||||
decoration: InputDecoration(
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Doe',
|
||||
labelText: 'Last Name',
|
||||
),
|
||||
autofillHints: [AutofillHints.familyName],
|
||||
autofillHints: const [AutofillHints.familyName],
|
||||
),
|
||||
TextField(
|
||||
const TextField(
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
textInputAction: TextInputAction.next,
|
||||
decoration: InputDecoration(
|
||||
@@ -56,7 +58,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
|
||||
),
|
||||
autofillHints: [AutofillHints.email],
|
||||
),
|
||||
TextField(
|
||||
const TextField(
|
||||
keyboardType: TextInputType.phone,
|
||||
textInputAction: TextInputAction.next,
|
||||
decoration: InputDecoration(
|
||||
@@ -65,7 +67,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
|
||||
),
|
||||
autofillHints: <String>[AutofillHints.telephoneNumber],
|
||||
),
|
||||
TextField(
|
||||
const TextField(
|
||||
keyboardType: TextInputType.streetAddress,
|
||||
textInputAction: TextInputAction.next,
|
||||
decoration: InputDecoration(
|
||||
@@ -74,7 +76,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
|
||||
),
|
||||
autofillHints: <String>[AutofillHints.streetAddressLine1],
|
||||
),
|
||||
TextField(
|
||||
const TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.next,
|
||||
decoration: InputDecoration(
|
||||
@@ -83,7 +85,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
|
||||
),
|
||||
autofillHints: <String>[AutofillHints.postalCode],
|
||||
),
|
||||
TextField(
|
||||
const TextField(
|
||||
textInputAction: TextInputAction.next,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'United States',
|
||||
@@ -91,7 +93,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
|
||||
),
|
||||
autofillHints: <String>[AutofillHints.countryName],
|
||||
),
|
||||
TextField(
|
||||
const TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
hintText: '1',
|
||||
@@ -102,7 +104,7 @@ class _AutofillDemoState extends State<AutofillDemo> {
|
||||
].expand(
|
||||
(widget) => [
|
||||
widget,
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user