showResultDialog<T> function

Future<T> showResultDialog<T>(
  1. BuildContext context,
  2. {@required Color backgroundColor,
  3. @required Color textColor,
  4. @required Widget icon,
  5. dynamic title,
  6. Widget content,
  7. DialogAction<T> action,
  8. bool barrierDismissible = false,
  9. Color barrierColor,
  10. bool useSafeArea = true,
  11. bool useRootNavigator = true,
  12. RouteSettings routeSettings}
)

Generic method used to generate the dialogs of success, warning and error.

Use this method if you want to create a similar dialog with other colors and icons.

Implementation

Future<T> showResultDialog<T>(BuildContext context,
    {@required Color backgroundColor,
    @required Color textColor,
    @required Widget icon,
    title,
    Widget content,
    DialogAction<T> action,
    bool barrierDismissible = false,
    Color barrierColor,
    bool useSafeArea = true,
    bool useRootNavigator = true,
    RouteSettings routeSettings}) async {
  return showDialog<T>(
      context: context,
      builder: (context) {
        return WillPopScope(
            onWillPop: () => Future.value(barrierDismissible),
            child: ResultDialog(
                backgroundColor: backgroundColor,
                textColor: textColor,
                icon: icon,
                title: title,
                content: content,
                action: (action ??
                    DialogAction<T>(
                        title: Text(StandardDialogsLocalizations.of(
                            context)[DialogResult.ok]),
                        action: null))));
      },
      barrierDismissible: barrierDismissible,
      barrierColor: barrierColor,
      useSafeArea: useSafeArea,
      useRootNavigator: useRootNavigator,
      routeSettings: routeSettings);
}