<?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 Arikaran S on Medium]]></title>
        <description><![CDATA[Stories by Arikaran S on Medium]]></description>
        <link>https://medium.com/@arikaran1302?source=rss-a9d93c267863------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VSKhZ7rJRFVGg8S0G47F6Q.jpeg</url>
            <title>Stories by Arikaran S on Medium</title>
            <link>https://medium.com/@arikaran1302?source=rss-a9d93c267863------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:49:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arikaran1302/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[How to Navigate Between Screens in Flutter]]></title>
            <link>https://medium.com/@arikaran1302/how-to-navigate-between-screens-in-flutter-1113ddb05fe2?source=rss-a9d93c267863------2</link>
            <guid isPermaLink="false">https://medium.com/p/1113ddb05fe2</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[flutter-navigation]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Arikaran S]]></dc:creator>
            <pubDate>Fri, 07 Aug 2026 07:37:40 GMT</pubDate>
            <atom:updated>2026-08-07T07:50:23.711Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBLt_qS5d0mS8xII3JClSQ.png" /></figure><p>In a real world Flutter application, we cannot display all the information on a single screen because it quickly becomes cluttered and difficult to use. Instead, we divide the application into multiple screens, where each screen is responsible for displaying a specific piece of information.</p><p>Once an application contains multiple screens, we need a way to navigate between them. Flutter provides a simple way to achieve this using the <strong>Navigator</strong> class.</p><p>There are two common ways to navigate between screens:</p><ol><li><strong>Navigator with unnamed routes</strong></li><li><strong>Navigator with named routes</strong></li></ol><h4>How the Navigator Works</h4><p>The <strong>Navigator</strong> works very similarly to a <strong>Stack</strong> data structure.<br>Imagine a stack of books. Whenever you add a new book, it is placed on top of the stack. Likewise, when you remove a book, the topmost book is removed first.</p><p>Flutter’s Navigator follows the same principle.</p><ul><li>When you navigate to a new screen, Flutter <strong>pushes</strong> that screen onto the navigation stack.</li><li>When you return to the previous screen, Flutter <strong>pops</strong> the current screen from the stack.</li></ul><p>That’s why the Navigator class provides the push() and pop() methods.</p><h4>Navigator with Unnamed Routes</h4><p>Let’s create two widgets and navigate between them.</p><ol><li><strong>Home()</strong> — The home screen. Pressing the Floating Action Button should navigate to the Loading() screen.</li><li><strong>Loading()</strong> — The loading screen. Pressing the Floating Action button should navigate back to the Home() screen.</li></ol><p>Home Screen Widget:</p><pre>import &#39;package:flutter/cupertino.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_demo_project/screens/loading.dart&#39;;<br><br>class Home extends StatelessWidget {<br>  const Home({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      backgroundColor: Colors.grey[900],<br>      appBar: AppBar(<br>        title: const Text(<br>          &#39;Home&#39;,<br>          style: TextStyle(<br>            color: Colors.white,<br>            fontWeight: FontWeight.bold,<br>          ),<br>        ),<br>        iconTheme: const IconThemeData(color: Colors.white),<br>        backgroundColor: Colors.grey[850],<br>      ),<br>      body: const Center(<br>        child: Text(<br>          &#39;Welcome to the Home Screen!&#39;,<br>          style: TextStyle(<br>            fontSize: 24,<br>            color: Colors.white,<br>            fontWeight: FontWeight.bold,<br>          ),<br>        ),<br>      ),<br>      floatingActionButton: FloatingActionButton(<br>        onPressed: () {<br>          // Will be added later<br>        },<br>        child: const Icon(Icons.add),<br>      ),<br>    );<br>  }<br>}</pre><p>Home screen widget looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*_cT52PFMe4kNgEbO6jZ0NQ.png" /><figcaption>home screen</figcaption></figure><p>Loading Screen Widget:</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>class Loading extends StatelessWidget {<br>  const Loading({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      backgroundColor: Colors.grey[900],<br>      body: const Center(<br>        child: Text(<br>          &quot;Loading...&quot;,<br>          style: TextStyle(<br>            color: Colors.white,<br>            fontSize: 24,<br>            fontWeight: FontWeight.bold,<br>          ),<br>        ),<br>      ),<br>      floatingActionButton: FloatingActionButton(<br>        onPressed: () {<br>          // Will be added later<br>        },<br>        child: const Icon(Icons.arrow_back),<br>      ),<br>    );<br>  }<br>}<br></pre><p>Loading screen widget:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*x0nZM1OCG-KaLRFm5OuT4w.png" /><figcaption>Loading screen</figcaption></figure><p>Now that we have two widgets, the final step is to add navigation between them.</p><p>Inside the FloatingActionButton of the <strong>Home</strong> screen, add the following code:</p><pre>onPressed: () {<br>  Navigator.push(<br>    context,<br>    MaterialPageRoute&lt;void&gt;(<br>      builder: (context) =&gt; const Loading(),<br>    ),<br>  );<br>}</pre><p>Let’s understand what is happening here.</p><p>Navigator.push() takes two arguments.</p><h4>1. BuildContext</h4><p>The first argument is the BuildContext of the current widget.</p><p>It tells the Navigator from which widget (or screen) the navigation is being triggered.</p><h4>2. Route</h4><p>The second argument is a <strong>Route</strong> object.</p><p>Here, we use MaterialPageRoute, which creates a route with a Material Design transition animation and tells the Navigator which screen to display next.</p><p>You may notice the &lt;void&gt; in MaterialPageRoute&lt;void&gt;.</p><p>This specifies the type of value that will be returned when this screen is removed from the navigation stack using Navigator.pop().</p><p>Since the Loading screen is not returning any value, we use void.</p><p>If the screen needed to return a String, for example, we would write:</p><pre>MaterialPageRoute&lt;String&gt;(<br>  builder: (context) =&gt; const Loading(),<br>)</pre><p>Returning to the Previous Screen</p><p>Inside the Loading widget, add the following code to the FloatingActionButton:</p><pre>onPressed: () {<br>  Navigator.pop(context);<br>}<br></pre><p>Navigator.pop(context) removes the current screen from the navigation stack. Once the current screen is removed, Flutter automatically displays the previous screen in the stack.</p><h4>Navigator with Named Routes</h4><p>Let’s use the same <strong>Home</strong> and <strong>Loading</strong> widgets, but this time navigate using <strong>named routes</strong>.</p><p>Before using named routes, we need to define them inside MaterialApp.</p><pre>MaterialApp(<br>  initialRoute: &#39;/&#39;,<br>  routes: {<br>    &#39;/&#39;: (context) =&gt; const Home(),<br>    &#39;/loading&#39;: (context) =&gt; const Loading(),<br>  },<br>);</pre><p>The routes property is a map where:</p><ul><li>The <strong>key</strong> is the route name.</li><li>The <strong>value</strong> is the widget builder associated with that route.</li></ul><p>Now, instead of using Navigator.push(), we can use Navigator.pushNamed().</p><pre>onPressed: () {<br>  Navigator.pushNamed(context, &#39;/loading&#39;);<br>}</pre><p>Here, we simply specify the route name associated with the Loading screen, making the navigation code cleaner and easier to read.</p><p>Returning to the previous screen remains exactly the same</p><pre>onPressed: () {<br>  Navigator.pop(context);<br>}</pre><p>That’s it! You now know how to navigate between screens in Flutter using the Navigator class. Mastering these basics will make it much easier to build larger Flutter applications in the future.</p><p>Happy Coding 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1113ddb05fe2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing Data with Bar Charts Using fl_chart]]></title>
            <link>https://medium.com/@arikaran1302/visualizing-data-with-bar-charts-using-fl-chart-081af52f808c?source=rss-a9d93c267863------2</link>
            <guid isPermaLink="false">https://medium.com/p/081af52f808c</guid>
            <category><![CDATA[fl-chart-flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[bar-chart]]></category>
            <dc:creator><![CDATA[Arikaran S]]></dc:creator>
            <pubDate>Sun, 29 Dec 2024 04:05:47 GMT</pubDate>
            <atom:updated>2024-12-29T04:05:47.608Z</atom:updated>
            <content:encoded><![CDATA[<p>When you need to present data in an engaging and intuitive way, a <strong>Bar Chart</strong> is one of the best ways to do it. For instance, in an expense tracking app, you can display weekly expenses using a bar chart for better clarity and visualization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*O71ciNYROid1lAaJfi6Dqw.png" /><figcaption>Bar Chart created with fl_chart lib</figcaption></figure><p>In this tutorial, I will explain how to use the <strong>fl_chart</strong> library to add a simple bar chart to a Flutter project.</p><p>The key widgets used to build a bar chart are:</p><ol><li><strong>BarChart</strong> : The main widget to display the bar chart.</li><li><strong>BarChartData</strong> : Used to control and define the overall data and styling of the bar chart.</li><li><strong>BarChartGroupData</strong> : Used to represent the group of bars in the chart.</li><li><strong>BarChartRodData</strong>: Controls the appearance of bars in the chart such as width, color, borderRadius etc..</li><li><strong>FlTitlesData</strong>: It holds data to display them in each axis like left , right , top and bottom axis</li><li><strong>AxisTitles</strong>: Controls the axis of bar chart (left, right, top and bottom) axis.</li><li><strong>GridData</strong>: Controls the grid in the background of the bar chart, which helps visualize bar values more clearly.</li></ol><p><strong>Step 1: Add the fl_chart Dependency</strong></p><p>First, add the following dependency to your <strong>pubspec.yaml</strong> file:</p><pre>dependencies:    <br>  fl_chart: ^0.65.0</pre><p>Then, run:</p><pre>flutter pub get</pre><p><strong>Step 2: Create a Widget for the bar chart</strong></p><p>Start by creating a widget to hold the bar chart:</p><pre>import &#39;package:fl_chart/fl_chart.dart&#39;;  <br>import &#39;package:flutter/material.dart&#39;;  <br>  <br>class ExpenseBarChart extends StatefulWidget {  <br>  const ExpenseBarChart({super.key});  <br>  <br>  @override  <br>  State&lt;ExpenseBarChart&gt; createState() =&gt; _MyBarChartState();  <br>}  <br>  <br>class _MyBarChartState extends State&lt;ExpenseBarChart&gt; {  <br>  @override  <br>  Widget build(BuildContext context) {  <br>    return Container(  <br>      height: 350,  <br>      padding: const EdgeInsets.all(20),  <br>      width: MediaQuery.of(context).size.width*0.9,  <br>      decoration: BoxDecoration(  <br>        color: Colors.grey.shade200,  <br>        borderRadius: BorderRadius.circular(12),  <br>      ),  <br>       // Bar chart will be added here<br>    );  <br>  }   <br>}</pre><p>Step 3: Add a Basic Bar Chart</p><pre><br>BarChart(<br>  BarChartData(<br>    <br>  )<br>)</pre><p>This will create a plain empty bar chart</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*5EZniACSbAOHjMyyzJfYjw.png" /></figure><p><strong>Step 4: Add Bars to the Chart</strong></p><p>Now lets add few bars to the chart along with x and y axis value and customize it</p><pre>BarChart(    <br>  BarChartData(  <br>    borderData: FlBorderData(<br>      show:false, // Removes the outer borders of the bar chart <br>    ),   <br>    maxY: 500,  // Sets the maximum range for the y-axis<br>    barGroups: [<br>      BarChartGroupData(  <br>          x:0,  <br>          barRods: [  <br>            BarChartRodData(  <br>                toY: 150,  // Height of the bar on the y-axis<br>              width: 30,  // width of the bar<br>              color: Colors.grey.shade800,  // color of the bar<br>              borderRadius: BorderRadius.circular(3)  // makes the bar edges circular<br>            )  <br>          ]  <br>      ),  <br>      BarChartGroupData(  <br>          x:1,  <br>          barRods: [  <br>            BarChartRodData(toY: 170,  <br>              width: 30,  <br>              color: Colors.grey.shade800,  <br>              borderRadius: BorderRadius.circular(3)  <br>            )  <br>          ]  <br>      ),<br>      BarChartGroupData(  <br>         x:3,  <br>         barRods: [  <br>           BarChartRodData(toY: 189,  <br>            width: 30,  <br>            color: Colors.grey.shade800,  <br>            borderRadius: BorderRadius.circular(3)  <br>      )  <br>    ]  <br>      ).   <br> BarChartGroupData(  <br>     x:4,  <br>     barRods: [  <br>       BarChartRodData(toY: 350,  <br>           width: 30,  <br>           color: Colors.grey.shade800,  <br>           borderRadius: BorderRadius.circular(3)  <br>       )    <br>     ]  <br>   )  <br>)</pre><p><strong>Explanation:</strong></p><ul><li><strong>BarChartData</strong>: Contains the main chart settings like borderData, maxY (maximum y axis range) and the barGroups</li><li><strong>barGroups</strong>: A list of BarChartGroupData widgets, each representing a bar group on the chart.</li><li><strong>BarChartGroupData</strong>: Defines the x-axis value and the bars (barRods) for that group.</li><li><strong>BarChartRodData</strong>: Customizes the appearance of an individual bar</li></ul><p><strong>Step 5: Customize Grid Lines</strong></p><p>You can customize the grid lines in the background of the bar chart. The BarChartData widget has a property called gridData, which takes an instance of FlGridData. Using this, you can control the appearance of both vertical and horizontal grid lines.</p><p>Here’s how you can configure it:</p><pre>gridData: FlGridData(  <br>  drawVerticalLine: false,  // remove vertical lines in the grid<br>  getDrawingHorizontalLine: (val){<br>      return FlLine(  <br>        color: Colors.grey.shade400, // Sets the color of horizontal grid lines <br>        strokeWidth: 1.0, // Sets the thickness of the grid lines <br>      );  <br>  }  <br>),</pre><p>The getDrawingHorizontalLine method takes a callback function as an argument. This function receives a value parameter, which represents the Y-axis position where the horizontal line will be drawn.</p><p><strong>Step 6: Customize Left, Right, Bottom, and Top Axes</strong></p><p>You can customize the left, right, bottom, and top axes of the bar chart. The BarChartData widget has a property called titlesData, which takes an instance of FlTitlesData. This allows you to specify and customize each axis individually.</p><p><strong>Example:</strong></p><pre>titlesData: FlTitlesData(<br>  // Disable the right and top axis titles<br>  rightTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)),<br>  topTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)),<br>  <br>  // Customize the bottom axis (X-axis) values<br>  bottomTitles: AxisTitles(<br>    sideTitles: SideTitles(<br>      showTitles: true, // Enable titles for the X-axis<br>      getTitlesWidget: (value, metadata) { // Return a widget for each X-axis value<br>        switch (value.toInt()) {<br>          case 0:<br>            return _doBarChartTitleTextStyle(&quot;Sun&quot;);<br>          case 1:<br>            return _doBarChartTitleTextStyle(&quot;Mon&quot;);<br>          case 2:<br>            return _doBarChartTitleTextStyle(&quot;Tue&quot;);<br>          case 3:<br>            return _doBarChartTitleTextStyle(&quot;Wed&quot;);<br>          case 4:<br>            return _doBarChartTitleTextStyle(&quot;Thu&quot;);<br>          case 5:<br>            return _doBarChartTitleTextStyle(&quot;Fri&quot;);<br>          default:<br>            return _doBarChartTitleTextStyle(&quot;Sat&quot;);<br>        }<br>      },<br>    ),<br>  ),<br>)</pre><p><strong>Explanation:</strong></p><p>The rightTitles and topTitles properties are set to SideTitles(showTitles: false), disabling the titles for the right and top axes.</p><p>The bottomTitles property enables titles for the X-axis (showTitles: true) and uses getTitlesWidget to customize the text displayed for each X-axis value.</p><p>The getTitlesWidget method takes a callback function as a parameter with two arguments:</p><p>1. value: This represents the current X-axis value. Using this value, the corresponding title for each X-axis position is configured.<br>2. metadata: This provides additional details about the axis value (commonly used for advanced customizations).</p><p>After doing all these customizations, our bar chart will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*j5L8uy65c1lvY8MHzoPIag.png" /></figure><p>Full code link: <a href="https://github.com/arikaran-13/expenso_app/blob/master/lib/components/bar_chart_demo.dart">bar_chart_demo</a></p><p>Thank you for reading 🙂 I hope this helps with your Flutter project. If you found it useful, share it or leave your thoughts below. Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=081af52f808c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Form Validation in Flutter: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@arikaran1302/form-validation-in-flutter-a-step-by-step-guide-3449f705eaca?source=rss-a9d93c267863------2</link>
            <guid isPermaLink="false">https://medium.com/p/3449f705eaca</guid>
            <category><![CDATA[flutter-form]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-form-validation]]></category>
            <category><![CDATA[flutter-for-web]]></category>
            <category><![CDATA[flutter-for-beginner]]></category>
            <dc:creator><![CDATA[Arikaran S]]></dc:creator>
            <pubDate>Thu, 26 Dec 2024 15:46:27 GMT</pubDate>
            <atom:updated>2024-12-26T16:27:40.724Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Form that contains some invalid input" src="https://cdn-images-1.medium.com/max/540/1*v0UdK6wDfbXGoSWyfcwjOQ.png" /></figure><p>Forms are essential for collecting user data. Providing immediate feedback with form validation helps users correct errors before submission, enhancing the overall user experience.</p><p>In this example, I’ll demonstrate how to perform validation in a `Form` widget in Flutter. I will cover the following steps:</p><p>1. Create a form with a `GlobalKey`.<br>2. Add a `TextFormField` to capture user input.<br>3. Create a submit button to validate the data and proceed further.</p><p><strong>Step 1: Create a Form with a `GlobalKey`</strong></p><p>Start by creating a `Form` widget and associating it with a unique `GlobalKey` to manage its state.</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>class FormValidationExample extends StatefulWidget {<br>  const FormValidationExample({super.key});<br><br>  @override<br>  State&lt;FormValidationExample&gt; createState() =&gt; _FormValidationExampleState();<br>}<br><br>class _FormValidationExampleState extends State&lt;FormValidationExample&gt; {<br>  final formGlobalKey = GlobalKey&lt;FormState&gt;();<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: Form(<br>        key: formGlobalKey,<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center, // Center content vertically<br>          children: [],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p><strong>Step 2: Add a `TextFormField</strong></p><p>Add the `TextFormField` widget to allow users to input data.</p><pre>TextFormField(<br>  decoration: const InputDecoration(<br>    hintText: &quot;Username&quot;,<br>  ),<br>  validator: (val) {<br>    if (val == null || val.isEmpty) {<br>      return &quot;Username is required&quot;;<br>    }<br>    return null;<br>  },<br>),</pre><p>The validator property takes a function as its value, and the parameter of that function is the user-entered input. Using this, you can implement custom validation logic.</p><p><strong>Step 3: Create a Submit Button to Validate Data</strong></p><p>Add an `ElevatedButton` to validate the form and proceed based on the input.</p><pre>ElevatedButton(<br>  onPressed: () {<br>    if (formGlobalKey.currentState!.validate()) {<br>      // If the form is valid, proceed with the save logic<br>      print(&quot;Save the data&quot;);<br>    }<br>  },<br>  child: const Text(&quot;Submit&quot;),<br>)</pre><p>When the user clicks the button, the onPressed function is called. It retrieves the current state of the form using the unique form key, formGlobalKey. This triggers all the validator functions. If everything is valid, the method returns true; otherwise, the form reloads and displays the corresponding error messages.</p><p>Thank you for reading 🙂 I hope this helps with your Flutter form validation. If you found it useful, share it or leave your thoughts below. Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3449f705eaca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>