Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change color of the bubble (under cursor) on EditText in Flutter

Tags:

flutter

dart

How can I change the color of the bubble that appears upon text selection in a Text or TextFormField or .. in Flutter?

Here is the same question but for native code.

like image 201
Haidar Avatar asked Feb 11 '20 07:02

Haidar


2 Answers

According to this flutter documentation, textSelectionHandleColor is deprecated. You should use selectionHandleColor instead inside TextSelectionThemeData widget like the code below.

  theme: ThemeData(
   
    textSelectionTheme: TextSelectionThemeData(
      cursorColor: Colors.red,
      selectionColor: Colors.green,
      selectionHandleColor: Colors.black,
    ),
  )
like image 176
KayBee Avatar answered Oct 29 '22 07:10

KayBee


You may use the textSelectionHandleColor property.

Theme(
          data: Theme.of(context).copyWith(
            textSelectionHandleColor: Colors.green, 
          ),
          child: TextField(),
        );
like image 25
Darish Avatar answered Oct 29 '22 05:10

Darish