Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Now a days, dark mode in apps have become very popular. Mostly all major apps give choice to users to switch to dark mode. Now let’s see how we can add this feature to our Flutter apps.
Flutter was build with theming, so dealing with OS level dark mode is pretty simple.
Transform your app idea into reality with our Flutter app development services.
If you check the MaterialApp widget you will see we have the theme and darkTheme parameter where we can provide the dark ThemeData in darkTheme and light ThemeData in theme if we want our app to change the theme according to the system preferences.
MaterialApp
theme
darkTheme
ThemeData
So here as mentioned in the widget we can set theme and darkTheme.
Below an example of main.dart representing the complete implementation:
Here, I have create a toggle button to switch theme mode using ValueNotifier.
Thanks for reading this article ❤
If I got something wrong 🙈, let me know in the comments. I would love to improve.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.