Skip to content

CupertinoTextField overriding decoration when disabled. #83531

@GabRoyer

Description

@GabRoyer

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,
                decoration: BoxDecoration(color: Color(0xFFFF0000)),
              ),
              CupertinoTextField(
                enabled: false,
                decoration: BoxDecoration(color: Color(0xFFFF0000)),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

  1. Notice how the disabled field has a gray background

Expected results: The background of both text fields are red. I expected the background color to be respected, just like it was before #78058

Actual results: The background of the disabled text field is gray.

Logs
bug % flutter analyze
Analyzing bug...                                                        
No issues found! (ran in 4.3s)
bug % flutter doctor -v
[✓] Flutter (Channel stable, 2.2.0, on macOS 11.3 20E232 darwin-x64, locale en-US)
    • Flutter version 2.2.0 at /Users/gabroyer/Development/flutter
    • Framework revision b22742018b (13 days ago), 2021-05-14 19:12:57 -0700
    • Engine revision a9d88a4d18
    • Dart version 2.13.0

[!] Android toolchain - develop for Android devices
    • Android SDK at /usr/local/Caskroom/android-platform-tools/30.0.0
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

    ✗ No valid Android SDK platforms found in /usr/local/Caskroom/android-platform-tools/30.0.0/platforms. Directory
      was empty.
    • Try re-installing or updating your Android SDK,
      visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.

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

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

[!] 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).

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

[✓] Connected device (3 available)
    • iPhone 11 (mobile)      • 78D85886-701C-4254-9175-45343C35C6F5 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • iPhone 12 mini (mobile) • 3E837647-6228-43E1-BD9D-A642E83A922D • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)            • chrome                               • web-javascript • Google Chrome 90.0.4430.212

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: cupertinoflutter/packages/flutter/cupertino repositoryfound in release: 2.2Found to occur in 2.2frameworkflutter/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 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