Support for disabling TextField, TextFormField (#16027)
This commit is contained in:
@@ -138,8 +138,10 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: <Widget>[
|
||||
new TextField(
|
||||
enabled: true,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Event name',
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
style: Theme.of(context).textTheme.display1,
|
||||
),
|
||||
|
||||
@@ -249,17 +249,21 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
|
||||
fieldKey: _passwordFieldKey,
|
||||
helperText: 'No more than 8 characters.',
|
||||
labelText: 'Password *',
|
||||
onSaved: (String value) { person.password = value; },
|
||||
onFieldSubmitted: (String value) {
|
||||
setState(() {
|
||||
person.password = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24.0),
|
||||
new TextFormField(
|
||||
enabled: person.password != null && person.password.isNotEmpty,
|
||||
decoration: const InputDecoration(
|
||||
border: const UnderlineInputBorder(),
|
||||
filled: true,
|
||||
labelText: 'Re-type password',
|
||||
),
|
||||
maxLength: 8,
|
||||
onFieldSubmitted: (String value) { person.password = value; },
|
||||
obscureText: true,
|
||||
validator: _validatePassword,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user