<?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 Zamahsyari on Medium]]></title>
        <description><![CDATA[Stories by Zamahsyari on Medium]]></description>
        <link>https://medium.com/@zmachmobile?source=rss-c69b07d24725------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ghPwzTOfBMSqnO6Rl-lfRw.png</url>
            <title>Stories by Zamahsyari on Medium</title>
            <link>https://medium.com/@zmachmobile?source=rss-c69b07d24725------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:28:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zmachmobile/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[I Purchased Macbook Air M1 and I’m a bit Disappointed]]></title>
            <link>https://medium.com/@zmachmobile/i-purchased-macbook-air-m1-and-im-a-bit-disappointed-fec6550e1f2b?source=rss-c69b07d24725------2</link>
            <guid isPermaLink="false">https://medium.com/p/fec6550e1f2b</guid>
            <category><![CDATA[m1-mac]]></category>
            <category><![CDATA[apple-silicon]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[macbook-air]]></category>
            <category><![CDATA[review]]></category>
            <dc:creator><![CDATA[Zamahsyari]]></dc:creator>
            <pubDate>Tue, 01 Feb 2022 13:28:12 GMT</pubDate>
            <atom:updated>2022-02-01T13:28:12.128Z</atom:updated>
            <content:encoded><![CDATA[<h4>Here is my 6 months recap using a base model Macbook Air M1. Mostly great, but with one small issue.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Luh39tiILhyFUaO1CzZjwg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@arnav_arw?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Arnav Singhal</a> on <a href="https://unsplash.com/s/photos/macbook-air-m1?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>It’s been 6 months since I bought my Macbook Air M1. The reason was simply that my previous Macbook Air 2015 was as slow as snail and randomly crashed out of the blue. I’m a full-time backend developer with an occasional job as frontend developer as well as app developer, and sometimes become a graphic designer and video editor. I’m using a lot of tools to get the job done, namely Docker, Visual Studio Code, IntelliJ IDEA, Sublime Text, Sequel Ace, DBeaver, Postman, Figma, Vectornator, and DaVinci Resolve. Browser? Yes, mostly Chrome and Safari with 10 tabs opened. Sometimes I held a meeting while coding in VS Code.</p><p>Why did I purchase a base model? First, I need to know the limit of this infamous M1 chip to handle my workload. Second, 256 GB storage feels just right, while most of my files go to Google Drive or git repositories. Third, 8 GB RAM seems still acceptable to handle the moderate workload, moreover, the very-fast SSD will be served as a swap when memory is low. Fourth, it is the best bang for the buck, the 1000 USD that will outperform any higher price Intel or AMD configuration laptop. Leading performance per watt, Apple said.</p><h3>Here’s what I found</h3><p>I was right, it is lightning fast, everything feels snappy. 20 tabs Chrome? No problem. Held a meeting while debugging? Fine. Compiling Java code while browsing? Still fine. The M1 chip is awesome! Battery? Incredible, I could work all day without needing a single plug.</p><p>No fan, no worries, the CPU managed to sustain in 33–34 degrees Celcius most of the time in moderate usage. The display also makes a leap over my previous laptop: namely brighter, higher-res, wide color (P3) support, and True Tone support. The dimensions are also still fine for my portability.</p><p>Apple’s effort to enable Rosetta 2 translations seems to works just fine, by the time I write this, almost all of my apps already support the ARM x64 version. The only I missed is VirtualBox, Parallels might just work, but it is not free.</p><h3>But there’s a catch</h3><p>It won’t be an all-day laptop if you maxed out the CPU. Don’t get me wrong, the M1 chip can handle any task without being fully loaded, thus it saves energy (battery). But if it is for a very specific reason you need to max out the CPU, the battery will drain fast. I already tried to render a movie clip with DaVinci Resolve, it utilizes 100% of the CPU, thus the battery percentage level dropping rapidly.</p><p>Is 8 GB RAM enough? Not really. If I use it to debug my React or Node app, it will be okay. But if I open IntelliJ IDEA while debugging the Spring Boot app, and at the same time open DBeaver, I will suffer from lag. Tried to open Memory Activity in Activity Monitor, whoa, Swap Used already hit 3 GB with red memory pressure. Here I noticed when I had too much memory pressure, i.e. Swap Used more than 1 GB, the computer started to slow down. The fast-SSD, which is where swap is, doesn’t help after all. My solution? Restart!</p><h3>So, here’s my take</h3><p>Did I regret buying this base-model configuration? Nope. It is a great machine, I will be fine for most of my everyday tasks. Sure, I am a bit disappointed when debugging the Java app in IntelliJ IDEA. I have to use Java-based IDE, run Java app, and manage database in Java-based DB Manager. I am pretty sure you would have a similar experience when debugging using Android Studio plus running Android Emulator.</p><p>To sum up, if you are a web developer, an 8 GB RAM configuration is the bare minimum for you to work seamlessly. You will need more if you are an app developer, although coding while running emulators will be fine for a few hours, you will suffer for the next more hours, except you can manage your workflow like this: open IDE — write code — run emulator — maxed out memory — force quit all apps — repeat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fec6550e1f2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Require Another Project in Gradle]]></title>
            <link>https://medium.com/swlh/require-another-project-in-gradle-800212ea984d?source=rss-c69b07d24725------2</link>
            <guid isPermaLink="false">https://medium.com/p/800212ea984d</guid>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[jvm]]></category>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[multi-projects]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Zamahsyari]]></dc:creator>
            <pubDate>Sat, 14 Dec 2019 02:47:20 GMT</pubDate>
            <atom:updated>2019-12-15T16:09:00.343Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to configure a Gradle setup to be able to require another project as dependency? Whether you are Android dev, Java dev, Kotlin dev, or any JVM-based dev, it is not that hard to setup.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dC7Va-3Y7cIawcVt" /><figcaption>Photo by <a href="https://unsplash.com/@chantalgarnier?utm_source=medium&amp;utm_medium=referral">Chantal Garnier</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>What is the first thing in your mind when a bunch of people need to make an app that will works great?</p><p>Microservices! Splitting an app into smaller services, those people will be split into several teams, each team will responsible to for a service, each service is running independently, no more chaining errors, no more scalability issue, easy to maintain, sounds great!</p><p>Monorepo! Wait what is it? Sounds contradictory. Well, not really. As the name suggest, it is a monolithic repository, meaning one codebase for everything your company needed. Doesn’t end in monolithic app either. You can put multiple projects in one repository, you can include any module from another project within one repo, you can build any project independently and run as a single service, microservices again!</p><h4>E-Commerce Use Case</h4><p>Let say, we work in a e-commerce company, there are two separate divisions: customer division and inventory division, each division has two apps with their team already working on it, as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*yeBE9KUGiVNQOgRq4z_2Ew.png" /><figcaption>Team Organisation</figcaption></figure><h3>Getting Started</h3><h4>Create Directories</h4><p>How do we implement the case into code? We will make use of Gradle ability to combine multiple Java projects into one codebase. All you need is a Terminal, Gradle (installed on your computer’s path), and JDK, obviously. First, create some directories, as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*3vCBqAkxtDq-NDhXHWJIFA.png" /><figcaption>basic directory structure</figcaption></figure><h4>Initialize as Gradle Project</h4><p>Go to the root of the project, in this case “<em>e-commerce</em>”, run <strong>gradle init</strong>, while prompted, select all defaults.</p><pre>gradle init</pre><p>You will notice that it created few files for us:</p><ul><li>build.gradle</li><li>gradlew</li><li>gradlew.bat</li><li>settings.gradle</li></ul><h4>Include All Projects</h4><p>We need to include all of our projects in our <em>settings.gradle</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a7492645a6c92e2606d73fc5f6d66cd/href">https://medium.com/media/9a7492645a6c92e2606d73fc5f6d66cd/href</a></iframe><p>Go to our root of the project again, now run <strong>gradle projects.</strong></p><pre>gradle projects</pre><p>If your configuration is valid, you will receive “<em>BUILD SUCCESSFUL</em>” message as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*ou2493sKtSJKfudh1dGT3w.png" /><figcaption>successfully create projects</figcaption></figure><h3>The Common Module</h3><p>Someday in the morning, our CTO announces that every app should use company’s auth mechanism. We need to place auth class somewhere that any app can use, so we place it under e-commerce’s root module, next to customer and inventory division, we called it “common” module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*TGE93MlqGvOJNeA40mfxAw.png" /><figcaption>Modules of e-commerce</figcaption></figure><h4>Create Common Directory</h4><p>Under project’s root, create a common directory, so the root directory will be like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*p1l2Vt_Az2hz5u56SE_e8A.png" /><figcaption>added common directory</figcaption></figure><p>Now add “common” to our <em>settings.gradle</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7d7adbcf7c4f464694fda21d860c12f/href">https://medium.com/media/b7d7adbcf7c4f464694fda21d860c12f/href</a></iframe><p>Maybe you will notice, why including common in <em>settings.gradle</em> don’t use “:” symbol? It is because <em>common</em> sits exactly under <em>e-commerce</em> directory<em>, w</em>hile the other projects sit under <em>inventory</em> or <em>customer</em> directory.</p><p>Remember our directory structure :</p><ul><li>e-commerce — common</li><li>e-commerce — inventory — search</li><li>e-commerce — inventory — transaction</li><li>e-commerce — customer — chatbot</li><li>e-commerce — customer — refund</li></ul><p>Now validate our <em>settings.gradle</em> again</p><pre>gradle projects</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*sXVmhK6oTTKqP2klFs2h_w.png" /><figcaption>validate again</figcaption></figure><h4>Include Common in Projects</h4><p>From previous step, we know that now we have 5 projects (:chatbot, :common, :refund, :search, :transaction), it is time to include the common into our projects.</p><p>Now go to e-commerce — customer — chatbot, create new <em>build.gradle</em> file as follows. Do the same for refund, search, and transaction.</p><pre>plugins <strong>{<br>    </strong>id &#39;java&#39;<br><strong>}<br></strong>dependencies <strong>{<br>    </strong>implementation project(&quot;:common&quot;)<br><strong>}</strong></pre><p>Now validate our dependency in <em>build.gradle</em> by running command within chatbot directory.</p><pre>gradle dependencies</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*tUMmp3cLDGVAEhheK6jYfw.png" /><figcaption>checking dependencies</figcaption></figure><p>Great, we have successfully include <em>common</em> module, now run this command to make sure our configuration is correct.</p><pre>gradle check</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*1-aMAszdP81gbe429yQpnw.png" /><figcaption>error build</figcaption></figure><p>Oh no, what’s going on here :(</p><p>Gradle failed to find matching configuration of project common. So go to common directory, create these folder respectively : src — main — java — com — company — common.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*H6Rg0yDf1gtLG9O7vCtsqQ.png" /><figcaption>common directory structure</figcaption></figure><p>Create new <em>build.gradle </em>under common directory, as follows.</p><pre>plugins <strong>{<br>    </strong>id &#39;java&#39;<br><strong>}</strong></pre><p>Go to chatbot directory, again, run <strong>gradle check</strong></p><pre>gradle check</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*MQaH1kc0KqKSwDnj51USiQ.png" /><figcaption>successfully build</figcaption></figure><p>Good job! Then run <strong>gradle check</strong> on refund, search, and transaction to make sure we have successfully include our common module.</p><h3>Shared Module</h3><p>Actually every other module will have the ability to include another project’s module, not only “common”. For instance, refund module is able to include chatbot module in order to import User class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*u8MfsvXF6bpMx8ZOuLlXoQ.png" /><figcaption>shared module</figcaption></figure><p>Well, that would simply add another sweet line as we did for common module. This is the <em>build.gradle</em> for refund.</p><pre>plugins <strong>{<br>    </strong>id &#39;java&#39;<br><strong>}<br></strong>dependencies <strong>{<br>    </strong>implementation project(&quot;:common&quot;)<br>    implementation project(&quot;:chatbot&quot;)<br><strong>}</strong></pre><p>And this is the <em>build.gradle</em> for transaction.</p><pre>plugins <strong>{<br>    </strong>id &#39;java&#39;<br><strong>}<br></strong>dependencies <strong>{<br>    </strong>implementation project(&quot;:common&quot;)<br>    implementation project(&quot;:search&quot;)<br><strong>}</strong></pre><p>To make sure everything is correct, go to our root directory, run <strong>gradle check</strong> there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*j1w39SSN9bjzh7Plzvcepw.png" /><figcaption>successfully build, again!</figcaption></figure><p>Voila! Everything is perfect, now you can import classes from another project. You can find this project on Github : <a href="https://github.com/zamahsyari/gradle-dependency-tutorial">https://github.com/zamahsyari/gradle-dependency-tutorial</a>.</p><p>Hope you enjoy this tutorial and happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=800212ea984d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/require-another-project-in-gradle-800212ea984d">Require Another Project in Gradle</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Multi-Stage Build : Build from One Image, Copy to Another Image]]></title>
            <link>https://medium.com/better-programming/docker-multi-stage-build-build-from-one-image-copy-to-another-image-c76cdc62ba7e?source=rss-c69b07d24725------2</link>
            <guid isPermaLink="false">https://medium.com/p/c76cdc62ba7e</guid>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[vue]]></category>
            <dc:creator><![CDATA[Zamahsyari]]></dc:creator>
            <pubDate>Wed, 04 Sep 2019 06:47:31 GMT</pubDate>
            <atom:updated>2019-09-05T20:12:27.968Z</atom:updated>
            <content:encoded><![CDATA[<h3>Docker Multi-Stage Build</h3><h4>Build from one image, copy to another image</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*9LE68V2_nLQjRg3dAx54VA.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/Skitterphoto-324082/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=943245">Rudy and Peter Skitterians</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=943245">Pixabay</a></figcaption></figure><p>I want my server clean <em>now</em>. Why bother installing Node if it is just for building the app? In the end, Nginx takes care of the server-side.</p><p>If you’re lazy like me, this article is for you!</p><p>Gone are the days of installing everything on the server. What if you have 10 servers? 20 servers? 40 servers? Installing everything on the servers one by one is a <em>terrible </em>idea.</p><p>Nowadays all you have to do is make sure each server already has Docker and Git installed and you’re good to go! The goal is to deploy the latest code — all we have to do is git pull and docker-compose up. Neat!</p><p>We’ll compile <a href="https://vuejs.org/">Vue</a> project into static html and serve it with Nginx. First, you need to have Vue project— clone the hello world vue <a href="https://github.com/zamahsyari/vue-hello-world">here</a> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RqKz4sdh_UOwwbgtd6uskg.png" /><figcaption>hello world Vue</figcaption></figure><p>Next go into the <em>vue-hello-world</em> directory, create new two files and name them Dockerfile and docker-compose.yml. The idea is to use a multi-stage build in Dockerfile.</p><h4>Stage 1</h4><ul><li>Pull Node image</li><li>Copy current directory into Node image</li><li>Install project dependencies</li><li>Build project</li></ul><h4>Stage 2</h4><ul><li>Pull Nginx image</li><li>Copy built project folder from stage 1 to nginx</li></ul><pre>FROM node AS node<br>COPY . /root<br>WORKDIR /root<br>RUN npm install<br>RUN npm run build<br>RUN echo &#39;BUILD SUCCEEDED&#39;</pre><pre>FROM nginx:alpine<br>COPY --from=node /root/dist /usr/share/nginx/html<br>RUN echo &#39;ATTACHED TO NGINX&#39;</pre><p>In case you’re wondering, <em>npm run build </em>will create a new <em>dist directory </em>containing static html. This static html is what Nginx served.</p><p>Then, in <strong>docker-compose.yml</strong>, we need to write the config to build the image and open a specific port to open to the real world.</p><pre>version: &#39;3&#39;<br>services:<br>  app:<br>    build: .<br>    ports:<br>    - &quot;8181:80&quot;<br>    command: &#39;nginx -g &quot;daemon off;&quot;&#39;</pre><p>Done! Now we need to test it. Go to <em>vue-hello-world</em> directory and execute this command:</p><pre>docker-compose up</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*17HuDDp-oBhIuP5J6vd5rw.png" /><figcaption>Ready to serve</figcaption></figure><p>Docker will now build the image based on the Dockerfile script. Wait a few minutes and your app will be served on localhost:8181.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6o6-Ni7iSGyBw0cmAG8Vug.png" /><figcaption>localhost:8181</figcaption></figure><p>Finally, when one of your team members commits changes on repo and wants to deploy, all you have to do is git pull and docker-compose up.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c76cdc62ba7e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/docker-multi-stage-build-build-from-one-image-copy-to-another-image-c76cdc62ba7e">Docker Multi-Stage Build : Build from One Image, Copy to Another Image</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dead Simple Flutter’s BLoC Pattern]]></title>
            <link>https://medium.com/@zmachmobile/dead-simple-flutters-bloc-pattern-c05275c7fc4c?source=rss-c69b07d24725------2</link>
            <guid isPermaLink="false">https://medium.com/p/c05275c7fc4c</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[bloc-pattern]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Zamahsyari]]></dc:creator>
            <pubDate>Thu, 11 Jul 2019 15:09:46 GMT</pubDate>
            <atom:updated>2019-07-11T15:12:12.734Z</atom:updated>
            <content:encoded><![CDATA[<h3>Dead Simple Flutter BLoC Pattern</h3><h4>Minimal BLoC pattern sample tutorial</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pc81-MclE75DHkB6sP29oQ.jpeg" /></figure><p>So you already know what Flutter capable of, you are amused after creating single app with speed, and you add more code to your app. Bang! the code is so tangled, I can hardly recognize my own code, and I am desperately too lazy to debug. I want to refactor my code, but how? Is there anything I can do to make my code a bit human-readable, or at least coder-readable? Enter BLoC Pattern.</p><p>Simply speaking, BLoC patterns aims to separate UI and business logic. If you ever heard Model-View-Controller, Model-View-Presenter, and Model-View-ViewModel, yes BLoC is one of them. BLoC stands for <strong>B</strong>usiness <strong>Lo</strong>gic <strong>C</strong>omponents.</p><figure><img alt="UI &lt;-&gt; BLoC &lt;-&gt; Repository &lt;-&gt; Network Provider" src="https://cdn-images-1.medium.com/max/243/1*NPLcQqJ6LZyYV8oYzl6FVw.png" /><figcaption>BLoC diagram</figcaption></figure><p>UI is where we code our widgets, BLoC is where we put our app’s business logic, Repository is where store our methods to handle data, Network Provider is where we put our data-related methods.</p><p>BLoC pattern uses reactive programming, which means, UI will listen to the data stream. In other words, when the data changes, so does the UI. Why do we need this? In term of separation of concern, when we has one component handles the UI, one handles the business logic, one handles the data; when the data changes on data component, how do we tell the UI that it need to be changed too? Passing data between components back and forth? Big NO.</p><h4>What Are We Trying to Do?</h4><p>To make it easy to understand, we only need two components: UI and BLoC. We are going to make simple streaming text app, involving only two widgets : Text and TextField. When we are typing something on TextField, the Text widget automatically detect the changes on TextField, thus update the Text accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*pXbKMf8TkpK7VHUoNlq4Yg.gif" /><figcaption>final result</figcaption></figure><h4>Hang Tight, Start Your IDE Right Now</h4><p>We need RXDart to enable our reactive programming. You may already knew RXJava if you are Android Developer, yes this one is the same guy ✌🏻. Add rxdart dependency in your pubspec.yaml as such:</p><pre>dependencies:<br><strong>rxdart</strong>: <strong>^0.22.0</strong></pre><p>Then install it using :</p><pre>flutter pub get</pre><p>Now for the main codes. We will need three dart files:</p><ul><li>main.dart → our app entry point</li><li>home_ui.dart → UI component</li><li>home_bloc.dart → BLoC component</li></ul><p>Here is the code for main.dart. Simple, only one call to home_ui.dart.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c094d1c7553f1943908b037e860242c/href">https://medium.com/media/9c094d1c7553f1943908b037e860242c/href</a></iframe><p>Here is the code for the UI part.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc79fdc978c5423b301d8c5f4ff312ba/href">https://medium.com/media/bc79fdc978c5423b301d8c5f4ff312ba/href</a></iframe><p><strong>StreamBuilder</strong> is our widget to display data stream. You can see it streaming our BLoC component’s data (<em>message</em>). If our data is null, it will return empty <strong>Container</strong>, otherwise it will return <strong>Text</strong> displaying the data.</p><p><strong>TextField</strong> is the widget responsible for calling BLoC component to update the data, that’s why we put it on <strong>onChanged</strong> event.</p><p>Here is the code for our BLoC component:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2108d80047ffa66b28dfe3cc5f94ffd/href">https://medium.com/media/e2108d80047ffa66b28dfe3cc5f94ffd/href</a></iframe><p>We have 2 objects here: <strong>messageFetcher</strong> to store the data stream and <strong>message</strong> where we return the data stream from messageFetcher. Then, we have <strong>setMessage</strong> method to supply the data to messageFetcher.</p><p>That’s it, compile and run !</p><p>If this post is helpful, show your support by clicking 👏 a few times as many as you like.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c05275c7fc4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker for Laravel Development]]></title>
            <link>https://medium.com/@zmachmobile/docker-for-laravel-development-edaec89d8e5d?source=rss-c69b07d24725------2</link>
            <guid isPermaLink="false">https://medium.com/p/edaec89d8e5d</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel-5]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Zamahsyari]]></dc:creator>
            <pubDate>Fri, 22 Feb 2019 12:24:50 GMT</pubDate>
            <atom:updated>2019-02-22T12:56:05.914Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*p7HUVDWbktPhkX7YfqyRjQ.jpeg" /></figure><p>If you are PHP developer, chance you know Laravel are high. Laravel is one of the most popular PHP Framework today. Getting started with Laravel is easy, make sure you have meet all requirements, and composer create-project --prefer-dist laravel/laravel something .</p><p>But to meet all requirements is something else, if you are using Windows and XAMPP, it is hard to fulfil all the requirements, you have to manually install missing PHP extensions, or you are Mac person or Linux version, having installed different version of PHP, and the brand new Laravel version require you to upgrade your PHP into PHP 7.2, but you don’t want to mess with your old project that still running on PHP 5.4. What should you do?</p><p>I know, <a href="https://laravel.com/docs/5.7/homestead">install Laravel Homestead</a>, sounds perfect, right? Laravel Homestead powered by <a href="https://www.vagrantup.com/">Vagrant</a>, or virtual machine, so you just have to download Vagrant, download Laravel Homestead Vagrant box, run it, the VM is alive, there you go!</p><p>Yes, it will run, but I’d rather say it is overkill! You don’t have to emulate the whole machine to run just one project. You can actually share your computer resource to run your project, rather than you have to allocate some amount of your computer resource. Use <a href="https://docs.docker.com/engine/docker-overview/">Docker</a> instead !</p><h3>What will we do?</h3><p>If you haven’t already know Docker, think Docker like a smart virtual machine. Docker will create our development image (container) and run it like a virtual machine. Our container will contains OS, PHP, and Nginx.</p><h3>Building the Container</h3><p>First of all, we will make a script to provision our container, create a new file called <strong>Dockerfile</strong> in one of your folder e.g. <em>/home/yourname/dockerfiles</em>. Copy-paste the following script to your Dockerfile file. We will use Alpine Linux as our base image because of its small size (~5 MB, compared with ~80 MB as in ubuntu base image).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e095a24eacbbf6935572ce99d73f2e2/href">https://medium.com/media/5e095a24eacbbf6935572ce99d73f2e2/href</a></iframe><p>Then create a new file called <strong>default.conf </strong>in the same folder as our previous Dockerfile (<em>/home/yourname/dockerfiles)</em>, which it is the Nginx configuration for our Nginx server. Copy-paste the following config to your default.conf file. We will replace default Nginx configuration in our container with our Laravel Nginx configuration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86a34f406be85984c82a72fd13d5d77a/href">https://medium.com/media/86a34f406be85984c82a72fd13d5d77a/href</a></iframe><p>Make sure Docker is installed and running, then hit following command to create our container image, we named it <strong>homestead</strong></p><pre>cd /home/zmachmobile/dockerfiles<br><strong>docker build -t homestead .</strong></pre><p><em>*) Notice the dot (.) at the end of the command, dot represents current directory</em></p><p>Wait for a moment until the image creation completed. You can check the already created images with following command, you will see homestead images within the list.</p><pre>docker images</pre><h3>Install Laravel</h3><p>Install Laravel with Composer, make sure you already installed Composer in your computer.</p><pre>🎉 /home/yourname/projects<br>cd /home/yourname/projects<br><strong>composer create-project --prefer-dist laravel/laravel homestead</strong></pre><p>Wait until Laravel finished installing.</p><h3>Share Project Folder with Container</h3><p>Our container is finished, our environment is ready, yeaaay 🎉 . Now we are ready to code, but connect our newly created Laravel project to our container first. What we will do is as follow :</p><ol><li>Start homestead container</li><li>Open port 5000 in our computer, connect to port 80 in our container</li><li>Share our project folder (/home/yourname/projects/homestead) with our container’s default nginx project folder (/var/www/html)</li></ol><p>Hit your terminal with this command :</p><pre>docker run -d \<br>-p 5000:80 \<br>-v /home/yourname/projects/homestead:/var/www/html \<br>homestead</pre><p>Our container will run in background and now you can check <a href="http://localhost:5000.">http://localhost:5000.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NsHLue_S48keknPvA8SP3A.png" /><figcaption>Our container is live</figcaption></figure><h3>Start Making Changes</h3><p>You can now edit <strong>routes/web.php</strong>, change</p><pre>return view(‘welcome’); </pre><p>to</p><pre>return ‘Hello World’;</pre><p>Save changes and reload your web browser</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mZSOB1FZskHP1DLTQQ4IGQ.png" /></figure><p>Nice, now we are ready to develop !</p><p>If this post is helpful, show your support by clicking 👏 a few times as many as you like.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edaec89d8e5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rapid Mobile Development with Flutter]]></title>
            <link>https://medium.com/@zmachmobile/rapid-mobile-development-with-flutter-fb71a2310939?source=rss-c69b07d24725------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb71a2310939</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Zamahsyari]]></dc:creator>
            <pubDate>Fri, 08 Feb 2019 10:52:14 GMT</pubDate>
            <atom:updated>2019-02-22T12:56:43.027Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HfbRRZDYIvQR5ujUvdgpg.jpeg" /></figure><p>Flutter is now 1.0…yeay…but wait, what is flutter by the way? If you are mobile app developer, you ought to know this, why? Flutter will speed up your app development, seriously.</p><p>I came from web developer, then became android developer. I miss the day when building an app is just arranging components from top to bottom, save, refresh, repeat. Fortunately, Flutter comes with similar development pattern.</p><p><strong>One code base, two platforms</strong></p><p>It’s hard to deny that mobile app is getting more popularity nowadays, compared with in-browser app. But, to get dirty developing mobile app, you should now that mobile app runs above OS, and there are two major mobile OS : Android and iOS, develop for both platforms may sound challenging and interesting at the same time, but you will lose your time to learn both native language. Hmm…any clue? Yes, let’s use cross-platform mobile SDK.<br>Flutter is a cross-platform mobile SDK, which means you can develop both Android and iOS with just one code base. Cool, lets getting started.</p><p><strong>Install SDK and Setup Editor</strong></p><ol><li>Install Flutter SDK as nicely documented in <a href="https://flutter.io/docs/get-started/install">here</a>, make sure you follow each step until <strong>Set up the Android emulator</strong>.</li><li>Now, setup the editor as <a href="https://flutter.io/docs/get-started/editor?tab=androidstudio">here</a> or <a href="https://flutter.io/docs/get-started/editor?tab=vscode">here</a>.</li><li>If you already create your first Flutter project, you can skip Get Started section.</li></ol><h3><strong>Get Started</strong></h3><p>Make sure you have properly installed Flutter by execute this command on terminal.</p><pre>flutter --version</pre><p>If the installation succeed, you should see flutter version like below:</p><pre>Flutter 1.0.0 • channel stable • <a href="https://github.com/flutter/flutter.git">https://github.com/flutter/flutter.git</a><br>Framework • revision 5391447fae (10 weeks ago) • 2018-11-29 19:41:26 -0800<br>Engine • revision 7375a0f414<br>Tools • Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)</pre><p>Go to your preferred directory for creating new project, <em>eg. FlutterProjects.</em></p><pre>cd $HOME<br>mkdir FlutterProjects<br>cd FlutterProjects/</pre><p>Now hit the create command, where <em>todoapp</em> is your project name.</p><pre>flutter create todoapp</pre><p>After bunch of lines in terminal, finally you’re done creating new project, sweet 🎉</p><h3><strong>Running Sample Project</strong></h3><p>If you noticed the generated files and folder from previous command, Flutter already create a new sample project for you. Take a look at <em>todoapp/lib/main.dart</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*Wdv7D89h3ZZDFInkqhIymg.png" /><figcaption>Generated code just for you 🎁</figcaption></figure><p>Why don’t we take a look about what Flutter already done for you? Start your emulator now, select devices from your favorite IDE (top-right side in Android Studio or bottom-right side in Visual Studio Code) and hit <strong>Run</strong> (Android Studio) or <strong>Debug</strong> &gt; <strong>Start Debugging </strong>(VS Code).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*E591-dyRKtrmjcbBCF0vpw.png" /><figcaption>Device selection in Android Studio</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*7Cwh-QSm0HtarZLPPysG2Q.png" /><figcaption>Device selection in Visual Studio Code</figcaption></figure><p>Wait while Flutter compiles the code into your emulator, and…<em>voila</em>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/193/1*KZS3hTpoURoW7Z5pC00DYg.png" /><figcaption>running sample project</figcaption></figure><p>You have successfully created an app using Flutter, congrats! You can continue learning the <em>main.dart</em> file and guessing what piece of code doing what, if you want to learn more, stay tuned!</p><h3><strong>Layouting and Styling</strong></h3><p>Flutter is all about widget, text is a widget, button is a widget, image is a widget, even a container is a widget. So, to make a minimal app, what you need is a Container and a Text, as below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ea493d863680683ec1f2debfd0d63d0/href">https://medium.com/media/9ea493d863680683ec1f2debfd0d63d0/href</a></iframe><p>Hit run, and the result as below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*34hP0h9InY5DJPGmbmon_Q.png" /><figcaption>minimal simple app</figcaption></figure><p>Not so pretty eh? Indeed, because we only use Container and Text. Now we want to make the Text centered. Edit the code as below :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4532f92f8060e531ccb2d9305fddf83f/href">https://medium.com/media/4532f92f8060e531ccb2d9305fddf83f/href</a></iframe><p>Hit run, now we can see the Text centered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/193/1*UnaOGeAVL_G7Ga-A-4xexg.png" /><figcaption>minimal simple app centered</figcaption></figure><p>The code is rather complex than the previous one, because to make the Text centered, we need another widget, named Center, wrapping the Text. The relationship between those widgets can be illustrated as a box wrapping another box, wrapping another box. Container has a child, that is Center, Center has a child, that is Text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*YpGG4d7TRyNsFOWV7D5QVw.png" /><figcaption>Widget’s parent-child relationship</figcaption></figure><p>What if we want to have more than one child? We can use <strong>Row</strong> or <strong>Column</strong>, instead of Container or Center. Row display its children horizontally, while Column display its children vertically. This code will have two texts arranged vertically in the center of the screen.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4eb0906749bbb87b7dcb9ea1623c2255/href">https://medium.com/media/4eb0906749bbb87b7dcb9ea1623c2255/href</a></iframe><p>You can add color to the screen, to do so, just add color property in the Container, and add style &gt; color in the Text, as below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c4dbe034bbbe2c1a05d8b1668cc8a55/href">https://medium.com/media/3c4dbe034bbbe2c1a05d8b1668cc8a55/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*Dl9mtbsiEDcpUppYch0crA.png" /><figcaption>minimal simple app styled</figcaption></figure><p>It is now your time to play with color, fontFamily, fontSize, etc. Your lovely IDE has nice autocomplete feature which come in handy for you to experiment.</p><h3>The Login Page</h3><p>What is the most recognizable page on app? The Login page! So before we tried to make the login page, you better stretch your leg and take a cup of coffee first 🤓</p><p>In this section, we tried to make static login page, with Image, TextFormField, and a RaisedButton, here is what we are going to achieve. The button does nothing by the way, since we only focused to build the layout.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*oncxBSIaR9KlrfapIMmQBA.gif" /><figcaption>our final result</figcaption></figure><p>What’s new here? We will use <strong>Scaffold</strong> widget, it is like Container, but it comes with AppBar and FloatingActionButton by default. Very handy if you want to build more complex app. Then we will separate the codes into several parts than a block of too many codes.</p><p>Ready? Let’s the fun begin!</p><h4><strong>Split Main Method</strong></h4><p>Here comes the code</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a803a831e880b0c63ac8db3d0b797d9/href">https://medium.com/media/4a803a831e880b0c63ac8db3d0b797d9/href</a></iframe><p>Then hit <strong>Run</strong>, whoops, blank white screen! Of course, because we only build the frames, you can see appBar, body, and floatingActionButton are null. Wait, what is <strong>MaterialApp</strong>? To use <strong>Scaffold</strong>, you must include the parent, the MaterialApp.</p><p>What if I don’t want to build material-themed app? Well, use Container or Center as previously learned. FYI, MaterialApp has another nice feature, it’s called routing, you can call another page by its route name, such as “/home” easily. Hmm…alright, let’s stick with MaterialApp.</p><p>StatefulWidget, what is it? To use widget functionality, you should extend your class with either <strong>StatelessWidget</strong> or <strong>StatefulWidget</strong>, what’s the difference? In short, if you want your class is immutable or <strong>static</strong>, extends <strong>StatelessWidget</strong>; otherwise, if you want your class is mutable or <strong>dynamic</strong>, extends <strong>StatefulWidget</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*V5xNG1Z6TN72ja4Xm6xIcA.png" /><figcaption>the nothingness</figcaption></figure><h4><strong>Add Image, TextFormField, and RaisedButton</strong></h4><p>Let’s move on into the next phase, arranging widgets! As you may guess, put them inside a Column, so they will be vertically arranged. Remove appBar and floatingActionButton property from Scaffold since we will not use it for now.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f0b91ac15a77762536afc1b999a4a08b/href">https://medium.com/media/f0b91ac15a77762536afc1b999a4a08b/href</a></iframe><p>We can see the image, input field, and button now, almost done! Try to input the email and password. Oh no, the password is clearly visible 😱.</p><p>Don’t worry, add <strong>obscureText</strong>: <strong>true </strong>in password TextFormField and we’re done for now.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8aa3c21b46bc39c5391be5df91b4f75c/href">https://medium.com/media/8aa3c21b46bc39c5391be5df91b4f75c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*QTyDlmAqjb4Aj4Kyao5lMQ.png" /><figcaption>almost done!</figcaption></figure><h4><strong>Add Password Visibility Toggle</strong></h4><p>Wouldn’t it be nice if we can add password visibility toggle? Alright, let’s add <strong>suffix</strong> property in the <strong>InputDecoration</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b6b8fe73ed9773c7607279995f0c5e9/href">https://medium.com/media/3b6b8fe73ed9773c7607279995f0c5e9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*KzSWFA-1YxuaSaXaDftY_Q.png" /><figcaption>tiny little eye</figcaption></figure><p>Then we make the “eye” clickable by adding <strong>Inkwell </strong>as the parent of our eye icon, as such:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56e4ce6dd8864ab7c519f171e96da6c7/href">https://medium.com/media/56e4ce6dd8864ab7c519f171e96da6c7/href</a></iframe><p>Now, add method when our user click the eye icon. What we want is, when user click the eye, the password will be visible and the eye turns blue. When user click the eye once more, the password will be obscured and the eye turns grey.</p><p>Create 2 variables:</p><ol><li><strong>_isToggled</strong> to store obscureText property, default value is <strong>true</strong></li><li><strong>_toggleIcon</strong> to store icon color information, default value is <strong>Icon(Icons.<em>remove_red_eye</em>, color: Colors.<em>grey</em>)</strong></li></ol><pre>bool _isToggled = <strong>true</strong>;<br><strong>var </strong>_toggleIcon = Icon(Icons.<em>remove_red_eye</em>, color: Colors.<em>grey</em>);</pre><p>Assign the variables into obscureText property and suffix’s child. So, the TextFormField will be like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb13d7f0cc37ca5b5b5f6aade04c2216/href">https://medium.com/media/eb13d7f0cc37ca5b5b5f6aade04c2216/href</a></iframe><p>Create the method, we named it <strong>_togglePassword()</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/743066a964447cda927710afe93ae903/href">https://medium.com/media/743066a964447cda927710afe93ae903/href</a></iframe><p>As we discussed earlier, we extends StatefulWidget, therefore to change variable, put the logic inside setState() method. When _isToggled is false, change the icon into grey and set _isToggled into true. Here’s the final code for now:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b092f4d7cefd3e74c56dd748af22519/href">https://medium.com/media/0b092f4d7cefd3e74c56dd748af22519/href</a></iframe><p>Save your code and let hot reload feature refresh your emulator’s screen, your toggle is working now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*29HW06pUixrp4EhwoL6B8w.gif" /><figcaption>yeay..it’s halfway done</figcaption></figure><p>There is still one issue, our app is ugly 🙈. Go get yourself into the last part 💄.</p><h4><strong>Make It Pretty</strong></h4><p>What we will do is to add padding, add space between widgets, prettify button, and center-align widgets.</p><p><strong>Add padding</strong></p><p>Padding is the property of Container, so wrap our Column as the child of Container, then add padding property, add new widget, called <strong>EdgeInsets</strong>, set all padding to 32. Make sure the code as below :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f450de30d6db80e14c3bc41bbb20bd0d/href">https://medium.com/media/f450de30d6db80e14c3bc41bbb20bd0d/href</a></iframe><p>Save and hot reload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*zRvXwhB3GJif0bnNkA_YzQ.png" /><figcaption>added padding</figcaption></figure><p><strong>Add space between widgets</strong></p><p>Don’t you see that we need to add extra space between widgets? How to add extra space? You can add Container, Padding, or SizedBox to overcome that problem, but for the sake of cleaner code, we will use SizedBox.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c42b5163ba4f1f7305d46768a9aebbb/href">https://medium.com/media/8c42b5163ba4f1f7305d46768a9aebbb/href</a></iframe><p>Save and hot reload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*YChN71GqlNLlfEKrYakkxw.png" /><figcaption>added extra space</figcaption></figure><p><strong>Prettify button</strong></p><p>Cool, our app is now properly arranged. Our next goal is to prettify the button. The button should has blue color, rounded edge, the width should be as long as the width of the screen, the padding in the button is 16. The text in the button should has white color, the font size is 16, spacing between letter is 1. Wow, that’s so much.</p><p>Alright, set these property in RaisedButton : color, textColor, padding, and shape, as below :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f0d7bd8e2a957e7169408fec29aed1e/href">https://medium.com/media/6f0d7bd8e2a957e7169408fec29aed1e/href</a></iframe><p>Save and hot reload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*jX_fJ1PJtdvZQff7-SVhFg.png" /><figcaption>styled button</figcaption></figure><p>Now, style the text inside the button. Set fontSize to 16 and set letterSpacing to 1.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31c5fe86dd538bc76f33a11068cc668a/href">https://medium.com/media/31c5fe86dd538bc76f33a11068cc668a/href</a></iframe><p>Save and hot reload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*77-ggMA-MGaKeQtgL_EpwQ.png" /><figcaption>Nothing much hmm</figcaption></figure><p>Next, set the width of the button as long as the width of the screen. Unfortunately RaisedButton doesn’t have width property, so we will need another widget that has width property, that is <strong>ButtonTheme</strong>. Wrap RaisedButton as the child of ButtonTheme, then set the <strong>minWidth</strong> into <strong>double.infinity.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0f897fc391a752e843b571ab1a2f92d/href">https://medium.com/media/d0f897fc391a752e843b571ab1a2f92d/href</a></iframe><p>Save and hot reload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*LmMv-L9HyIeUZJvUbvWQiA.png" /><figcaption>pretty 🦄</figcaption></figure><p><strong>Center-align widgets</strong></p><p>One last thing, make them positioned in the middle of the screen. How? Set <strong>mainAxisAlignment</strong> property of Column into <strong>MainAxisAlignment.center</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/307b99d47b39288a9916c428433505a4/href">https://medium.com/media/307b99d47b39288a9916c428433505a4/href</a></iframe><p>Save and hot reload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*YsQhVe4mgWZUeWgEF80pAQ.png" /><figcaption>voila 🎉</figcaption></figure><p>Done! You can see the full code <a href="https://gist.github.com/zamahsyari/502c888d8f5f91f26f95e43a8438347d">here</a>. It is now your turn to explore more about Flutter.</p><p>If this post is helpful, show your support by clicking 👏 a few times as many as you like.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb71a2310939" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>