<?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 Gerard Horgan on Medium]]></title>
        <description><![CDATA[Stories by Gerard Horgan on Medium]]></description>
        <link>https://medium.com/@gerard.horgan1?source=rss-8ef582c409f8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x_UNYNe0qGLsybEd4FBLCA.png</url>
            <title>Stories by Gerard Horgan on Medium</title>
            <link>https://medium.com/@gerard.horgan1?source=rss-8ef582c409f8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:39:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gerard.horgan1/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[Getting data from GoogleSheets and displaying it elegantly using the PaginatedDataTable class in…]]></title>
            <link>https://medium.com/@gerard.horgan1/getting-data-from-googlesheets-and-displaying-it-elegantly-using-the-paginateddatatable-class-in-cb54f4e41b28?source=rss-8ef582c409f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb54f4e41b28</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[google-sheets]]></category>
            <dc:creator><![CDATA[Gerard Horgan]]></dc:creator>
            <pubDate>Tue, 20 Nov 2018 20:27:32 GMT</pubDate>
            <atom:updated>2018-12-17T23:30:20.439Z</atom:updated>
            <content:encoded><![CDATA[<p>Getting data from GoogleSheets and displaying it elegantly using the PaginatedDataTable class in Flutter</p><p>In this blog, we’re going make an app where the data for the app originates in a googlesheet. We’re going to first convert our googlesheets file to json. Then we’re going hit an <a href="https://api.myjson.com/bins/j5xau"><strong>URL </strong></a>and download that <strong>JSON</strong> data and present it using a material design widget called PaginatedDataTable. We’re going to use data from the <a href="https://www.cso.ie/webserviceclient/DatasetListing.aspx">CSO</a> (the central statistics office of Ireland).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FlAze-LR6A_c&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DlAze-LR6A_c&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOktLAfJ2tow%2Fhqdefault.jpg%3Fsqp%3D-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ%3D%3D%26rs%3DAOn4CLBg3nEOuAq7_buZ59HSFlbejSEwXg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d3f534f839648f8dc48b0ddf9a82063/href">https://medium.com/media/6d3f534f839648f8dc48b0ddf9a82063/href</a></iframe><p>First of all I copied the “<a href="https://www.cso.ie/webserviceclient/JSON-stattotable.aspx?tableid=EY001">table</a>” data from the CSO and pasted it into googlesheets. I used a third party plugin for converting the data to json in googlesheets. You can check it out <a href="http://blog.pamelafox.org/2013/06/exporting-google-spreadsheet-as-json.html">here</a> (check out comments to freeze the top row!!….the column headers ). It returns an array of objects, which suits our needs.</p><p>Now over to Flutter.</p><p>Here are the methods for fetching the data and parsing the response.</p><pre>Future&lt;List&lt;Result&gt;&gt; fetchResults(http.Client client) <strong>async </strong>{<br>  <strong>final </strong>response = <strong>await </strong>client.get(&#39;https://api.myjson.com/bins/j5xau&#39;);<br><br>  // Use the compute function to run parseResults in a separate isolate<br>  <strong>return </strong>compute(parseResults, response.body);<br>}<br><br>// A function that will convert a response body into a List&lt;Result&gt;<br>List&lt;Result&gt; parseResults(String responseBody) {<br>  <strong>final </strong>parsed = json.decode(responseBody).cast&lt;Map&lt;String, <strong>dynamic</strong>&gt;&gt;();<br><br>  <strong>return </strong>parsed.map&lt;Result&gt;((json) =&gt; Result.fromJson(json)).toList();<br>}</pre><p>and here we implement those methods in a function called <em>getData(). You can call this class in the build method in a class.</em></p><pre>Future&lt;<strong>void</strong>&gt; getData() <strong>async </strong>{<br>  <strong>final </strong>results = <strong>await </strong>fetchResults(http.Client());<br>  <strong>if </strong>(!isLoaded) {<br>    setState(() {<br>      _resultsDataSource = ResultsDataSource(results);<br>      isLoaded = <strong>true</strong>;<br>    });<br>  }<br>}</pre><p>The Paginated class has a required field in it’s constructor called DataTableSource. And this is where the magic happens! We extend this class with <em>ResultsDataSource</em> and this class is used to populate the data table. Other properties of the PaginatedDataTable class include columns where we put the column names</p><pre>columns: &lt;DataColumn&gt;[<br>  DataColumn(<br>      label: <strong>const </strong>Text(&#39;Sex&#39;),<br>      onSort: (int columnIndex, bool ascending) =&gt; _sort&lt;String&gt;(<br>          (Result d) =&gt; d.sex, columnIndex, ascending)),<br>  DataColumn(<br>      label: <strong>const </strong>Text(&#39;Region&#39;),<br>      numeric: <strong>true</strong>,<br>      onSort: (int columnIndex, bool ascending) =&gt; _sort&lt;String&gt;(<br>          (Result d) =&gt; d.region, columnIndex, ascending)),<br>  DataColumn(<br>      label: <strong>const </strong>Text(&#39;Year&#39;),<br>      numeric: <strong>true</strong>,<br>      onSort: (int columnIndex, bool ascending) =&gt; _sort&lt;num&gt;(<br>          (Result d) =&gt; d.year, columnIndex, ascending))<br>etc..</pre><p>Have a look at this <a href="https://gist.github.com/horgag1/c4ce662e62d3a0a7ace0648697651dbe">gist</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb54f4e41b28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Expandable Lists in the Drawer]]></title>
            <link>https://medium.com/@gerard.horgan1/expandable-lists-in-the-drawer-3177fa338d6b?source=rss-8ef582c409f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3177fa338d6b</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Gerard Horgan]]></dc:creator>
            <pubDate>Wed, 24 Oct 2018 14:22:18 GMT</pubDate>
            <atom:updated>2018-10-24T14:53:04.870Z</atom:updated>
            <content:encoded><![CDATA[<h3>Expandable Lists in the Drawer (Flutter)</h3><p>The two main ways to control the navigation in a material design flutter app are tabs and the navigation drawer. Here we’ll look at the navigation drawer from material design.</p><p><strong>WHEN TO USE:</strong></p><p>Navigation drawers provide access to destinations and app functionality, such as switching accounts. They can either be permanently on-screen or controlled by a navigation menu icon. The specs for material design state a navigation drawer should be used when</p><ul><li>Apps with five or more top-level destinations</li><li>Apps with two or more levels of navigation hierarchy</li><li>Quick navigation between unrelated destinations</li></ul><p>For large apps with lots of different headings and sub headings a ExpansionTile within the drawer can be used to navigate to different parts of the app. Here is the headings and sub headings for the app.</p><pre>final List&lt;Entry&gt; data = &lt;Entry&gt;[<br>  Entry(<br>    &#39;Chapter A&#39;,<br>    &lt;Entry&gt;[<br>      Entry(<br>        &#39;Section A0&#39;,<br>        &lt;Entry&gt;[<br>          Entry(&#39;Item A0.1&#39;),<br>          Entry(&#39;Item A0.2&#39;),<br>          Entry(&#39;Item A0.3&#39;),<br>        ],<br>      ),<br>      Entry(&#39;Section A1&#39;),<br>      Entry(&#39;Section A2&#39;),<br>    ],<br>  ),<br>  Entry(<br>    &#39;Chapter B&#39;,<br>    &lt;Entry&gt;[<br>      Entry(&#39;Section B0&#39;),<br>      Entry(&#39;Section B1&#39;),<br>    ],<br>  ),<br>  Entry(<br>    &#39;Chapter C&#39;,<br>    &lt;Entry&gt;[<br>      Entry(&#39;Section C0&#39;),<br>      Entry(&#39;Section C1&#39;),<br>      Entry(<br>        &#39;Section C2&#39;,<br>        &lt;Entry&gt;[<br>          Entry(&#39;Item C2.0&#39;),<br>          Entry(&#39;Item C2.1&#39;),<br>          Entry(&#39;Item C2.2&#39;),<br>          Entry(&#39;Item C2.3&#39;),<br>        ],<br>      ),<br>    ],<br>  ),<br>];</pre><p>If we have no sub heading for a heading we’ll just return a ListTile</p><pre>Widget _buildTiles(Entry root) {<br>    if (root.children.isEmpty) return ListTile(title: Text(root.title));<br>    return ExpansionTile(<br>      key: PageStorageKey&lt;Entry&gt;(root),<br>      title: Text(root.title),<br>      children: root.children.map(_buildTiles).toList(),<br>    );<br>  }</pre><p>And the app with the drawer open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*ohny2mjT9sr53Q056XCO3g.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3177fa338d6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>