Welcome to another Flutter Widget of the Day post. Today we have AboutDialog widget, which can be must have for every app, since every developer tech like to have some license info for the users.
How to use the AboutDialog
It is a good idea to create function to show the dialog which return a AboutDialog in a Flutter Manner as follows.
void showAboutDialog({ @required BuildContext context, String applicationName, String applicationVersion, Widget applicationIcon, String applicationLegalese, List<Widget> children, bool useRootNavigator = true, RouteSettings routeSettings, }) { assert(context != null); assert(useRootNavigator != null); showDialog<void>( context: context, useRootNavigator: useRootNavigator, builder: (BuildContext context) { return AboutDialog( applicationName: applicationName, applicationVersion: applicationVersion, applicationIcon: applicationIcon, applicationLegalese: applicationLegalese, children: children, ); }, routeSettings: routeSettings, ); }
Now we are ready for calling the function inside the floating Actions button. You can now add all relevant information about your app, name, icon, version, etc as follows
floatingActionButton: FloatingActionButton( child: Icon(Icons.help), onPressed: () { showAboutDialog( context: context, applicationName: "My APP", applicationVersion: "Beta", children: [ Text('Developer: Manoj A.P'), Text('can be reached @ manojap@outlook.com'), Text('Web:' + 'http://manojap.github.io') ], applicationIcon: Icon(Icons.games)); }, ),
Besides there is children : [ ] which is used to add additional information in case you need them as a list of Widgets of your choice.
You may already noticed that flutter automatically included package license info for you, it can also be done manually