<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Song Kimchhay on Medium]]></title>
        <description><![CDATA[Stories by Song Kimchhay on Medium]]></description>
        <link>https://medium.com/@songkimchhay67?source=rss-c6d1f3509127------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*9bAPHRotokeB1sPt</url>
            <title>Stories by Song Kimchhay on Medium</title>
            <link>https://medium.com/@songkimchhay67?source=rss-c6d1f3509127------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 06:19:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@songkimchhay67/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[In this article, I will guide you through the process of creating a custom theme in Flutter .]]></title>
            <link>https://medium.com/@songkimchhay67/in-this-article-i-will-guide-you-through-the-process-of-creating-a-custom-theme-in-flutter-470fb0acb5fe?source=rss-c6d1f3509127------2</link>
            <guid isPermaLink="false">https://medium.com/p/470fb0acb5fe</guid>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter-riverpod]]></category>
            <category><![CDATA[flutter-app-developer]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Song Kimchhay]]></dc:creator>
            <pubDate>Tue, 27 Aug 2024 02:30:01 GMT</pubDate>
            <atom:updated>2024-08-27T02:30:01.898Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong><em>Flutter ThemeMode Light And Dark | Riverpod</em></strong></blockquote><p>In this article, I will guide you through the process of <strong>creating a custom theme in Flutter </strong>. I will provide you with <em>template</em>s<strong> </strong>for The AppTheme Class. Additionally, the last part free source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*M1azh8dmXqb5jxDjqc35Tg.png" /></figure><p>Here, video link :</p><p><a href="https://www.youtube.com/watch?v=clGkyAXc3ig">Flutter ThemeMode Light And Dark | Riverpod And Provider (youtube.com)</a></p><ol><li>Custom theme(Dark and light)</li></ol><p>This class will contain Flutter ThemeData getters for light and dark modes and the ability to switch between different theme modes programmatically. Firstly, let’s implement the AppTheme Class.</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>class AppTheme {<br>  static ThemeData lightMode = ThemeData(<br>    brightness: Brightness.light,<br>    useMaterial3: false,<br>    appBarTheme: const AppBarTheme(<br>      elevation: 0,<br>      backgroundColor: Colors.white,<br>      titleTextStyle: TextStyle(<br>        color: Colors.black,<br>        fontSize: 20,<br>        fontWeight: FontWeight.w800,<br>      ),<br>      iconTheme: IconThemeData(<br>        color: Colors.black,<br>      ),<br>    ),<br>    elevatedButtonTheme: ElevatedButtonThemeData(<br>      style: ButtonStyle(<br>        backgroundColor:<br>            MaterialStateColor.resolveWith((states) =&gt; Colors.deepPurple),<br>      ),<br>    ),<br>  );<br>  static ThemeData darkMode = ThemeData(<br>    brightness: Brightness.dark,<br>    useMaterial3: false,<br>    appBarTheme: const AppBarTheme(<br>      elevation: 0,<br>      backgroundColor: Colors.transparent,<br>      titleTextStyle: TextStyle(<br>        color: Colors.white,<br>        fontSize: 20,<br>        fontWeight: FontWeight.w800,<br>      ),<br>      iconTheme: IconThemeData(<br>        color: Colors.white,<br>      ),<br>    ),<br>     elevatedButtonTheme: ElevatedButtonThemeData(<br>      style: ButtonStyle(<br>        backgroundColor:<br>            MaterialStateColor.resolveWith((states) =&gt; Colors.lightBlue),<br>      ),<br>    ),<br>  );<br>}</pre><p>2. Custom ThemeProvider using Riverpod</p><ul><li>ThemeState : For the state to switching between the dark and light depend on the state change with copyWith method.</li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br><br>class ThemeState {<br>  final ThemeMode themeMode;<br>  ThemeState({required this.themeMode});<br><br>  ThemeState copyWith({<br>    ThemeMode? themeMode,<br>  }) {<br>    return ThemeState(<br>      themeMode: themeMode ?? this.themeMode,<br>    );<br>  }<br>}</pre><ul><li>ThemeProvider(Notifier) : manage the themeState with the Notifier .</li></ul><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_riverpod/flutter_riverpod.dart&#39;;<br>import &#39;package:theme_mode_demo/theme_provider/theme_state.dart&#39;;<br><br>final appThemeProvider = NotifierProvider&lt;ThemeProvider, ThemeState&gt;(() {<br>  return ThemeProvider();<br>});<br><br>class ThemeProvider extends Notifier&lt;ThemeState&gt; {<br>  @override<br>  ThemeState build() {<br>    return ThemeState(themeMode: ThemeMode.system);<br>  }<br><br>  void setDarkTheme() {<br>    state = state.copyWith(themeMode: ThemeMode.dark);<br>  }<br><br>  void setLightTheme() {<br>    state = state.copyWith(themeMode: ThemeMode.light);<br>  }<br><br>  void setSystemTheme() {<br>    state = state.copyWith(themeMode: ThemeMode.system);<br>  }<br><br>  void toggleTheme() {<br>    state = state.copyWith(themeMode: _onToggleTheme(state.themeMode));<br>  }<br><br>  ThemeMode _onToggleTheme(ThemeMode themeMode) {<br>    switch (themeMode) {<br>      case ThemeMode.dark:<br>        return ThemeMode.light;<br>      case ThemeMode.light:<br>        return ThemeMode.dark;<br>      default:<br>        return ThemeMode.system;<br>    }<br>  }<br>}</pre><p>3. Light and Dark modes</p><p>To change between Light and Dark modes in Flutter, you need to specify theme and darkTheme properties in the MaterialApp. Additionally, you should also provide themeMode property that is responsible for determining the current theme mode of the app. ThemeMode is an enum with 3 options:</p><ol><li>ThemeMode.<strong>light</strong></li><li>ThemeMode.<strong>dark</strong></li><li>ThemeMode.<strong>system</strong></li></ol><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_riverpod/flutter_riverpod.dart&#39;;<br>import &#39;package:theme_mode_demo/theme_provider/theme_provider.dart&#39;;<br>import &#39;page/home_page.dart&#39;;<br>import &#39;theme/app_theme.dart&#39;;<br><br>void main() {<br>  runApp(const ProviderScope(child: MyApp()));<br>}<br><br>class MyApp extends ConsumerWidget {<br>  const MyApp({super.key});<br><br>  // This widget is the root of your application.<br>  @override<br>  Widget build(BuildContext context, WidgetRef ref) {<br>    final appThemeMode = ref.watch(appThemeProvider);<br>    return MaterialApp(<br>      title: &#39;Flutter Demo&#39;,<br>      theme: AppTheme.lightMode,<br>      darkTheme: AppTheme.darkMode,<br>      themeMode: appThemeMode.themeMode,<br>      home: const HomePage(),<br>    );<br>  }<br>}</pre><p><strong>CONGRATULATIONS AGAIN 🎉 </strong>Now you have ThemeMode that, you can using at all of your project.And I invite you to look at the full source code below.</p><p><a href="https://github.com/Chhay67/Theme-Mode-Demo">Chhay67/Theme-Mode-Demo: provider riverpod package (github.com)</a></p><p><em>Thank you for reading. Bye</em> 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=470fb0acb5fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Sushi Restaurant App | Bloc]]></title>
            <link>https://medium.com/@songkimchhay67/flutter-sushi-restaurant-app-bloc-754e50d30a19?source=rss-c6d1f3509127------2</link>
            <guid isPermaLink="false">https://medium.com/p/754e50d30a19</guid>
            <category><![CDATA[flutter-app-developer]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter-bloc]]></category>
            <dc:creator><![CDATA[Song Kimchhay]]></dc:creator>
            <pubDate>Sun, 04 Aug 2024 06:52:24 GMT</pubDate>
            <atom:updated>2024-08-04T06:52:24.344Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome Reader, this is the beginner to medium project, I developed a Flutter app called Sushi App, utilizing the BLoC pattern for state management. The purpose of this project is to serve as a study resource for beginners and intermediate developers. In the app, I demonstrate how to fetch data from an API, project folder, convert it into model objects, and implement business logic using BLoC. don’t forget to like the video, if the video got 10 likes, I will drop the new flutter project with the riverpod.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hgFpdqFMGoH-a6K05Lcb1w.png" /></figure><p><a href="https://www.youtube.com/watch?v=dqDshUliavE&amp;t=7s">Flutter Sushi Restaurant App | Bloc (youtube.com)</a></p><p>Here are some key things about this <strong>Project </strong>:</p><ol><li>Free source code</li><li>Custom Widgets, explain in detail</li><li>Explain about Flow and logic</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=754e50d30a19" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>