<?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 Yatin Deokar on Medium]]></title>
        <description><![CDATA[Stories by Yatin Deokar on Medium]]></description>
        <link>https://medium.com/@yatindeokar33?source=rss-78e62a88ceef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UMmrGf9pWPSiMLSL8TPiHQ.jpeg</url>
            <title>Stories by Yatin Deokar on Medium</title>
            <link>https://medium.com/@yatindeokar33?source=rss-78e62a88ceef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:40:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yatindeokar33/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[Working with Dynamic Multi-Form in Flutter With Validation]]></title>
            <link>https://yatindeokar33.medium.com/working-with-dynamic-multi-form-in-flutter-with-validation-73ed03833874?source=rss-78e62a88ceef------2</link>
            <guid isPermaLink="false">https://medium.com/p/73ed03833874</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dynamic-form]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[forms]]></category>
            <dc:creator><![CDATA[Yatin Deokar]]></dc:creator>
            <pubDate>Mon, 29 Mar 2021 05:27:47 GMT</pubDate>
            <atom:updated>2021-03-29T06:09:01.195Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fp0EHbB-e6yiqMVxmJ5Bgg.png" /></figure><p>Sometimes we need to add FormField dynamically or provide multiple dynamic forms to the user for multiple data entries such as add multiple contacts. In this case, we have to manage its form field controllers and apply validation to each dynamic field. So let’s see how we can achieve this in a simple way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*XqGd0KsQfFBzoo0KEQ9LmA.gif" /></figure><h4><strong>What we cover in this article:</strong></h4><ul><li>Add multiple forms dynamically</li><li>Remove Form dynamically</li><li>Apply Validation to each Form Field.</li><li>Clear Each Form Field Data</li><li>Validate All forms and Get Each form Data on Submit</li></ul><h3>Let’s start with actual implementation:</h3><p>To Start with Flutter visit the <a href="https://flutter.dev/docs/get-started/install">Flutter official installation guide</a></p><h4>1. Create a Data Model</h4><p>Here we create <em>ContactModel</em> which contains contact name, contact number, and contact email. Which are basically our form fields. We will use this model to store form data.</p><p><strong>Code:</strong></p><pre>class ContactModel {<br> String name;<br> String number;<br> String email;<br> <br> ContactModel({this.name, this.number, this.email, this.address});<br> }</pre><h4>3. Create Form Widget</h4><p>Here we create a single contact form widget with Form Fields like Name, Number, and Email as follows. and create Clear button to clear form and Remove/Delete button to delete specific form</p><blockquote>Form Widget should be <strong>StatefulWidget</strong> so each form will maintain its own state<br> Note: Declare all your <strong>TextEditingController’s</strong> outside the state class <br> Don&#39;t forget to Add <strong>GlobalKey</strong> to the form to identify each form separately and validate the form by geting form state</blockquote><p><strong>Code:</strong></p><pre>class ContactFormItemWidget extends StatefulWidget {<br>  ContactFormItemWidget(<br>      {Key key, this.contactModel, this.onRemove, this.index})<br>      : super(key: key);<br><br>  final index;<br>  ContactModel contactModel;<br>  final Function onRemove;<br>  final state = _ContactFormItemWidgetState();<br><br>  @override<br>  State&lt;StatefulWidget&gt; createState() {<br>    return state;<br>  }<br><br>  TextEditingController _nameController = TextEditingController();<br>  TextEditingController _contactController = TextEditingController();<br>  TextEditingController _emailController = TextEditingController();<br><br>}<br><br>class _ContactFormItemWidgetState extends State&lt;ContactFormItemWidget&gt; {<br>  final formKey = GlobalKey&lt;FormState&gt;();<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Material(<br>      child: Padding(<br>        padding: const EdgeInsets.all(12.0),<br>        child: Form(<br>          key: formKey,<br>          child: Container(<br>            padding: const EdgeInsets.only(left: 12, right: 12, bottom: 12),<br>            decoration: BoxDecoration(<br>              color: Colors.<em>white</em>,<br>              borderRadius: BorderRadius.all(Radius.circular(12)),<br>              boxShadow: [<br>                BoxShadow(<br>                  color: Colors.<em>grey</em>.withOpacity(0.2),<br>                  spreadRadius: 2,<br>                  blurRadius: 10,<br>                  offset: Offset(0, 3), // changes position of shadow<br>                ),<br>              ],<br>            ),<br>            child: Column(<br>              mainAxisSize: MainAxisSize.min,<br>              children: [<br>                Row(<br>                  mainAxisSize: MainAxisSize.max,<br>                  mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>                  children: [<br>                    Text(<br>                      &quot;Contact - ${widget.index}&quot;,<br>                      style: TextStyle(<br>                          fontWeight: FontWeight.<em>bold</em>,<br>                          fontSize: 16,<br>                          color: Colors.<em>orange</em>),<br>                    ),<br>                    Row(<br>                      mainAxisSize: MainAxisSize.min,<br>                      children: [<br>                        TextButton(<br>                            onPressed: () {<br>                              setState(() {<br>                                //Clear All forms Data<br>                                widget.contactModel.name = &quot;&quot;;<br>                                widget.contactModel.number = &quot;&quot;;<br>                                widget.contactModel.email = &quot;&quot;;<br>                                widget._nameController.clear();<br>                                widget._contactController.clear();<br>                                widget._emailController.clear();<br>                              });<br>                            },<br>                            child: Text(<br>                              &quot;Clear&quot;,<br>                              style: TextStyle(color: Colors.<em>blue</em>),<br>                            )),<br>                        TextButton(<br>                            onPressed: () =&gt; widget.onRemove(),<br>                            child: Text(<br>                              &quot;Remove&quot;,<br>                              style: TextStyle(color: Colors.<em>blue</em>),<br>                            )),<br>                      ],<br>                    ),<br>                  ],<br>                ),<br>                TextFormField(<br>                  controller: widget._nameController,<br>                  // initialValue: widget.contactModel.name,<br>                  onChanged: (value) =&gt; widget.contactModel.name = value,<br>                  onSaved: (value) =&gt; widget.contactModel.name = value,<br>                  decoration: InputDecoration(<br>                    contentPadding: EdgeInsets.symmetric(horizontal: 12),<br>                    border: OutlineInputBorder(),<br>                    hintText: &quot;Enter Name&quot;,<br>                    labelText: &quot;Name&quot;,<br>                  ),<br>                ),<br>                SizedBox(<br>                  height: 8,<br>                ),<br>                TextFormField(<br>                  controller: widget._contactController,<br>                  onChanged: (value) =&gt; widget.contactModel.number = value,<br>                  onSaved: (value) =&gt; widget.contactModel.name = value,<br>                  decoration: InputDecoration(<br>                    contentPadding: EdgeInsets.symmetric(horizontal: 12),<br>                    border: OutlineInputBorder(),<br>                    hintText: &quot;Enter Number&quot;,<br>                    labelText: &quot;Number&quot;,<br>                  ),<br>                ),<br>                SizedBox(<br>                  height: 8,<br>                ),<br>                TextFormField(<br>                  controller: widget._emailController,<br>                  onChanged: (value) =&gt; widget.contactModel.email = value,<br>                  onSaved: (value) =&gt; widget.contactModel.email = value,<br>                  decoration: InputDecoration(<br>                    contentPadding: EdgeInsets.symmetric(horizontal: 12),<br>                    border: OutlineInputBorder(),<br>                    hintText: &quot;Enter Email&quot;,<br>                    labelText: &quot;Email&quot;,<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br><br><br>}</pre><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*3vrmXKOr3GS7y9-l_6KueA.png" /></figure><p>Here we create StatefulWidget `<em>ContactFormItemWidget</em>` which is single contact form. Pass this widget a contact model.</p><h4>5. Add multiple Forms Dynamically</h4><ul><li>Create another StatefulWidget to display Forms List.</li><li>Create a List that holds Contact Form Widget. Initially, It will be an empty list when the user clicks on Add We will add FormWidget to the list.</li></ul><pre>List&lt;ContactFormItemWidget&gt; contactForms = List.empty(growable: true);</pre><ul><li>Create ListView which renders Contact Form Items:</li></ul><pre>ListView.builder(<br>    itemCount: contactForms.length,<br>    itemBuilder: (_, index) {<br>      return contactForms[index];<br>    })</pre><ul><li>Create Add form and submit form button. Checkout Full Class File.</li></ul><blockquote>Initially, the form list is empty. so add an empty view or message</blockquote><p><strong>Add Form in FormList:</strong></p><ul><li>Add contact form Widget in contact forms list and pass <em>ContactModel</em> with Form index. you will get a remove/Delete call back here only.</li></ul><p><strong>Code:</strong></p><pre>//Add New Form<br>onAdd() {<br>  setState(() {<br>    ContactModel _contactModel = ContactModel(id: contactForms.length);<br>    contactForms.add(ContactFormItemWidget(<br>      index: contactForms.length,<br>      contactModel: _contactModel,<br>      onRemove: () =&gt; onRemove(_contactModel),<br>    ));<br>  });<br>}</pre><h4>6. Delete Single Form</h4><ul><li>To delete any form we just need to remove Form from the <em>FormWidgetList</em> by identifying the index of a particular form:</li></ul><p><strong>Code:</strong></p><pre>//Delete/Remove specific form <br>onRemove(ContactModel contact) {<br>  setState(() {<br>    int index = contactForms<br>        .indexWhere((element) =&gt; element.contactModel.id == contact.id);<br><br>    if (contactForms != null) contactForms.removeAt(index);<br>  });<br>}</pre><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*C0Z2vakipDVmhz5M3-rAEQ.jpeg" /></figure><h4>7. Clear Form Fields</h4><ul><li>Clear all controllers and <em>ContactModel</em> data <em>onClick</em> of clear button inside `<em>ContactFormItemWidget</em>`</li></ul><p><strong>Code:</strong></p><pre>TextButton(<br>    onPressed: () {<br>      setState(() {<br>        //Clear All forms Data<br>        widget.contactModel.name = &quot;&quot;;<br>        widget.contactModel.number = &quot;&quot;;<br>        widget.contactModel.email = &quot;&quot;;<br>        widget._nameController.clear();<br>        widget._contactController.clear();<br>        widget._emailController.clear();<br>      });<br>    },<br>    child: Text(<br>      &quot;Clear&quot;,<br>      style: TextStyle(color: Colors.<em>blue</em>),<br>    )),</pre><h4>8. Define Form Validation and Check for All Forms</h4><ul><li>It seems difficult to manage dynamic forms validation of each form field, Let&#39;s see how we can do it easily.</li><li>First, we need to apply validation on each required form field. you can add more validation here eg. @ is required for email or the number length should be 10 digits etc.</li><li>If validation is passed it should return null otherwise error message.</li></ul><p><strong>Code:</strong></p><pre>TextFormField(<br>  controller: widget._nameController,<br>  onChanged: (value) =&gt; widget.contactModel.name = value,<br>  onSaved: (value) =&gt; widget.contactModel.name = value,<br>//Add Validation for required field<br>  validator: (value) =&gt; value.length &gt; 3 ? null : &quot;Enter Name&quot;,<br>  decoration: InputDecoration(<br>    contentPadding: EdgeInsets.symmetric(horizontal: 12),<br>    border: OutlineInputBorder(),<br>    hintText: &quot;Enter Name&quot;,<br>    labelText: &quot;Name&quot;,<br>  ),<br>),</pre><ul><li>Then create a validation function that runs Form validation that&#39;s it validation is done. it&#39;s for the particular form. but you can check the validation for all the forms field by using <strong><em>formKey</em></strong> like below.</li></ul><p><strong>Code:</strong></p><pre>bool validate() { <br> //Validate Form Fields by form key<br> bool validate = formKey.currentState.validate(); <br> if (validate) formKey.currentState.save(); <br> return validate; <br> }</pre><ul><li>We need to Access Form Validation function outside the ContactFormItemWidget, so create isValidated function in `<em>ContactFormItemWidget</em>` and assign <em>validate()</em> to it. It will return true or false as form validated or not.</li></ul><p><strong>Code:</strong></p><pre>bool isValidated() =&gt; state.validate();</pre><h4>9. Get All Forms Data and Submit</h4><p>All the form data is stored in its own model class. so we just need to access the model for each form.</p><p><strong>Code:</strong></p><pre>onSave() {<br>  bool allValid = true;<br><br>  //If any form validation function returns false means all forms are not valid<br>  contactForms<br>      .forEach((element) =&gt; allValid = (allValid &amp;&amp; element.isValidated()));<br><br>  if (allValid) {<br>    for (int i = 0; i &lt; contactForms.length; i++) {<br>      ContactFormItemWidget item = contactForms[i];<br>      debugPrint(&quot;Name: ${item.contactModel.name}&quot;);<br>      debugPrint(&quot;Number: ${item.contactModel.number}&quot;);<br>      debugPrint(&quot;Email: ${item.contactModel.email}&quot;);<br>    }<br>    //Submit Form Here<br>  } else {<br>    debugPrint(&quot;Form is Not Valid&quot;);<br>  }<br>}</pre><p>Full Class Code: <strong><em>MultiContactFormWidget</em></strong></p><pre>class MultiContactFormWidget extends StatefulWidget {<br>  @override<br>  State&lt;StatefulWidget&gt; createState() {<br>    return _MultiContactFormWidgetState();<br>  }<br>}<br><br>class _MultiContactFormWidgetState extends State&lt;MultiContactFormWidget&gt; {<br>  List&lt;ContactFormItemWidget&gt; contactForms = List.empty(growable: true);<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: Text(&quot;Create Multi Contacts&quot;),<br>      ),<br>      bottomNavigationBar: Padding(<br>        padding: const EdgeInsets.all(8.0),<br>        child: CupertinoButton(<br>          color: Theme.<em>of</em>(context).primaryColor,<br>          onPressed: () {<br>            onSave();<br>          },<br>          child: Text(&quot;Save&quot;),<br>        ),<br>      ),<br>      floatingActionButton: FloatingActionButton(<br>        backgroundColor: Colors.<em>orange</em>,<br>        child: Icon(Icons.<em>add</em>),<br>        onPressed: () {<br>          onAdd();<br>        },<br>      ),<br>      body: contactForms.isNotEmpty<br>          ? ListView.builder(<br>              itemCount: contactForms.length,<br>              itemBuilder: (_, index) {<br>                return contactForms[index];<br>              })<br>          : Center(child: Text(&quot;Tap on + to Add Contact&quot;)),<br>    );<br>  }<br><br>  //Validate all forms and submit<br>  onSave() {<br>    bool allValid = true;<br><br>    //If any form validation function returns false means all forms are not valid<br>    contactForms<br>        .forEach((element) =&gt; allValid = (allValid &amp;&amp; element.isValidated()));<br><br>    if (allValid) {<br>      for (int i = 0; i &lt; contactForms.length; i++) {<br>        ContactFormItemWidget item = contactForms[i];<br>        debugPrint(&quot;Name: ${item.contactModel.name}&quot;);<br>        debugPrint(&quot;Number: ${item.contactModel.number}&quot;);<br>        debugPrint(&quot;Email: ${item.contactModel.email}&quot;);<br>      }<br>      //Submit Form Here<br>    } else {<br>      debugPrint(&quot;Form is Not Valid&quot;);<br>    }<br>  }<br><br>  //Delete specific form<br>  onRemove(ContactModel contact) {<br>    setState(() {<br>      int index = contactForms<br>          .indexWhere((element) =&gt; element.contactModel.id == contact.id);<br><br>      if (contactForms != null) contactForms.removeAt(index);<br>    });<br>  }<br><br>  //Add New Form<br>  onAdd() {<br>    setState(() {<br>      ContactModel _contactModel = ContactModel(id: contactForms.length);<br>      contactForms.add(ContactFormItemWidget(<br>        index: contactForms.length,<br>        contactModel: _contactModel,<br>        onRemove: () =&gt; onRemove(_contactModel),<br>      ));<br>    });<br>  }<br>}</pre><p><strong>Check out the Complete App Code on </strong><a href="https://github.com/yatindeokar/Flutter_Dynamic_Forms"><strong>GIT Repository</strong></a></p><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*OZzG38KHNjtYrGi6tk-A4A.jpeg" /></figure><p>That’s it for now, I hope it will help you to implement dynamic Forms in your next awesome Flutter project. <strong>Please provide feedback</strong> in the comments so, I can improve my tutorial and <strong>provide me a suggestion</strong> for any topic you need a tutorial.</p><p><strong>Or you can connect with</strong></p><p><strong>Twitter:</strong> <a href="https://twitter.com/yatin_deokar">https://twitter.com/yatin_deokar</a></p><p><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/yatin-deokar-673a30106](https://www.linkedin.com/in/yatin-deokar-673a30106)">https://www.linkedin.com/in/yatin-deokar-673a30106</a></p><p><strong>GitHub:</strong> <a href="https://github.com/yatindeokar](https://github.com/yatindeokar)">https://github.com/yatindeokar</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dONV7tZvrQHtwALD6C_n1w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73ed03833874" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Talented Flutter Widgets]]></title>
            <link>https://yatindeokar33.medium.com/talented-flutter-widgets-49d4efe441e9?source=rss-78e62a88ceef------2</link>
            <guid isPermaLink="false">https://medium.com/p/49d4efe441e9</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Yatin Deokar]]></dc:creator>
            <pubDate>Wed, 22 Jul 2020 06:42:32 GMT</pubDate>
            <atom:updated>2020-07-22T06:42:32.258Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJ-GPj_AbBy5YCu-eXyO2g.png" /></figure><p>Flutter is all about widgets, but there are some less used or we can say hidden widgets with some extra talent that will help you to build apps faster and make them more beautiful. In this article, we will cover some of the unique flutter widgets. All those widgets are described individually with code snippets also so that you can play with them. So let’s explore the flutter talent.</p><p><strong>Widgets covered are described below:</strong></p><ol><li>ListWheelScrollView</li><li>BackdropFilter</li><li>ColorFiltered</li><li>ShaderMask</li><li>AnimatedDefaultTextStyle</li><li>ReorderableListView</li><li>AnimatedSwitcher</li></ol><p><strong>How to get started with Flutter</strong></p><ul><li>Flutter official document for <a href="https://flutter.dev/docs/get-started/install"><em>starting Flutter</em></a></li><li>Try Flutter on <a href="https://dartpad.dartlang.org/"><em>DartPad</em></a><em> and </em><a href="https://codepen.io/pen/editor/flutter"><em>CodePen</em></a></li></ul><h3>1. ListWheelScrollView</h3><p>ListWheelScrollView is a widget that puts its children in a scrollable wheel. That results in a 3D effect as if the children are rotating in a wheel you will get a selected item at the center of the wheel. you can use it where you need to select a single item from multiple options. It can be a better replacement option for <a href="https://api.flutter.dev/flutter/material/DropdownButton-class.html">DropdownButton</a>. Let&#39;s see how to implement and get a selected item.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hnSLI945R_aJFXRhrNiJxw.png" /></figure><ul><li><strong>DiameterRatio</strong> is a ratio between the diameter of the cylinder and the viewport’s size in the main axis.</li><li><strong>ItemExtend</strong> is the Size of each child in the main axis. Must not be null and must be positive.</li><li><strong>offAxisFraction </strong>will change the horizontal axis direction of the wheel. as shown below.</li></ul><blockquote>Explore ListWheelScrollView at <a href="https://codepen.io/yatindeokar/pen/xxZQgBw"><strong>CodePen</strong></a></blockquote><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*VnVDXlOAT6aPeID5gwIByw.gif" /><figcaption>ListWheelScrollView.gif(With <strong>offAxisFraction: 0.0</strong>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*3rm6_dqOAiGQRQqrXPM6gg.gif" /><figcaption>ListWheelScrollView(With <strong>offAxisFraction: -1</strong>)</figcaption></figure><h3>2. BackdropFilter</h3><p>What if you want to apply the effects on Widget like a blur, rotate or skew, backdrop filter will help you in these cases. ImageFilter.blur will create a blur layer at the background of the child. Let&#39;s see the example for more understanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NiWpXjStZiahcNRqD7GXNQ.png" /></figure><ul><li>The <strong>sigmaX</strong> and <strong>sigmaY</strong> properties control the blur effect</li><li>Wrap <strong>BackdropFilter</strong> inside the <strong>Stack</strong> Widget along with the child widget to be superimposed.</li><li>Use <strong>Positioned</strong> Widget to apply BackdropFilter at a specific place on the screen.</li></ul><blockquote>Make sure that BackdropFilter must be wrapped inside ClipRRect it acts as a boundary for the filter effect, so it will cover the child only otherwise it gets applied to the parent widget/entire screen.</blockquote><blockquote>Explore BackdropFilter at <a href="https://codepen.io/yatindeokar/pen/vYLQZQx"><strong>CodePen</strong></a></blockquote><pre><em>class </em>MyBackdropFilter <em>extends </em>StatelessWidget{<br>  @override<br>  Widget build(BuildContext context) {<br>    <em>return </em>Stack(<br>      children: &lt;Widget&gt;[<br><br>        Container(<br>          height: 50,<br>          width: 50,<br>          color: Colors.<em>red</em>,<br>        ),<br><br>        Positioned(<br>          bottom: 5.0,<br>          child: Container(<br>            height: 50,<br>            width: 50,<br>            color: Colors.<em>red</em>,<br>          ),<br>        ),<br><br>        Center(<br>          child: <em>new </em>Container(<br>              height: 300,<br>              width: 300,<br>              child: <em>new </em>FlutterLogo()<br>          ),<br>        ),<br><br>        Center(<br>            child: <strong>BackdropFilter</strong>(<br>              filter: <em>new </em>ui.ImageFilter.blur(<br>                  sigmaX: 5.0, <br>                  sigmaY: 5.0),<br>              child: Container(<br>                width: 200.0,<br>                height: 200.0,<br>                child: Center(<br>                  child: Container(<br>                      height: 60,<br>                      width: 60,<br>                      child: FlutterLogo()),),<br>              ),<br>            )<br>        )<br><br>      ],<br>    );<br>  }<br><br>}</pre><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/282/1*go_ieBgvfXdg_EoMc4XJZw.png" /><figcaption>BackdropFilter Without ClipRRect (IMAGE)</figcaption></figure><p><strong>Wrap BackdropFilter with ClipRRect</strong></p><pre>Center(<br>    child: <strong>ClipRRect</strong>(<br>      child: <strong>BackdropFilter</strong>(<br>        filter: <em>new </em>ui.ImageFilter.blur(<br>            sigmaX: 5.0,<br>            sigmaY: 5.0),<br>        child: Container(<br>          width: 200.0,<br>          height: 200.0,<br>          child: Center(<br>            child: Container(<br>                height: 60,<br>                width: 60,<br>                child: FlutterLogo()),),<br>        ),<br>      ),<br>    )<br>)</pre><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*ouXDHwQwNXBTMIkKdavZrw.png" /><figcaption>BackdropFilter Wrap with ClipRRect.(IMAGE)</figcaption></figure><h3>3. <strong>ColorFiltered</strong></h3><p>To apply the basic filter or shade on the image we have to deal with the image bitmap and image processing.it&#39;s A little bit of lengthy operation to get just a simple effect. In this situation, the magical widget ColorFiltered comes into the frame. It will help you to apply the filters on your image view with multiple combinations of colors and BlendModes and the bonus is you can apply this filter not only on an image but also on any widget.</p><p>What if you want to gray out all the widgets in a page ……Wrap it with ColorFiltered and change filter mode tadda🎉🎊... Simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TxRujh415k7ffHA6Eev_2g.png" /></figure><blockquote>ColorFiltered Widget is added to <a href="https://flutter.dev/docs/development/tools/sdk/release-notes/release-notes-1.9.1">Flutter 1.9 release</a>.</blockquote><pre><em>class </em>MyColorFilter <em>extends </em>StatefulWidget{<br>  @override<br>  State&lt;StatefulWidget&gt; createState() {<br>    <em>return </em>_MyColorFilterState();<br>  }<br><br>}<br><br><em>class </em>_MyColorFilterState <em>extends </em>State&lt;MyColorFilter&gt;{<br><br>  BlendMode _blendMode = <strong>BlendMode.plus</strong>;<br>  String filterName = &quot;Plus&quot;;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    <em>return </em>Column(<br>      mainAxisSize: MainAxisSize.max,<br>      crossAxisAlignment: CrossAxisAlignment.center,<br>      mainAxisAlignment: MainAxisAlignment.spaceBetween,<br>      children: &lt;Widget&gt;[<br><br>        <em>new </em>Container(<br>          height: 400,<br>            child: <strong>ColorFiltered</strong>(<br>                colorFilter: ColorFilter.mode(Colors.<em>red</em>, _blendMode),<br>                child: Image.asset(&#39;assets/my_painting.jpeg&#39;,))<br>        ),<br><br>        Text(&quot;Applied Filter $filterName&quot;),<br><br>        Expanded(<br>          child: ListView(<br>            scrollDirection: Axis.horizontal,<br>            shrinkWrap: <em>true</em>,<br>            children: &lt;Widget&gt;[<br><br>              FlatButton(onPressed: (){<br><br>                setState(() {<br>                  _blendMode = <strong>BlendMode.plus</strong>;<br>                  filterName = &quot;Plus&quot;;<br>                });<br><br>              }, child: Text(&quot;Plus&quot;)),<br>              FlatButton(onPressed: (){<br>                setState(() {<br>                  _blendMode = <strong>BlendMode.colorBurn</strong>;<br>                  filterName = &quot;ColorBurn&quot;;<br>                });<br>              }, child: Text(&quot;ColorBurn&quot;)),<br><br>              FlatButton(onPressed: (){<br>                setState(() {<br>                  _blendMode = <strong>BlendMode.colorDodge</strong>;<br>                  filterName = &quot;ColorDodge&quot;;<br>                });<br>              }, child: Text(&quot;ColorDodge&quot;)),<br><br>              FlatButton(onPressed: (){<br>                setState(() {<br>                  _blendMode = <strong>BlendMode.hue</strong>;<br>                  filterName = &quot;Hue&quot;;<br>                });<br>              }, child: Text(&quot;Hue&quot;)),<br><br>            ],<br>          ),<br>        )<br><br>      ],<br>    );<br>  }<br><br><br><br>}</pre><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*mo6452nZdOOQJ2S7LRXgiw.gif" /><figcaption><strong>ColorFiltered(GIF)</strong></figcaption></figure><h3>4. ShaderMask</h3><p>ShaderMask is a hidden gem of flutter. It applies a mask generated by shader to its child widget. For example, You cut the sticker and applied it on the wall, so the cutting tool is a <strong>shader</strong>, a sticker is a <strong>mask</strong> and the wall is a <strong>child widget</strong>. Let&#39;s see how to apply it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xsf1F2yPg2xEvG8uhYbAQQ.png" /></figure><ul><li><strong>shaderCallback</strong> must return shader that can be gradient shader or Image shader.</li><li>You can try <a href="https://api.flutter.dev/flutter/painting/LinearGradient-class.html"><strong>LinearGradient</strong></a>, <a href="https://api.flutter.dev/flutter/painting/RadialGradient-class.html"><strong>RadialGradient</strong></a>, or <a href="https://api.flutter.dev/flutter/painting/SweepGradient-class.html"><strong>SweepGradient</strong></a>.</li></ul><p><strong>Let&#39;s Create Tiger Pikachu with Image ShaderMask</strong></p><pre><em>class </em>MyShaderMaskTigerPikachu <em>extends </em>StatelessWidget{<br><br>  Image <strong>_image</strong>;<br>  <em>final </em>Float64List <strong>deviceTransform</strong> = <em>new </em>Float64List(16)<br>    ..[0] = 1<br>    ..[5] = 1<br>    ..[10] = 1.0<br>    ..[15] = 3.5;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    <strong>_getImage</strong>();<br>   <em>return </em>Center(<br>     child: ShaderMask(<br>       blendMode: BlendMode.srcIn,<br>       shaderCallback: (Rect bounds) {<br>         <em>return </em><strong>ImageShader</strong>(<br>             <strong>_image</strong>,<br>             TileMode.mirror,<br>             TileMode.mirror,<br>             <strong>deviceTransform</strong>);<em><br>       </em>},<br>       child:Image.asset(&#39;assets/<strong>pikachu</strong>.png&#39;),<br>     ),<br>   );<br>  }<br><br>  <strong>_getImage</strong>() <em>async</em>{<br>    Completer&lt;ui.Image&gt; completer = <em>new </em>Completer&lt;ui.Image&gt;();<br>    <em>new </em>AssetImage(&#39;assets/<strong>tiger_pattern</strong>.jpg&#39;)<br>        .resolve(<em>new </em>ImageConfiguration())<br>        .addListener(<em>new </em>ImageStreamListener((ImageInfo image, bool synchronousCall) {<br>      <strong>_image</strong> = image.image;<br>          completer.complete(image.image);<br>    }));<br><br>  }<br><br>}</pre><p><strong>Result:(This is the magic of flutter</strong>✨🎩✨<strong>…)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*myP2dsoJiUFt0LsYFqYHog.png" /><figcaption><strong>Image mask</strong> + <strong>Child Widget</strong> = <strong>Shader Mask</strong></figcaption></figure><h3>5. AnimatedDefaultTextStyle</h3><p>This widget changes the text style dynamically. Wait that’s not new. We can do that without this widget by changing the style in setState, so what’s make that widget unique? The answer is animation, yes it animates the change for you. So the transition from one style to another style looks smooth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G8N2CpIXqqwIds_AGQCfDQ.png" /></figure><blockquote>Explore AnimatedDefaultTextStyle at <a href="https://codepen.io/yatindeokar/pen/oNbQeOq"><strong>CodePen</strong></a></blockquote><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*JsLDTg9spD3Dk7rHC53-jA.gif" /><figcaption>GIF</figcaption></figure><h3>6. <strong>ReorderableListView</strong></h3><p>As the name says this list gives you the advantage of re-ordering the list item.to do that with normal ListView it&#39;s very tedious. but for every problem flutter has a single widget solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x0YxiLPktVn4i8E3TR6QIA.png" /></figure><blockquote>Explore ReorderableListView at <a href="https://codepen.io/yatindeokar/pen/jOWQdrW"><strong>CodePen</strong></a></blockquote><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*z08uAbSTgHQQIPPZl-VPbA.gif" /><figcaption>GIF</figcaption></figure><h3>7. AnimatedSwitcher</h3><p>Last but not the least, AnimatedSwitcher. Many times in our app we have to switch between the two widgets(Show only one at a time) based on the condition, in this case, we can use AnimatedSwitcher.It will help you to change the visibility of widgets with animation like Fade, Rotation, and Scale. also with <a href="https://api.flutter.dev/flutter/widgets/AnimatedContainer-class.html">AnimatedContainer</a> and <a href="https://api.flutter.dev/flutter/widgets/AnimatedCrossFade-class.html">AnimatedCrossFade</a>, you will get a similar effect. We will explore it sometime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0G-SXGSAD5M1Xc72IZjUA.png" /></figure><blockquote>Explore AnimatedSwitcher at <a href="https://codepen.io/yatindeokar/pen/BajGJPM"><strong>CodePen</strong></a></blockquote><p><strong>Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*zIopwZcBaov2NTiubY1sAw.gif" /><figcaption>GIF</figcaption></figure><p>That’s it for now, I hope it will help you to get started with flutter and choose an appropriate widget for your next awesome project. <strong>Please provide feedback</strong> in comments so, I can improve my tutorial and <strong>provide me a suggestion</strong> for any topic you need a tutorial.</p><p><strong>Or you can connect with</strong></p><p><strong>Twitter: </strong><a href="https://twitter.com/yatin_deokar">https://twitter.com/yatin_deokar</a></p><p><strong>LinkedIn: </strong><a href="https://www.linkedin.com/in/yatin-deokar-673a30106">https://www.linkedin.com/in/yatin-deokar-673a30106</a></p><p><strong>GitHub: </strong><a href="https://github.com/yatindeokar">https://github.com/yatindeokar</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aR3OfiK_540MR5G83D7B2w.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49d4efe441e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>