enabled property

bool? enabled
final

If false the text field is "disabled": it ignores taps and its decoration is rendered in grey.

If non-null this property overrides the decoration's InputDecoration.enabled property.

When a text field is disabled, all of its children widgets are also disabled, including the InputDecoration.suffixIcon. If you need to keep the suffix icon interactive while disabling the text field, consider using readOnly and enableInteractiveSelection instead:

TextField(
  enabled: true,
  readOnly: true,
  enableInteractiveSelection: false,
  decoration: InputDecoration(
    suffixIcon: IconButton(
      onPressed: () {
        // This will work because the TextField is enabled
      },
      icon: const Icon(Icons.edit_outlined),
    ),
  ),
)

Implementation

final bool? enabled;