V_MsgBox method

Future<bool> V_MsgBox(
  1. BuildContext context, {
  2. String? title = "",
  3. CyberMsgBoxType type = CyberMsgBoxType.defaultType,
  4. String? confirmText,
  5. String? cancelText,
})

Show MessageBox từ String

Usage:

bool result = await "Nội dung thông báo".V_MsgBox(
  context,
  title: "Tiêu đề",
  type: CyberMsgBoxType.warning,
);

Implementation

// ignore: non_constant_identifier_names
Future<bool> V_MsgBox(
  BuildContext context, {
  String? title = "",
  CyberMsgBoxType type = CyberMsgBoxType.defaultType,
  String? confirmText,
  String? cancelText,
}) async {
  if (title == "") {
    switch (type) {
      case CyberMsgBoxType.defaultType:
        title = 'Thông báo';
        break;
      case CyberMsgBoxType.warning:
        title = 'Cảnh báo';
        break;
      case CyberMsgBoxType.error:
        title = 'Lỗi';
        break;
    }
  }
  final msgBox = CyberMessageBox(
    message: this,
    title: title,
    type: type,
    confirmText: confirmText,
    cancelText: cancelText,
  );

  return await msgBox.show(context);
}