Skip to content

cursorColor with an opacity is not respected #132886

@gintominto5329

Description

@gintominto5329

Steps to reproduce

  1. run the code sample, on dartpad.
  2. press the text-field, in the center of page.
  3. cursor is visible now.

Expected results

TextField's cursor should not be visible, because the background's color matches with cursor.

Actual results

TextField's cursor is clearly visible, indicating that the cursor's color's alpha is not respected

Code sample

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

final color = Colors.black.withAlpha(15);

void main() => //
    runApp(MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: Padding(
            padding: const EdgeInsets.symmetric(
              horizontal: 16,
            ),
            child: ColoredBox(
              color: color,
              child: TextField(
                decoration: null,
                cursorColor: color,
                cursorOpacityAnimates: false,
                onSubmitted: (String value) => //
                    print(value),
              ),
            ),
          ),
        ),
      ),
    ));

Host

Master channel on dartpad_dev

Fix

In EditableText, check if cursorOpacityAnimates == false, and ignore the animation provided alpha, for cursorColor

thanks

Metadata

Metadata

Assignees

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.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14frameworkflutter/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

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions