appForceUpdateDialog static method

dynamic appForceUpdateDialog(
  1. String downloadURL
)

Implementation

static appForceUpdateDialog(String downloadURL) {
  return CommonDialog.commonDialogs(
      dismiss: false,
      body: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              Container(
                padding: EdgeInsets.all(margin_10),
                decoration: const BoxDecoration(
                    shape: BoxShape.circle, color: CommonColors.primaryColor),
                child: const Icon(
                  Icons.question_mark,
                  color: Colors.white,
                ),
              ),
              sizedBox(width: margin_20),
              commonText("Update Available",
                  fontWeight: FontWeight.w500,
                  color: CommonColors.subtitleColor,
                  textHeight: 1.4,
                  align: TextAlign.center,
                  fontSize: font_16),
            ],
          ),
          sizedBox(height: margin_20),
          commonText(
              "Newer version of the app available. Do you want to install ?",
              fontWeight: FontWeight.w400,
              color: CommonColors.subtitleColor,
              textHeight: 1.4,
              align: TextAlign.center),
          sizedBox(height: margin_20),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              CustomButton.customButton(
                onClick: () {
                  if (Platform.isIOS) {
                    exit(0);
                  }
                  if (Platform.isAndroid) {
                    SystemNavigator.pop();
                  }
                },
                buttonColor: CommonColors.primaryColor,
                cornerRadius: radius_20,
                verticalPadding: margin_12,
                horizontalPadding: margin_32,
                buttonText: noStr.tr,
              ),
              sizedBox(width: margin_16),
              CustomButton.customButton(
                onClick: () async {
                  if (Platform.isIOS) {
                    Get.back();
                  } else {
                    final Uri url = Uri.parse(downloadURL);
                    await launchUrl(
                        url); //launch is from url_launcher package to launch URL
                    logPrint("URL can't be launched.");
                  }
                },
                buttonColor: CommonColors.primaryColor,
                cornerRadius: radius_20,
                verticalPadding: margin_12,
                horizontalPadding: margin_32,
                buttonText: yesStr.tr,
              )
            ],
          )
        ],
      ));
}