<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maadhav</title>
    <description>The latest articles on DEV Community by Maadhav (@maadhav_sharma).</description>
    <link>https://dev.to/maadhav_sharma</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F210330%2Fc1322b41-8810-4e5a-8f74-045539b937ba.jpg</url>
      <title>DEV Community: Maadhav</title>
      <link>https://dev.to/maadhav_sharma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maadhav_sharma"/>
    <language>en</language>
    <item>
      <title>Flutter Drawer with Custom Icon</title>
      <dc:creator>Maadhav</dc:creator>
      <pubDate>Sat, 15 Aug 2020 04:06:30 +0000</pubDate>
      <link>https://dev.to/codedecoders/flutter-drawer-with-custom-icon-cok</link>
      <guid>https://dev.to/codedecoders/flutter-drawer-with-custom-icon-cok</guid>
      <description>&lt;p&gt;Hello guys, this blog post is a part of a video series we have started to upload on YouTube.&lt;br&gt;
Flutter News App (Frontend to Backend)&lt;/p&gt;

&lt;p&gt;Here is the video:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/e8BV1euFT7U"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In this video, we will have a look at how to create a Drawer with a Custom Icon in Flutter.&lt;/p&gt;

&lt;p&gt;So before we customize the icon, lets just build the default Drawer.&lt;/p&gt;

&lt;p&gt;Now in our &lt;code&gt;Scafdfold()&lt;/code&gt;, there is a parameter named as &lt;code&gt;drawer:&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let's pass the Drawer() widget to this parameter.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;

&lt;span class="nl"&gt;drawer:&lt;/span&gt; &lt;span class="n"&gt;Drawer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nl"&gt;children:&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Widget&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;[&lt;/span&gt;
              &lt;span class="n"&gt;SizedBox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;DrawerHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;142&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;width:&lt;/span&gt; &lt;span class="n"&gt;MediaQuery&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;asset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                      &lt;span class="s"&gt;"assets/images/ten_news.png"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="p"&gt;)),&lt;/span&gt;
                &lt;span class="nl"&gt;decoration:&lt;/span&gt; &lt;span class="n"&gt;BoxDecoration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                  &lt;span class="nl"&gt;color:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;transparent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;SizedBox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;GestureDetector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;onTap:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="n"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;currentIndex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                  &lt;span class="p"&gt;});&lt;/span&gt;
                  &lt;span class="n"&gt;Navigator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
                &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                  &lt;span class="s"&gt;'Profile'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;style:&lt;/span&gt; &lt;span class="n"&gt;TextStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="nl"&gt;fontFamily:&lt;/span&gt; &lt;span class="s"&gt;'Avenir'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;fontSize:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;fontWeight:&lt;/span&gt; &lt;span class="n"&gt;FontWeight&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;w700&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="p"&gt;),&lt;/span&gt;
                  &lt;span class="nl"&gt;textAlign:&lt;/span&gt; &lt;span class="n"&gt;TextAlign&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;SizedBox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;GestureDetector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;onTap:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
                &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                  &lt;span class="s"&gt;'Settings'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;style:&lt;/span&gt; &lt;span class="n"&gt;TextStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="nl"&gt;fontFamily:&lt;/span&gt; &lt;span class="s"&gt;'Avenir'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;fontSize:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;fontWeight:&lt;/span&gt; &lt;span class="n"&gt;FontWeight&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;w700&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="p"&gt;),&lt;/span&gt;
                  &lt;span class="nl"&gt;textAlign:&lt;/span&gt; &lt;span class="n"&gt;TextAlign&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;SizedBox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="s"&gt;'About'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nl"&gt;style:&lt;/span&gt; &lt;span class="n"&gt;TextStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                  &lt;span class="nl"&gt;fontFamily:&lt;/span&gt; &lt;span class="s"&gt;'Avenir'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;fontSize:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;fontWeight:&lt;/span&gt; &lt;span class="n"&gt;FontWeight&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;w700&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="nl"&gt;textAlign:&lt;/span&gt; &lt;span class="n"&gt;TextAlign&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;SizedBox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="s"&gt;'Log Out'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nl"&gt;style:&lt;/span&gt; &lt;span class="n"&gt;TextStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                  &lt;span class="nl"&gt;fontFamily:&lt;/span&gt; &lt;span class="s"&gt;'Avenir'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;fontSize:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;fontWeight:&lt;/span&gt; &lt;span class="n"&gt;FontWeight&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;w700&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="nl"&gt;textAlign:&lt;/span&gt; &lt;span class="n"&gt;TextAlign&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;SizedBox&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="n"&gt;Expanded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                  &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Align&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;alignment:&lt;/span&gt; &lt;span class="n"&gt;Alignment&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;bottomCenter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                  &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;65&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;width:&lt;/span&gt; &lt;span class="n"&gt;MediaQuery&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;color:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;black&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Center&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                      &lt;span class="s"&gt;'v1.0.1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                      &lt;span class="nl"&gt;style:&lt;/span&gt; &lt;span class="n"&gt;TextStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="nl"&gt;fontFamily:&lt;/span&gt; &lt;span class="s"&gt;'Avenir'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="nl"&gt;fontSize:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="nl"&gt;color:&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xffffffff&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                      &lt;span class="p"&gt;),&lt;/span&gt;
                      &lt;span class="nl"&gt;textAlign:&lt;/span&gt; &lt;span class="n"&gt;TextAlign&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="p"&gt;),&lt;/span&gt;
                  &lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
          &lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Now above, inside the &lt;code&gt;Drawer()&lt;/code&gt; widget, in the child parameter, we have a passed a &lt;code&gt;Column()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is just used for the sake of inserting multiple widgets in my drawer.&lt;/p&gt;

&lt;p&gt;There is also a widget named, &lt;code&gt;DrawerHeader&lt;/code&gt;.&lt;br&gt;
This widget is used for displaying any content on top of the whole drawer. This widget comes with a default divider. We have passed our app logo to it.&lt;/p&gt;
&lt;h3&gt;
  
  
  Now where is the drawer?
&lt;/h3&gt;

&lt;p&gt;In order to see the drawer, we need to also pass the &lt;code&gt;AppBar()&lt;/code&gt; to our Home Page's &lt;code&gt;Scaffold()&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;

&lt;span class="n"&gt;Scaffold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="nl"&gt;appBar:&lt;/span&gt; &lt;span class="n"&gt;AppBar&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;After building the current project we can see the default hamburger Icon in our AppBar. Pressing on it our drawer opens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5ybtsr4riu3cyafe7hy5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5ybtsr4riu3cyafe7hy5.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  How to Exit the Drawer On Press of a Button?
&lt;/h3&gt;

&lt;p&gt;I order to close the drawer manually i.e on the press of a button, we only need to return the &lt;code&gt;Navigator.of(context).pop()&lt;/code&gt; to exit the Drawer.&lt;/p&gt;

&lt;p&gt;So let's also add a button on our Drawer.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;

&lt;span class="n"&gt;Material&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nl"&gt;borderRadius:&lt;/span&gt; &lt;span class="n"&gt;BorderRadius&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;circular&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;InkWell&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                  &lt;span class="nl"&gt;borderRadius:&lt;/span&gt; &lt;span class="n"&gt;BorderRadius&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;circular&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                  &lt;span class="nl"&gt;splashColor:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;black45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="nl"&gt;onTap:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;Navigator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
                  &lt;span class="p"&gt;},&lt;/span&gt;
                  &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;CircleAvatar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="nl"&gt;radius:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;backgroundColor:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;black&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Icon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Icons&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;arrow_back&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;color:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;white&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                  &lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Now on pressing the button the drawer closes.&lt;/p&gt;
&lt;h3&gt;
  
  
  How to change the default Hamburger Icon?
&lt;/h3&gt;

&lt;p&gt;This question had arrived in my mind on the first day I had learned to build a Drawer in Flutter.&lt;/p&gt;

&lt;p&gt;Now in order to have a custom Icon, lets remove the default one first.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;

 &lt;span class="n"&gt;AppBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;automaticallyImplyLeading:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;code&gt;automaticallyImplyLeading&lt;/code&gt; set to &lt;code&gt;false&lt;/code&gt; would just remove the default icon.&lt;/p&gt;

&lt;p&gt;Now let's pass out Icon to either &lt;code&gt;leading:&lt;/code&gt; or &lt;code&gt;title:&lt;/code&gt; parameter.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;

&lt;span class="nl"&gt;appBar:&lt;/span&gt; &lt;span class="n"&gt;AppBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;automaticallyImplyLeading:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="n"&gt;Padding&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;padding:&lt;/span&gt; &lt;span class="n"&gt;EdgeInsets&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;symmetric&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;horizontal:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
          &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nl"&gt;builder:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;IconButton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
              &lt;span class="nl"&gt;icon:&lt;/span&gt; &lt;span class="n"&gt;SvgPicture&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;asset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="s"&gt;"assets/icons/drawer.svg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nl"&gt;height:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nl"&gt;width:&lt;/span&gt; &lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="nl"&gt;onPressed:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Scaffold&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;openDrawer&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="p"&gt;),&lt;/span&gt;
          &lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="nl"&gt;backgroundColor:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;white&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;elevation:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;centerTitle:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;titleSpacing:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;),&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Now in the above code, there are a few importing things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Builder()&lt;/code&gt;: We use a Builder class to pass the context of the Scaffold widget to a particular widget. More Info: &lt;a href="https://stackoverflow.com/a/52123080/6484719" rel="noopener noreferrer"&gt;https://stackoverflow.com/a/52123080/6484719&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Scaffold.of(context).openDrawer()&lt;/code&gt;: This is why used the builder widget, to get the current context of the scaffold and then open the drawer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, our output:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fccdeyewx2snqctkmj2w7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fccdeyewx2snqctkmj2w7.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👨‍💻Source Code: &lt;a href="https://github.com/Code-Decoders/ten_news_yt/tree/Part-2--Drawer" rel="noopener noreferrer"&gt;https://github.com/Code-Decoders/ten_news_yt/tree/Part-2--Drawer&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Code-Decoders" rel="noopener noreferrer"&gt;
        Code-Decoders
      &lt;/a&gt; / &lt;a href="https://github.com/Code-Decoders/ten_news_yt" rel="noopener noreferrer"&gt;
        ten_news_yt
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;ten_news&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;A new Flutter project.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Getting Started&lt;/h2&gt;

&lt;/div&gt;

&lt;p&gt;This project is a starting point for a Flutter application.&lt;/p&gt;

&lt;p&gt;A few resources to get you started if this is your first Flutter project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://flutter.dev/docs/get-started/codelab" rel="nofollow noopener noreferrer"&gt;Lab: Write your first Flutter app&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://flutter.dev/docs/cookbook" rel="nofollow noopener noreferrer"&gt;Cookbook: Useful Flutter samples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For help getting started with Flutter, view our
&lt;a href="https://flutter.dev/docs" rel="nofollow noopener noreferrer"&gt;online documentation&lt;/a&gt;, which offers tutorials,
samples, guidance on mobile development, and a full API reference.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Code-Decoders/ten_news_yt" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;💐Join Our Slack Group: &lt;a href="https://bit.ly/JoinSlackCD" rel="noopener noreferrer"&gt;https://bit.ly/JoinSlackCD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✌Subscribe to CodeDecoders: &lt;a href="http://bit.ly/CodeDecoders" rel="noopener noreferrer"&gt;http://bit.ly/CodeDecoders&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💮Design Link: &lt;a href="https://xd.adobe.com/view/99205dd3-7fe4-44bb-9edd-dd2a75290cbf-cc73/screen/90d0c71c-26b7-44d1-b29d-6578cbd87884" rel="noopener noreferrer"&gt;https://xd.adobe.com/view/99205dd3-7fe4-44bb-9edd-dd2a75290cbf-cc73/screen/90d0c71c-26b7-44d1-b29d-6578cbd87884&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🤝Developed by &lt;br&gt;
   Maadhav Sharma: &lt;br&gt;
     🌐 &lt;a href="https://maadhav.github.io/" rel="noopener noreferrer"&gt;https://maadhav.github.io/&lt;/a&gt;&lt;br&gt;
     🐤 &lt;a href="https://twitter.com/maadhav_sharma" rel="noopener noreferrer"&gt;https://twitter.com/maadhav_sharma&lt;/a&gt;&lt;br&gt;
     📘 &lt;a href="https://www.facebook.com/maadhav2001" rel="noopener noreferrer"&gt;https://www.facebook.com/maadhav2001&lt;/a&gt;&lt;br&gt;
     📷 &lt;a href="https://www.instagram.com/maadhav_sharma/" rel="noopener noreferrer"&gt;https://www.instagram.com/maadhav_sharma/&lt;/a&gt;&lt;br&gt;
   Kunal Jain:&lt;br&gt;
     📷 &lt;a href="https://www.instagram.com/jainkunal528" rel="noopener noreferrer"&gt;https://www.instagram.com/jainkunal528&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Bubble Bottom Bar Flutter</title>
      <dc:creator>Maadhav</dc:creator>
      <pubDate>Sun, 09 Aug 2020 03:31:14 +0000</pubDate>
      <link>https://dev.to/codedecoders/bubble-bottom-bar-flutter-blh</link>
      <guid>https://dev.to/codedecoders/bubble-bottom-bar-flutter-blh</guid>
      <description>&lt;p&gt;Hello guys, this blog post is a part of a video series we are starting to upload on YouTube.&lt;br&gt;
&lt;strong&gt;Flutter News App (Frontend to Backend)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is the video:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/kzS4uvlR4kU"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In this blog post, we will have a look at a package that allows us to create a customizable bottom navigation bar. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F94wk5d3n8yhcb8zzds9w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F94wk5d3n8yhcb8zzds9w.gif" alt="Customizable Bottom Navigation Bar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So now first open our project and create a &lt;code&gt;home.dart&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Now let's create a StateFull Widget named as &lt;code&gt;Home()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Home would return a &lt;code&gt;Saffold()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the Scaffold there is a parameter, &lt;code&gt;bottomNavigationBar:&lt;/code&gt;&lt;br&gt;
Instead of returning the default BottomNavigationBar widget which is provided by Flutter, we would use a package, &lt;a href="https://pub.dev/packages/bubble_bottom_bar" rel="noopener noreferrer"&gt;bubble_bottom_bar&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Add this to your package's pubspec.yaml file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
dependencies:
  bubble_bottom_bar: ^1.2.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now in your Dart code, you can use:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:bubble_bottom_bar/bubble_bottom_bar.dart';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now in the &lt;code&gt;bottomNavigationBar:&lt;/code&gt; pass &lt;code&gt;BubbleBottomBar()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As in our app, we don't need any background shade behind the selected item, we would keep the opacity to 0.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bottomNavigationBar: BubbleBottomBar(
        opacity: 0,
        ...
      ),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now we also need to declare a variable in which we will be storing the current index.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int currentIndex = 0;
.
.
currentIndex: currentIndex,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now in the &lt;code&gt;onTap()&lt;/code&gt; parameter, we need to pass a function that would update the &lt;code&gt;currentIndex&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  void changePage(int index){
    setState(() {
      currentIndex = index;
    });
  }
.
.
onTap: changePage,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now the most important thing is the &lt;code&gt;items:&lt;/code&gt; parameter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxrem4w20spteesogwdul.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxrem4w20spteesogwdul.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
As seen in the image above the &lt;code&gt;items&lt;/code&gt; needs a List of &lt;code&gt;BubbleBottomBarItems&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So, our first item:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BubbleBottomBarItem(
              backgroundColor: Colors.black,
              icon: SvgPicture.asset(
                'assets/icons/home.svg',
                width: 21,
                color: Colors.black54,
                height: 21,
              ),
              activeIcon: SvgPicture.asset(
                'assets/icons/home.svg',
                width: 21,
                color: Colors.black,
                height: 21,
              ),
              title: Text("Home")),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Three out of the four items in our app are similar, but the fourth item does not need an &lt;code&gt;activeIcon&lt;/code&gt; as its the image of the user. So for the fourth item.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BubbleBottomBarItem(
              backgroundColor: Colors.black,
              icon: Container(
                height: 24,
                width: 24,
                decoration: BoxDecoration(
                  shape: BoxShape.circle,
                  image: DecorationImage(image: AssetImage('assets/user.png')),
                  boxShadow: [
                    BoxShadow(
                        color: Color(0x5c000000),
                        offset: Offset(0, 1),
                        blurRadius: 5)
                  ],
                ),
              ),
              title: Text("Profile")),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now lets see the final output...&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F73dcbcfxba0exrd1bncv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F73dcbcfxba0exrd1bncv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full Source Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



</description>
      <category>flutter</category>
      <category>dart</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>A Short Tutorial on How to Develop a Switch button in Flutter.</title>
      <dc:creator>Maadhav</dc:creator>
      <pubDate>Sat, 11 Apr 2020 12:09:53 +0000</pubDate>
      <link>https://dev.to/maadhav_sharma/a-short-tutorial-on-how-to-develop-a-switch-button-in-flutter-52mp</link>
      <guid>https://dev.to/maadhav_sharma/a-short-tutorial-on-how-to-develop-a-switch-button-in-flutter-52mp</guid>
      <description>&lt;h1&gt;
  
  
  A Short Tutorial on How to Develop a Switch button in Flutter.
&lt;/h1&gt;


&lt;div class="instagram-position"&gt;
  &lt;iframe id="instagram-liquid-tag" src="https://www.instagram.com/p/B-yruCRHj-Z/embed/captioned/"&gt;
  &lt;/iframe&gt;
  
&lt;/div&gt;


&lt;p&gt;Flutter Switch is used to toggle a setting between on/off which is true/false respectively.&lt;/p&gt;

&lt;p&gt;When the switch is on, the value returned by the Switch onChanged property is true, while the switch is off, onChanged property returns false.&lt;/p&gt;

&lt;p&gt;In the following example Flutter application, we defined a Switch widget. Whenever the Switch is toggled, onChanged is called with new state of Switch as value.&lt;/p&gt;

&lt;p&gt;We have defined a boolean variable isSwitched to store the state of Switch.&lt;/p&gt;

&lt;p&gt;Create a basic Flutter application and replace main.dart with the following code.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;main.dart&lt;/strong&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Complete Source Code…
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;I have started this new series named Flutter Shorts in which I will share some simple and useful tutorials related to Flutter Widgets.&lt;/p&gt;

&lt;p&gt;So Stay Tuned for more…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AID93LK1fwlFUbRPsluasOw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AID93LK1fwlFUbRPsluasOw.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Learning Flutter without knowing any other language.</title>
      <dc:creator>Maadhav</dc:creator>
      <pubDate>Thu, 30 Jan 2020 12:22:20 +0000</pubDate>
      <link>https://dev.to/maadhav_sharma/learning-flutter-without-knowing-any-other-language-3pn9</link>
      <guid>https://dev.to/maadhav_sharma/learning-flutter-without-knowing-any-other-language-3pn9</guid>
      <description>&lt;p&gt;As a student, I always wanted to be able to develop complex applications and upload them to the Play Store. So I started learning core java for developing apps on Android as it is the most popular platform for mobile apps. I started by choosing a free course on &lt;a href="https://www.udacity.com/" rel="noopener noreferrer"&gt;Udacity&lt;/a&gt; but after one month I realized that instead of understanding the logic behind the program, I was just copying and pasting which was being shown in the video tutorial. This is what happens with almost every absolute beginner. After that one month, I lost my interest in making applications using Java. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.istockphoto.com%2Fvectors%2Fman-is-working-with-computer-vector-id542314302%3Fk%3D6%26m%3D542314302%26s%3D612x612%26w%3D0%26h%3DVnHMy3V1LJpzUo2bgfN2oNr5NjilJWbl6-NCayHeKvY%3D" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia.istockphoto.com%2Fvectors%2Fman-is-working-with-computer-vector-id542314302%3Fk%3D6%26m%3D542314302%26s%3D612x612%26w%3D0%26h%3DVnHMy3V1LJpzUo2bgfN2oNr5NjilJWbl6-NCayHeKvY%3D" alt="Beginner getting bored"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  How did Flutter brought my interest back?
&lt;/h1&gt;

&lt;p&gt;So after 2 years, I thought to find a more interesting way to develop apps. &lt;br&gt;
At that time flutter had just entered. After reading about its features I got excited to learn it. &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbuzzanimatedvideos.com%2Fwp-content%2Fuploads%2F2016%2F07%2Fvectorstock_5146721.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbuzzanimatedvideos.com%2Fwp-content%2Fuploads%2F2016%2F07%2Fvectorstock_5146721.jpg" alt="Beginner excited"&gt;&lt;/a&gt; &lt;br&gt;
Meanwhile, in the past 2 years, I had learned C++ basics in my school. &lt;br&gt;
As I was a beginner I wasn't good at reading and understanding the Official Documentation. So opted for buying a course this time rather than picking a free course from YouTube.&lt;/p&gt;

&lt;p&gt;If one wishes to learn flutter, learning DART is a pre-requisite. As I mentioned I had the basic knowledge of C++, so I had enough knowledge about OOPs. After trying to write simple programs using Dart I got a good grip on it. As a beginner, I only needed to know how variables, functions, and classes are declared in Dart, rest advanced concepts like Future, Factory, etc. can be learned alongside learning Flutter.  &lt;/p&gt;

&lt;p&gt;Now after following the video tutorial, I was able to understand almost everything. The assignments which my tutor used to give me acted like DIY tasks for me, it enabled me to think on my own rather than spoon-feeding. The flutter documentation and the videos uploaded on their channel helped me of learning all the widgets. Concepts like a database with sqflite were tough to understand but doing regular practice gave me a hold of it.&lt;/p&gt;

&lt;p&gt;Then I started a YouTube Channel, where I uploading my own videos on different UI concepts. The main aim of these videos was to increase my practice and inspire some other beginners to start with flutter. All the steps above helped me keep practicing flutter. &lt;/p&gt;

&lt;p&gt;As a side project, I started to develop a news app. Making it was really fun and useful. I completed my project names as TEN News and uploaded it on google play store. The whole journey made me continuously learn new things related to flutter. Do check out my App from the &lt;a href="https://play.google.com/store/apps/details?id=com.tennews" rel="noopener noreferrer"&gt;Play Store: TEN News&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;So if you want to start learning flutter as a beginner the first and very important thing you need to know is the concept of OOP(Object Oriented Programming). For that, you can choose to learn C++ or any other programming language which came after it. &lt;/p&gt;

&lt;p&gt;Now opt for a Flutter course. As mentioned above, paying for a course makes you keep going. So I would advise you to select a paid course.&lt;/p&gt;

&lt;p&gt;Make sure that you follow a routine when learning from a course.&lt;/p&gt;

&lt;p&gt;After your course is completed start developing small projects just for fun or start a YouTube channel to showcase your apps. You can even join people on Slack, Discord where people make a team and work on different projects. I had contributed to an open-source flutter project which helped me. I also learned that how the presentation of our code matters. &lt;/p&gt;

&lt;h3&gt;
  
  
  Some Useful Links
&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://flutter.dev/" rel="noopener noreferrer"&gt;Flutter Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://courses.learncodeonline.in/learn/complete-flutter-course" rel="noopener noreferrer"&gt;Recommended Flutter Course&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wanna get in contact with me? Here are the links. 😊&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/maadhav_sharma" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.facebook.com/maadhav2001" rel="noopener noreferrer"&gt;Facebook&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.instagram.com/maadhav_sharma/" rel="noopener noreferrer"&gt;Instagram&lt;/a&gt;&lt;br&gt;
or just mail me at &lt;a href="//mailto:maadhav2001@gmail.com"&gt;maadhav2001@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dart</category>
      <category>flutter</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
