<?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 HIMANSHU SHARMA on Medium]]></title>
        <description><![CDATA[Stories by HIMANSHU SHARMA on Medium]]></description>
        <link>https://medium.com/@himanshusharma89?source=rss-5502f607931c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*RyXUKR6c2_Db-Gha2GVAbw.png</url>
            <title>Stories by HIMANSHU SHARMA on Medium</title>
            <link>https://medium.com/@himanshusharma89?source=rss-5502f607931c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 06:56:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@himanshusharma89/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[Deploy Flutter Web App to Azure App Service with Node.js]]></title>
            <link>https://medium.com/flutter-community/deploy-flutter-web-app-to-azure-app-service-with-node-js-b0781fc6def2?source=rss-5502f607931c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0781fc6def2</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[flutter-web]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[azure-app-service]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[HIMANSHU SHARMA]]></dc:creator>
            <pubDate>Mon, 29 Mar 2021 00:45:45 GMT</pubDate>
            <atom:updated>2021-03-29T00:45:45.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n4ApyU7OaNj7RNscj5C2cA.png" /><figcaption>Deploy Flutter Web App to Azure App Service with Node.js</figcaption></figure><p>Ever thought of deploying your Flutter Web App to Azure App Services? You must be thinking we have other resources to do it, so why?</p><blockquote>Hosting your web application using Azure App Service makes deploying and managing a web app much easier when compared to managing a physical server.</blockquote><p>Before starting, If you are new at Flutter Development, you can get started here: <a href="https://flutter.dev/docs/get-started/codelab">https://flutter.dev/docs/get-started/codelab</a></p><p><strong>In this article, you will:</strong></p><ol><li><strong>Use Flutter Web to create a starter web application</strong></li><li><strong>Use the Azure portal to create an Azure App Service web app</strong></li><li><strong>Deploy your web application to App Service web app</strong></li></ol><p><em>Let’s begin!</em></p><h4><strong>Use Flutter Web to create a starter web application</strong></h4><p>To create a new Flutter project with web support you need to run the following commands to use the beta channel and enable web support:</p><pre>flutter channel beta<br>flutter upgrade<br>flutter config --enable-web</pre><p>Now, you can <a href="https://flutter.dev/docs/get-started/test-drive?tab=vscode">create the project</a> as same as you do for other platforms.</p><p>Also, you need to generate a release build to deploy your web app, you can do so by the following command:</p><pre>flutter build web</pre><p>If you want to select between HTML or Canvaskit renderer, see <a href="https://flutter.dev/docs/development/tools/web-renderers">this</a>.</p><h4><strong>Use the Azure portal to create an Azure App Service web app</strong></h4><p>You might be wondering what is Azure App Service?</p><blockquote>It is a fully managed web application hosting platform. This platform as a service (PaaS) offered by Azure allows you to focus on designing and building your app while Azure takes care of the infrastructure to run and scale your applications.</blockquote><p>The first step in hosting your web application is to create a web app (an App Service app) inside your Azure subscription.</p><p>There are several ways you can create a web app but I’ll use the Azure portal.</p><p>Sign in to your <a href="https://portal.azure.com/learn.docs.microsoft.com">Azure portal</a>.</p><ol><li>On the Azure portal menu or from the Home page, select Create a resource. Everything you create on Azure is a resource.</li><li>The portal navigates you to the Marketplace page. From here, you can search for the resource you want to create or select one of the popular resources that people create in the Azure portal.</li><li>In the left navigation panel, select Web.</li><li>In the Search box, search for Web App. The Create Web App resource page appears. Select Create.</li><li>Enter the following values for each field on the Basics tab.</li></ol><ul><li>Subscription: <strong><em>Visual Studio Enterprise Subscription</em></strong>. The web app you are creating must belong to a resource group. Here, you select the Azure subscription to which the resource group belongs (or will belong, if you are creating it within the wizard).</li><li>Resource Group: From the dropdown, select the resource group to which the web app will belong (or will belong, if you are creating it within the wizard). All Azure resources must belong to a resource group.</li><li>Name: <strong><em>Enter a unique name</em></strong><em>. </em>The name of your web app. This name will be part of the app’s URL: <em>appname</em>.azurewebsites.net. The name you choose must be unique among all Azure web apps.</li><li>Publish: <strong><em>Code</em></strong>. The method you will use to publish your application. When publishing your application as code, you also must configure the Runtime stack to prepare your App Service resources to run your app.</li><li>Runtime stack: <strong><em>Node 12 LTS</em></strong>. The platform on which your application runs. Your choice may affect whether you have a choice of an operating system — for some runtime stacks, App Service supports only one operating system.</li></ul><blockquote><strong>Select Node 12 LTS, as you’ll deploy the Flutter web app as a Node.js server.</strong></blockquote><ul><li>Operating System: <strong><em>Linux</em></strong>. The operating system used on the virtual servers that run your app.</li><li>Region: <strong><em>Select Central India</em></strong><em>. </em>The geographical region from which your app will be hosted.</li><li>Linux Plan: <strong><em>Leave default</em></strong><em>. </em>The name of the App Service plan that will power your app. By default, the wizard will create a new plan in the same region as the web app.</li></ul><blockquote>Select <em>West US</em> or <em>Central US in Region for free App Service Plan</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*msWQJYkc8k5hixuC.png" /></figure><p>Select Review + Create to navigate to the review page, and to create the app, select Create.</p><h4>Preview your web app</h4><ol><li>After deployment completes for your app, select Go to the resource. The portal displays the web app overview page.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l44rju_9_ZeeLHhm.png" /></figure><ol><li>To preview your new web app’s default content, select its URL at the top right. The placeholder page that loads indicate that your web app is up and running and ready to receive deployment of your app’s code.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yE1d4zVEDZEKnmQS.png" /></figure><h4><strong>Deploy your web application to App Service web app</strong></h4><p>As I mentioned before, I’ll use Flutter Web with Node.js to deploy the web app.</p><blockquote>Note: I am not so familiar with Node 😅</blockquote><ul><li>Create a new directory with your web app name and <a href="https://expressjs.com/en/starter/generator.html">use the application generator tool, </a><a href="https://expressjs.com/en/starter/generator.html">express-generator, to quickly create an application skeleton</a>.</li></ul><pre>$ npm install -g express-generator<br>$ express</pre><ul><li>Remove the public, routes, and view folder and create a folder in the root public-flutter which will contain the generated release build of Flutter Web from the previous step. You can find the release build in build\web .</li><li>Now replace the path from public to public-flutter in app.js and debug the node application. You’ll see the flutter web app being deployed locally.</li></ul><blockquote>Note: It is not mandatory to use public-flutter, you can use the default public folder also.</blockquote><p>Now, I need to deploy the code to App Service. Azure supports automated deployment and provides you with a lot of options but I’ll use GitHub with Azure Portal. So push your code to your GitHub before deployment.</p><ul><li>Go to your Azure App Service web app on Azure Portal from the previous step and select Deployment center in the left panel.</li><li>Select the GitHub, then authorize Azure App Service.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Px_0OsMPp2tk0xh_.png" /></figure><ul><li>For GitHub, on the Build provider page, select App Service build service: GitHub Action.</li><li>Configure the build provider: In the Code section, select the Organization, Repository, and Branch in which you pushed the code previously and select Continue.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VM2nintjRC_5r1pd.png" /></figure><ul><li>After you configure the build provider, review the settings on the Summary page, and then select Finish.</li></ul><p>After this, It’ll automatically create SECRETS and GitHub Action workflow in your repository and deploy the web app. Later, you just need to push the changes in the repo and it’ll deploy your app.</p><h4>And you are done! Your Flutter Web App is now deployed to Azure App Service using Node.js. 🎉</h4><p>Check my deployed web app: <a href="https://100daysofflutter.azurewebsites.net/">https://100daysofflutter.azurewebsites.net/</a></p><p>Source Code:</p><p><a href="https://github.com/himanshusharma89/100DaysOfFlutter">himanshusharma89/100DaysOfFlutter</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3og0IAQG2BtR13joe4%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3og0IAQG2BtR13joe4%2Fgiphy.mp4&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3og0IAQG2BtR13joe4%2Fgiphy-downsized-large.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="241" frameborder="0" scrolling="no"><a href="https://medium.com/media/421cec7ddcedba35237828ad44017375/href">https://medium.com/media/421cec7ddcedba35237828ad44017375/href</a></iframe><blockquote>Thank you for reading, if you enjoyed the article make sure to give a clap (👏)! You can connect with me on <a href="https://twitter.com/_SharmaHimanshu">Twitter</a>, <a href="https://www.linkedin.com/in/himanshusharma89/">LinkedIn</a> and find some of my work on <a href="https://github.com/himanshusharma89">GitHub</a> and <a href="https://codepen.io/himanshusharma89">Codepen</a>. And for more such articles you can support me by buying me a coffee</blockquote><figure><a href="https://www.buymeacoffee.com/himanshusharma"><img alt="" src="https://cdn-images-1.medium.com/max/170/0*rCdGUnW46ksbN5qw.png" /></a></figure><h4>If you liked this article, here are some other articles you may enjoy:</h4><ul><li><a href="https://medium.com/flutter-community/flutter-how-to-scroll-an-expansiontile-when-it-is-expanded-ad706cfb80a6">Flutter: How to scroll an ExpansionTile when it is expanded?</a></li><li><a href="https://medium.com/flutter-community/flutter-firebase-github-authentication-990fe8731d9e">Flutter: Firebase GitHub Authentication</a></li><li><a href="https://medium.com/flutter-community/flutter-sharing-files-using-share-package-45103d7a21cb">Flutter: Sharing files using share package</a></li></ul><h4><strong>Reference:</strong></h4><ul><li><a href="https://docs.microsoft.com/en-us/learn/modules/host-a-web-app-with-azure-app-service/">Host a web application with Azure App Service - Learn</a></li><li><a href="https://blog.logrocket.com/flutter-web-app-node-js/">Running a Flutter web app and API on Node.js - LogRocket Blog</a></li><li><a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment">Configure continuous deployment - Azure App Service</a></li></ul><p>Follow Flutter Community on Twitter for everything happening in the 🌎 of Flutter: <a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0781fc6def2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/deploy-flutter-web-app-to-azure-app-service-with-node-js-b0781fc6def2">Deploy Flutter Web App to Azure App Service with Node.js</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter: How to scroll an ExpansionTile when it is expanded?]]></title>
            <link>https://medium.com/flutter-community/flutter-how-to-scroll-an-expansiontile-when-it-is-expanded-ad706cfb80a6?source=rss-5502f607931c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad706cfb80a6</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[expansion]]></category>
            <category><![CDATA[expansiontile]]></category>
            <category><![CDATA[collapse]]></category>
            <dc:creator><![CDATA[HIMANSHU SHARMA]]></dc:creator>
            <pubDate>Tue, 01 Dec 2020 09:01:47 GMT</pubDate>
            <atom:updated>2020-12-01T09:01:47.492Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nYjkEGRArPyZGGGTCjsWaA.gif" /></figure><p>Hi, in this article, I’ll focus on ExpansionTile and how you can use it in your app or web app. If you are not familiar with ExpansionTile, you can check my previous article on it:</p><p><a href="https://medium.com/flutter-community/flutter-expansion-collapse-view-fde9c51ac438">Flutter: Expansion/Collapse view</a></p><p><em>Let’s begin!</em></p><p>So, I need a way to scroll my ExpansionTile up automatically so that the user doesn’t have to do it manually to see its content.</p><p>Currently, I have to manually scroll up:</p><figure><img alt="Default ExpansionTile" src="https://cdn-images-1.medium.com/max/398/1*cnaMyy9RmH3_vP2dH2mJsA.gif" /></figure><p>For the above example, I have used ListView(without any constraints) that will contain the ExpansionTiles.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d1cca78a4f6a2628a9667ff61f30e8d/href">https://medium.com/media/5d1cca78a4f6a2628a9667ff61f30e8d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b824854bbf567c2a6298c2bafb7ea767/href">https://medium.com/media/b824854bbf567c2a6298c2bafb7ea767/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36188a084362c105216bc9d4908e85f6/href">https://medium.com/media/36188a084362c105216bc9d4908e85f6/href</a></iframe><p>To automate the process of the scroll in ExpansionTile, I need to know:</p><h4>1. How much I need to scroll after expansion?</h4><p>In this particular case, I do not know how many pixels the ExpansionTile height will take or what will be its context after expansion. So, we can use a GlobalKey and then check its current context at runtime to make it visible later.</p><p>I’ll use the key property to get the current context of the ExpansionTile.</p><pre>//..<br>final GlobalKey expansionTileKey = GlobalKey();<br>//..</pre><p>And the onExpansionChanged property to check the expansion status.</p><pre>//..<br>  key: expansionTileKey,<br>  onExpansionChanged: (value) {<br>    if (value) { // Checking expansion status</pre><pre>    }<br>  },<br>//..</pre><h4>2. How to scroll after getting the context?</h4><p>I will use Scrollable widget to make the current context visible after expansion. As the name suggests, it is a widget that scrolls.</p><p><a href="https://api.flutter.dev/flutter/widgets/Scrollable-class.html">Scrollable class</a></p><p>I created a private function _scrollToSelectedContent which will receive the key and scroll the widget with a duration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d29b8396893801b1b2b874a2389ee0dd/href">https://medium.com/media/d29b8396893801b1b2b874a2389ee0dd/href</a></iframe><blockquote>Here, I am checking whether the current context is null. If it isn’t, I delayed the Scrollable widget. The ExpansionTile’s expansion animation takes 200ms to show the content, as shown in its definition: const Duration _kExpand = Duration(milliseconds: 200); therefore it is a good idea to wait for expansion animation to finish before starting scrolling so you can get the updated context.</blockquote><p>You can also add the curve and alignment to the way of the scroll.</p><p>Now I will call this function within the onExpansionChanged property and pass the key:</p><pre>//..<br>  key: expansionTileKey,<br>  onExpansionChanged: (value) {<br>     if (value) {<br>       _scrollToSelectedContent(expansionTileKey: expansionTileKey);<br>     }<br>  },<br>//..</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56513b40cd08634d74c4f769e0368646/href">https://medium.com/media/56513b40cd08634d74c4f769e0368646/href</a></iframe><p>And I am done! After this, my ExpansionTile will auto-scroll to display its content:</p><figure><img alt="Auto-scroll ExpansionTile" src="https://cdn-images-1.medium.com/max/420/1*syP2BEIEb5UnRY-ZP3iwUw.gif" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FXreQmk7ETCak0%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FXreQmk7ETCak0%2Fgiphy.mp4&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FXreQmk7ETCak0%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc1f85c0fca987a128709ab408ed6072/href">https://medium.com/media/dc1f85c0fca987a128709ab408ed6072/href</a></iframe><blockquote><em>Thank you for reading, if you enjoyed the article make sure to give a clap (👏)! You can connect with me on </em><a href="https://twitter.com/_SharmaHimanshu"><em>Twitter</em></a><em>, </em><a href="https://www.linkedin.com/in/himanshusharma89/"><em>LinkedIn</em></a><em> and find some of my work on </em><a href="https://github.com/himanshusharma89"><em>GitHub</em></a><em> and </em><a href="https://codepen.io/himanshusharma89"><em>Codepen</em></a><em>. And for more such articles you can support me by buying me a coffee</em></blockquote><figure><a href="https://www.buymeacoffee.com/himanshusharma"><img alt="" src="https://cdn-images-1.medium.com/max/170/0*4kOzcK-M0VGyttoN.png" /></a><figcaption>Buy me a coffee for more articles</figcaption></figure><h4>If you liked this article, here are some other articles you may enjoy:</h4><ul><li><a href="https://medium.com/flutter-community/flutter-firebase-github-authentication-990fe8731d9e">Flutter: Firebase GitHub Authentication</a></li><li><a href="https://medium.com/flutter-community/flutter-sharing-files-using-share-package-45103d7a21cb">Flutter: Sharing files using share package</a></li><li><a href="https://medium.com/flutter-community/how-to-create-card-carousel-in-flutter-979bc8ecf19">How to create Card Carousel in Flutter?</a></li></ul><p><strong>Reference:</strong></p><p><a href="https://stackoverflow.com/q/54829431/11545939">How to scroll an ExpansionTile / Listview when a tile is expanded?</a></p><p>Follow Flutter Community on Twitter for everything happening in the 🌎 of Flutter: <a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad706cfb80a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/flutter-how-to-scroll-an-expansiontile-when-it-is-expanded-ad706cfb80a6">Flutter: How to scroll an ExpansionTile when it is expanded?</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter: Firebase GitHub Authentication]]></title>
            <link>https://medium.com/flutter-community/flutter-firebase-github-authentication-990fe8731d9e?source=rss-5502f607931c------2</link>
            <guid isPermaLink="false">https://medium.com/p/990fe8731d9e</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[HIMANSHU SHARMA]]></dc:creator>
            <pubDate>Sat, 19 Sep 2020 01:49:26 GMT</pubDate>
            <atom:updated>2020-09-19T01:49:26.675Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*djZYLkTJQD56wrc8PHw6Aw.png" /><figcaption>Firebase GitHub Authentication</figcaption></figure><p>Ever thought of how to implement GitHub Authentication with Firebase in your Flutter Project? In this article, I’ll show you how to implement it. This article is inspired by this article:</p><p><a href="https://medium.com/flutter-community/implementing-firebase-github-authentication-in-flutter-1c49a172c648">Implementing Firebase GitHub Authentication in Flutter</a></p><p>Although the above article have a good explanation, but I faced the issue with deep links and it does not have a source code. That is why I am writing this article.</p><p>Before starting, If you are new at Flutter Development, you can get started here: <a href="https://flutter.dev/docs/get-started/codelab">https://flutter.dev/docs/get-started/codelab</a></p><p>If you have successfully created the app then <a href="https://firebase.google.com/docs/flutter/setup?platform=android"><strong>Add Firebase to your Flutter app</strong>.</a></p><p>I suppose you have already done the above step, so let’s begin. These are the steps that I will be covering up:</p><ol><li><strong>Create an OAuth app on GitHub</strong></li><li><strong>Enable GitHub Sign-in provider in Firebase console</strong></li><li><strong>Deep links (Android) and Custom URL schemes</strong> (<strong>iOS)</strong></li><li><strong>Coding ( Launch GitHub login on the browser and Handling the incoming data after successful login)</strong></li></ol><h4>1. Create an OAuth app on GitHub:</h4><p>For GitHub Authentication, you need to <a href="https://github.com/settings/applications/new"><strong>register a new OAuth application</strong></a>. Fill up all the required fields and in the <strong>Authorization callback URL </strong>field, you need to enter the authorization callback URL <em>(e.g. my-app-12345.firebaseapp.com/__/auth/handler)</em> when you enable the GitHub Sign-in provider in the Firebase console in the next step. After successfully registering your app, you will get the <strong>Client ID</strong> and <strong>Client Secret.</strong></p><blockquote>The Client ID and Client Secret will be used in the next step when we enable the GitHub Sign-in provider in Firebase Console. And the authorization callback URL will be used to set up deep links configuration later.</blockquote><h4>2. Enable GitHub Sign-in provider in Firebase console:</h4><p>In the Firebase console, open the Authentication section. On the Sign-in method tab, enable the GitHub provider. Add the Client ID and Client Secret from the previous step:</p><blockquote>Make sure your Firebase OAuth redirect URI (e.g. my-app-12345.firebaseapp.com/__/auth/handler) is set as your Authorization callback URL as mentioned in the previous setup.</blockquote><p>Add the dependency for the Firebase Authentication Android library to your module (app-level) Gradle file (usually app/build.gradle):</p><pre>implementation ‘com.google.firebase:firebase-auth:19.3.2’</pre><blockquote>If you haven’t yet specified your app’s SHA-1 fingerprint, do so from the <a href="https://console.firebase.google.com/project/_/settings/general/?authuser=0">Settings page</a> of the Firebase console.</blockquote><h4>3. <strong>Deep links (Android) and Custom URL schemes</strong> (<strong>iOS):</strong></h4><p><em>These links are simply web-browser-like-links that activate your app and may contain information that you can use to load specific section of the app or continue certain user activity from a website (or another app).</em></p><p>In this step, I’ll consider <em>my-app-12345.firebaseapp.com/__/auth/handler </em>as Authorization callback URL</p><p><strong>For Android:<br></strong>Add the following intent filter to the <em>AndroidManifest.xml</em> file located under <em>/android/app/src/main</em> directory:</p><pre><em>&lt;!-- Deep Links --&gt;</em><br>&lt;intent-filter&gt;<br>  &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;<br>  &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;<br>  &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;<br>  <em>&lt;!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST --&gt;</em><br>  &lt;data<br>    android:scheme=&quot;[YOUR_SCHEME]&quot;<br>    android:host=&quot;[YOUR_HOST]&quot; /&gt;<br>&lt;/intent-filter&gt;</pre><p>The YOUR_SCHEME and YOUR_HOST in my case will be: https and my-app-12345.firebaseapp.com</p><p>So the intent filter will look like this:</p><pre>&lt;intent-filter&gt;<br>   &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;<br>   &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;<br>   &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;<br>   &lt;!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST --&gt;<br>   &lt;data<br>     android:scheme=&quot;https&quot;<br>     android:host=&quot;my-app-12345.firebaseapp.com&quot; /&gt;<br>&lt;/intent-filter&gt;</pre><p><strong>For iOS:<br></strong>Add the following attributes into <em>Info.plist</em> file located under <em>/ios/Runner</em> directory:</p><pre>&lt;?xml ...&gt;<br>&lt;!-- ... other tags --&gt;<br>&lt;plist&gt;<br>&lt;dict&gt;<br>  &lt;!-- ... other tags --&gt;<br>  &lt;key&gt;CFBundleURLTypes&lt;/key&gt;<br>  &lt;array&gt;<br>    &lt;dict&gt;<br>      &lt;key&gt;CFBundleTypeRole&lt;/key&gt;<br>      &lt;string&gt;Editor&lt;/string&gt;<br>      &lt;key&gt;CFBundleURLName&lt;/key&gt;<br>      &lt;string&gt;[ANY_URL_NAME]&lt;/string&gt;<br>      &lt;key&gt;CFBundleURLSchemes&lt;/key&gt;<br>      &lt;array&gt;<br>        &lt;string&gt;[YOUR_SCHEME]&lt;/string&gt;<br>      &lt;/array&gt;<br>    &lt;/dict&gt;<br>  &lt;/array&gt;<br>  &lt;!-- ... other tags --&gt;<br>&lt;/dict&gt;<br>&lt;/plist&gt;</pre><p>The YOUR_SCHEME and ANY_URL_NAME in my case will be: https and my-app-12345.firebaseapp.com</p><p>So the attributes will be this:</p><pre>&lt;array&gt;<br>  &lt;dict&gt;<br>   &lt;key&gt;CFBundleTypeRole&lt;/key&gt;<br>   &lt;string&gt;Editor&lt;/string&gt;<br>   &lt;key&gt;CFBundleURLName&lt;/key&gt;<br>   &lt;string&gt;my-app-12345.firebaseapp.com&lt;/string&gt;<br>   &lt;key&gt;CFBundleURLSchemes&lt;/key&gt;<br>   &lt;array&gt;<br>    &lt;string&gt;https&lt;/string&gt;<br>   &lt;/array&gt;<br>  &lt;/dict&gt;<br>&lt;/array&gt;</pre><blockquote>Note: I cannot test the Custom URL schemes for iOS as I am Windows user and cannot use Xcode, but let me know if you find any issue with it.</blockquote><h4><strong>4. Coding:</strong></h4><p>Here comes the most exciting part.</p><p>Add the following dependencies in your app.</p><pre><strong>firebase_core</strong>: ^0.5.0<br><strong>firebase_auth</strong>: ^0.18.0+1<br><strong>url_launcher</strong>: ^5.5.2<br><strong>uni_links</strong>: ^0.4.0</pre><blockquote>Note: A lot of changes has occurred since the latest firebase packages update, so make sure to look into the new changes, I’ll cover a few of them here.</blockquote><p>First of all, add your Client ID and Client Secret in a file called secret_keys.dart. You will use these keys may times.</p><pre>library secretkeys;</pre><pre>const GITHUB_CLIENT_ID = &quot;client_id&quot;;<br>const GITHUB_CLIENT_SECRET = &quot;client_secret&quot;;</pre><p>Now, create a function onClickGitHubLoginButton() in your login screen</p><pre><strong>import</strong> &#39;secret_keys.dart&#39; as <strong>SecretKey</strong>;<br><strong>import</strong> &#39;package:url_launcher/url_launcher.dart&#39;;</pre><pre>//..</pre><pre><strong>void</strong> onClickGitHubLoginButton() <strong>async</strong> {<br>  <strong>const</strong> String url = &quot;<a href="https://github.com/login/oauth/authorize"><strong>https://github.com/login/oauth/authorize</strong></a>&quot; +<br>        &quot;?client_id=&quot; + <strong>SecretKey.GITHUB_CLIENT_ID</strong> +<br>        &quot;&amp;scope=public_repo%20read:user%20user:email&quot;;</pre><pre>  if (<strong>await</strong> canLaunch(url)) {<br>      <strong>await</strong> <strong>launch</strong>(<br>        url,<br>        forceSafariVC: <strong>false</strong>,<br>        forceWebView: <strong>false</strong>,<br>      );<br>    } else {<br>      print(&quot;CANNOT LAUNCH THIS URL!&quot;);<br>    }<br>  }</pre><p>This will open up the browser for GitHub sign-in, you have to log in with your credentials.</p><p>After successfully logging in, you will get redirected to an URL like <a href="https://my-app-12345.firebaseapp.com/__/auth/handler?code=AUTHENTICATION_CODE"><em>https://my-app-12345.firebaseapp.com/__/auth/handler?code=AUTHENTICATION_CODE</em></a><em> </em>, this URL will be caught by the app as you have already configured Deep Link in your app in previous step and you will be redirected back to the app (or prompted to be redirected). The <em>AUTHENTICATION_CODE</em> is required for successful log in.<em> </em>For handling the incoming data or parse the URL to get the <em>AUTHENTICATION_CODE,</em> check the following code:</p><pre>final <strong>AuthService authService</strong> = AuthService();</pre><pre>//..</pre><pre><strong>StreamSubscription</strong> _subs;</pre><pre>@override<br>void initState() {<br>  <strong>_initDeepLinkListener</strong>();<br>  super.initState();<br>}</pre><pre>@override<br>void dispose() {<br>  <strong>_disposeDeepLinkListener</strong>();<br>  super.dispose();<br>}</pre><pre>void <strong>_initDeepLinkListener</strong>() async {<br>  _subs = <strong>getLinksStream</strong>().listen((String link) {<br>    <strong>_checkDeepLink</strong>(link);<br>  }, cancelOnError: true);<br>}</pre><pre>void <strong>_checkDeepLink</strong>(String link) {<br>  if (link != null) {<br>    String code = link.substring(link.indexOf(RegExp(&#39;code=&#39;)) + 5);<br>    <strong>authService</strong>.<strong>loginWithGitHub</strong>(code)<br>      .then((firebaseUser) {<br>        print(firebaseUser.email);<br>        print(firebaseUser.photoURL);<br>        print(&quot;LOGGED IN AS: &quot; + firebaseUser.displayName);<br>      }).catchError((e) {<br>        print(&quot;LOGIN ERROR: &quot; + e.toString());<br>      });<br>  }<br>}</pre><pre>void <strong>_disposeDeepLinkListener</strong>() {<br>  if (_subs != null) {<br>    _subs.cancel();<br>    _subs = null;<br>  }<br>}</pre><pre>//..</pre><p>In the above code, you have <strong>_initDeepLinkListener()</strong> in initState() which is listening to the link with <strong>getLinksStream()</strong> and pass it to <strong>_checkDeepLink()</strong> to get the <em>AUTHENTICATION_CODE.</em></p><p>The _checkDeepLink() later pass the “code” in the <strong>loginWithGitHub() </strong>which is a method from a different class named <strong>AuthService. </strong>Your login screen is implemented now, so you will create the class AuthService:</p><pre><strong>import </strong>&#39;dart:convert&#39;;<br><strong>import</strong> &#39;package:http/http.dart&#39; as <strong>http</strong>;<br><strong>import</strong> &#39;package:firebase_github_authentication/secret_keys.dart&#39; as <strong>SecretKey</strong>;</pre><pre><strong>import</strong> &#39;package:firebase_auth/firebase_auth.dart&#39; as <strong>auth</strong>;<br><strong>import</strong> &#39;package:firebase_github_authentication/model/github_login_request.dart&#39;;<br><strong>import</strong> &#39;package:firebase_github_authentication/model/github_login_response.dart&#39;;</pre><pre>class <strong>AuthService</strong>{</pre><pre>final auth.FirebaseAuth <strong>_firebaseAuth</strong> = auth.FirebaseAuth.instance;</pre><pre>Future&lt;auth.User&gt; <strong>loginWithGitHub</strong>(String code) <strong>async</strong> {<br>    //ACCESS TOKEN REQUEST<br>    final <strong>response </strong>= <strong>await</strong> http.post(<br>      &quot;<a href="https://github.com/login/oauth/access_token">https://github.com/login/oauth/access_token</a>&quot;,<br>      headers: {<br>        &quot;Content-Type&quot;: &quot;application/json&quot;,<br>        &quot;Accept&quot;: &quot;application/json&quot;<br>      },<br>      body: jsonEncode(<strong>GitHubLoginRequest</strong>(<br>        clientId: SecretKey.GITHUB_CLIENT_ID,<br>        clientSecret: SecretKey.GITHUB_CLIENT_SECRET,<br>        code: code,<br>      )),<br>    );</pre><pre><strong>GitHubLoginResponse</strong> <strong>loginResponse</strong> = GitHubLoginResponse.<strong>fromJson</strong>(json.decode(response.body));</pre><pre>//FIREBASE SIGNIN<br>    final auth.AuthCredential <strong>credential</strong> = auth.GithubAuthProvider.<strong>credential</strong>(loginResponse.accessToken);<br>    <br>    final <strong>auth</strong>.<strong>User</strong> <strong>user</strong> = (await _firebaseAuth.<strong>signInWithCredential</strong>(credential)).user;<br>    return user;<br>  }<br>}</pre><p>In the above code, you have defined the FirebaseAuth.instance as _firebaseAuth and you are requesting for an access token by sending an HTTP POST call to the specified URL, whose request body contains the “code” you have sent in from the Login screen, along with the client ID and client secret.</p><p>Then, you are decoding the response body and using the access token to get the credentials and passing it to _firebaseAuth.signInWithCredential() to sign in to Firebase</p><p>Here are the <strong>GitHubLoginResponse </strong>and <strong>GitHubLoginRequest </strong>models that you used:</p><pre>class <strong>GitHubLoginResponse</strong> {<br>  String accessToken;<br>  String tokenType;<br>  String scope;</pre><pre><strong>GitHubLoginResponse</strong>({this.accessToken, this.tokenType, this.scope});</pre><pre>factory <strong>GitHubLoginResponse</strong>.<strong>fromJson</strong>(Map&lt;String, dynamic&gt; json) =&gt;<br>      GitHubLoginResponse(<br>        accessToken: json[&quot;access_token&quot;],<br>        tokenType: json[&quot;token_type&quot;],<br>        scope: json[&quot;scope&quot;],<br>      );<br>}</pre><pre>class <strong>GitHubLoginRequest</strong> {<br>  String clientId;<br>  String clientSecret;<br>  String code;</pre><pre><strong>GitHubLoginRequest</strong>({this.clientId, this.clientSecret, this.code});</pre><pre>dynamic <strong>toJson</strong>() =&gt; {<br>        &quot;client_id&quot;: clientId,<br>        &quot;client_secret&quot;: clientSecret,<br>        &quot;code&quot;: code,<br>      };<br>}</pre><p>If you are logged in successfully, you should have a <strong>User </strong>(previously FirebaseUser) object in your hands.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3otPoS81loriI9sO8o%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Ffilmeditor-will-ferrell-elf-3otPoS81loriI9sO8o&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2F3otPoS81loriI9sO8o%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/aea9d0db722893f74633627304b71152/href">https://medium.com/media/aea9d0db722893f74633627304b71152/href</a></iframe><h4>Conclusion</h4><p>Now you are logged into Firebase with your GitHub account! I hope you learned something new from this article.</p><p>Here is the GitHub repository for this project:</p><p><a href="https://github.com/himanshusharma89/firebase-github-authentication">himanshusharma89/firebase-github-authentication</a></p><blockquote><strong>Thank you for reading, if you enjoyed the article make sure to give a clap (👏)! </strong>You can connect with me on <a href="https://twitter.com/_SharmaHimanshu">Twitter</a>, <a href="https://www.linkedin.com/in/himanshusharma89/">LinkedIn</a> and find some of my work on <a href="https://github.com/himanshusharma89">GitHub</a> and <a href="https://codepen.io/himanshusharma89">Codepen</a>. <strong>And for more such articles you can support me by buying me a coffee:</strong></blockquote><figure><a href="https://www.buymeacoffee.com/himanshusharma"><img alt="If you like the article buy me a coffee" src="https://cdn-images-1.medium.com/max/170/1*Dpw8-hNGI2fDmosV4E8DVQ.png" /></a><figcaption>Buy me a coffee for more articles</figcaption></figure><h4><strong>If you liked this article, here are some other articles you may enjoy:</strong></h4><ul><li><a href="https://medium.com/flutter-community/flutter-sharing-files-using-share-package-45103d7a21cb">Flutter: Sharing files using share package</a></li><li><a href="https://medium.com/flutter-community/flutter-expansion-collapse-view-fde9c51ac438">Flutter: Expansion/Collapse view</a></li><li><a href="https://medium.com/flutter-community/how-to-create-card-carousel-in-flutter-979bc8ecf19">How to create Card Carousel in Flutter?</a></li></ul><p><strong>References</strong>:</p><ul><li><a href="https://pub.dev/packages/uni_links">uni_links | Flutter package</a></li><li><a href="https://firebase.google.com/docs/auth/android/github-auth">Authenticate Using GitHub on Android | Firebase</a></li></ul><p><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=990fe8731d9e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/flutter-firebase-github-authentication-990fe8731d9e">Flutter: Firebase GitHub Authentication</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter: Sharing files using share package]]></title>
            <link>https://medium.com/flutter-community/flutter-sharing-files-using-share-package-45103d7a21cb?source=rss-5502f607931c------2</link>
            <guid isPermaLink="false">https://medium.com/p/45103d7a21cb</guid>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[share]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[HIMANSHU SHARMA]]></dc:creator>
            <pubDate>Fri, 07 Aug 2020 16:01:01 GMT</pubDate>
            <atom:updated>2020-08-07T16:01:01.054Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYEeP4zOBXIeJQqqoAnBmg.gif" /></figure><p>In this article, we will implement the sharing files feature using the share package. Yes, you read it right. But you might be thinking it only supports text share, so how do we do it? and we already have other packages for that.</p><p>We’ll use a modified version of the share package for sharing files. And about the already available packages, we have few issues with these packages like, we cannot share a File which we call from a network (like converting an image URL into an image file and then sharing it).</p><p>Before starting, If you are new at Flutter Development, you can get started here: <a href="https://flutter.dev/docs/get-started/codelab">https://flutter.dev/docs/get-started/codelab</a></p><p>If you are wondering what is this modified share package, check it here: <a href="https://github.com/flutter/plugins/pull/1423">https://github.com/flutter/plugins/pull/1423</a></p><blockquote><strong>Note</strong>: It’s better to fork the above repository and use it. So that we won’t face an issue like the owner changing the files.</blockquote><p>Now let’s begin. I’ll implement two logic for sharing files</p><ul><li><strong>Capturing the current screen and sharing that screenshot on a single tap.</strong></li><li><strong>Converting the image URL to an image file and share it with a single tap.</strong></li></ul><p>First of all, create two buttons in your app which will call the above two logics and do our work:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d35996f5df4fbd3d75bcf12dc5a57162/href">https://medium.com/media/d35996f5df4fbd3d75bcf12dc5a57162/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*ydWDDouqsgh-JfBOY4hZHA.png" /><figcaption>Home Screen</figcaption></figure><p>So let’s begin.</p><h3><strong>Screenshot + Share</strong></h3><p>In this logic, we will capture the current screen, save it as an image file in the device and then Share that file by providing its directory path. <br>So we need <a href="https://pub.dev/packages/path_provider">path_provider</a> package for storing the image in the device.</p><p>Let’s look into the code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1685853820debb060173835c656ca854/href">https://medium.com/media/1685853820debb060173835c656ca854/href</a></iframe><blockquote>We are performing Exception Handling before implementing the above logic. Why? because we can possibly face a PlatformException with iOS platform (because of its restrictions).</blockquote><ul><li>You need to wrap your Scaffold widget with RepaintBoundary as a parent and provide key to it because it creates a separate display list for its child. And in this method, we are using RenderRepaintBoundary to use the key and get the current context and build a separate display.</li></ul><pre>static GlobalKey previewContainer = GlobalKey();</pre><ul><li>We need import ‘dart:ui’ as ui so that we can convert the boundary into an image.</li><li>Now we need to get storage location path to save the image, for that we are using path_provider package.</li><li>Then we are converting the image into byte array and providing a format of the image(in our case we have .png). And later we are converting the above bytes into Uint8List, and then writing it in the imgFile.</li></ul><blockquote>If you are unable to take a screenshot you can add the below code in the method. This issue usually occurs when RenderRepaintBoundary doesn’t work properly.</blockquote><pre>if (boundary.debugNeedsPaint) {<br>  Timer(Duration(seconds: 1), () =&gt; _screenShot());<br>  return null;<br>}</pre><ul><li>And finally, we are now sharing the imgFile using Share.shareFile by providing the location of storage. If you face issue in adding the package you can do it like this:</li></ul><pre>share:<br>    git:<br>      url: git://github.com/himanshusharma89/plugins.git<br>      path: packages/share</pre><p>This feature can be used to share reports, data, or charts as a screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*SHYzBO2VztutLi7rlaMWqw.gif" /><figcaption>Screenshot and Share</figcaption></figure><h3>Conversion + Share</h3><p>In this logic, we will get and convert the image from a URL to an image file, save it in the device and then Share it as we did it earlier. Also in this method, the <a href="https://pub.dev/packages/http">http</a> package is required.</p><p>Here’s the code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15a5688a697314cabfd1c25c10b1340f/href">https://medium.com/media/15a5688a697314cabfd1c25c10b1340f/href</a></iframe><ul><li>In this method we have an image URL, we are using the get method to store it in a variable. And then proceeding with the same steps as before.</li><li>But in this case, we are writing response.bodyBytes as bytes.</li><li>And finally we are sharing the file with the Share.shareFile().</li></ul><p>This feature can be used to share images from an API call, like sharing an individual product image with a share button/icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*BBo6EAIiNW-TGTSRioDSbA.gif" /><figcaption>URL conversion and Share</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FicPn4EwqNpAsZQmInZ%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmailchimp-complete-task-icPn4EwqNpAsZQmInZ&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FicPn4EwqNpAsZQmInZ%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/67c4f87dd906b7f6900383a721b9542b/href">https://medium.com/media/67c4f87dd906b7f6900383a721b9542b/href</a></iframe><h4>If you like this article, give a clap! or you can:</h4><figure><a href="https://www.buymeacoffee.com/himanshusharma"><img alt="If you like the article buy me a coffee" src="https://cdn-images-1.medium.com/max/170/1*Dpw8-hNGI2fDmosV4E8DVQ.png" /></a></figure><p><strong>Source Code:</strong> <a href="https://github.com/himanshusharma89/sharefiles"><strong>https://github.com/himanshusharma89/sharefiles</strong></a></p><h4>If you liked this article, here are some other articles you may enjoy:</h4><ul><li><a href="https://medium.com/flutter-community/flutter-expansion-collapse-view-fde9c51ac438">Flutter: Expansion/Collapse view</a></li><li><a href="https://medium.com/flutter-community/how-to-create-card-carousel-in-flutter-979bc8ecf19">How to create Card Carousel in Flutter?</a></li></ul><p><strong>Connect with me:</strong> <a href="https://github.com/himanshusharma89"><strong>GitHub </strong></a><strong>, </strong><a href="https://twitter.com/_SharmaHimanshu"><strong>Twitter</strong></a><strong>, </strong><a href="https://www.linkedin.com/in/himanshusharma89/"><strong>LinkedIn</strong></a></p><p><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45103d7a21cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/flutter-sharing-files-using-share-package-45103d7a21cb">Flutter: Sharing files using share package</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter: Expansion/Collapse view]]></title>
            <link>https://medium.com/flutter-community/flutter-expansion-collapse-view-fde9c51ac438?source=rss-5502f607931c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fde9c51ac438</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[expansiontile]]></category>
            <category><![CDATA[expansionpanel]]></category>
            <dc:creator><![CDATA[HIMANSHU SHARMA]]></dc:creator>
            <pubDate>Wed, 15 Apr 2020 18:58:21 GMT</pubDate>
            <atom:updated>2020-12-02T05:58:19.840Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swL1MjJ3u_Bx-KMYJtxxJw.gif" /></figure><p>In many application, you have seen an expansion or a collapsed view like the above.</p><p>There are two ways of creating an expandable view in Flutter :</p><ol><li><strong>ExpansionTile</strong></li><li><strong>ExpansionPanelList &amp; ExpansionPanel</strong></li></ol><p>So let’s start implementing it. First, you need to create a new flutter project with your IDE. If you are facing an error check this: <a href="https://flutter.dev/docs/get-started/codelab">Write your first Flutter app</a>.</p><p>After creating your project delete everything within your <strong>main.dart</strong> file and write this:</p><pre>import &#39;package:flutter/material.dart&#39;;</pre><pre>void main() {<br>  runApp(MyApp());<br>}</pre><pre>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      title: &#39;Flutter Expansion View&#39;,<br>      theme: ThemeData(<br>        primarySwatch: Colors.blue,<br>      ),<br>      home: Home(),<br>    );<br>  }<br>}</pre><p>Create the home.dart with a class Home() which extends a Stateless widget. In this class return Scaffold widget and within this add Column including two RaisedButtons which will navigate you to the respective expansion view example.</p><p>The home.dart will look like this:</p><pre>import &#39;package:flutter/material.dart&#39;;</pre><pre>class Home extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: Text(<br>          &#39;Flutter Expansion View&#39;,<br>        ),<br>        centerTitle: true,<br>        elevation: 0.0,<br>      ),<br>      body: Padding(<br>        padding: const EdgeInsets.symmetric(horizontal:30.0),<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center,<br>          children: &lt;Widget&gt;[<br>            Row(<br>              children: &lt;Widget&gt;[<br>                Expanded(<br>                  child: RaisedButton(<br>                    onPressed: (){<br>                      Navigator.push(<br>                        context, <br>                        MaterialPageRoute(<br>                          builder: (BuildContext          context)=&gt;Expansiontile()));<br>                    },<br>                    child: Text(<br>                      &#39;ExpansionTile&#39;<br>                    ),<br>                  ),<br>                ),<br>              ],<br>            ),<br>            Row(<br>              children: &lt;Widget&gt;[<br>                Expanded(<br>                  child: RaisedButton(<br>                    onPressed: (){<br>                      Navigator.push(<br>                        context, <br>                        MaterialPageRoute(<br>                          builder: (BuildContext context)=&gt;Expansionpanel()));<br>                    },<br>                    child: Text(<br>                      &#39;ExpansionPanel&#39;<br>                    ),<br>                  ),<br>                ),<br>              ],<br>            )<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><blockquote>Let’s begin!</blockquote><h3><strong>ExpansionTile</strong>:</h3><p>It is a simple and useful widget. This widget lets you create a collapse or expansion view with features similar to ListTile. It is like a ListTile which will expand on tapping the title.</p><p>ExpansionTile has the following attributes similar to List Tile:</p><ul><li><strong>title: </strong>This property lets you choose the Title for the ExpansionTile Widget. The title will be the one item that will always be shown to the user. Only upon clicking this title, the Widget will expand to reveal the contents.</li><li><strong>children: </strong>The property holds any number of widgets. It could be a Card, ListTile to a simple Text. This will be revealed only upon clicking on the Title of the ExpansionTile widget.</li><li><strong>leading: </strong>Lets you give any Icon/Text before the Title(To the left of the title). Similar to how the ListTile is used, this attribute does the same here also.</li><li><strong>trailing: </strong>Lets you give any Icon/Text after the Title(To the right of the title). Similar to how the ListTile is used, this attribute does the same with the trailing property of the ExpansionTile</li><li><strong>backgroundColor: </strong>Lets you provide the background colour to the entire Expanded Tile. Note that, this is not the colour of the entire Title, rather only the expanded Tile.</li></ul><p>Now we will create a new file expansionTile.dart (I prefer to use camelCase for filename) which includes class Expansiontile() which will extend a StatelessWidget as no changes are required.</p><pre>import &#39;package:flutter/material.dart&#39;;</pre><pre>class Expansiontile extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        centerTitle: true,<br>        title: Text(<br>          &#39;Expansion Tile&#39;<br>        ),<br>      ),<br>      body: Padding(<br>        padding: const EdgeInsets.symmetric(horizontal: 30.0),<br>        child: Column(<br>          children: &lt;Widget&gt;[<br>            SizedBox(height:20.0),<br>            ExpansionTile(<br>              title: Text(<br>                &quot;Title&quot;,<br>                style: TextStyle(<br>                  fontSize: 18.0,<br>                  fontWeight: FontWeight.bold<br>                ),<br>              ),<br>              children: &lt;Widget&gt;[<br>                ExpansionTile(<br>                  title: Text(<br>                    &#39;Sub title&#39;,<br>                  ),<br>                  children: &lt;Widget&gt;[<br>                    ListTile(<br>                      title: Text(&#39;data&#39;),<br>                    )<br>                  ],<br>                ),<br>                ListTile(<br>                  title: Text(<br>                    &#39;data&#39;<br>                  ),<br>                )<br>              ],<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>So we have an ExpansionTile widget with a title which will be the header and the children which will be displayed on the expansion of the header. We can also have nested ExpansionTile widget.</p><figure><img alt="ExpansionTile example" src="https://cdn-images-1.medium.com/max/560/1*6MzhANKHyniWYofFGESRXg.gif" /><figcaption>ExpansionTile Example</figcaption></figure><p>By default, the keyboard_arrow_down icon will be shown in trailing attribute of the widget. You can change the trailing and leading attributes by your choice.</p><p>That’s easy!</p><blockquote><strong>Note</strong>: This example of ExpansionTile is deprecated and its content may be out of date. But you can still use it.</blockquote><blockquote>If you want to auto-scroll your ExpansionTile up on expansion, check my other article:</blockquote><p><a href="https://medium.com/flutter-community/flutter-how-to-scroll-an-expansiontile-when-it-is-expanded-ad706cfb80a6">Flutter: How to scroll an ExpansionTile when it is expanded?</a></p><h3>ExpansionPanelList &amp; ExpansionPanel</h3><p>Another way to achieve the expansion/collapse view is by using ExpansionPanelList &amp; ExpansionPanel widgets.</p><p><strong>ExpansionPanelList </strong>has the following attributes similar to List Tile:</p><ul><li><strong>AnimationDuration: </strong>This property is used to define the time required to expand/collapse.</li><li><strong>Children: </strong>This property takes the <strong>ExpansionPanel </strong>as a parameter which means ExpansionPanel will be used to create a hidden view and header.</li><li><strong>ExpansionCallback: </strong>This property works wherever the view expands/collapses.</li></ul><p><strong>ExpansionPanel </strong>has the following attributes similar to List Tile:</p><ul><li><strong>HeaderBuilder: </strong>This property is used to design the visible part of the list or title of the list/row.</li><li><strong>Body: </strong>This property take the widget, we can have any widget to expand and collapse.</li><li><strong>IsExpanded: </strong>This property indicates whether the panel is expanded or not.</li></ul><p>Now we will create a new file expansionPanel.dart which includes class Expansionpanel() which will extend a StatelessWidget as the list will be updated and changed.</p><pre>import &#39;package:flutter/material.dart&#39;;</pre><pre>class Expansionpanel extends StatefulWidget {<br>  Expansionpaneltate createState() =&gt;  Expansionpaneltate();<br>}</pre><pre>class NewItem {<br>  bool isExpanded;<br>  final String header;<br>  final Widget body;<br>  final Icon iconpic;<br>  NewItem(this.isExpanded, this.header, this.body, this.iconpic);<br>}</pre><pre>class Expansionpaneltate extends State&lt;Expansionpanel&gt; {</pre><pre>  List&lt;NewItem&gt; items = &lt;NewItem&gt;[<br>    NewItem(<br>      false, // isExpanded ?<br>      &#39;Header&#39;, // header<br>      Padding(<br>        padding: EdgeInsets.all(20.0),<br>        child: Column(<br>          children: &lt;Widget&gt;[<br>            Text(&#39;data&#39;),<br>            Text(&#39;data&#39;),<br>            Row(<br>              mainAxisAlignment: MainAxisAlignment.spaceAround,<br>              children: &lt;Widget&gt;[<br>                Text(&#39;data&#39;),<br>                Text(&#39;data&#39;),<br>                Text(&#39;data&#39;),<br>              ],<br>            ),<br>            Radio(value: null, groupValue: null, onChanged: null)<br>          ]<br>        )<br>      ), // body<br>      Icon(Icons.image) // iconPic<br>    ),<br>  ];</pre><pre>ListView List_Criteria;</pre><pre>Widget build(BuildContext context) {<br>    List_Criteria = ListView(<br>      children: [<br>         Padding(<br>          padding: EdgeInsets.all(10.0),<br>          child: ExpansionPanelList(<br>            expansionCallback: (int index, bool isExpanded) {<br>              setState(() {<br>                items[index].isExpanded = !items[index].isExpanded;<br>              });<br>            },<br>            children: items.map((NewItem item) {<br>              return ExpansionPanel(<br>                headerBuilder: (BuildContext context, bool isExpanded) {<br>                  return  ListTile(<br>                    leading: item.iconpic,<br>                    title:  Text(<br>                      item.header,<br>                      textAlign: TextAlign.left,<br>                      style:  TextStyle(<br>                        fontSize: 20.0,<br>                        fontWeight: FontWeight.w400,<br>                      ),<br>                    )<br>                  );<br>                },<br>                isExpanded: item.isExpanded,<br>                body: item.body,<br>              );<br>            }).toList(),<br>          ),<br>        ),<br>      ],<br>    );</pre><pre>    Scaffold scaffold =  Scaffold(<br>      appBar:  AppBar(<br>        title:  Text(&quot;ExpansionPanelList&quot;),<br>      ),<br>      body: List_Criteria,<br>    );<br>    return scaffold;<br>  }<br>}</pre><p>In the above code, we created a new class NewItem which will hold the properties of our ExpansionPanelList.</p><p>The List items (of type NewItem) will contain our data in which we will pass values to the constructor of NewItem(). The build method will have a ListView in which we have our widget ExpansionPanelList.</p><ul><li>The <strong>expansionCallback </strong>will check whether isExpanded from items List is expanded or not.</li><li>In the <strong>children, </strong>we have mapped List items which will return ExpansionPanel() including the data. <br>In the ExpansionPanel() we have the headerBuilder which will be shown on the screen, the isExpanded which will check whether the panel is expanded or not and the body of the expansion panel that’s displayed below the header. This widget is visible only when the panel is expanded.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*JMRcuqwD6h7ceV88sBMVTg.gif" /></figure><p>So this is how we create an expansion view using <strong>ExpansionTile</strong> and <strong>ExpansionPanelList &amp; ExpansionPanel</strong></p><p><a href="https://github.com/himanshusharma89/flutter_expansion_view">himanshusharma89/flutter_expansion_view</a></p><blockquote><strong><em>Thank you for reading, if you enjoyed the article make sure to give a clap (👏)! You can connect with me on </em></strong><a href="https://twitter.com/_SharmaHimanshu"><strong><em>Twitter</em></strong></a><strong><em>, </em></strong><a href="https://www.linkedin.com/in/himanshusharma89/"><strong><em>LinkedIn </em></strong></a><strong><em>and find some of my work on </em></strong><a href="https://github.com/himanshusharma89"><strong><em>GitHub </em></strong></a><strong><em>and </em></strong><a href="https://codepen.io/himanshusharma89"><strong><em>Codepen</em></strong></a><strong><em>. And for more such articles you can support me by buying me a coffee:</em></strong></blockquote><figure><a href="https://www.buymeacoffee.com/himanshusharma"><img alt="" src="https://cdn-images-1.medium.com/max/170/0*1Vep2Ib7OZJ8lYuQ.png" /></a><figcaption>Buy me a coffee for more articles</figcaption></figure><p><a href="https://himanshusharma.tech/#/main">Himanshu Shrama | Flutter Dev</a></p><h4>If you liked this article, here are some other articles you may enjoy:</h4><ul><li><a href="https://medium.com/flutter-community/flutter-firebase-github-authentication-990fe8731d9e">Flutter: Firebase GitHub Authentication</a></li><li><a href="https://medium.com/flutter-community/flutter-sharing-files-using-share-package-45103d7a21cb">Flutter: Sharing files using share package</a></li></ul><p><strong>References:</strong></p><ul><li><a href="https://androidmonks.com/expansiontile-widget/">https://androidmonks.com/expansiontile-widget/</a></li><li><a href="https://diveintoflutter.blogspot.com/2019/04/flutter-expandcollapse-widget-expansion.html">https://diveintoflutter.blogspot.com/2019/04/flutter-expandcollapse-widget-expansion.html</a></li></ul><p><a href="https://www.twitter.com/FlutterComm">JavaScript is not available.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fde9c51ac438" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/flutter-expansion-collapse-view-fde9c51ac438">Flutter: Expansion/Collapse view</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create Card Carousel in Flutter?]]></title>
            <link>https://medium.com/flutter-community/how-to-create-card-carousel-in-flutter-979bc8ecf19?source=rss-5502f607931c------2</link>
            <guid isPermaLink="false">https://medium.com/p/979bc8ecf19</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[cards]]></category>
            <category><![CDATA[carousel]]></category>
            <dc:creator><![CDATA[HIMANSHU SHARMA]]></dc:creator>
            <pubDate>Sat, 21 Mar 2020 19:13:47 GMT</pubDate>
            <atom:updated>2020-11-14T19:24:56.500Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADMXwv5Wppl_wu0ub27PqA.jpeg" /></figure><p>As a mobile developer, we sometimes have to create sliding, animated, background image carousels, but sometimes we require to create sliding card carousel which contains some data with different background colour or gradient. In this article, I will explain how to implement a card carousel in Flutter with the help of a package.</p><p>If you are brand new to Flutter, please begin with the setup process: <a href="https://flutter.io/get-started/">https://flutter.io/get-started/</a></p><p>The carousel package we will be using is <strong>carousel_slider </strong>: <a href="https://pub.dev/packages/carousel_slider">https://pub.dev/packages/carousel_slider</a></p><p>I will be using VS Code for this walkthrough. Your first step will be to create a new Flutter Project by pressing Ctrl+Shift+P. When the project has been created, navigate to the <strong>pubspec.yaml</strong> file located at the top level of your project directory and add <strong>carousel_slider: ^1.4.1 </strong>under Flutter SDK dependency:</p><pre><strong>name</strong>: card_carousel</pre><pre><strong>description</strong>: A new Flutter project.</pre><pre><strong>version</strong>: 1.0.0+1</pre><pre><strong>environment</strong>:<br>  <strong>sdk</strong>: &quot;&gt;=2.1.0 &lt;3.0.0&quot;</pre><pre><strong>dependencies</strong>:<br><strong>flutter</strong>:<br>  <strong>sdk</strong>: flutter</pre><pre><strong>cupertino_icons</strong>: ^0.1.3<br><strong>carousel_slider</strong>: ^1.4.1</pre><p>This communicates to the app that you want to add carousel_slider version 1.4.1.</p><p>Next, run <strong>flutter packages get. </strong>If you are in VS Code, you can do this by clicking the icon that sits at the top-right corner above the pubspec.yaml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8TA2CmPM9NGPOr8PhKn7_g.png" /></figure><p>Or by typing flutter packages get in the terminal below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQTNEik9Ll4IBGTroj9spA.png" /></figure><p>Now, navigate to your <strong>main.dart </strong>file and delete everything that’s there and replace it with this barebones Hello World script. Notice that we are <strong>importing carousel_slider.dart </strong>at the top of the file:</p><pre><strong>import </strong>&#39;package:flutter/material.dart&#39;;<br><strong>import </strong>&#39;package:carousel_slider/carousel_slider.dart&#39;;</pre><pre><strong>void </strong>main() {<br>runApp(MyApp());<br>}</pre><pre><strong>class </strong>MyApp <strong>extends </strong>StatelessWidget {<br>  <strong>@override</strong><br>  Widget build(BuildContext context) {<br>    <strong>return </strong>MaterialApp(<br>      title: &#39;Flutter Card Carousel App&#39;,<br>      theme: ThemeData(<br>        primarySwatch: Colors.blue,<br>      ),<br>      home: Center(child:Text(&quot;Hello there!&quot;)),<br>    );<br>  }<br>}</pre><p>You can run the app now by pressing F5. The app would look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*2tZAAY2LOpNVSDbw5nEtqA.png" /></figure><p>Let’s begin implementing the carousel feature. Firstly convert your <strong>MyApp </strong>class to <strong>StatefulWidget </strong>by clicking on the MyApp then a bulb will be displayed on its left, later on selecting the bulb to click on ‘change to StatefulWidget’. After this replace your body with a Column that has two children: a <strong>CarouselSlider </strong>and a <strong>Row</strong>.</p><p>CarouselSlider will be using the list in which we have defined our cards respectively.</p><pre>body: Column(<br>  children: &lt;Widget&gt;[<br>    CarouselSlider(<br>      items: null<br>    ),<br>    Row(<br>      children: &lt;Widget&gt;[<br>        Text(&quot;data&quot;)<br>      ],<br>    )<br>  ],<br>)</pre><p>This will throw an error for now, but after defining our parameters in CarouselSlider the app will work. Following are the parameters that we can use in CarouselSlider:</p><pre>height, aspectRatio, viewportFraction, initialPage,    enableInfiniteScroll, reverse, autoPlay, autoPlayInterval, autoPlayAnimationDuration, autoPlayCurve, pauseAutoPlayOnTouch, enlargeCenterPage, onPageChanged, and scrollDirection,</pre><p>For our case, we will be using the below code for CarouselSlider. Here :</p><ul><li><strong>height </strong>is the overall height of our cards.</li><li><strong>autoPlay </strong>is for cards to automatically slide one page at a time.</li><li><strong>autoPlayInterval </strong>sets Duration to determent the frequency of slides when autoPlay is set to true.</li><li><strong>autoPlayAnimationDuration </strong>The animation duration between two cards while in auto playback.</li><li><strong>autoPlayCurve </strong>determines the animation curve.</li><li><strong>pauseAutoPlayOnTouch </strong>sets a timer on touch detected that pause the autoplay.</li><li><strong>aspectRatio </strong>is used if no height have been declared.</li><li><strong>onPageChanged c</strong>alled whenever the page in the centre of the viewport changes.</li></ul><pre>CarouselSlider(<br>  height: 200.0,<br>  autoPlay: true,<br>  autoPlayInterval: Duration(seconds: 3),<br>  autoPlayAnimationDuration: Duration(milliseconds: 800),<br>  autoPlayCurve: Curves.fastOutSlowIn,<br>  pauseAutoPlayOnTouch: Duration(seconds: 10),<br>  aspectRatio: 2.0,<br>  onPageChanged: (index) {<br>    setState(() {<br>      _currentIndex = index;<br>    });<br>  },<br>  items: cardList.map((card){<br>    return Builder(<br>      builder:(BuildContext context){<br>        return Container(<br>          height: MediaQuery.of(context).size.height*0.30,<br>          width: MediaQuery.of(context).size.width,<br>          child: Card(<br>            color: Colors.blueAccent,<br>            child: card,<br>          ),<br>        );<br>      }<br>    );<br>  }).toList(),<br>),</pre><p>Here:</p><ul><li>card is used to access cardList items.</li><li>.map((card){}) This method returns a view of the mapped elements in the cardList.</li><li>Builder is used for creating Card.</li></ul><h4><strong>N<em>EW UPDATE: </em></strong><em>After the new update in the package (</em><strong><em>carousel_slider: ^2.2.1)</em></strong><em> the CarouselSlider() is updated to this:</em></h4><pre>CarouselSlider(<br>              options: CarouselOptions(<br>                height: 200.0,<br>                autoPlay: true,<br>                autoPlayInterval: Duration(seconds: 3),<br>                autoPlayAnimationDuration: Duration(milliseconds: 800),<br>                autoPlayCurve: Curves.fastOutSlowIn,<br>                pauseAutoPlayOnTouch: true,<br>                aspectRatio: 2.0,<br>                onPageChanged: (index, reason) {<br>                  setState(() {<br>                    _currentIndex = index;<br>                  });<br>                },<br>              ),<br>              items: cardList.map((card){<br>                return Builder(<br>                  builder:(BuildContext context){<br>                    return Container(<br>                      height: MediaQuery.of(context).size.height*0.30,<br>                      width: MediaQuery.of(context).size.width,<br>                      child: Card(<br>                        color: Colors.blueAccent,<br>                        child: card,<br>                      ),<br>                    );<br>                  }<br>                );<br>              }).toList(),<br>            ),</pre><p>Now we will define the _currentIndex and cardList under _MyAppState class.</p><pre>int _currentIndex=0;</pre><pre>List cardList=[<br>    Item1(),<br>    Item2(),<br>    Item3(),<br>    Item4()<br>  ];</pre><pre>List&lt;T&gt; map&lt;T&gt;(List list, Function handler) {<br>    List&lt;T&gt; result = [];<br>    for (var i = 0; i &lt; list.length; i++) {<br>      result.add(handler(i, list[i]));<br>    }<br>    return result;<br>  }</pre><p>The _currentIndex is the index of card currently being displayed in the slider. And the Item1, Item2, Item3 and Item4 are the list items in the cardList. These items have the content of our cards. These items are defined below:</p><p>Item1:</p><pre>class Item1 extends StatelessWidget {<br>  const Item1({Key key}) : super(key: key);</pre><pre><a href="http://twitter.com/override">@override</a><br>  Widget build(BuildContext context) {<br>    return Container(<br>      decoration: BoxDecoration(<br>        gradient: LinearGradient(<br>          begin: Alignment.topLeft,<br>          end: Alignment.bottomRight,<br>          stops: [0.3, 1],<br>          colors: [Color(0xffff4000),Color(0xffffcc66),]<br>        ),<br>      ),<br>      child: Column(<br>        mainAxisAlignment: MainAxisAlignment.center,<br>        children: &lt;Widget&gt;[<br>          Text(<br>            &quot;Data&quot;,<br>            style: TextStyle(<br>              color: Colors.white,<br>              fontSize: 22.0,<br>              fontWeight: FontWeight.bold<br>            )<br>          ),<br>          Text(<br>            &quot;Data&quot;,<br>            style: TextStyle(<br>              color: Colors.white,<br>              fontSize: 17.0,<br>              fontWeight: FontWeight.w600<br>            )<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br>}</pre><p>Item2:</p><pre>class Item2 extends StatelessWidget {<br>  const Item2({Key key}) : super(key: key);</pre><pre><a href="http://twitter.com/override">@override</a><br>  Widget build(BuildContext context) {<br>    return Container(<br>      decoration: BoxDecoration(<br>        gradient: LinearGradient(<br>          begin: Alignment.topLeft,<br>          end: Alignment.bottomRight,<br>          stops: [0.3, 1],<br>          colors: [Color(0xff5f2c82), Color(0xff49a09d)]<br>        ),<br>      ),<br>      child: Column(<br>        mainAxisAlignment: MainAxisAlignment.center,<br>        children: &lt;Widget&gt;[<br>          Text(<br>            &quot;Data&quot;,<br>            style: TextStyle(<br>              color: Colors.white,<br>              fontSize: 22.0,<br>              fontWeight: FontWeight.bold<br>            )<br>          ),<br>          Text(<br>            &quot;Data&quot;,<br>            style: TextStyle(<br>              color: Colors.white,<br>              fontSize: 17.0,<br>              fontWeight: FontWeight.w600<br>            )<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br>}</pre><p>Item3:</p><pre>class Item3 extends StatelessWidget {<br>  const Item3({Key key}) : super(key: key);</pre><pre><a href="http://twitter.com/override">@override</a><br>  Widget build(BuildContext context) {<br>    return Container(<br>      decoration: BoxDecoration(<br>        gradient: LinearGradient(<br>          begin: Alignment.topLeft,<br>          end: Alignment.bottomRight,<br>          stops: [0.3, 1],<br>          colors: [Color(0xffff4000),Color(0xffffcc66),]<br>        ),<br>      ),<br>      child: Column(<br>        mainAxisAlignment: MainAxisAlignment.center,<br>        children: &lt;Widget&gt;[<br>          Image.asset(<br>            &#39;assets/flutter_dev.png&#39;,<br>            height: 180.0,<br>            fit: BoxFit.cover,<br>          )<br>        ],<br>      ),<br>    );<br>  }<br>}</pre><p>Item4:</p><pre>class Item4 extends StatelessWidget {<br>  const Item4({Key key}) : super(key: key);</pre><pre><a href="http://twitter.com/override">@override</a><br>  Widget build(BuildContext context) {<br>    return Container(<br>      child: Column(<br>        mainAxisAlignment: MainAxisAlignment.center,<br>        children: &lt;Widget&gt;[<br>          Text(<br>            &quot;Data&quot;,<br>            style: TextStyle(<br>              color: Colors.white,<br>              fontSize: 22.0,<br>              fontWeight: FontWeight.bold<br>            )<br>          ),<br>          Text(<br>            &quot;Data&quot;,<br>            style: TextStyle(<br>              color: Colors.white,<br>              fontSize: 17.0,<br>              fontWeight: FontWeight.w600<br>            )<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br>}</pre><p>Now we define our Row() which will indicate <strong>dotted indicator</strong> for the slider.</p><pre>Row(<br>  mainAxisAlignment: MainAxisAlignment.center,<br>  children: map&lt;Widget&gt;(cardList, (index, url) {<br>    return Container(<br>      width: 10.0,<br>      height: 10.0,<br>      margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0),<br>      decoration: BoxDecoration(<br>        shape: BoxShape.circle,<br>        color: _currentIndex == index ? Colors.blueAccent : Colors.grey,<br>       ),<br>     );<br>   }),<br> ),</pre><p>All set. Reload your app and you have a working card carousel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*VVhZzbZgpuJoNpcRuPKaQQ.gif" /></figure><h4>Source Code:</h4><p><a href="https://github.com/himanshusharma89/Flutter-Card-Carousel">himanshusharma89/Flutter-Card-Carousel</a></p><blockquote>Thank you for reading, if you enjoyed the article make sure to give a clap (👏)! You can connect with me on <a href="https://twitter.com/_SharmaHimanshu">Twitter</a>, <a href="https://www.linkedin.com/in/himanshusharma89/">LinkedIn</a> and find some of my work on <a href="https://github.com/himanshusharma89">GitHub</a> and <a href="https://codepen.io/himanshusharma89">Codepen</a>. And for more such articles you can support me by buying me a coffee:</blockquote><figure><a href="https://www.buymeacoffee.com/himanshusharma"><img alt="" src="https://cdn-images-1.medium.com/max/170/1*Dpw8-hNGI2fDmosV4E8DVQ.png" /></a></figure><h4>If you liked this article, here are some other articles you may enjoy:</h4><ul><li><a href="https://medium.com/flutter-community/flutter-firebase-github-authentication-990fe8731d9e">Flutter: Firebase GitHub Authentication</a></li><li><a href="https://medium.com/flutter-community/flutter-sharing-files-using-share-package-45103d7a21cb">Flutter: Sharing files using share package</a></li><li><a href="https://www.twitter.com/FlutterComm">JavaScript is not available.</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=979bc8ecf19" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/how-to-create-card-carousel-in-flutter-979bc8ecf19">How to create Card Carousel in Flutter?</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>