<?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 Run Theory on Medium]]></title>
        <description><![CDATA[Stories by Run Theory on Medium]]></description>
        <link>https://medium.com/@run_theory?source=rss-ceea3626feed------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u5rqidU5LLUWZnwlIs1qag.png</url>
            <title>Stories by Run Theory on Medium</title>
            <link>https://medium.com/@run_theory?source=rss-ceea3626feed------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 23:37:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@run_theory/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[HOW TO PUBLISH TO PUB.DEV FROM GITHUB ACTIONS USING OIDC?]]></title>
            <link>https://medium.com/@run_theory/how-to-publish-to-pub-dev-from-github-actions-using-oidc-32d6fd948377?source=rss-ceea3626feed------2</link>
            <guid isPermaLink="false">https://medium.com/p/32d6fd948377</guid>
            <dc:creator><![CDATA[Run Theory]]></dc:creator>
            <pubDate>Tue, 07 Apr 2026 07:34:28 GMT</pubDate>
            <atom:updated>2026-04-07T07:34:28.811Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_5KqWJEwtIC82vT8-nYZQ.png" /></figure><p>I wanted to automate publishing so that every time a new version is tagged, it goes straight to pub.dev without me having to run dart pub publish manually. OIDC makes that possible — no stored secrets, just GitHub&#39;s identity token.</p><p>What I didn’t expect was hitting three completely different errors along the way, each pointing at a different missing piece. If you’re getting any of these, here’s what each one actually means.</p><h3>The three errors</h3><h3>Error 1 — You haven’t configured pub.dev yet</h3><pre>Publishing is not enabled for this repository.<br>publishing from github is not enabled</pre><p>This one is straightforward: you need to tell pub.dev that it’s allowed to accept pushes from your GitHub repo. Go to:</p><pre>https://pub.dev/packages/&lt;your-package&gt;/admin</pre><p>Then under <strong>Automated publishing</strong>:</p><ol><li>Click <strong>Enable publishing from GitHub Actions</strong></li><li>Enter your repository as owner/repo</li><li>Set <strong>Tag pattern</strong> to v[0-9]+.[0-9]+.[0-9]+</li><li>Leave <strong>Environment</strong> blank unless you’re using GitHub Environments</li><li>Save</li></ol><h3>Error 2 — Your workflow is running on a branch, not a tag</h3><pre>Automated publishing is only allowed from a &#39;tag&#39; refType,<br>but the current one is &#39;branch&#39;.</pre><p>pub.dev OIDC requires the workflow to be triggered by a tag push. If your publish job lives inside a workflow that runs on push: branches: [main], it will always fail this check — no matter what else you do.</p><p>If you want to publish on every release, your publish workflow trigger must look like this:</p><pre>on:<br>  push:<br>    tags:<br>      - &#39;v*.*.*&#39;</pre><blockquote><em>⚠️ </em><strong><em>Warning:</em></strong><em> </em><em>workflow_dispatch triggers run on a branch ref, not a tag. Manually triggering a publish workflow will always fail the OIDC check. Don&#39;t use it for publishing.</em></blockquote><h3>Error 3 — The job can’t get an OIDC token</h3><pre>Insufficient permissions to get OIDC token.</pre><p>This one surprised me — I thought OIDC was automatic. It’s not. You have to explicitly grant the job permission to request the token:</p><pre>jobs:<br>  publish:<br>    permissions:<br>      id-token: write</pre><h3>Full minimal publish workflow</h3><p>Once all three things are in place, a publish job looks like this:</p><pre>name: Publish</pre><pre>on:<br>  push:<br>    tags:<br>      - &#39;v*.*.*&#39;</pre><pre>jobs:<br>  publish:<br>    runs-on: ubuntu-latest<br>    permissions:<br>      id-token: write<br>    steps:<br>      - uses: actions/checkout@v4<br>      - uses: dart-lang/setup-dart@v1<br>      - run: dart pub get<br>      - run: dart pub publish --force</pre><blockquote><em>⚠️ </em><strong><em>Warning:</em></strong><em> Don’t put </em><em>dart pub publish in your release workflow if that workflow is triggered by a branch push. Keep publishing in a separate workflow triggered only by tags. See </em><em>04-release-vs-publish-split.md for the full pattern.</em></blockquote><h3>Verify it worked</h3><p>Push a tag:</p><pre>git tag v1.2.3<br>git push origin v1.2.3</pre><p>The publish job should complete and the version should appear on pub.dev within a few minutes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32d6fd948377" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HOW TO WIDEN THE ANALYZER CONSTRAINT WHEN pub upgrade WON’T MOVE IT?]]></title>
            <link>https://medium.com/@run_theory/how-to-widen-the-analyzer-constraint-when-pub-upgrade-wont-move-it-55cdf3b2e5c1?source=rss-ceea3626feed------2</link>
            <guid isPermaLink="false">https://medium.com/p/55cdf3b2e5c1</guid>
            <category><![CDATA[analyzer]]></category>
            <category><![CDATA[publishing]]></category>
            <category><![CDATA[package]]></category>
            <category><![CDATA[pubspec]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Run Theory]]></dc:creator>
            <pubDate>Tue, 07 Apr 2026 07:34:18 GMT</pubDate>
            <atom:updated>2026-04-07T07:34:18.695Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6SHUAWPDjROsAQWSEjEAQ.png" /></figure><p>I was trying to bump the analyzer version in pubspec.yaml to improve the pub.dev score. I ran:</p><pre>dart pub upgrade --major-versions analyzer</pre><p>And nothing changed. No error, no output, just silence. The version stayed exactly where it was.</p><h3>Why this happens</h3><p>Something else in your dependencies has a tighter upper bound on analyzer than you&#39;re trying to set, and it wins. In my case it was a dev dependency — build_runner — with a caret constraint (^2.4.0) that implicitly capped analyzer at an older major version.</p><p>pub resolves a single version of every package across all dependencies, including dev ones. So even if your direct constraint on analyzer is wide, a dev dependency can quietly cap it.</p><h3>What to check</h3><p>Run both of these to see what’s happening:</p><pre># What your published package resolves (no dev deps)<br>dart pub deps --no-dev | grep analyzer</pre><pre># What your local dev environment resolves<br>dart pub deps | grep analyzer</pre><p>If the versions differ, a dev dependency is the culprit. You can also do a dry run to confirm:</p><pre>dart pub upgrade --major-versions --dry-run 2&gt;&amp;1 | grep analyzer</pre><h3>How to fix it</h3><p><strong>Option 1 — Switch from caret to a wide range:</strong></p><pre># Before — caret caps at next major<br>dev_dependencies:<br>  build_runner: ^2.4.0</pre><pre># After — explicit range gives room to grow<br>dev_dependencies:<br>  build_runner: &quot;&gt;=2.4.0 &lt;4.0.0&quot;</pre><p>Pick the upper bound as the next major version that doesn’t exist yet, so future analyzer upgrades aren’t blocked.</p><p><strong>Option 2 — Remove the dev dependency entirely if it’s unused:</strong></p><p>If build_runner (or whatever is blocking) isn&#39;t actually being used — no .g.dart files, no part directives pointing at generated code — just remove it from pubspec.yaml. It has no business being there.</p><blockquote><em>⚠️ </em><strong><em>Warning:</em></strong><em> </em><em>dart pub upgrade --major-versions will silently do nothing if the blocker is a dev dependency with a caret bound. It&#39;s not a bug, it&#39;s working as designed. Always check </em><em>dev_dependencies manually when this command produces no output.</em></blockquote><blockquote><em>⚠️ </em><strong><em>Warning:</em></strong><em> Wide version ranges mean you might pick up a breaking change in a dev tool. Always run </em><em>dart test after upgrading.</em></blockquote><h3>Verify it worked</h3><pre>dart pub upgrade<br>dart pub deps | grep analyzer</pre><p>The resolved version should now be the latest available, not the one capped by the old constraint. Then run dart analyze and dart test to make sure nothing broke.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55cdf3b2e5c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HOW TO SEPARATE THE RELEASE WORKFLOW FROM THE PUBLISH WORKFLOW?]]></title>
            <link>https://medium.com/@run_theory/how-to-separate-the-release-workflow-from-the-publish-workflow-773376cc732d?source=rss-ceea3626feed------2</link>
            <guid isPermaLink="false">https://medium.com/p/773376cc732d</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[package]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Run Theory]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 17:23:45 GMT</pubDate>
            <atom:updated>2026-03-17T17:23:45.181Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_5KqWJEwtIC82vT8-nYZQ.png" /></figure><p>I initially had everything in one workflow: bump version, create tag, publish to pub.dev — all triggered when something merged into main. It seemed clean. Then every publish step failed with an OIDC error.</p><p>The problem is that pub.dev OIDC requires the GitHub Actions run to be associated with a <strong>tag ref</strong>. A workflow triggered by push: branches: [main] runs in a branch context. That context will never pass the OIDC check, no matter what else you configure.</p><p>The fix is to split it into two workflows with different triggers.</p><h3>The two workflows</h3><p>Workflow Trigger What it does release.yml push to main creates tag + GitHub Release + opens sync PR publish.yml push of a v*.*.* tag publishes to pub.dev</p><h3>release.yml</h3><p>This one runs on branch push. It creates the tag (which then triggers publish.yml automatically):</p><pre>name: Release</pre><pre>on:<br>  push:<br>    branches:<br>      - main</pre><pre>jobs:<br>  release:<br>    runs-on: ubuntu-latest<br>    permissions:<br>      contents: write<br>      pull-requests: write<br>    steps:<br>      - uses: actions/checkout@v4<br>      - uses: dart-lang/setup-dart@v1<br>      - run: dart pub get</pre><pre>      - name: Create tag<br>        run: |<br>          VERSION=$(grep &#39;^version:&#39; pubspec.yaml | cut -d&#39; &#39; -f2)<br>          git tag &quot;v$VERSION&quot;<br>          git push origin &quot;v$VERSION&quot;</pre><pre>      - name: Open sync PR<br>        run: gh pr create --base dev --head main --title &quot;chore: sync main → dev&quot;<br>        env:<br>          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}</pre><blockquote><em>⚠️ </em><strong><em>Warning:</em></strong><em> Do not add </em><em>dart pub publish here. This workflow runs on a branch ref and will fail the OIDC check every single time.</em></blockquote><h3>publish.yml</h3><p>This one runs only when a tag is pushed — which release.yml does automatically:</p><pre>name: Publish</pre><pre>on:<br>  push:<br>    tags:<br>      - &#39;v*.*.*&#39;</pre><pre>jobs:<br>  publish:<br>    runs-on: ubuntu-latest<br>    permissions:<br>      id-token: write<br>    steps:<br>      - uses: actions/checkout@v4<br>      - uses: dart-lang/setup-dart@v1<br>      - run: dart pub get<br>      - run: dart pub publish --force</pre><h3>The full flow</h3><pre>push to main<br>  └─► release.yml runs<br>        ├─ creates tag v1.2.3  ──────────────► triggers publish.yml<br>        └─ opens sync PR                             └─ dart pub publish ✓</pre><h3>Verify it worked</h3><ol><li>Merge to main</li><li>Confirm release.yml creates the tag and GitHub Release</li><li>Confirm publish.yml is triggered by that tag and completes</li><li>Check the new version on pub.dev</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=773376cc732d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HOW TO LET GITHUB ACTIONS OPEN PULL REQUESTS?]]></title>
            <link>https://medium.com/@run_theory/how-to-let-github-actions-open-pull-requests-d504163137bb?source=rss-ceea3626feed------2</link>
            <guid isPermaLink="false">https://medium.com/p/d504163137bb</guid>
            <category><![CDATA[pull-request]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[yaml]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Run Theory]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 16:55:50 GMT</pubDate>
            <atom:updated>2026-03-17T16:55:50.085Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_5KqWJEwtIC82vT8-nYZQ.png" /></figure><p>I was setting up a release workflow that automatically opens a sync PR after pushing to main. Everything looked fine — the YAML was correct, the gh pr create command was there but the run kept failing with:</p><pre>GitHub Actions is not permitted to create or approve pull requests</pre><p>Turns out, GitHub blocks this by default. There are actually two things you need to fix, and if you only do one of them it still won’t work.</p><h2>What you need to do</h2><p><strong>First</strong>, go to your repository on GitHub and enable the setting:</p><ol><li>Open <strong>Settings → Actions → General</strong></li><li>Scroll down to <strong>Workflow permissions</strong></li><li>Check <strong>“Allow GitHub Actions to create and approve pull requests”</strong></li><li>Save</li></ol><p><strong>Then</strong>, add pull-requests: write to the permissions block of the job in your workflow YAML. The repo setting alone is not enough — without this, GITHUB_TOKEN is issued with read-only pull-request scope:</p><pre>jobs:<br>  your-job:<br>    permissions:<br>      contents: write<br>      pull-requests: write</pre><blockquote>⚠️ <strong>Warning:</strong> If you’re working inside an org, don’t assume the org-level default covers your repo. This setting is per-repository — check it directly.</blockquote><h2>Verify it worked</h2><p>Re-run the workflow. If both steps are done, the gh pr create call should go through with no errors.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d504163137bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Tutorial from design to code]]></title>
            <link>https://medium.com/@run_theory/flutter-tutorial-from-design-to-code-e320a4995231?source=rss-ceea3626feed------2</link>
            <guid isPermaLink="false">https://medium.com/p/e320a4995231</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[fingerprint]]></category>
            <category><![CDATA[local-auth]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[listviewbuilder]]></category>
            <dc:creator><![CDATA[Run Theory]]></dc:creator>
            <pubDate>Thu, 12 Mar 2020 13:06:21 GMT</pubDate>
            <atom:updated>2020-03-13T16:18:51.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*conABpFD11o4ihyx4bIL2w.png" /></figure><h4>implementing Fingerprint and FaceID authentication</h4><p>I wrote this article to share with you how I created this screen using Flutter, if you’re interested on how I’ve done it, keep reading and do not hesitate to ask any question.</p><p>Along this tutorial will be interacting and learning a lot of stuff that I divided them into:</p><h4>Major points:</h4><ul><li>Dynamic list view (ListViewBuilder)</li><li>Biometrics authentication (local_auth package)</li><li>Bottom navigation implementation</li><li>Widgets reusability</li></ul><h4>Minor points:</h4><ul><li>Caching images (CachedNetworkImage package)</li><li>SVG Image implementation</li><li>Date formatting</li><li>DropDown list</li></ul><p>I’ve divided this tutorial into 4 sections, and you can find the source code of each section on <a href="https://github.com/kthirirania/my_wallet">Github</a>.</p><blockquote><a href="#5445">First Step</a>: <a href="https://github.com/kthirirania/my_wallet/tree/step_1">Bottom Navigation Widget</a><br><a href="#d4d2">Second Step</a>: <a href="https://github.com/kthirirania/my_wallet/tree/step_2">Credit Card Widget</a><br><a href="#23f6">Third Step</a>: <a href="https://github.com/kthirirania/my_wallet/tree/step_3">Transactions’ List Widget</a><br><a href="#0c0f">Fourth Step</a>: <a href="https://github.com/kthirirania/my_wallet/tree/step_4">Biometrics Authentication</a></blockquote><h3>“Before The First Step” Step</h3><p>Let’s create a new flutter project using this command line:</p><pre>flutter create --org com.yourcompany -i swift -a kotlin --description &#39;Wallet App Tutorial&#39; my_wallet</pre><p>Or if you’re using Android Studio make sure to check Kotlin and swift.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sFwlAIdBhPtOcqdwH6_s4A.png" /><figcaption>Create Flutter App using Android Studio</figcaption></figure><p>First thing to do when we’re converting a design to code, is to structure and visualize how our code will be organized.</p><p>When I look at this picture I see 4 sections as shown in the picture, and based on this outlook we’ll be building our scaffold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*bheNigL_Qgdw6UN77GOINg.png" /></figure><p>Now that we have seen the big picture let’s get to the real business!</p><h3>First Step: Bottom Navigation Widget</h3><p>Let’s start by creating the bottom navigation widget. In this section I’ve used the <a href="https://pub.dev/packages/circular_bottom_navigation">Circular Bottom Navigation</a> library.</p><p>First of all let’s clean up our main dart file and remove all the unnecessary code and just leave a basic scaffold, I’m going to start by the bottom navigation widget and make it the root widget, (Don’t mind the error of the ‘<em>BottomNavigationWidget()</em>’, we’re going to ad it later.)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36af182a46204d17e30f2a45908a5fbd/href">https://medium.com/media/36af182a46204d17e30f2a45908a5fbd/href</a></iframe><p>1- Start by adding the library to the pubspec.yaml file, and run <strong>flutter pub get.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQ0FvVASoPZiKmwpzvSNCw.png" /></figure><p>2- Next create a widget folder(Inside the lib folder), in which we’re gonna add all of our widgets, then create a stateful widget and name it ‘<em>BottomNavigationWidget</em>’.</p><p>Change the build function as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f08a4c5b619a5a66fcfe5c615c1c0fed/href">https://medium.com/media/f08a4c5b619a5a66fcfe5c615c1c0fed/href</a></iframe><p>Don’t worry about the errors your getting from the <em>bodyContainer()</em> and <em>bottomNav()</em>, we’re gonna add them one by one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0dcedf97236a0412e60c4afb844af23/href">https://medium.com/media/c0dcedf97236a0412e60c4afb844af23/href</a></iframe><p>Now let’s add the code that displays the correspondent container, and create the ‘HomeScreen’ for test purposes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66cc51ee94808de879db9908f7066057/href">https://medium.com/media/66cc51ee94808de879db9908f7066057/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*y7AVBusDwW9PGlYsHSEKQw.png" /></figure><p>If everything went as planned the output should be something like this, here’s the <a href="https://github.com/kthirirania/my_wallet/tree/step_1"><em>source code</em></a> if you want to jump to the next section.</p><h3>Second Step: Credit Card Widget</h3><p>From this section we’ll be dealing with pictures and icons you can find all the assets in this <a href="https://drive.google.com/open?id=19B0m2fzMYenXp_0jJsnz1zPZ3Nx8gVjI">link</a>, most of the icons that I used are from <a href="https://www.flaticon.com/">flaticon</a>.</p><p>Now let’s move on into creating the credit card widget, first let’s add the <a href="https://pub.dev/packages/flutter_svg">flutter_svg</a> package don’t forget to run ‘flutter pub get’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z1FF6A4MVQmwrxH1rz8HqQ.png" /></figure><p>The HomeScreen will contain a Column widget and for the header part we’ll be implementing a Row widget.</p><p>Next, let’s add <a href="https://drive.google.com/drive/folders/1-vMmpJEO2GW2VX-dWxAsJvrzTw4d994D?usp=sharing">icons</a> to our projet, create a folder at the root of the project assets/icons and add the “menu.svg” icon.</p><p>And let’s use the SvgPicture.asset from the flutter_svg package.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc2a76d05947db2c13357a67d56e36e8/href">https://medium.com/media/fc2a76d05947db2c13357a67d56e36e8/href</a></iframe><p>Then we’re going to need to use the <a href="https://pub.dev/packages/cached_network_image">cached_network_image</a>, and the <a href="https://pub.dev/packages/shimmer">shimmer</a> packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2RJmmxuIBM_tIt_x8kYEaQ.png" /></figure><p>Since we’re going to load a lot of images in this screen, it’s more practical to create a separate widget to handle the loading of the image and reduce repetitive code.<br>Start by creating a stateless widget and implement all the needed variables.</p><p>We’re going to create a container with rounded border and its child will be CachedNetworkImage.</p><ul><li>imageUrl: It’s the URL of the image, in our case it’s the imageURL variable,</li><li>image builder: Takes context and imageProvider as parameters and returns the result widget.</li><li>placeholder: The widget that will be shown when the image is loading.</li><li>errorWidget: The widget that will be shown in case of an error.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8bfd00e3d284f1edd530648a07c93ae3/href">https://medium.com/media/8bfd00e3d284f1edd530648a07c93ae3/href</a></iframe><p>Now let’s implement the image builder, the placeholder, and the errorWidget.<br>The placeholder and the errorWidget will be returning a shimmer effect, but you can choose whatever suits your business.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7367d1d2f33730a9e681dcdacf89c5d1/href">https://medium.com/media/7367d1d2f33730a9e681dcdacf89c5d1/href</a></iframe><p>Now we’re going to use the LoadImage widget that we just created to show the profile image in the HomeScreen.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9938d49a0572fe0db84bd8cf209c8ad/href">https://medium.com/media/d9938d49a0572fe0db84bd8cf209c8ad/href</a></iframe><p>Next, let’s add another <a href="https://drive.google.com/drive/folders/1-vMmpJEO2GW2VX-dWxAsJvrzTw4d994D?usp=sharing">icons</a> to our projet, under assets/icons and add the fingerprint and visa pics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*_bVp3S81i4noIV4cIpo2Vw.png" /></figure><p>Going back to the HomeScreen under the Row widget let’s add a Container which will be the background of the credit card.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb2f06a5eebfdf39440334bc36cad03c/href">https://medium.com/media/eb2f06a5eebfdf39440334bc36cad03c/href</a></iframe><p>Let’s finish the credit card widget.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aad98471f8f9e8bba3ec827485c7902a/href">https://medium.com/media/aad98471f8f9e8bba3ec827485c7902a/href</a></iframe><p>And if everything went well this is the output that you’ll be getting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*41gRYKbwphBVNt5uHthS_g.png" /></figure><p>As we can see, the HomeScreen became a little bit crowded and container many lines of code, so let’s create two stateless widgets for the HomeTop widget and the CreditCard widget and add them to the Column of the HomeScreen.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cfa49515b8bbabe34ee63909069a318e/href">https://medium.com/media/cfa49515b8bbabe34ee63909069a318e/href</a></iframe><p>The Credit Card Widget.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c43b1f30a0af1a701e6b7acb350b09e7/href">https://medium.com/media/c43b1f30a0af1a701e6b7acb350b09e7/href</a></iframe><p>The HomeTopWidget.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/687d7a610fee0561577c04db8a9e8cb8/href">https://medium.com/media/687d7a610fee0561577c04db8a9e8cb8/href</a></iframe><p>And that’s it for this section, you can find the source code of this part at <a href="https://github.com/kthirirania/my_wallet/tree/step_2">Github</a>.</p><h3>Third Step: Transactions List</h3><p>In this part we’ll ce coding the transactions part, we have a Row containing the title and a dropdown and a ListViewBuilder.</p><p>Let’s start by creating a Stateful Widget called TransactionsHeaderWidget inside the widgets folder.</p><p>And let’s add the title and the dropdown List.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31086eee65ca4e51b17db082214a24b3/href">https://medium.com/media/31086eee65ca4e51b17db082214a24b3/href</a></iframe><p>Now let’s get back to the HomeScreen and call that widget.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eec88b7568a19982c63bdc645c43d124/href">https://medium.com/media/eec88b7568a19982c63bdc645c43d124/href</a></iframe><p>Here’s the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*-X4aAHuF_lzSernWGx4X0Q.png" /></figure><p>Since the list will be dynamic, we need to create a transaction model, let’s create a models folder and inside of it a class called Transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tnA7OxS2FOq_pVwuCe42fg.png" /></figure><p>Add the needed variables and a constructor.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9fea6000db2ce114b75726fe2594b8e9/href">https://medium.com/media/9fea6000db2ce114b75726fe2594b8e9/href</a></iframe><p>Since in this tutorial we’re not going to work with APIs and fetching data, we’re going to add a static list inside the Transaction Model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c3592bcd92092355e12191c0c8f606d/href">https://medium.com/media/6c3592bcd92092355e12191c0c8f606d/href</a></iframe><p>Here’s the final Transaction Model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e060e5276f58a8fa0ad8a2528c1a70b9/href">https://medium.com/media/e060e5276f58a8fa0ad8a2528c1a70b9/href</a></iframe><p>Now let’s create the TransactionItem widget, this stateless widget represents one transaction UI.</p><p>In this widget we’re going to add a variable of type Transaction, and a constructor to set this variable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7beebe72b54e37122006bad2a5d6d3b4/href">https://medium.com/media/7beebe72b54e37122006bad2a5d6d3b4/href</a></iframe><p>At this point we still can’t see the output of what we’re doing which kind of sucks, so let’s create the TransactionsWidget and add a ListViewBuilder to loop the transactions list and displays it.</p><ul><li>scrollDirection: could be vertical or horizontal</li><li>itemCount: the length/the number of the item to display</li><li>itemBuilder: takes context and index as params and return the widget that we want to display(Could be even an empty Container if you want to test your list).</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6309e3dc0d1649bf51640768e312549d/href">https://medium.com/media/6309e3dc0d1649bf51640768e312549d/href</a></iframe><p>Here’s an outlook on how things are going on for now. Don’t forget to call the TransactionsWidget inside the Column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*orjcd1jceQGaeH3phqQcrg.png" /></figure><p>This is an optional part to format our data and make it more presentable.<br>Let’s add the intl package to format the date.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*viQmiXRKB9pjBVangfaHtA.png" /></figure><p>Start by creating a class called Utils, and add the following function to format the date.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16d8dc7012e0bd27d7737e27dee27ede/href">https://medium.com/media/16d8dc7012e0bd27d7737e27dee27ede/href</a></iframe><p>And let’s add another function to capitalize each word of a sentence, data in the database could be messy so let’s make sure our UI is always on point.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1740c4a526ecb3b760c7b91e80b82588/href">https://medium.com/media/1740c4a526ecb3b760c7b91e80b82588/href</a></iframe><p>Than let’s get back to the TransactionItem widget and replace the subtitle with the following code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ba92e27c2b1d95ea1b5e4f8ae457a9b/href">https://medium.com/media/9ba92e27c2b1d95ea1b5e4f8ae457a9b/href</a></iframe><p>And inside the text widget for the title call the capitalizeSentence function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b95ff2fb2942e8a8ab447472944151eb/href">https://medium.com/media/b95ff2fb2942e8a8ab447472944151eb/href</a></iframe><p>Here’s the output, and as in each section here’s the source code of this <a href="https://github.com/kthirirania/my_wallet/tree/step_3">part</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*Rf5O83qCAWbZWpffompSSw.png" /></figure><p>Congratulate yourself we have just finished 3 out of 4 parts of this tutorial.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fbeautifulsoggyjaguarundi&amp;display_name=Gfycat&amp;url=https%3A%2F%2Fgfycat.com%2Fbeautifulsoggyjaguarundi&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FBeautifulSoggyJaguarundi-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="480" height="267" frameborder="0" scrolling="no"><a href="https://medium.com/media/98491bbf86b82738d54891ed9e14aa6b/href">https://medium.com/media/98491bbf86b82738d54891ed9e14aa6b/href</a></iframe><h3>Fourth Step: Transactions List</h3><p>In this section we’ll be needing the <a href="https://pub.dev/packages/local_auth">local_auth</a> package let’s add it to our project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*_rLjAnFbTbzUx8uJrCcQtQ.png" /></figure><p>Let’s go back to the CreditCardWidget and convert it to a stateful widget, if your using android Studio you can do it using shortcut (Alt + Enter).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cRsGK4jFjr9-gcsuwaFKvA.png" /></figure><p>Let’s add these variables.</p><pre>...<br>import &#39;package:local_auth/local_auth.dart&#39;;<br><br>class CreditCardWidget extends StatefulWidget {<br>  @override<br>  _CreditCardWidgetState createState() =&gt; _CreditCardWidgetState();<br>}<br><br>class _CreditCardWidgetState extends State&lt;CreditCardWidget&gt; {</pre><pre>  final LocalAuthentication auth = LocalAuthentication();<br>  List&lt;BiometricType&gt; _availableBiometrics = [];<br>  bool _canCheckBiometrics = false;<br>  bool _authorized = false;<br>  bool _isAuthenticating = false;</pre><pre> ...</pre><pre>}</pre><p>And add these functions one by one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff5300c3ac02c1f585f55db19b56efdc/href">https://medium.com/media/ff5300c3ac02c1f585f55db19b56efdc/href</a></iframe><pre>import &#39;package:flutter/services.dart&#39;;</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec335821a06992eb3d565b9b0565f164/href">https://medium.com/media/ec335821a06992eb3d565b9b0565f164/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/738342e7acb4093bacdf4fcfda2a67f1/href">https://medium.com/media/738342e7acb4093bacdf4fcfda2a67f1/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb06f433e90dd3cddaac0bd47c8f2815/href">https://medium.com/media/bb06f433e90dd3cddaac0bd47c8f2815/href</a></iframe><p>Let’s get back to the fingerprint icon and wrapp it with InkWell to enable the tap gesture. Add the onTap and call the corresponding functions.</p><pre>InkWell(<br>  onTap: () async {<br>    await _checkBiometrics();<br>    await _getAvailableBiometrics();<br>    _isAuthenticating<br>        ? _cancelAuthentication()<br>        : await _authenticate();<br>  },<br>  child: Padding(<br>    padding: const EdgeInsets.all(12.0),<br>    child: SvgPicture.asset(<br>      &#39;assets/icons/fingerprint.svg&#39;,<br>      height: 32,<br>      color: Colors.<em>white</em>,<br>    ),<br>  ),<br>),</pre><p>Here’s how the code is setting.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00999b3fa380c7f46a915597c6663ce5/href">https://medium.com/media/00999b3fa380c7f46a915597c6663ce5/href</a></iframe><p>To enable this in Android go to:</p><p><em>/android/app/src/main/kotlin/{your_package}/my_wallet/MainActivity.kt</em></p><p>and make the MainActivity extends FlutterFragmentActivity() instead of FlutterActivity() just like bellow.<br>Don’t mind the errors you’re getting in the android folder if you’re using AndroidStudio, if want to sync it you can open the android folder in a separate Android Studio tab, but no need for that here.</p><pre>package com.raniakthiri.my_wallet<br><br>import androidx.annotation.NonNull;<br>import io.flutter.embedding.android.FlutterFragmentActivity;<br>import io.flutter.embedding.engine.FlutterEngine<br>import io.flutter.plugins.GeneratedPluginRegistrant<br><br>class MainActivity: FlutterFragmentActivity() {<br>    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {<br>        GeneratedPluginRegistrant.registerWith(flutterEngine);<br>    }<br>}</pre><p>And for ios, go to:</p><p>ios/Runner/info.plist, and add the following lines. ios will need this peace of message to show when he’s gonna ask for the permission to use faceID.</p><pre>&lt;key&gt;NSFaceIDUsageDescription&lt;/key&gt;<br>&lt;string&gt;FaceID is required to authorize this operation&lt;/string&gt;</pre><p>Now when we click on the fingerprint we get the permission request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*PqFBR3djftqYYWiBks0o0g.png" /></figure><p>Then let’s go back on hide the information that need authorization.</p><pre>child: SvgPicture.asset(<br>  _authorized<br>      ? &#39;assets/icons/lock.svg&#39;<br>      : &#39;assets/icons/fingerprint.svg&#39;,<br>  height: 32,<br>  color: Colors.<em>white</em>,<br>),</pre><pre>Text(<br>  _authorized ? &quot;1254&quot; : &quot;* * * *&quot;,<br>  ...<br>),</pre><pre>_authorized<br>    ? Text(<br>        &quot;\$ 26,848.00&quot;,<br>        textAlign: TextAlign.center,<br>        style: TextStyle(<br>          color: Colors.<em>white</em>,<br>          fontSize: 20,<br>          fontWeight: FontWeight.<em>bold</em>,<br>          shadows: &lt;Shadow&gt;[<br>            Shadow(<br>              offset: Offset(1.0, 1.0),<br>              blurRadius: 2.0,<br>              color: Colors.<em>black26</em>,<br>            ),<br>            Shadow(<br>              offset: Offset(1.0, 1.0),<br>              blurRadius: 2.0,<br>              color: Colors.<em>black26</em>,<br>            ),<br>          ],<br>        ),<br>      )<br>    : Text(<br>        &quot;\$\$\$,\$\$\$.\$\$&quot;,<br>        textAlign: TextAlign.center,<br>        style: TextStyle(<br>          color: Colors.<em>white</em>,<br>          fontSize: 20,<br>          shadows: &lt;Shadow&gt;[<br>            Shadow(<br>              offset: Offset(1.0, 1.0),<br>              blurRadius: 2.0,<br>              color: Colors.<em>black26</em>,<br>            ),<br>            Shadow(<br>              offset: Offset(1.0, 1.0),<br>              blurRadius: 2.0,<br>              color: Colors.<em>black26</em>,<br>            ),<br>          ],<br>        ),<br>      ),</pre><p>Your creditCardWidget should be liking like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/52f6a5ef4ee30b2faf2cf2956123ab0d/href">https://medium.com/media/52f6a5ef4ee30b2faf2cf2956123ab0d/href</a></iframe><p>Here’s how to test faceID using iphone simulator.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fpleasedmiserlyamericanlobster&amp;display_name=Gfycat&amp;url=https%3A%2F%2Fgfycat.com%2Fpleasedmiserlyamericanlobster&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FPleasedMiserlyAmericanlobster-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="1840" height="1646" frameborder="0" scrolling="no"><a href="https://medium.com/media/120a72e68ea9b6a12882c8c083dad2d8/href">https://medium.com/media/120a72e68ea9b6a12882c8c083dad2d8/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fbiodegradableillegalchrysalis&amp;display_name=Gfycat&amp;url=https%3A%2F%2Fgfycat.com%2Fbiodegradableillegalchrysalis-excitement-yay-celebration-hooray-party&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FBiodegradableIllegalChrysalis-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="502" height="268" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8c35b0e54f0fdf942023122d37795d9/href">https://medium.com/media/a8c35b0e54f0fdf942023122d37795d9/href</a></iframe><p>You did it yay!! the <a href="https://github.com/kthirirania/my_wallet/tree/step_4">fourth</a> step contains all the work we have done check it out.<br>This was a little bit of a long article, I hope you learned something.</p><p>Keep coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e320a4995231" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>