How to change text color of AppBar, icon color of FAB universally using theme?

后端 未结 9 1578
渐次进展
渐次进展 2020-12-14 13:50

I am able to set the background color of AppBar to Colors.amber. This automatically sets the text color to Black. I am aware of the accessibility i

9条回答
  •  遥遥无期
    2020-12-14 14:28

    title of AppBar uses headline6 and floatingActionBar uses color from primarySwatch. Though it is not documented in TextTheme, but I tested it. For example : to have red FloatingActionButton and blue title text in AppBar your theme inside MaterialApp should look like the following :

      MaterialApp(
        theme: ThemeData(
          primarySwatch: Colors.red,
          appBarTheme: AppBarTheme(            
            textTheme: TextTheme(
              headline6: TextStyle(
                color: Colors.blue,
                fontWeight: FontWeight.bold,
                fontSize: 28.0,
              ),
            ),
          ),
        ),
      )
    

提交回复
热议问题