showDialog method

Future<DialogResponse?> showDialog({
  1. String? title,
  2. String? description,
  3. String? cancelTitle,
  4. Color? cancelTitleColor,
  5. String buttonTitle = 'Ok',
  6. Color? buttonTitleColor,
  7. bool barrierDismissible = false,
  8. DialogPlatform? dialogPlatform,
})

Shows a dialog to the user

It will show a platform specific dialog by default. This can be changed by setting dialogPlatform

Implementation

Future<DialogResponse?> showDialog({
  String? title,
  String? description,
  String? cancelTitle,
  Color? cancelTitleColor,
  String buttonTitle = 'Ok',
  Color? buttonTitleColor,
  bool barrierDismissible = false,

  /// Indicates which [DialogPlatform] to show.
  ///
  /// When not set a Platform specific dialog will be shown
  DialogPlatform? dialogPlatform,
}) {
  if (dialogPlatform != null) {
    return _showDialog(
      title: title,
      description: description,
      cancelTitle: cancelTitle,
      cancelTitleColor: cancelTitleColor,
      buttonTitle: buttonTitle,
      buttonTitleColor: buttonTitleColor,
      dialogPlatform: dialogPlatform,
      barrierDismissible: barrierDismissible,
    );
  } else {
    var _dialogType = GetPlatform.isAndroid
        ? DialogPlatform.Material
        : DialogPlatform.Cupertino;
    return _showDialog(
      title: title,
      description: description,
      cancelTitle: cancelTitle,
      cancelTitleColor: cancelTitleColor,
      buttonTitle: buttonTitle,
      buttonTitleColor: buttonTitleColor,
      dialogPlatform: _dialogType,
      barrierDismissible: barrierDismissible,
    );
  }
}