Skip to content

CupertinoTextField not changing background color when disabled #78010

@HarukaMa

Description

@HarukaMa

Steps to Reproduce

  1. Run flutter create bug.
  2. Change content of lib/main.dart to:
import 'package:flutter/cupertino.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      title: 'Flutter Demo',
      theme: CupertinoThemeData(),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: SafeArea(
        child: Padding(
          padding: const EdgeInsets.all(20.0),
          child: Column(
            children: [
              CupertinoTextField(
                enabled: true,
              ),
              CupertinoTextField(
                enabled: false,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
  1. Observe that two CupertinoTextFields have same background color.

Expected results: According to the document, disabled text field should have light gray background.

Actual results: Disabled text field still have white background (verified using Digital Color Meter.app).

Logs
# MrX @ MacBook-Pro in /tmp/test [18:03:09] C:64
$ flutter analyze
Analyzing test...
No issues found! (ran in 2.9s)
# MrX @ MacBook-Pro in /tmp/test [18:03:26] C:64
$ flutter doctor -v
[✓] Flutter (Channel stable, 2.0.1, on Mac OS X 10.15.7 19H15 darwin-x64, locale ja-JP)
    • Flutter version 2.0.1 at /Users/MrX/flutter
    • Framework revision c5a4b4029c (8 days ago), 2021-03-04 09:47:48 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/MrX/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • Java binary at: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /Applications/Chromium.app/Contents/MacOS/Chromium

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
    • IntelliJ at /Users/MrX/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 54.0.3
    • Dart plugin version 203.7759

[✓] Connected device (3 available)
    • はるかのiPhone (Dead) (mobile) • *snip* • ios            • iOS 13.6.1
    • iPhone 12 mini (mobile)    • 7CC41F12-75AD-4B4D-B086-EB0D6E9FDA5A     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    • Chrome (web)               • chrome                                   • web-javascript • Chromium 87.0.4280.88
    ! Error: はるかのiPhone is busy: Waiting for Device. Xcode will continue when はるかのiPhone is finished. (code -10)
    ! Error: はるかのiPhone (Dead) is busy: Copying cache files from device. Xcode will continue when はるかのiPhone (Dead) is finished. (code -10)

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: text inputEntering text in a text field or keyboard related problemsf: cupertinoflutter/packages/flutter/cupertino repositoryfound in release: 2.1Found to occur in 2.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions