messageWithNavigationOptionsDialog static method

dynamic messageWithNavigationOptionsDialog(
  1. BuildContext context,
  2. String title,
  3. String cancel,
  4. String proceed,
  5. String content, {
  6. bool isDismissible = true,
  7. bool isReason = false,
  8. required dynamic onProceed(),
  9. required dynamic onCancel(),
})

Implementation

static messageWithNavigationOptionsDialog(
  BuildContext context,
  String title,
  String cancel,
  String proceed,
  String content, {
  bool isDismissible = true,
  bool isReason = false,
  required Function() onProceed,
  required Function() onCancel,
}) {
  final Localization localization = Localization.getInstance();
  showDialog(
    barrierDismissible: isDismissible,
    context: context,
    builder: (_) {
      return PopScope(
          canPop: isDismissible,
          child: Dialog(
            insetPadding: EdgeInsets.symmetric(
                horizontal: SizeConstant.getHeightWithScreen(10),
                vertical: SizeConstant.getHeightWithScreen(24)),
            child: Container(
              decoration: BoxDecoration(
                color: ColorConstant.white,
                borderRadius: BorderRadius.circular(
                    SizeConstant.getHeightWithScreen(16)),
              ),
              padding: EdgeInsets.symmetric(
                  vertical: SizeConstant.getHeightWithScreen(30),
                  horizontal: SizeConstant.getHeightWithScreen(20)),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  SvgPicture.asset(
                    "assets/images/error_icon.svg",
                    package: Constants.packageName,
                    height: SizeConstant.getHeightWithScreen(50),
                    width: SizeConstant.getHeightWithScreen(50),
                  ),
                  SizedBox(
                    height: SizeConstant.getHeightWithScreen(10),
                  ),
                  Text(
                    localization.translate(title),
                    style: TextStyle(
                        color: ColorConstant.pgvDescTextColor,
                        fontSize: SizeConstant.mediumFont,
                        fontWeight: FontWeight.w600),
                  ),
                  content.isNotEmpty
                      ? Padding(
                          padding: EdgeInsets.only(
                              top: SizeConstant.getHeightWithScreen(6)),
                          child: Text(
                            localization.translate(content),
                            style: TextStyle(
                                color: ColorConstant.grey11,
                                fontSize: SizeConstant.smallFont,
                                fontWeight: FontWeight.w500),
                          ),
                        )
                      : const SizedBox(),
                  SizedBox(
                    height: SizeConstant.getHeightWithScreen(22),
                  ),
                  Padding(
                    padding: EdgeInsets.symmetric(
                        horizontal: SizeConstant.getHeightWithScreen(10)),
                    child: Row(
                      children: [
                        InkWell(
                          onTap: () {
                            onCancel();
                          },
                          child: Container(
                              width: (MediaQuery.of(context).size.width / 2) -
                                  SizeConstant.getHeightWithScreen(45),
                              height: SizeConstant.getHeightWithScreen(40),
                              decoration: BoxDecoration(
                                border: Border.all(
                                  width: 1,
                                  color: ColorConstant.primaryColor,
                                ),
                                borderRadius: BorderRadius.circular(
                                    SizeConstant.getHeightWithScreen(10)),
                              ),
                              child: Center(
                                child: Text(
                                  localization.translate(cancel),
                                  style: TextStyle(
                                    fontSize: SizeConstant.mediumFont,
                                    fontWeight: FontWeight.w500,
                                    color: ColorConstant.primaryColor,
                                  ),
                                ),
                              )),
                        ),
                        SizedBox(
                          width: SizeConstant.getHeightWithScreen(10),
                        ),
                        VentasPrimaryButton(
                          onTap: () {
                            onProceed();
                          },
                          label: localization.translate(proceed),
                          textColor: ColorConstant.white,
                          borderRadius: 10,
                          textSize: SizeConstant.mediumFont,
                          weight: FontWeight.w500,
                          btnHeight: SizeConstant.getHeightWithScreen(40),
                          btnWidth: (MediaQuery.of(context).size.width / 2) -
                              SizeConstant.getHeightWithScreen(45),
                        ),
                      ],
                    ),
                  )
                ],
              ),
            ),
          ));
    },
  );
}