<?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 Karan Verma on Medium]]></title>
        <description><![CDATA[Stories by Karan Verma on Medium]]></description>
        <link>https://medium.com/@hydroweaver?source=rss-c3e410fbc111------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4SQU_ZOrr3FKWq23.</url>
            <title>Stories by Karan Verma on Medium</title>
            <link>https://medium.com/@hydroweaver?source=rss-c3e410fbc111------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:46:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hydroweaver/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[Passing the driving exam in Belgium]]></title>
            <link>https://medium.com/@hydroweaver/passing-the-driving-exam-in-belgium-58b03d961bca?source=rss-c3e410fbc111------2</link>
            <guid isPermaLink="false">https://medium.com/p/58b03d961bca</guid>
            <dc:creator><![CDATA[Karan Verma]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 07:36:12 GMT</pubDate>
            <atom:updated>2024-03-05T16:06:18.930Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IfcNx6xUg4cR48nN" /><figcaption>Photo by <a href="https://unsplash.com/@feliixlam?utm_source=medium&amp;utm_medium=referral">Félix Lam</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I know the image might look a little over-dramatic, but that’s what it feels like after passing the driving exam. It’s a journey with its own highs and lows, frustrations and small wins, constant disappointments and a big win, persistent worry, and a bunch of feeling which I thought I’d not experience ever since I took my last exam (and that was probably 13 years ago). I’d like to take you through my journey and hope it will help you in some way.</p><h3>Background</h3><p>I moved to Brussels from Bengaluru, India in March 2023. While the move itself is a massive undertaking, combining that with a new job and new baby, I didn’t realise there is a silent juggernaut still waiting — <strong><em>The driving license</em></strong>!<strong><em> </em></strong>I assumed it would be a straightforward series of tests — theory and a practical and that should be it! Given that I’d been driving in India since 2005, I didn’t give it much thought and assumed we’ll cross the bridge when we get there without a lot of fuss.</p><p><strong>I was wrong!</strong></p><p>If it weren’t for my good friends at office, I would have never started in the first place. I didn’t internalise the ‘<em>start planning in advance’ </em>way of doing things until I got on the <em>prepare, book test, get dates</em>… treadmill. And a treadmill it is.</p><h3>Timeline</h3><p>Here’s a timeline of all the major and minor milestones that I went through, I’ve included everything I did, as far as I remember.</p><figure><img alt="Link here: https://docs.google.com/spreadsheets/d/1lO61B8GCOD10mmz8QTeI-uEIlCLzT8nE1MdctF_7Q6w/edit?usp=sharing" src="https://cdn-images-1.medium.com/max/1024/1*_qknv2m9AI2HUnwHOrhLGg.png" /><figcaption><a href="https://docs.google.com/spreadsheets/d/1lO61B8GCOD10mmz8QTeI-uEIlCLzT8nE1MdctF_7Q6w/edit?usp=sharing">https://docs.google.com/spreadsheets/d/1lO61B8GCOD10mmz8QTeI-uEIlCLzT8nE1MdctF_7Q6w/edit?usp=sharing</a></figcaption></figure><p><strong>GIST (Process I followed) → </strong><em>Get the date for theory exam, start preparing with the online sources, while doing this find the school, book your training slots in advance, train, apply for M36 so you can start your counter for minimum practice time, after finishing training, convert to M18, practice however you can (catch is, you won’t know the mistakes you are making if you drive alone! But it does give you a lot of confidence), plan for risk perception (not applicable in Flanders) and practical exam. Give the exam and be done with it!</em></p><p>In essence it took me nearly 200 days to get my license, if we count from the day I registered for the theory exam.</p><h3>A few pointers</h3><p>Start preparing as soon as possible, the inherent delays in the system, the preparation, <strong>while living your life</strong>, trying to balance everything, takes time. So kick it off if you can, but as you will see there are too many things happening, just one after the other till the end.</p><p>One key thing I found out despite having help from friends, colleagues and most importantly the WhatsApp group (<em>get yourself added to it</em>) is that while there is ton of information, you never see a consolidated view on anything. Maybe I’m adding to that pile as well, but anything helps I think.</p><p>You won’t get an easily digestible version from anyone, primarily because once you are over the hump, you tend to forget the smaller details and so I thought of putting this all down before I forget and second the finer lines you can only experience yourself.</p><p>Let’s go over each of these main phases without this becoming a ग्रंथ (a book)!</p><h3>Theory Exam</h3><p>Coming from India, the theory exam is a labyrinth of rules which you need to cram, and it’s for the better, as it will help you in the real world when you drive. There is some disconnect of course between theory and practice, but you will eventually retain the important parts.</p><ul><li><strong>Source of frustration</strong> — During the preparation a lot of times you might question WHY would a certain rule be the way it is and it might be not common nonsensical, but keep at it. Also, different people might have different explanations for the same thing, try and converge based to the explanation which makes most sense.</li><li><strong>Preparation — </strong>I mainly prepared for the tests (<a href="https://www.drivinglicence-belgium.be/theory/the-theory-exam">here</a>), going through the theory chapters on by one, taking the chapter wise test and then continuously taking the mock exams until the day of the exam. Some people claim to have been able to do it over a weekend, I’m not one of those, I took my time, I didn’t start passing the mock exams by studying over a weekend.</li><li><strong>Exam Day —</strong> It’s a computer based test with real images, as opposed to the still graphics that you see in the mock exam and training. Chill out, take a mock exam again before the test, listen to the translator carefully and then answer the questions on the screen.</li></ul><h3>Practical Training</h3><p>Finding the right school with dates that suit you takes a bit of time. More importantly you are trying to find a school which teaches in English. Sometimes the school near your residence might not be great, sometimes it could be! Some schools only book for a month in advance, while others book the schedule as long as they can and because of that you might not find free slots for months! But you can then pace yourself, don’t have to do everything at once. I went to the Tomberg branch of <a href="https://www.permisreussi.com/">this</a> school. They book students until the upcoming month, which is advantageous.</p><ul><li><strong>Source of frustration</strong> — I drove in India for almost 18 years before I came to Belgium. I’m 37 years old, trust me, I don’t like someone telling me, <strong><em>don’t do this, don’t do that, look here, there, why did you press the brakes?, why didn’t you look there? You are too close to the cars etc. etc. </em></strong>Your mind doesn’t want to accept someone correcting you, especially when you have a “pretty good” driver in India. (OK, we all know how driving is there, but still, I drove around without any problems). But regardless, because of this constant correction, your confidence might take a hit sometimes, you might doubt yourself and it doesn’t feel good. But you take this in the stride, you are learning something new, forget Indian roads, the way of driving, let it go and the ego would allow you to be easy and calm.</li><li><strong>Preparation<br></strong> — Red lights, pedestrians, cycle lanes, right priority, roundabouts, and all these things are talked about everywhere, so you will know about them amply anyway<br>— Focus on the road signs on your right, especially no entries, speeds, stop signs<br> — Keep looking in front, before you realise, a new sign would have already passed you<br> — Focus on the road signs on the road itself as well, the change lanes, bus lanes, trams, stop lines<br> — Remember major faults, such as blocking cycle path, crossing red lights, crossing a blocked railway track and others, not over running the curb<br> — Maintain speed, don’t go too slow as well<br> — One of the keys things that allow you to succeed is to familiarise with the roads, just like you would with your home town. Stops signs, no entries, the nooks and crannies, to the extent you can. The more you practice the more you learn, of course extra practice (<strong>when done alone after you are done with you 20/30 hours classes</strong>) does not tell you things which you cannot know. These are the things your instructor will prepare you for.<br> — Important manoeuvres — S parking (also known as parallel parking), front in parking, reverse parking, 3 point turn (U turn), reversing a car, stepping out of the car and coming in</li></ul><p>Every class is an opportunity to better yourself. You will see yourself getting better, remembering a lot of things which you might think you need to hold like a bag continuously.</p><h3>Risk Perception</h3><p>Intention with the risk perception test is to gauge your ability to perceive potential scenarios which might impact your speed, manoeuvring, and subsequent actions, so you keep everyone safe. As you might here it’s about <strong>defensive driving</strong>, constantly reducing the risk of any mishaps.</p><ul><li><strong>Source of frustration — </strong>There is no major source of frustration here actually. The practice videos on YouTube are good, they give you a sense of what you will see. Of course, depending upon your location the actual exam screen might be different.</li><li><strong>Preparation — </strong>Go through the videos, understand what you missed, it’s essentially a memory game, remember <strong>MAJOR</strong> things which you saw in the video, so you can answer the questions in the end. It’s important to know that you can have either 1, 2 or 3 correct responses to a question.</li><li><strong>Exam Day — </strong>Relax, you will have the translator with you (in Brussels), although in Flanders (<a href="https://www.google.com/maps/place/Asse/@50.9090391,4.1376673,12z/data=!3m1!4b1!4m6!3m5!1s0x47c3bf914363bb71:0x6c5d92527be215ee!8m2!3d50.9106775!4d4.2003858!16zL20vMDE0cTZq?entry=ttu">Asse</a> is where I took the test) you have headphones which translate. Look at the what’s in front, what’s in the rear view mirror, side mirror and what’s happening further away from you, on your left, right. Check for pedestrians, cyclists, cars opening gates, cars parking, overtaking. This is something you already do when you drive on a daily basis, the only difference is that now it’s presented to you as a test. Also remember in Brussels, failing this test means you essentially fail one attempt of the practical test. In Flanders, risk perception is done before the practical exam every time.</li></ul><h3>Red Cross Training</h3><p>The red cross training is thankfully a breeze, although the online training is not in English, so you might want to use inbuilt translator in the browser. All of that is done <a href="https://pser.brussels/">here</a>, including the booking for the on site training. On the training day, you will learn about CPR, safety and care during collisions. It’s not in English, but you can follow it, the instructors were nice enough to clarify things I didn’t understand.</p><h3>Desperation</h3><p>Regardless of the superb infrastructure, a car is almost like a right. It gives you freedom of mobility, freedom to go wherever you want, whenever you want, it’s your own personal space on the road. I’d rather have a car and not drive it, than not have it at all. It’s like having money in your wallet, you don’t have to spend it, but having it, keeps your mind at rest.</p><p>So, by the time I completed by the red cross training, it was Jan 2024, almost 6 months already in, plus after taking while driving with a few folks I know, I came to realise that I’m making too many mistakes. Not that I can’t drive, <strong>but mistakes which will fail you in the practical exam.</strong></p><p>I wanted to the whole project to end, so the first thing I did was ask my driving school for dates for practical exam. Approaching driving school for practical dates is always convenient, as they can manage the appointments, translator’s schedule at the same time. However in my case the dates I was getting were just 2 weeks in advance and I wasn’t confident I would pass as I thought I needed a lot more practice.</p><p>I kept delaying the process of booking an exam with the school and for some reason went out of touch with them. Later (foolishly) I went to the exam centre in Evere myself and booked a date which I got in April (this was in January)!</p><p>Just between a rock and hard place! Should I take an exam which 2 weeks from now and fail (most likely) or take something 3 months from now and continue with this anxiety in my head?</p><p>Well, during that time I registered with the school in Asse, link <a href="http://www.rijschoolheymans.be/">here</a> and they got me a date in Feb itself. I had to register for some classes there as well, as it’s a new place and every location has its quirks, so better to practice in a new place.</p><h4>Thoughts about buying a car</h4><p>During the same time, I was using Cambio for practice. The problem with Cambio is that they don’t have practice cars in Brussels. Which means you will have to go to a location in Flanders (Mechlen, Leuven) most likely, drive the car to where you want to practice, practice and then drive it back to the pick up location <strong>AND THEN</strong> catch a train back home. It looked like the map below and every time it’s about a 5-6 hour commitment, assuming you will take 2 hours to practice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*gvIb0s3OgQ4xZaeelRqkwA.png" /></figure><p>And to avoid this, I also started thinking about buying a second hand car. I spent countless hours on all the websites, and not in the least constantly thinking about the extra money I will spend. And of course owning a car (second hand or not) is not easy, then you need to sell it.</p><p>In the end I didn’t get anything, I felt the cost / benefit was not worth it, and this cost is not just money, but money, time and the <strong>hassle</strong>! This is where you internalise the money / time dependency, same as energy and mass 😂</p><h3>First Attempt</h3><p>My first attempt was booked for 21st Feb in Asse. Although I was confident to an extent, I failed! Reasons:</p><ul><li>Drove on to a bus lane ← first mistake</li><li>Drove into a no entry ← because of the pressure of the first mistake I made another, my presence of mind was already gone</li><li>Although I passed my risk perception with 8/10 score</li></ul><p>Failing the exam is quite a disappointment! Even though you hear it from so many people, but failing yourself is hard and it takes a toll. You need to practice again, see why you made those mistakes, improve, and then wait for the next slot.</p><p>My instructor rightfully told me that I failed because of absolutely foolish preventable mistakes. But yeah, that’s how it goes…when you are under pressure you make mistakes, small or big doesn’t matter. It doesn’t feel good to fail at all. I wasted that day completely and couldn’t focus on anything.</p><h3>Second Attempt</h3><p>Thankfully for me, with my driving school I got the second chance within a week! So my next attempt was 28th Feb 2024. My translator in both cases was pretty cool and helped me focus and keep calm.</p><p>Key points of advise (and you will read from a lot of other folks who did it, and thanks to them indeed):</p><ul><li>Keep calm — really, keep calm</li><li>Show initiative that you are in control of the car</li><li>Do you own thing, little mistakes can happen, but correct and move on</li><li>Remember major things while you practised</li><li>Always check your exists, if no directions are given, be even more vigilant</li></ul><p>Items I kept on the top my mind:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fEv-ox6iM6K9HPt-q8K9qw.jpeg" /></figure><h4>Success at last</h4><p>Thankfully I passed this time, I couldn’t contain myself and teared up a bit. The dam broke, the months of practice, frustrations, thinking back and forth etc. all swelled up!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5GPNRCHyTB6scsCi" /><figcaption>Photo by <a href="https://unsplash.com/@insolitus?utm_source=medium&amp;utm_medium=referral">Rowan Heuvel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>A Big thank you!</h3><p>I’d like to thank my dear colleagues and friends: Arul, Sheriden, Shreyas, Daniel, Prasanth, Prashant, Vijay, my dear neighbours and several more people from the WhatsApp group who really helped whenever I had a question. The WhatsApp group is indeed a godsend! Thank you to the creators of that group. Really!</p><p>And in no less intensity, my instructors Eric, Greg &amp; Hubert for teaching me the ropes, my wife and son who bore the brunt of my sad face every time I talked questioned if I will ever get a license!</p><h3>Key Links</h3><ul><li><a href="https://mobilite-mobiliteit.brussels/en/b-licence-training-and-test">https://mobilite-mobiliteit.brussels/en/b-licence-training-and-test</a></li><li><a href="https://www.autocontrole.be/nl/rijbewijs">https://www.autocontrole.be/nl/rijbewijs</a></li><li><a href="https://www.brussels.be/temporary-driving-licence">https://www.brussels.be/temporary-driving-licence</a></li><li><a href="https://www.cambio.be/en-vla/driving-lesson-car">https://www.cambio.be/en-vla/driving-lesson-car</a></li></ul><h3>To the reader</h3><p>If you are in the same boat as me, keep working through the struggle, I feel your exasperation, but rest assured you will eventually get there🚀🚀🚀</p><p><em>Sorry for any typos, grammar etc. 😉</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58b03d961bca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making a Flutter Todo App from Scratch Part 4]]></title>
            <link>https://medium.com/@hydroweaver/making-a-flutter-todo-app-from-scratch-part-4-414bb28eeec9?source=rss-c3e410fbc111------2</link>
            <guid isPermaLink="false">https://medium.com/p/414bb28eeec9</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[to-do-list-app]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Karan Verma]]></dc:creator>
            <pubDate>Tue, 26 May 2020 09:50:57 GMT</pubDate>
            <atom:updated>2020-05-27T05:43:42.958Z</atom:updated>
            <content:encoded><![CDATA[<p><em>CheckboxListTile </em><strong><em>Behave!</em></strong></p><h3>Checking the Checkboxes</h3><p><a href="https://medium.com/@hydroweaver/making-a-flutter-todo-app-from-scratch-part-3-9bb7f1cf00af"><strong>Last time</strong></a> we stopped short of making the check box list tiles do anything. In this post we’ll make the checkboxes interactive, so they make the some change to our todos. Our aim is to reach the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*Ib-tJ___PCsiHPyVKPlULQ.gif" /><figcaption>Responsive Check Boxes</figcaption></figure><h3><strong>Custom Widgets</strong></h3><p>There could be several ways to go about creating our todo list, however, the one that I followed was to use CheckboxListTiles. Now that’s well and good, but there would still be some tinkering required, before they work as we expect them. Here comes the need for custom widgets.</p><h4><strong>What are they?</strong></h4><p>Put simply, as a thumb rule, they can be used when:</p><ol><li>Widgets out of the box do not provide all the functionality you want, and you need to add / modify the behavior.</li><li>Or, you need to make something completely new, say like the <a href="https://pub.dev/packages/analog_clock"><strong>flutter clock widget</strong></a><strong>, </strong>which fortunately is not the case for us <a href="https://emojipedia.org/partying-face/">🥳</a></li></ol><p>So, for us, we only need a slight modification to our CheckboxListTiles.</p><h4><strong>Enter Text Widget</strong></h4><p>You have seen the Text widget, several times here, it’s quite simple and looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e42fadddbb6992c16eff7ff1358037d2/href">https://medium.com/media/e42fadddbb6992c16eff7ff1358037d2/href</a></iframe><p>For our purpose, if you recall from the <a href="https://levelup.gitconnected.com/making-a-flutter-todo-app-from-scratch-part-1-bd66608b1818"><strong>first post</strong></a>. We should be able to mark the <strong>todo as complete</strong>, and this essentially in normal UI terms would mean a <strong>strikethrough + italics + color change</strong> for the user to visually separate the todo as complete.</p><p>And to accomplish this, we need <strong>TEXT</strong> widgets to behave a little different. Remember, the text widgets we are referring to <strong><em>reside inside the CheckboxListTiles</em></strong>. So what we’re trying to do, should look something like the following:</p><p>When the todo is <strong><em>incomplete:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JdyT55U6lzDR3QrphYE-xQ.png" /><figcaption>Incomplete Todo, not checked</figcaption></figure><p>When the todo is <strong><em>complete:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P7lNCH0QEQ3tpfy0o2cMfw.png" /><figcaption>Complete Todo, checked</figcaption></figure><p>This goes without saying, that our existing <strong>reorderable list</strong> still works, i.e. we are able to change the <strong>TEXT widgets </strong>and also be able to move our Todos up and down based on priority or liking etc.</p><h4><strong>How do we go about making this custom widget behavior?</strong></h4><ol><li>We’ll create a new statelesswidget which can <strong>change</strong> a <strong>Text</strong> widget’s appearance when the checkbox is clicked.</li><li>This statelesswidget will basically return a modified <strong>Text </strong>widget inside the CheckboxListTile.</li><li>This is where the <strong>onChanged property </strong>of CheckboxListTile would be useful. It will redraw the entire skeleton to <strong>SHOW</strong> the changes.</li></ol><h4><strong>Defining our Custom Widget</strong></h4><p>This requires the use of a statelesswidget class, since all it does is, to pass the newly created widget to the <strong>STATE</strong> <strong>implementation </strong>class. Recall from the <a href="https://levelup.gitconnected.com/making-a-flutter-todo-app-from-scratch-part-2-47dadd3a0b96#3f42"><strong>second post</strong></a><strong> </strong>about these classes being static. What the class would do is as follows:</p><ol><li>If checkbox is checked (CHECKED == TRUE)</li></ol><ul><li><strong>change text color to red</strong></li><li><strong>italicize the text</strong></li><li><strong>strikethrough text</strong></li><li><strong>&amp; <em>RETURN THIS NEW TEXT WIDGET.</em></strong></li></ul><p>2. Else (CHECKED == FALSE)</p><ul><li><strong>DO NOTHING</strong></li><li><strong>&amp; <em>RETURN THIS UNCHANGED TEXT WIDGET.</em></strong></li></ul><p>Since flutter redraws the UI continuously in a very inexpensive manner, the <strong>setState</strong> draws the this quite fast. Let’s look at the code for this class. We’ll add this class after our <strong>main </strong>function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83a68dcfb119224ccbde7543e2710748/href">https://medium.com/media/83a68dcfb119224ccbde7543e2710748/href</a></iframe><p>To make more sense of the code above, take a look here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-xLxbDGj3ACjJppc4vSYw.png" /><figcaption>How the statelessWidget class works to get us changed TEXT Widgets</figcaption></figure><p>The class constructor takes two parameters:</p><ol><li><strong>Todo toggle value</strong> — where the the todo would be <strong>true </strong>or <strong>false</strong></li><li><strong>Todo text — </strong>the actual todo text</li></ol><p>The constructor taking these parameter really means, that when it is called, it will create <strong>a new _strikewidget object</strong> with the <strong>todo toggle</strong> and <strong>todo text</strong> values we pass to it.</p><p>This would make more sense, once we make a small modification to the <strong>FOR </strong>loop that serves the <strong>Todos</strong> to the UI. The list is just a bunch of ChecboxListTiles having some text and a checkbox, <strong>however now, </strong>we’ll replace the <strong>Title</strong> property of the ChecboxListTile with the <strong>new statelesswidget </strong>we just created, like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aec85967f0aeb24b60e9db6ca68174ba/href">https://medium.com/media/aec85967f0aeb24b60e9db6ca68174ba/href</a></iframe><p>This change would allow us to <strong>embed</strong> the new <strong>custom widget </strong>to the CheckboxListTiles we have instead of <strong>Text widgets </strong>we had previously. Simple! Let’s try and run this…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*ZrxKNL8yvrBYsAbht-kWxA.png" /><figcaption>NO CHANGE?!</figcaption></figure><p>No surprise, that nothing new works still! Why though?</p><ol><li><strong>OnChange</strong> callback is <strong>NULL, </strong>when this is null, the check boxes become inactive.</li><li>The <strong>value </strong>parameter is <strong>false, </strong>which means when Flutter builds, the UI, the checkboxes will be <strong>unchecked. </strong>Let’s try and make a change there to see what happens:</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4faac6284731b0ce84a213c8bb031181/href">https://medium.com/media/4faac6284731b0ce84a213c8bb031181/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*AjrqoXq5WM5OyTboHbxrIg.png" /><figcaption>Ah! the checkboxes are checked, BUT all are still inactive!</figcaption></figure><p>Well then, to make these checkboxes active, or rather <strong>to make them accept our tap event, </strong>let’s add a new variable which captures the <strong>Todo</strong> toggle. This value either be <strong>true (checked)</strong> or <strong>false (unchecked)</strong>.<strong> </strong>We can add this <strong>global</strong> variable after our items list, like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6bb3c243130c7f6d1ceb72170167d919/href">https://medium.com/media/6bb3c243130c7f6d1ceb72170167d919/href</a></iframe><p>Let’s make 3 changes to our <strong>CheckboxListTile </strong>code <a href="https://gist.github.com/hydroweaver/968e9806e595d2bbe21a4d053bfe74a7"><strong>here</strong></a><strong>:</strong></p><ol><li><strong>value </strong>parameter is set to <strong>toggle </strong>variable we just defined</li><li>Adding a <strong>callback function </strong>to <strong>onChanged</strong> event</li><li>Adding <strong>toggle </strong>to our <strong>_strikeThrough</strong> <strong>custom widget</strong></li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c3c27271d2771db468965612f65bc5a/href">https://medium.com/media/7c3c27271d2771db468965612f65bc5a/href</a></iframe><p>By making these 3 changes, we have enabled our</p><ul><li><strong>For </strong>loop to add <strong>CheckboxListTiles </strong>which can add <strong>custom widgets </strong>with <strong>toggle </strong>values <strong>which in turn</strong> change <strong>Text(todo)</strong> appearance.</li><li>Added small piece of conditional logic inside the <strong>onChanged</strong> event, which says, if <strong>unchecked</strong>, <strong>toggle </strong>would be <strong>false</strong>, else it would be <strong>true</strong>.</li><li>This itself triggers how the text appears in the <strong>CheckboxListTile Title</strong>.</li></ul><p>Let’s run this and see what happens…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*cq4YE2mCKAMSBUByV2KlEA.gif" /><figcaption>Looks like the toggle is not working as expected!</figcaption></figure><p>Let’s try and make sense of this with a figure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgxzKE-uko6i5LU0D-znXA.png" /><figcaption>toggle is toggle for all todos</figcaption></figure><p>The functionality is straight forward:</p><ol><li>For loop calls each text item in our items list, which is a todo</li><li>Creates a CheckboxListTile with each item</li><li>Sets the title of the CheckboxListTile as the custom widget</li><li>Custom widget sets the appearance based on the toggle.</li></ol><p>So it seems that it’s working, except for one thing. As you can see, the <strong>toggle is a global variable</strong> which gets set for all the todos that we have!</p><p>This sets makes the toggle same for all the todos in our list and <strong>that </strong>we’ll cover in the next post.</p><p>You can find the latest code <a href="https://github.com/hydroweaver/medium_wip_todo"><strong>here</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=414bb28eeec9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making a Flutter Todo App from Scratch Part 3]]></title>
            <link>https://medium.com/@hydroweaver/making-a-flutter-todo-app-from-scratch-part-3-9bb7f1cf00af?source=rss-c3e410fbc111------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bb7f1cf00af</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[to-do-list-app]]></category>
            <dc:creator><![CDATA[Karan Verma]]></dc:creator>
            <pubDate>Sun, 24 May 2020 07:00:35 GMT</pubDate>
            <atom:updated>2020-05-27T18:21:39.688Z</atom:updated>
            <content:encoded><![CDATA[<h3>Checkbox List Tiles</h3><p>Last time we stopped <a href="https://levelup.gitconnected.com/making-a-flutter-todo-app-from-scratch-part-2-47dadd3a0b96"><strong>here</strong></a>. Apologies for the delay &amp; thanks to <a href="https://medium.com/@eventhorizonre">Event Horizon</a> for pushing me to complete this!<a href="https://emojipedia.org/folded-hands-light-skin-tone/">🙏🏻</a></p><p>So let’s move on and make our Todos look a little bit fancy looking:</p><ul><li>They should have a checkbox on the right side (it doesn’t have to do anything right now <a href="https://emojipedia.org/winking-face/">😉</a>)</li><li>This checkbox should be a toggle which can make them appear as done. (again, shouldn’t be doing anything right now)</li></ul><p>For this purpose we use check box list tiles. You can read about them <a href="https://api.flutter.dev/flutter/material/CheckboxListTile-class.html"><strong>here</strong></a>.</p><p>If you remember our <strong>ReorderableListView </strong>from the last article, you’d see that our TODOs are essentially a list of a quite simple <strong>TEXT </strong>widget and the code is as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ce44fbe35e458b64f57571e5161f205/href">https://medium.com/media/0ce44fbe35e458b64f57571e5161f205/href</a></iframe><p>And also, that the above text widgets lie inside a for loop like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fcf63c8cdd769f43b4ae1db84cf873c8/href">https://medium.com/media/fcf63c8cdd769f43b4ae1db84cf873c8/href</a></iframe><p>So if our idea is to replace, the text widget with a <strong>CheckboxListTile</strong>, all we have to do is <strong>replace the text widget with a CheckboxListTile</strong>. Simple!</p><p><strong><em>Except</em></strong>, to make our work easier, we will take the text box widget code inside the for loop and place it inside the <strong>CheckboxListTile’s <em>title </em></strong>section, as follows: (<strong>Remember, </strong>the title section itself only takes a <strong>WIDGET </strong>as parameter, which you’ll see in the gist below)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e9eb1491fa98747f23190c5e0989628/href">https://medium.com/media/1e9eb1491fa98747f23190c5e0989628/href</a></iframe><p>If the code above looks a little confusing, visualize it as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*Z5JINoMx9Rx9KLPNGRjFkw.png" /><figcaption>Embed Text Widget Inside CheckboxListTile Tree</figcaption></figure><p><strong><em>The Text widget is assigned to the Title parameter of CheckboxListTile.</em></strong></p><p>If it doesn’t make sense, don’t worry, once you make mistakes with IDE and read the documentation <strong>carefully</strong> this would make sense, just try and visualize it again and again, instead of reading the code, because the way I wrote it, it no doubt looks messy! <a href="https://emojipedia.org/downcast-face-with-sweat/">😓</a></p><p>Let’s look at other properties of <strong>CheckboxListTile </strong>which we need to focus on:</p><ol><li><strong>Value</strong> — This allows us to toggle the checkmark</li><li><strong>onChanged — </strong>This is the function called when the <strong>Value </strong>mentioned in point 1 changes, or what to call when a toggle is checked. As you can imagine, we’re looking at including some logic which changes text color or style when a <strong>TODO is toggled.</strong> Like say, it changes to red &amp; strike-through when we think it’s done etc.</li><li>Don’t worry about the rest right now :).</li></ol><p>So, how does our dumb++ app look now?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*SqWyiyHXAJ6IKXr-JZWUcA.gif" /><figcaption>Todo App with CheckboxListTiles</figcaption></figure><p>Hope you liked this one, let’s cover how to make those toggles work in the next post! <a href="https://emojipedia.org/clinking-beer-mugs/">🍻</a></p><p>You can access the code <a href="https://github.com/hydroweaver/medium_wip_todo"><strong>here</strong></a>.</p><h4>Access the next post <a href="https://link.medium.com/5x8luMDRP6">here</a>.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bb7f1cf00af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making a Flutter Todo App from Scratch Part 2]]></title>
            <link>https://levelup.gitconnected.com/making-a-flutter-todo-app-from-scratch-part-2-47dadd3a0b96?source=rss-c3e410fbc111------2</link>
            <guid isPermaLink="false">https://medium.com/p/47dadd3a0b96</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Karan Verma]]></dc:creator>
            <pubDate>Mon, 06 Jan 2020 14:51:13 GMT</pubDate>
            <atom:updated>2020-05-24T08:25:10.586Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understanding states in Flutter</h4><h3>States</h3><p>Moving forward from the <a href="https://medium.com/@hydroweaver/making-a-flutter-todo-app-from-scratch-part-1-bd66608b1818?"><strong>dumb app</strong></a> we made last time, let’s understand states in Flutter. When your app does something which needs a change in the UI, the state is changed. State documentation is <a href="https://flutter.dev/docs/development/data-and-backend/state-mgmt/intro">here</a>. Let&#39;s look at some of the following examples which trigger a state change:</p><ol><li>Toggle a todo as done / not done, can change the state of the app.</li><li>Adding a new Todo from the text bar</li><li>Deleting a todo</li><li>Editing a Todo</li><li>...Any change that requires a change in visual appearance.</li></ol><p>Let’s put this in the app and our goal would be to <strong><em>actually make the ro-orderable list items stick to their new position. </em></strong>As you can imagine, a simple change, from one position to another, is really a state change.</p><p>To embed states in our app, we need to change the code a little bit.</p><ul><li>The first thing is to change our app to <strong>StatefulWidget </strong>class which means it would be a Widget whose state can change, not like <strong>StatelessWidget</strong> which is essentially static.</li><li>Create another class which holds the implementation of the <strong>StatefulWidget </strong>class defined in point 1.</li></ul><p>Now it does look confusing, but it will make sense soon. Here is our new class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fff6c052222286df691523edb81c749/href">https://medium.com/media/1fff6c052222286df691523edb81c749/href</a></iframe><p>Here is the new class which now holds the implementation we added last time, notice there is only <strong>ONE </strong>change in code, but the app works the same way, i.e. <strong>the dumb way! </strong>😉</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de4ddb68ad50ed7bc67b439163551507/href">https://medium.com/media/de4ddb68ad50ed7bc67b439163551507/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*GdCVxeBKCcP_TiHQN6YUlw.gif" /><figcaption>Reorder not implemented, still dumb</figcaption></figure><p>Notice the first line in the gist above?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/614e360dadda8bb9433a3ae568ddef6b/href">https://medium.com/media/614e360dadda8bb9433a3ae568ddef6b/href</a></iframe><p>The new class holds the innards of the state <strong><em>‘implementation’ </em></strong>of the class which we worked on last time, but nothing else has changed. I’ve quoted the word implementation because as you see there is no other difference. The real difference will come from the <strong>OnReorder </strong>function which resides in the implementation. Let’s add some code to that.</p><h3><strong>OnReorder</strong></h3><p>The idea of a re-orderable list is to be able to move the children widgets here and there, which is to say, in our app lingo, move the todos here and there. So the idea behind the movement is simple:</p><ol><li>When a user long presses a todo, the app should <strong>remove </strong>the todo from its existing Index and hold it in a temporary location (or memory).</li><li>When the user holds and inserts the hovering todo in a new Index, the app should <strong>insert</strong> the todo in the new location (or memory).</li><li>When the switch happens, the UI should update and the user should be able to see the change.</li></ol><h3><strong>setState()</strong></h3><p>This is where a new kid on the block for this article comes in, the <strong>setState()</strong> function. This function is tells the framework to re-draw the screen to show the new state.</p><p>This function only appears inside the state implementation, or the new class that we defined and is like any other function generally, except it triggers a rebuild along with whatever definition you put in it.</p><p>In our case, the <strong>OnReorder </strong>function should call the setState() function to move the todos around. Do remember, <strong>OnReorder </strong>is a required parameter of <strong>Reorderable lists. </strong>Here is the new <strong>OnReorder </strong>call:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d87aa2d1987c8ae560a280826d06764/href">https://medium.com/media/4d87aa2d1987c8ae560a280826d06764/href</a></iframe><p>Now, putting it all together, we get the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f6259850e31a6ba55d3bb866803e1cc9/href">https://medium.com/media/f6259850e31a6ba55d3bb866803e1cc9/href</a></iframe><p>And here’s our <strong><em>non-dumb re orderable list:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*5Nkw5eoZaKkQAY1-tRXxlg.gif" /><figcaption>Here we go!</figcaption></figure><p>Here’s the code to the latest <a href="https://github.com/hydroweaver/flutter_simple_todo"><strong>repo</strong></a>.</p><p>Check out the next post <a href="https://medium.com/@hydroweaver/making-a-flutter-todo-app-from-scratch-part-3-9bb7f1cf00af"><strong>here</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47dadd3a0b96" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/making-a-flutter-todo-app-from-scratch-part-2-47dadd3a0b96">Making a Flutter Todo App from Scratch Part 2</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making a Flutter Todo App from Scratch Part 1]]></title>
            <link>https://levelup.gitconnected.com/making-a-flutter-todo-app-from-scratch-part-1-bd66608b1818?source=rss-c3e410fbc111------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd66608b1818</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Karan Verma]]></dc:creator>
            <pubDate>Thu, 02 Jan 2020 10:28:45 GMT</pubDate>
            <atom:updated>2020-01-10T11:16:06.199Z</atom:updated>
            <content:encoded><![CDATA[<p>Link to <a href="https://medium.com/@hydroweaver/making-a-flutter-todo-app-from-scratch-part-2-47dadd3a0b96"><strong><em>Part 2</em></strong></a>.</p><p>I recently started using flutter after years of telling myself that one day I’ll start making mobile apps! Well, I finally made one, although it’s just a todo app 😅, here’s a quick peek.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*Y9UPVkWARQZIvsnuLhbdvw.gif" /></figure><p>The primary motivation came from <a href="https://www.youtube.com/channel/UCWr0mx597DnSGLFk1WfvSkQ"><strong>Kalle Hallden’s</strong></a> YouTube channel, and from there I went to the flutter website to try it. I’ve tried android development before, but was never able to really push the boundary of tutorials to make something workable. I found it faster to build in flutter for some reason.</p><p>As you’ll see, it’s not just a <strong><em>single </em></strong>file, but a bunch of files that flutter generates for you to work and produce your output (an app in this case). You don’t have to worry about all the verbosity, just write your code in the main file and go from there. Let’s cover some basic steps in this post.</p><h3><strong>Background for Flutter</strong></h3><ol><li><a href="https://dart.dev/">Dart programming language</a> — they say it’s easier if you know Java or any object oriented language, but I don’t know Java, I can only write <strong><em>public static void main </em></strong>😆. However I do know variables and classes and all the usual stuff that a language offers, so the <a href="https://dart.dev/guides/language/language-tour"><strong>dart language tour</strong></a> and <a href="https://flutter.dev/docs/codelabs"><strong>flutter codelabs</strong></a> will help you to pick up what you need, rest you can discard if it’s not needed, learn it <strong>lazily</strong>.</li><li>Android Studio / Visual Studio Code — this is where you write your dart code to make those cool apps!</li><li>That’s it! Let’s get cracking… Let’s try and make the initial skeleton in this post, regardless of how good / bad it looks, let’s just make operational.</li></ol><h3><strong>Architecture of the Todo App</strong></h3><ol><li>If you have seen any flutter videos or tutorials, you will not miss hearing <strong>“in flutter everything is a widget”, </strong>well that’s very true, but it does not help a programmer who is just starting from scratch. To a beginner it sounds as if you can align a bunch of widgets and the app would work on its own. There is always the boilerplate code which forms the structure of the app, the loops, the conditions, classes, states, etc. I went through the phase of thinking <strong>“if everything is widget, why don’t I understand this”!!.</strong></li><li>But what is a Widget, you might ask? Look at the following GIF, they are really programmatic containers (boxes of code) of different kinds which do some special task. And the best thing, as point 1 says, is you can nest them in one another to make incrementally new stuff, our Todo app (see image below) is essentially nested widgets, don’t worry about the name of widgets, we’ll cover that later, what you are seeing is a <strong><em>widget inside a widget inside a widget inside a widget</em></strong>! No one tells you that in any of the tutorials, it’s all this high-sounding stuff that you don’t want / need to know, when starting out.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KOzOw4Ebx2FyvMn2rG84lA.jpeg" /><figcaption>Widget inside a widget inside a widget inside a widget!</figcaption></figure><h3><strong>Todo User Story</strong></h3><p>As a relatively simple Todo app, we are trying to achieve the following, this is our <strong>user story</strong>, and this take a lot of influence from <a href="https://watchandcode.com/"><strong>Watch &amp; Code</strong></a><strong>.</strong> Note, there is no sequence in which we’ll make this app and there’d be a lot of better and efficient ways of making this, but this is how I understood it.</p><ul><li>I should be able to add a Todo</li><li>I should be able to delete a Todo</li><li>I should be able to edit a Todo</li><li>I should be able to mark a Todo as complete</li><li>I should be able to prioritize my Todo (move them up or down)</li></ul><h3><strong>IDE Setup (on Windows using Visual Studio Code)</strong></h3><ol><li>Download and setup flutter as per Google’s <a href="https://flutter.dev/docs/get-started/install/windows"><strong>flutter page</strong></a>.</li><li>Make sure you run flutter doctor as the page suggests, this will help you resolve any problems with installation.</li><li>You don’t need to install Android Studio, you can work just fine with <a href="https://code.visualstudio.com/download"><strong>Visual Studio Code</strong></a>. However if you need to you, you’ll have to follow the Android installation guidelines which are also on the same page.</li><li>Install flutter and dart extensions for VS Code, just get Dart and Flutter in the screenshot below.</li><li>If you just want to run the app and see for yourself, the code is <a href="https://github.com/hydroweaver/flutter_simple_todo"><strong>here</strong></a>. Just pull it using GIT and run in VS code or Android Studio.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*38om3_EgPElnQkhNkMlZIw.jpeg" /><figcaption>Only install Dart &amp; Flutter as seen above</figcaption></figure><h3>Let’s Code</h3><p>Once you have the IDE setup, we can create a new project.</p><p>In VS Code press <strong>Ctrl + Shift + P</strong> and you’ll see a drop appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*2249psJE0UW4a0hiV-ZHNA.jpeg" /></figure><p>Select new flutter project and give it an understandable name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*8r8A48jKWGTEnwEyN4yr1Q.jpeg" /></figure><p>Let VS code do it’s magic and setup everything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sHpIt03c8cABNtySUccJww.jpeg" /><figcaption>VS code will create several files and folder for you, let it run wild.</figcaption></figure><p>Oh and also, during debug and run, you’ll to install an emulator, which is like a dummy phone app on your system on which you would run all your apps and make your laptop cooling pad go crazy!</p><p>Now when you have everything setup, go ahead and delete the test folder and also delete all code in the main.dart file, we’re going to write our own stuff here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*U_TNycgp7GURvRL0LJLrqg.jpeg" /><figcaption>Delete test folder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*vUz1cAFDxHv6jzKMxYLtIw.jpeg" /><figcaption>Delete all code in main.dart file, we’ll write our own</figcaption></figure><h3><strong>Put useful code in main.dart file</strong></h3><p>Dart uses the main function as the entry point, and once you are inside it, you need to use <strong>runApp() </strong>function which itself calls the <strong>MaterialApp()</strong> class constructor.</p><pre>void main(){<br>    runApp(MaterialApp(<br>          title: &quot;Todo App with Re-orderable Lists &amp; Swipe Cards&quot;, <br>          home: App(),<br>     ));}</pre><p>Now what does this mean? It means, if we were talking to the compiler : <strong><em>“when the main program starts, please run my material design widget whose name is App() and whose title is “Todo App with…””</em></strong>.</p><p>Let’s define this widget…which is basically a class / a container / a program box / call it whatever you want, but it’s a dumping ground for all code.</p><pre>class App extends StatelessWidget{<br>}</pre><p>So at this point, there are two things you should understand:</p><ol><li>The <strong>App() </strong>that you are trying to make is a statelessWidget</li><li>Don’t worry about what a StatelessWidget is at this point.</li></ol><p>So, it looks like an empty class which does nothing at this point, and it won’t even display anything, because it won’t run.</p><p>So we add some more code:</p><pre>class App extends StatelessWidget{<br><br>    Widget build(BuildContext context){<br>    }</pre><pre>}</pre><p>We used the <strong>@ override </strong>keyword to tell the program to use our class’s Widget, and not the super class’s (StatelessWidget) Widget. But that’s all I know. so moving on…</p><p>Next line talks about Widget build, which actually makes or creates the App in the user interface. All widgets needs a build method, as the name suggests, this method does the heavy lifting of making the UI changes of your app on the screen. Widgets are uniquely linked with something called elements and have a 1 — to — 1 relationship, you can know more about this from the flutter’s YouTube <a href="https://www.youtube.com/channel/UCwXdFgeE9KYzlDdR7TG9cMw"><strong>channel</strong></a>.</p><p>The BuildContext class is what holds the Widget’s <strong><em>spirit, </em></strong>so you’ll see in later examples, but we’ll just put it there, and let this flow.</p><h3><strong>What are we coding here?</strong></h3><p>We’re trying to make a half baked list which can be reordered. This list is what will hold our Todos in the end. If you notice the GIF in the starting, we’re able to move them up and down using the re-orderable list.</p><p>Moving on…let’s add a bar on top of the app, this is done by using a …guess…Widget! And this Widget is called a Scaffold.</p><pre>class App extends StatelessWidget{</pre><pre>    Widget build(BuildContext context){</pre><pre>        return Scaffold(</pre><pre>                appBar: AppBar(</pre><pre>                     title: Text(&quot;First Empty Half Baked App&quot;),</pre><pre>                 ),</pre><pre>         );</pre><pre>   }</pre><pre>}</pre><p>So we’re asking our Widget build method to inflate a Scaffold Widget into the screen (think of it as a balloon filling up a whole room). It’s used as a primary Widget which hold all other widgets inside it, you’ll see soon.</p><ol><li>Scaffold takes in several arguments, one of them being <strong>appBar</strong>, which is really the title bar you have on the top of lots of applications.</li><li>What do you think we should assign to an appBar? Guess again…</li><li>A Widget! The Laddie wants a Widget! So we give it one…and it’s name is, no prizes for guessing…AppBar() ! Ha!</li><li>AppBar() itself needs some arguments, one of them being title.</li><li>Title is the text you display on top of the app in a colored bar.</li><li>And then…to do that, we assign it, LO AND BEHOLD! Another Widget! OMG! Wat?</li><li>This Widget is a Text() Widget, don’t worry, no more nesting, we just put the text in quotes.</li><li>Look how <strong><em>easily </em>we got here…</strong></li></ol><p>Use <strong>F5</strong> to run the app, and you will see the following popup, if you have not created an emulator, create one now to compile and run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G4Wf2RiY-IoYERjcRjf_4g.jpeg" /><figcaption>Choose Pixel XL to run the app</figcaption></figure><p>The IDE will take sometime to build the app and display the emulator, so you can take a break and come back after a break ;-). And you should see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8bKd3MN-aSzVdFgFSO4dA.png" /></figure><p><strong>Let’s add a BODY to that face…</strong></p><p>So the next part, as you see in the image, is the body of the scaffold, we added the appbar already. The body again is like a playing area for manipulating programmable objects, lets add a list there, after all our todo app will be made out of textual todos.</p><pre>class App extends StatelessWidget{</pre><pre>    Widget build(BuildContext context){</pre><pre>        return Scaffold(</pre><pre>            appBar: AppBar(</pre><pre>                title: Text(&quot;First Empty Half Baked App&quot;),</pre><pre>),<br>            body: ReorderableListView(</pre><pre>              <br>            ),</pre><pre>        );</pre><pre>    }</pre><pre>}</pre><p>For this body to have something to display, we’ll initialize a list of strings. after the main program.</p><pre>List&lt;String&gt; items = [&quot;Item 1&quot;, &quot;Item 2&quot;, &quot;Item 3&quot;];</pre><p>So these strings would be displayed by the re-orderable list, which we will cover now.</p><p>If you <strong>hover </strong>your pointer over <strong>ReorderableListView(), </strong>you’ll see what it needs to run, one of the things it needs is a list of children and a OnReorder function. So let’s fill the children first:</p><pre>body: ReorderableListView(</pre><pre>    children: &lt;Widget&gt;[</pre><pre>        for(final value in items)</pre><pre>            Text(</pre><pre>                value,</pre><pre>                key: Key(value),</pre><pre>            )</pre><pre>    ],</pre><pre>),</pre><p><strong>Children</strong></p><p>You see, we created a <strong>For-In</strong> loop which loops over the string list we defined earlier. It takes the <strong>string </strong>from the list and embeds that into a <strong>TEXT WIDGET</strong>, which we used in the appBar to make our header.</p><p>The line <strong>children : &lt;Widget&gt; [] </strong>means we need to add Widget type children to the re-orderable list view.</p><p>As you see, Text() widget takes in one required parameter, which is the text, and here we pass the <strong>value</strong> from the loop as the string for it.</p><p>The second thing you notice is Key, which is like a unique identifier, this is not something required by Text, but required by ReorderableListView. It requires all it’s children to have a key.</p><p><strong>OnReorder</strong></p><p>This is something we will check in the posts later, so we just make it as a dummy function. Doing this will prevent us from getting into errors and help us run our app, since we cannot leave it missing.</p><pre>onReorder: (OldIndex, NewIndex){</pre><pre>},</pre><h3><strong>TADA!</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*q0UosooyuaGHxYiuW5r9Qw.gif" /></figure><p>That text looks very small, let’s make it larger…by adding a few lines in the Text widget. Text widget, you can use <strong>CTRL + space</strong> to see, style parameter.</p><p>We assign a textstyle class to it, as follows:</p><pre>style: TextStyle(</pre><pre>       fontSize: 22.0</pre><pre>),</pre><p>And here is the result…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Or5puogVKPD7Z5jX0i3hTQ.png" /><figcaption>Try and move the text portions by holding on to them, up and down.</figcaption></figure><h3><strong>Dumb Re-orderable List</strong></h3><p>So try and hold down any of the items to move them up and down and notice what they do. Not a lot, they move, but don’t stick to the new position, I think you might have an idea why that does not happen !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M05_OpTexnLcoqZf48UVgQ.gif" /></figure><p><strong>We’ll discuss states and how to make them stick to a new position in the next post. Until then enjoy.</strong></p><p>Link to <a href="https://medium.com/@hydroweaver/making-a-flutter-todo-app-from-scratch-part-2-47dadd3a0b96"><strong><em>Part 2</em></strong></a>.</p><p>Check out <a href="https://www.youtube.com/watch?v=3fB1mxOsqJE"><strong>WIDGET OF THE DAY</strong></a> post by google to understand more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd66608b1818" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/making-a-flutter-todo-app-from-scratch-part-1-bd66608b1818">Making a Flutter Todo App from Scratch Part 1</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>