31

Using Material3 useMaterial3: true in Flutter version 3.0.1, when scrolling lets say listview, the appbar changes to darker color... Can this be disabled?

Example from native android Material3 MaterialToolbar disable coloring at scroll:

enter image description here

dukaric1991
  • 602
  • 7
  • 11

7 Answers7

47

I had same problem.

In my case i had an AppBar with transparent background and a Scaffold with extendBodyBehindAppBar set to true.

I tried with shadowColor and surfaceTintColor with Colors.transparent value, but the shadow was still visible.

Then I noticed the scrolledUnderElevation property of AppBar. Setting it to 0.0 was the solution.

testerino
  • 642
  • 8
  • 19
17

I think you can just set the surfaceTintColor property of AppBar:

surfaceTintColor: Colors.transparent

I was facing this same issue and solved it right after looking at your question.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
CEOSiyris
  • 171
  • 3
11

I think this is the best solution mostly with the material3 flutter

scrolledUnderElevation: 0,

to disable it completely just make sure it is 0 incase you just want to reduce the opacity just increase the value i.e 0.6

Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
John Kinyanjui
  • 904
  • 11
  • 9
0

just add below property to AppBar :

forceMaterialTransparency: true,

problem will solved.

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
hp007
  • 1
  • 1
0

use surfaceTintColor: Colors.yourColor,

maskey
  • 1
  • 1
0

It works for me:

surfaceTintColor: Colors.transparent;   // add required color

Either add in the appBar or otherwise in the ThemeData.

ankushlokhande
  • 870
  • 5
  • 20
0

Best solution is chage the following property AppBar

scrolledUnderElevation: 0
ijas
  • 409
  • 5
  • 8