flutterdartmaterial-designthemedata

Flutter - How to change the color of the text being selected by the cursor?


I need to change the color of the text being highlighted by the cursor. I am able to chagne the color of cursor, its selction and handler using textSelectionTheme. But, how can I change the color of the highlighted text?

ThemeData so far.

get _lightTheme => ThemeData(
      disabledColor: Colors.grey.shade400,
      textSelectionTheme: TextSelectionThemeData(
        cursorColor: AppPalette.primaryColorLight,
        selectionColor: AppPalette.primaryColorLight.withOpacity(0.5),
        selectionHandleColor: AppPalette.primaryColorLight,
      ),
);

Solution

  • This is not possible as of now. You can track this link in github

    https://github.com/flutter/flutter/issues/99231