When the built in Theme is not enough

Theming UI heavy apps in Flutter

A different approach to styling your app

Jelena Lecic
4 min readJun 8, 2022


These days most apps support dark and light themes(modes), so you want to add that feature to your app too.

Yes, we all know that you can specify Theme in your MaterialApp, but that is not enough for an UI rich app. We want gradients, we want lots of colors and many custom components.

When you use predefined widgets, like AppBar, you can specify your colors in the app theme, like this:

… and by using this, all AppBars in your app will look the same.

But, if we want custom Widgets, written from scratch, we need to store all those colors somewhere.

Take a look at the bottom left button:

You can see, that this button is colored with:


… but, where those(primaryButtonGradient1 and primaryButtonGradient2) colors come from?

Well, from a custom color scheme class :)

When you write your own class, you can put in it whatever you want(as many colors as you want), so color named:




Jelena Lecic

Flutter developer & consultant. You can find me at https://www.linkedin.com/in/jelena-lecic/ 👋👋👋