Search code examples
flutterbackground-colorcolorbarappbar

Flutter, AppBar Color change


enter image description here

Is there a way that the AppBars color can be changed through a gradient and opacity as an example? From something lighter to something darker to see the icons above the phone clearer.


Solution

  • if I understand correctly you want to change the appbar color with one of these methods :

    1) change AppBar color only witch will affect the background of appbar only

         appBar: AppBar(
        backgroundColor: PrimaryColor,
      ),
    

    1) change primary App color swatch : witch will change all the colors of buttons , etc to a certain color including appbar

    MaterialApp(
        primaryColor: Colors.red,
    
    )
    

    2) Switch to dark mode : witch will invert the colors of all app to dark mode

    MaterialApp(
      title: title,
      theme: ThemeData.dark(),
    )