Sunday, May 31, 2020

How to use AboutDialog widget in Flutter?

This is going to be the third article in the series Lit Flutter widgets. In this series, I'm talking about the most formidable and best Flutter widgets out there.

The widgets which have been discussed until now in the series are

  1. CheckBoxTile Widget
  2. AnimateIcon Widget
  3. AboutDialog Widget (This article)



In this article, we are going to discuss the AboutDialog widget in Flutter.

AboutDialog Widget

Sometimes we need a definite place to put the legalese in the application, and some app stores have also made it mandatory to place the legalese before the publication.

What is legalese?

Legalese can be defined as the formal and technical language of legal documents. It contains information such as version number, the licenses, and all the other small print.

To place this legalese, we use the AboutDialog Widget in Flutter. An About box, this is the dialog box, i.e., used to show the information such as application icon, version no, and copyright details with a button at the bottom to show the licenses used in the application.

You can use AboutDialog() design it and then show it, but most people use ShowAboutDialog(). You just have to find a good place to call this function in onTap or onPressed callback 

Simple code to use AboutDialog Widget is,

 showAboutDialog(  
        context: context,  
        applicationVersion: '1.1.1',  
        applicationIcon: Icon(Icons.favorite),  
        applicationLegalese: 'This is legalese',  
        applicationName: 'About Dialog',  
       );  

These are some essential parts of the showAboutDialog

1. Context: This argument is used to get the current build context of the application.

2. ApplicationVersion: This is used to mention the application version of the Application

3. ApplicationIcon: We use this argument to show the Application icon in the dialog.

4. ApplicationLegalese: This argument is used to mention the legalese of the application.

5. ApplicationName: applicationName argument is used to show Application Name in the dialog.

6. Children: This one is not mentioned in the code, but it is used to indicate the Additional Widgets you want to show in the dialog box.

The license button that is shown on the bottom of the dialog is used to open the License page, which shows the licenses that are returned by LiscenceRegistry API, which can be used to add more licenses to the list.

Demo Application






In this demo application, I am going to show the usage of the AboutDialog widget in a Flutter application

In this application, usage of AboutDialog is shown with the help of a simple Raised button placed at the center.

Conclusion

Time to look at what we actually learned. AboutDialog widget can come handy whenever we need a definite place to put the legalese in the application. In fact, it is much easier to learn about AboutDialog than designing your own and then customizing it. However, if you prefer this article, bookmark this URL to come at any later point of time if required.


Let me know whats your fav icon till now in the series in the comment section.
Previous Post
Next Post

post written by:

Hi, Navjyot Singh is a coder, content maker and a freelance developer who's pursuing an undergraduate Engineering degree in Computer Science. He started out as a web developer but later picked up the mobile as his favourite platform to develop applications. A Writer by day and coder by night is loathed to discuss himself as the third person but can be persuaded to do so from time to time.

0 comments: