Custom Theme in Flutter


Flutter provides a great feature Theme to control UI. This allows developers to improve this design and also manage different custom themes (like dark). A theme describes the colors and typographic choices of an application. To know more about the theme please check flutter doc.

Read more about Flutter app development services from mobikul.

Before start let discuss some concept in Theme.

ThemeData class defines the configuration of the overall visual Theme for a MaterialApp or a widget subtree within the app.
The static Theme.of method finds the ThemeData value specified for the nearest BuildContext ancestor. This lookup is inexpensive, essentially just single HashMap access.

After defining a Theme, use it within your own widgets. Flutter’s Material widgets also use your Theme to set the background colors and font styles for AppBars, Buttons, Checkboxes, and more.

In this blog, I will implement a custom theme for both dark and light and also use common font for all widgets.
Let’s start.
First, create a Theme class and add color according to what you want in your app.

Now call the Theme element.

I hope this code will help you better to understand Custom Theme in flutter. If you feel any doubt or query please comment below.

Thanks for the read this blog and if you want to visit my other blog click here.

. . .

Leave a Comment

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


  • James
    Hey If you are able to describe how to call theme.of a little clearer, and identigy the difference between the two images, I.E press this button go to dark mode
    • Debabrata Roy (Moderator)
      In my code, dark and light themes are managed according to the device and I didn’t use any button to active dark mode.
      MaterialApp(title: ‘Flutter Demo’,
      theme: AppTheme.lightTheme,
      darkTheme: AppTheme.darkTheme,)


  • css.php

    Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.

    Stathis Plakidas

    Stathis Plakidas

    Talk to Sales


    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home