Skip to content

When enabled is false on InputDecoration; helperText, errorText and counterText is showing #161602

Closed

Description

@deandreamatias

Steps to reproduce

  1. Run example code
  2. Show how helperText and counterText is showing on app
  3. Can change and add the errorText to see it instead helperText

Expected results

When enabled is false, helperText, errorText and counterText is not showing on app

OR

That enable InputDecoration property documentation, do not says that helperText, errorText and counterText is not showing when enabled is false.

Actual results

When enabled is false, helperText, errorText and counterText is showing on app.

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter FormBuilder Example',
      debugShowCheckedModeBanner: false,
      localizationsDelegates: const [
        ...GlobalMaterialLocalizations.delegates,
        GlobalWidgetsLocalizations.delegate,
      ],
      home: const _ExamplePage(),
    );
  }
}

class _ExamplePage extends StatefulWidget {
  const _ExamplePage();

  @override
  State<_ExamplePage> createState() => _ExamplePageState();
}

class _ExamplePageState extends State<_ExamplePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Minimal code example')),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: TextFormField(
          // autovalidateMode: AutovalidateMode.always,
          // enabled: false,
          decoration: const InputDecoration(
            labelText: 'The language of my people',
            helperText: 'Select your favorite programming languages',
            counterText: '0/3',
            errorText: 'Please select at least one language',
            enabled: false,
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

Image

Logs

Logs
-- no logs

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.27.1, on Ubuntu 24.04.1 LTS 6.8.0-51-generic, locale en_US.UTF-8)
    • Flutter version 3.27.1 on channel stable at /home/matias/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (4 weeks ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc4)
    • Android SDK at /home/matias/Android/Sdk
    • Platform android-35, build-tools 35.0.0-rc4
    • Java binary at: /home/matias/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 18.1.3 (1ubuntu1)
    • cmake version 3.28.3
    • ninja version 1.11.1
    • pkg-config version 1.8.1

[✓] Android Studio (version 2024.1)
    • Android Studio at /home/matias/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin version 81.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.96.2)
    • VS Code at /snap/code/current/usr/share/code
    • Flutter extension version 3.102.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 24.04.1 LTS 6.8.0-51-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 110.0.5481.177

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. nate-thegrate commented on Jan 14, 2025

    @nate-thegrate
    Contributor

    Thank you @deandreamatias! I can confirm that the InputDecoration.enabled property claims that when enabled is false, "helperText, errorText, and counterText are not displayed," and that this description does not match its current behavior.

    In the spirit of Hyrum's Law (and to allow full configurability), I think it makes the most sense to update the documentation so that it reflects the current behavior, so I'll label this issue as such.

  2. added
    a: text inputEntering text in a text field or keyboard related problems
    p: material_uimaterial_ui package in flutter/packages
    d: api docsIssues with https://api.flutter.dev/
    team-designOwned by Design Languages team
    and removed
    in triagePresently being triaged by the triage team
    on Jan 14, 2025
  3. sethmfuller commented on Jan 15, 2025

    @sethmfuller
    Contributor

    I can submit a PR to fix this tomorrow. A good first issue for me as I'm wanting to dig into contributing to the Flutter repo. 🚀 FYI: @deandreamatias

  4. sethmfuller commented on Jan 15, 2025

    @sethmfuller
    Contributor

    PR submitted here: #161650

  5. added
    P2Important issues not at the top of the work list
    on Jan 16, 2025
  6. added a commit that references this issue on Jan 22, 2025
    20b1565
  7. added a commit that references this issue on Jan 24, 2025
    870bb9e
  8. github-actions commented on Feb 5, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsd: api docsIssues with https://api.flutter.dev/p: material_uimaterial_ui package in flutter/packagesteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input teamwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions