Is there a way to change TextField text input color from theme configuration in Flutter


Asked by Samir A on November 12, 2021 (source).

I know there is a way to change text input color of TextField using the style: TextStyle() property, but I want to change the text color from the ThemeData widget, when first setting up the theme for the whole app MaterialApp(theme: ThemeData...). Is there anyway to do that?


Question answered by Yeasin S (source).

The default TextStyle for TextField is subtitle1. You can change it on theme level.

If style is null, defaults to the subtitle1 text style from the current [Theme].

 return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
          textTheme: Theme.of(context).textTheme.copyWith(
                subtitle1: const TextStyle(color:,
      home: const MyHomePage(),