getDialogTwoButton function

CupertinoAlertDialog getDialogTwoButton(
  1. dynamic context,
  2. dynamic title,
  3. dynamic message,
  4. dynamic yes,
  5. dynamic no,
  6. Function callback,
  7. Function? onCancel,
)

Implementation

CupertinoAlertDialog getDialogTwoButton(context, title, message, yes, no, Function callback, Function? onCancel) {
  RenderObject.debugCheckingIntrinsics = true;
  return CupertinoAlertDialog(
    title: title != null
        ? Text(
            title,
            textAlign: TextAlign.center,
            style: TextStyle(
              color: Colors.black,
              fontFamily: FONT_STYLE_QUICK_BOLD,
              fontSize: NumberConst.SUB_HEADER_FONT_SIZE - 1.sp,
            ),
          )
        : Container(),
    content: message != null
        ? Center(
            child: Html(
              data: message.toString(),
              shrinkWrap: true,
              onLinkTap: (url, attributes, element) {
                if(url!=null) {
                  launchUrl(Uri.parse(url),mode: LaunchMode.externalApplication);
                }
              },
              style: {
                StringConst.BODY: Style(
                  fontSize: FontSize(NumberConst.SUB_HEADER_FONT_SIZE - 1.sp),
                  fontFamily: FONT_STYLE_QUICK_MEDIUM,
                  textAlign: TextAlign.center,
                ),
              },
            ),
          )
        : Container(),
    actions: [
      no != null
          ? CupertinoDialogAction(
              child: GNBoldTextWidget(
                title: no,
                fontcolor: Colors.red,
                fontsize: NumberConst.SUB_HEADER_FONT_SIZE,
              ),
              onPressed: () {
                // Future.delayed(
                //   const Duration(milliseconds: 10),
                //   () => callback(false),
                // );
                Navigator.of(context).pop();
                onCancel?.call(false);
              })
          : Container(),
      yes != null
          ? CupertinoDialogAction(
              child: GNBoldTextWidget(
                title: yes,
                fontcolor: Colors.blue,
                fontsize: NumberConst.SUB_HEADER_FONT_SIZE,
              ),
              onPressed: () {
                Navigator.of(context).pop();
                Future.delayed(
                  Duration(milliseconds: NumberConst.DEFAULT_10.toInt()),
                  () => callback(true),
                );

              })
          : Container(),
    ],
  );
}