Flutter Sliver AppBar leading color

Issue

This is a Sliver AppBar.

AppBar

How can I change the color of the back arrow ?

BUT I don’t want to set leading: Icon(Icons.arrow_back, color: Colors.red) since (I believe) that the Sliver AppBar has the nice property of adapting the lead icon depending on context.

Solution

wrap the SliverAppBar widget with Theme widget, and change primaryIconTheme color in ThemeData. Here’s the code:

     Theme(
            data: ThemeData(
                primaryIconTheme: IconThemeData(color: Colors.red)),
            child: SliverAppBar(),
          ),

Answered By – Mohammad K. Albattikhi

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.