showAboutPage function

Future<void> showAboutPage({
  1. required BuildContext context,
  2. Widget? title,
  3. ScaffoldBuilder? scaffoldBuilder,
  4. String? applicationName,
  5. String? applicationVersion,
  6. Widget? applicationIcon,
  7. String? applicationLegalese,
  8. Widget? applicationDescription,
  9. bool dialog = false,
  10. List<Widget>? children,
  11. Map<String, String> values = const {},
})

Displays an AboutPage, which describes the application and provides a button to show licenses for software used by the application.

The arguments correspond to the properties on AboutPage.

If the application has a Drawer, consider using AboutPageListTile instead of calling this directly.

If you do not need an about box in your application, you should at least provide an affordance to call showLicensePage.

The licenses shown on the MarkdownPage are those returned by the LicenseRegistry API, which can be used to add more licenses to the list.

The context argument is passed to showDialog, the documentation for which discusses how it is used.

Implementation

Future<void> showAboutPage({
  required BuildContext context,
  Widget? title,
  ScaffoldBuilder? scaffoldBuilder,
  String? applicationName,
  String? applicationVersion,
  Widget? applicationIcon,
  String? applicationLegalese,
  Widget? applicationDescription,
  bool dialog = false,
  List<Widget>? children,
  Map<String, String> values = const {},
}) async {
  final page = AboutPage(
    title: title,
    scaffoldBuilder: scaffoldBuilder,
    applicationName: applicationName,
    applicationVersion: applicationVersion,
    applicationIcon: applicationIcon,
    applicationLegalese: applicationLegalese,
    applicationDescription: applicationDescription,
    dialog: dialog,
    values: values,
    children: children,
  );

  if (dialog) {
    return await showDialog<void>(
      context: context,
      builder: (BuildContext context) {
        return page;
      },
    );
  }

  if (isCupertino(context)) {
    return await Navigator.of(context).push<void>(
      CupertinoPageRoute(
        builder: (context) => page,
      ),
    );
  }

  return await Navigator.of(context).push<void>(
    MaterialPageRoute(
      builder: (context) => page,
    ),
  );
}