appForceUpdateDialog function

dynamic appForceUpdateDialog(
  1. String downloadURL
)

Implementation

appForceUpdateDialog(String downloadURL) {
  return commonDialogs(
      dismiss: false,
      body: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              Container(
                padding: EdgeInsets.all(margin_10),
                decoration: const BoxDecoration(
                    shape: BoxShape.circle, color: primaryColor),
                child: const Icon(
                  Icons.question_mark,
                  color: Colors.white,
                ),
              ),
              sizedBox(width: margin_20),
              commonText("Update Available",
                  fontWeight: FontWeight.w500,
                  color: 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: subtitleColor,
              textHeight: 1.4,
              align: TextAlign.center),
          sizedBox(height: margin_20),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              CustomButton(
                onClick: () {
                  if (Platform.isIOS) {
                    exit(0);
                  }
                  if (Platform.isAndroid) {
                    SystemNavigator.pop();
                  }
                },
                buttonColor: primaryColor,
                cornerRadius: radius_20,
                verticalPadding: margin_12,
                horizontalPadding: margin_32,
                buttonText: noStr.tr,
              ),
              sizedBox(width: margin_16),
              CustomButton(
                onClick: () async {
                  // String url = "https://www.fluttercampus.com";
                  // final Uri _url = Uri.parse('https://drive.google.com/file/d/1yCTXEG_NpgXe9sIR8loGIJgzs7nbKkZC/view?usp=drive_link');
                  final Uri _url = Uri.parse(downloadURL);
                  await launchUrl(
                      _url); //launch is from url_launcher package to launch URL
                  print("URL can't be launched.");
                },
                buttonColor: primaryColor,
                cornerRadius: radius_20,
                verticalPadding: margin_12,
                horizontalPadding: margin_32,
                buttonText: yesStr.tr,
              )
            ],
          )
        ],
      ));
}