Skip to content

[TextField]backgroundColor covers/hides cursor and text selection #96112

Description

@uvizhe

Setting backgroundColor on TextField appears to mask cursor and text selection. That is when you type some text in a text box and move cursor back it disappears. Selecting text doesn't show any visual indicator of a selection either.

Below is a code to reproduce this.

I observe this behavior at least on linux and android.

import'package:flutter/material.dart';
voidmain() {
runApp(constMyApp());
}
classMyAppextendsStatelessWidget {
constMyApp({Key? key}) :super(key: key);
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
home:constMyHomePage(),
);
}
}
classMyHomePageextendsStatefulWidget {
constMyHomePage({Key? key}) :super(key: key);
@overrideState<MyHomePage> createState() =>_MyHomePageState();
}
class_MyHomePageStateextendsState<MyHomePage> {
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
body:Center(
child:TextField(
style:newTextStyle(backgroundColor:Colors.yellow),
),
),
);
}
}

https://dartpad.dev/?id=c76c8bd3543de7eeea64cd6d0b225835 <== you can test it here

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 problemsfound in release: 2.8Found to occur in 2.8found in release: 2.9Found to occur in 2.9has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions