Search code examples
flutterdartcolorsflutter-layouttextcolor

Flutter - how to change textcolor in search delegate class?


I managed to change the hintStyle-color

hintstyle

@override
ThemeData appBarTheme(BuildContext context) {
  return ThemeData(
    primaryColor: kPrimaryColor,
    primaryIconTheme: IconThemeData(
      color: Colors.white,
    ),
    inputDecorationTheme: InputDecorationTheme(
      hintStyle:
        Theme.of(context).textTheme.title.copyWith(color: Colors.white),
    ),
  );
}

But if i type something into the appbar searchfield, the color is still black...

enter image description here

How can I properly change the textcolor in the SearchDelegate class?


Solution

  • With reference to the discussion in the comments of the question, appBarTheme's textTheme property allows changing the color. example code credit @Matthias

    Code:

    textTheme: TextTheme(title: TextStyle( color: Colors.white, fontSize: 18,),),