Skip to content

TextFormField is not scrollable when disabled #140147

@Gummiees

Description

@Gummiees

Is there an existing issue for this?

Steps to reproduce

Sometimes it is necessary to have the input disabled instead of read-only because of how the input behaves if set to read-only, for instance, it can still get focused.

This could be solved by setting many style properties, but if Flutter allowed for a user to scroll on a disabled input as the HTML textarea does, it would be much easier. Personally, can't find a good reason to not make the input scrollable even when disabled.

You can find a very straight forward example on the code sample. Just have a TextFormField with maxLines, an initial value with more lines than the maxLines so it requires scrolling to see the full input, and enabled = false.

A multiline input being scrollable is something that HTML already does when using <textarea disabled>, so why wouldn't Flutter?

Expected results

Allow scroll on disabled input field so all the content can be read.

Actual results

User cannot scroll if the input is disabled, so they cannot read the full input value.

Code sample

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Material (
        child: TextFormField (
          enabled: false,
          readOnly: false,
          initialValue: 'lorem\nipsum\ndolor\nsit\namet\nconsectetur\nadipiscing\nelit\nsed',
          minLines: 5,
          maxLines: 5,
        ),
      ),
    );
  }
}

Related Stack Overflow question

https://stackoverflow.com/questions/77659987/make-a-disabled-textformfield-scrollable/77660516#77660516

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.9, on macOS 13.5.2 22G91 darwin-arm64, locale en-ES)
    • Flutter version 3.13.9 on channel stable at /Users/xavicaro/fvm/versions/3.13.9
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (7 weeks ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/xavicaro/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/xavicaro/Library/Android/sdk/platform-tools
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C65
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.85.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.5.2 22G91 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 120.0.6099.71

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

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 problemsf: material designflutter/packages/flutter/material repository.found in release: 3.16Found to occur in 3.16found in release: 3.18Found to occur in 3.18has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions