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

后端 未结 9 1569
渐次进展
渐次进展 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:39

    Firstly I wanna let u know that there are 3 ways to set colors in flutter.

    So u asked u wanna set color or text in app bar. So it works if u set color in style property of Text method. Let me show you how it works. And also I will show you 3 ways of setting color. It doesn't matter if u use theme property or not because setting color of Text works as diffrent. Thats way I didn't use Theme property in examples.

    1th:

    Scaffold(
      appBar: AppBar(
        title: Text("App Name",
        style: TextStyle(color: Colors.colorname),);
    

    2th :

    Scaffold(
      appBar: AppBar(
        title: Text("App Name",
        style: TextStyle(color: Color(0xffffff),));
    

    3th :

    Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white,
        title: Text("App Name",
        style: TextStyle(color: Color.fromRGBO(0, 0, 0, 0, 0),));
    

提交回复
热议问题