<?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 Joan Pablo Jiménez on Medium]]></title>
        <description><![CDATA[Stories by Joan Pablo Jiménez on Medium]]></description>
        <link>https://medium.com/@johnpjm85?source=rss-ca498841e664------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*cIb_gek-QpBDBuR941UQow.jpeg</url>
            <title>Stories by Joan Pablo Jiménez on Medium</title>
            <link>https://medium.com/@johnpjm85?source=rss-ca498841e664------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:48:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@johnpjm85/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[Star Rating Bar with Flutter Reactive Forms]]></title>
            <link>https://medium.com/flutter-community/star-rating-bar-with-flutter-reactive-forms-3d1560843f44?source=rss-ca498841e664------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d1560843f44</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[star-rating]]></category>
            <category><![CDATA[reactive-forms]]></category>
            <category><![CDATA[forms]]></category>
            <dc:creator><![CDATA[Joan Pablo Jiménez]]></dc:creator>
            <pubDate>Sun, 04 Oct 2020 09:21:31 GMT</pubDate>
            <atom:updated>2020-10-04T09:21:31.478Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ihS4GH-oEu4LObNLjf1YZw.jpeg" /><figcaption>Reactive Forms</figcaption></figure><p><a href="https://pub.dev/packages/reactive_forms">Reactive Forms</a> is not just limited to common widgets in Forms like text inputs, dropdowns, sliders, and switches; you can easily create custom widgets that two-way binds to <strong>FormControls</strong> and create your own set of Reactive Widgets.</p><p>In this post, we will learn how to implement a Reactive Star Rating widget using <strong>Reactive Forms</strong>, and thus be able to create rich forms that can also collect information using a star rating bar.</p><p>To know more about <strong>Reactive Forms</strong> you can read my previous post <a href="https://dev.to/joanpablo/why-use-reactive-forms-in-flutter-ea1">Why use Reactive Forms in Flutter?</a> or visit G<a href="https://github.com/joanpablo/reactive_forms">itHub</a> and <a href="https://pub.dev/packages/reactive_forms">pub repo</a>. You can also read the wiki page <a href="https://github.com/joanpablo/reactive_forms/wiki/Custom-Reactive-Widgets">Custom Reactive Widgets</a>.</p><p>This is what we are going to achieve at the end of this post:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*W22zNh2LztngU0cyE-y4Fg.gif" /><figcaption>Reactive Star Rating Bar</figcaption></figure><p>We are not going to create a Star Rating Bar from zero, instead, we are going to use an existing widget and convert it into a Reactive Widget.</p><p>We will use the excellent plugin <a href="https://pub.dev/packages/flutter_rating_bar"><strong>flutter_rating_bar</strong></a> and give it the ability to two-way binds with a <strong>FormControl</strong>.</p><h3>Less talking and more coding ;)</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9781e143284887067979a6cc9c735de0/href">https://medium.com/media/9781e143284887067979a6cc9c735de0/href</a></iframe><blockquote>flutter_rating_bar: <strong>^3.0.1+1</strong> was the last version at the time of the post.</blockquote><p>Create our reactive widget, declare <strong>ReactiveStarRating,</strong> and extends from <strong>ReactiveFormField</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de8824dcb26c64215cf8399c60884791/href">https://medium.com/media/de8824dcb26c64215cf8399c60884791/href</a></iframe><p>Then supply to the parent class the <strong>formControlName</strong> and the <strong>builder</strong> function:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a3bd66165c76a1c7202bc40f1a09d186/href">https://medium.com/media/a3bd66165c76a1c7202bc40f1a09d186/href</a></iframe><p><strong>Done</strong>, say hello to our new reactive widget <strong>ReactiveStarRating</strong>.</p><p>Wow but wait a minute, what just happened here, is that all? Yes, we are done with the reactive widget, but before we start using it, let me explain the above code a little bit.</p><h3>These are the steps:</h3><p>1- Extend from <strong>ReactiveFormField</strong>. This is a StatefulWidget that maintains the state and is bound with the FormControl.</p><p>2- Provide a <strong>builder</strong> function in the parent’s constructor (<strong>super</strong>). This function will return your inner widget, in this case, the <strong>RatingBar</strong> widget. The builder function will be called every time the <strong>FormControl</strong> changes its value.</p><p>3- Update the value of the FormControl with the method <strong>didChange</strong> method. Every time you want to update the value of the FormControl, call the <strong>didChange</strong> method of the ReactiveFormField passing the new value.</p><h3>How use it?</h3><p>We are almost done, now let’s consume our new ReactiveStarRating, we will also add some other reactive widgets that listen for changes in the FormControl just to visualize how they stay in sync with our new ReactiveStarRating:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c58a95d67c80a887b232d86064a25e54/href">https://medium.com/media/c58a95d67c80a887b232d86064a25e54/href</a></iframe><p>And that’s it. This was a very simple example. I urge you to make the widget more configurable so that it allows you to change the background color of the stars and evaluate with a half star.</p><p>I hope you have enjoyed the post.</p><p>Thanks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuT0GXEd7j21RI6uXlxYTQ.png" /><figcaption><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d1560843f44" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/star-rating-bar-with-flutter-reactive-forms-3d1560843f44">Star Rating Bar with Flutter Reactive Forms</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why use Reactive Forms in Flutter?]]></title>
            <link>https://medium.com/flutter-community/why-use-reactive-forms-in-flutter-477d6ab38d44?source=rss-ca498841e664------2</link>
            <guid isPermaLink="false">https://medium.com/p/477d6ab38d44</guid>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[reactive]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[reactive-forms]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Joan Pablo Jiménez]]></dc:creator>
            <pubDate>Tue, 21 Jul 2020 04:10:47 GMT</pubDate>
            <atom:updated>2020-10-03T21:11:58.341Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kSGazKuMKpjRWq08NVvN-w.jpeg" /></figure><h3>Haven’t you ever felt that getting data from a Form, validating a field, or even disabling the submit button is tedious and full of boilerplate code?</h3><p>Fortunately, that’s why <a href="https://pub.dev/packages/reactive_forms"><strong>Reactive Forms</strong></a> exists.</p><h3>1. Ease and clean way of collecting data from your Forms.</h3><p>No more <em>onSave</em>, <em>onChanges</em>, <em>onEditionCompleted</em> callbacks needed or <em>TextEditionControllers</em> to collect data from inputs.</p><p><strong>Reactive Forms</strong> get a clean separation between views and models and maintains data synchronization in a transparent two-way binding mechanism. Just declare your model and define your widgets. Then lay back and relax, data will flow smoothly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*kxaX2R6Xjwq93DaOB82VXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*BKsqwoOHMKP6T6ffm2-djw.png" /></figure><h3>2. Transparent Validations of inputs fields.</h3><p>No more StatefulWidget defining a <em>key</em> for the <em>Form</em> widget, goodbye to <em>Form.of(context)</em> and Goodbye to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*J2_-mI_73zK0FyTVCGvxmQ.png" /></figure><p><strong>Reactive Forms</strong> Validations occurs transparently. Just declare your model and define the <strong>validators</strong> you need. It will also handle the validity of the entire Form and will show error messages when needed. All of that without you needing to write a single line of imperative code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*d91jhOuNwsFeeZImS3qISw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*RjxWKroeS7dL161nvESdlQ.png" /></figure><h3>3. Enable/Disable buttons depending on Form validity.</h3><p>Getting this behavior, even in such a great framework as Flutter, can sometimes be hard and full of boilerplate code.</p><p>In <strong>Reactive Forms</strong> is as simple as asking to the Form if it is valid or not:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*kfwyqnlN7ZxrD4YVI2L5hw.png" /></figure><h3>4. Perfect integration with <a href="https://pub.dev/packages/provider">Provider</a> plugin and other state management plugins.</h3><p>The use of a state management library (MVC, MVVM, or just BLoc) clean your code and perfectly separates responsibilities between the UI and business logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*E__DnXvPJoaAUFlaQY6gnw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*O9loHTBpoRwGjVAoks9Mxg.png" /></figure><h3>5. Focus/Unfocus text fields.</h3><p>To add or remove focus to a control use FormControl.focus() or FormControl.unfocus(). No more <em>StatefulWidgets</em> and FocusNode declarations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*2OZFfc5LyLIHykjVpa33Bg.png" /></figure><h3>What is Reactive Forms?</h3><ul><li><strong>Reactive Forms</strong> provides a model-driven approach to handling form inputs whose values change over time. It’s heavily inspired in <a href="https://angular.io/guide/reactive-forms">Angular Reactive Form</a>.</li><li>It lets you focus on business logic and save you time from collect, validate, and maintain synchronization data between models and widgets.</li><li>Remove boilerplate code and brings you the possibility to write clean code with minimal efforts.</li><li>Integrates perfectly with common state management libraries like Provider, Bloc, and many others.</li></ul><h3>What is not Reactive Forms?</h3><ul><li><strong>Reactive Forms</strong> is not a fancy widget’s package. It’s not a widget’s library with new shapes, colors, or animations. It frees you from the responsibility of gathering and validating the data. And keeps the data in sync between your model and your widgets.</li><li><strong>Reactive Forms</strong> doesn’t replace native widgets that you commonly use in Flutter like <em>TextFormField</em>, <em>DropdownButtonFormField,</em> or <em>CheckboxListTile</em>. It brings new two-way binding capabilities and many more features to those same widgets.</li></ul><p><strong>Reactive Forms</strong> is much more. This POST was just a preview of some basic features. Please visit <a href="https://github.com/joanpablo/reactive_forms">Github Repo</a> or plugin page in <a href="https://pub.dev/packages/reactive_forms">pub.dev</a> for the full documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuT0GXEd7j21RI6uXlxYTQ.png" /><figcaption><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=477d6ab38d44" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/why-use-reactive-forms-in-flutter-477d6ab38d44">Why use Reactive Forms in Flutter?</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>