AboutDialog Widget in action(Flutter)
We all yearn for recognition in our respective fields and we care deeply about our identity. Advertising yourself is a key marketing technique in the digital era.
The pride that comes with listing your name or brand in the ‘About’ page is inexplicable. It is important to take credit for the work that you do and at the same time it is also important to acknowledge and attribute the work done by other people. This is sometimes mandatory when publishing your work.It helps to avoid confusions as to who the original author is and gives due credit to the original creator(s).
The About section is without doubt, one of the most important modules of your app and shouldn’t be left for the last moment. It sort of acts like your business card. The contents of a typical ‘About’ section include:
- Your name or company.
- The copyrights.
- Attributions
- Licences, including those of the third party libraries you’ve used for the project.
- Links to your website, GitHub profile, LinkedIn etc.
- Credits.
A good reference would be the Flutter Gallery app’s ‘About’ page that can be viewed by tapping the ‘About Flutter Gallery’ item in the navigation drawer.
Now clearly this is a lot of work, especially when it comes to keeping track of all the license statements. We need to act smartly here, instead of going about and building our own ‘About’ page from scratch and wasting valuable development time that could have been otherwise dedicated to some other task and reinventing the wheel, we could use Flutter’s own AboutDialog widget that does all of the work for us. The AboutDialog box contains the following properties for us to customize:
- applicationName: A String representation of the name of your application or service which serves as the title of the dialog box.
- applicationVersion: A String representation of the version or build number number of your application.
- applicationIcon: A widget that is shown as an icon next to the name of the application.
- applicationLegalese: A String representation of the text to be shown in small print, usually © copyright statements.
- children: The list of child widgets that are to be added to the dialog box. They can include information about the app itself.
Let’s now go ahead and create a brand new Flutter project and try out this widget to see what it looks like.
The code above renders a neat About page with the name, version and all the other properties we’ve set.
If you’ve noticed, this is basically another route over our current route(the home screen or the scaffold) much like an AlertDialog widget and just like how the AlertDialog widget uses the showDialog method to display itself, we can use the showDialog method to display our AboutDialog widget.
An ideal About page also lists all the relevant license statements pertaining to the project and its components and other third party libraries used by the same.
Now this becomes an especially daunting task to keep track of all such licenses. Fortunately, the AboutDialog widget has a solution for this as well. The Dialog box includes a button that calls the showLicensePage method to display a LicensePage widget which basically shows the licenses, retrieved by the LicenseRegistry API, for the libraries used by our application. Now what’s convenient about this is that it keeps track of all of the licenses of the APIs we use automatically without us having to do anything.
There also exists a very similar widget that does the same thing that we’ve been trying to achieve so far and that is the AboutListTile widget.
And that’s it.I hope this article was worth your time. Please do consider clapping for me if you really liked it.
