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.
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,
),
)
You may use the textSelectionHandleColor property.
Theme(
data: Theme.of(context).copyWith(
textSelectionHandleColor: Colors.green,
),
child: TextField(),
);
In case of iOS TextField
, i've found no other solution than adding the snippet below to the top level MaterialApp like this:
MaterialApp
=> theme: ThemeData( snippet )
snippet:
cupertinoOverrideTheme: CupertinoThemeData( primaryColor: Color(0xff554270), ),
i couldn't apply this snippet by wrapping the TextField
with Theme(data: Theme.of(context).copyWith( ...
did not work.. dunno why ]: (maybe this one would be my fault in somewhere but adding it to the app lv definitely worked tho)
Hope this answer help future iOS wanderers [: