Skip to content

TextField error state cursor color does not make use of Theme.of(context).inputDecorationTheme #140607

@strexicious

Description

@strexicious

Steps to reproduce

  1. Run the code sample
  2. Click on either TextFields to show the cursor
  3. Notice the difference in the color of the cursors

Expected results

The color of the cursors in both example should have been the same green.

Actual results

The color of the first TextField is the default MD3 error color, while the color of the second TextField is the expected Colors.green.

Code sample

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

const _errorStyle = TextStyle(color: Colors.green);

var _themeData = ThemeData(
  inputDecorationTheme: const InputDecorationTheme(
    errorStyle: _errorStyle,
  ),
);

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: _themeData, // setting errorStyle "globally"
      home: Scaffold(
        body: ListView(
          children: const [
            TextField(decoration: InputDecoration(
              errorText: "Some error here"
            )),
            TextField(decoration: InputDecoration(
              errorStyle: _errorStyle, // setting errorStyle "locally"
              errorText: "Some error here"
            )),
          ],
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.16.5, on Microsoft Windows [Version 10.0.19045.3803], locale en-150)
    • Flutter version 3.16.5 on channel stable at D:\not_important_programs\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (6 days ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at D:\AndroidSDK
    • Platform android-33, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2019 16.7.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
    • Visual Studio Build Tools 2019 version 16.7.30503.244
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 2021.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 11.0.12+7-b1504.28-7817840)

[√] VS Code (version 1.85.1)
    • VS Code at C:\Users\UserName\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.78.0

[√] Connected device (1 available)
    • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3803]

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

• No issues found!

Metadata

Metadata

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.18frameworkflutter/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