Flutter: How to set 'Enabled' TextField suffixIcon color with ThemeData

Viewed 115

How can i set default enabled color of suffix icon in a TextField/TextFormField in Flutter,. I can set this by adding the color into inline InputDecoration, but what i needs to do is to include it into themedata, so I don't have to duplicate same code.

Here is the ThemeData I have created for my Application.

ThemeData(
          fontFamily: "circular_std",
          accentColor: MaterialColor(0xFF575b6b, {}),
          backgroundColor: Color(0xFF46598C),
          colorScheme: Theme.of(context).colorScheme.copyWith(
                primaryVariant: Color(0xFF183588),
              ),
          appBarTheme: AppBarTheme(
            elevation: 0,
            color: Colors.transparent,
          ),
          iconTheme: IconThemeData(
            color: Colors.white,
          ),
          primaryIconTheme: IconThemeData(
            color: Colors.white,
          ),
          accentIconTheme: IconThemeData(
            color: Colors.white,
          ),
          inputDecorationTheme: InputDecorationTheme(
            labelStyle: TextStyle().copyWith(
              color: Color(0xFF58656c),
            ),
            hintStyle: TextStyle().copyWith(
              color: Color(0xFF58656c),
            ),
            border: UnderlineInputBorder(
              borderSide: BorderSide(color: Colors.white),
            ),
            enabledBorder: UnderlineInputBorder(
              borderSide: BorderSide(color: Colors.white),
            ),
          ),
          canvasColor: Color(0xFF181a20),
          // text color - white
          textTheme: TextTheme(
            subtitle1: TextStyle(
              fontSize: 20,
            ), // input text
            bodyText1: TextStyle(),
            bodyText2: TextStyle(),
            headline3: TextStyle(),
            headline5: TextStyle(
              fontSize: 22,
              fontWeight: FontWeight.normal
            ),
            headline6: TextStyle(
              fontSize: 18,
            ),
          ).apply(
            bodyColor: Colors.white,
            displayColor: Colors.white,
          ),
          // text color - Color(0xFF575b6b)
          primaryTextTheme: TextTheme(
            subtitle1: TextStyle(
              fontSize: 20,
            ), // input text
            bodyText1: TextStyle(),
            bodyText2: TextStyle(),
            headline3: TextStyle(),
            headline5: TextStyle(
              fontSize: 22,
              fontWeight: FontWeight.normal
            ),
            headline6: TextStyle(
              fontSize: 18,
            ),
          ).apply(
            bodyColor: Color(0xFF575b6b),
            displayColor: Color(0xFF575b6b),
          ),
          // text color - Color(0xFFc25fff)
          accentTextTheme: TextTheme(
            subtitle1: TextStyle(
              fontSize: 20,
            ), // input text
            bodyText1: TextStyle(),
            bodyText2: TextStyle(),
            headline3: TextStyle(),
            headline5: TextStyle(
              fontSize: 22,
              fontWeight: FontWeight.normal
            ),
            headline6: TextStyle(
              fontSize: 18,
            ),
          ).apply(
            bodyColor: Color(0xFFc25fff),
            displayColor: Color(0xFFc25fff),
          ),
          cardTheme: CardTheme(
            color: Color(0xFF262a34),
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(15.0),
            ),
          ),
          floatingActionButtonTheme: FloatingActionButtonThemeData(
              backgroundColor: Color(0xFF246bfd), foregroundColor: Colors.white),
        )
0 Answers
Related