Flutter: Card background color

After updating Flutter SDK to 3.19.2 I noticed that Card component used in one of my apps looks weird by no having background stretched to each side.

I checked the code and color property for Card was set. Padding was the next suspicion but Card was top-level object with padding underneath. So what is the problem here.

Apparently with material3 (https://blog.codemagic.io/migrating-a-flutter-app-to-material-3/) there is surfaceTintColor property for elevated controls.

Setting both surfaceTintColor and color propertyies of my card resolved the problem.

Leave a Reply

Your email address will not be published. Required fields are marked *