Skip to content

Disabled TextField InputDecoration errorText allocates space but is not shown #67409

@PetrasBartusis

Description

@PetrasBartusis

Steps to Reproduce

  1. Create a TextField that has enabled: false and has decoration: InputDecoration().

  2. Code of the sample app:

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Flutter Demo',
        home: MyHomePage(),
      );
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) => Scaffold(
        body: Center(
          child: Padding(
            padding: EdgeInsets.all(16),
            child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
              Container(
                color: Colors.green.withOpacity(0.4),
                child: TextField(
                  enabled: false,
                  decoration: InputDecoration(
                    hintText: 'hintText',
                  ),
                ),
              ),
              SizedBox(height: 8),
              Container(
                color: Colors.orange.withOpacity(0.4),
                child: TextField(
                  enabled: false,
                  decoration: InputDecoration(hintText: 'hintText', errorText: 'Error text'),
                ),
              ),
              SizedBox(height: 8),
              Container(
                color: Colors.red.withOpacity(0.4),
                child: TextField(
                  decoration: InputDecoration(hintText: 'hintText', errorText: 'Error text'),
                ),
              ),
            ]),
          ),
        ), // This trailing comma makes auto-formatting nicer for build methods.
      );
}

Expected results:
To my mind, TextField should not allocate the space if it is disabled or it should still display the errorText;

Actual results:
At the moment it allocates the space but does not show the error itself;

Example image:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsa: typographyText rendering, possibly libtxtf: material designflutter/packages/flutter/material repository.found in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions