updateDialog static method

dynamic updateDialog({
  1. required bool isPopup,
  2. required String appLogoApi,
  3. required String appNameApi,
  4. required String subtitleAppApi,
  5. required String appWebsiteUrl,
})

Implementation

static updateDialog(
    {required bool isPopup,
    required String appLogoApi,
    required String appNameApi,
    required String subtitleAppApi,
    required String appWebsiteUrl}) async {
  if (isPopup == true) {
    AssetsAudioPlayer.newPlayer().open(
      Audio("packages/arbis_flutter/assets/aa.wav"),
      autoStart: true,
      showNotification: false,
    );

    Get.defaultDialog(
        title: "",
        content: Stack(
          children: [
            Column(
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Text(
                      "Alert".tr,
                      style: TextStyle(
                          fontSize: 24.w, fontWeight: FontWeight.bold),
                    ),
                    const Text(
                      " (Ad)",
                      style: TextStyle(color: Colors.grey),
                    ),
                  ],
                ),
                const SizedBox(
                  height: 20,
                ),
                if (appLogoApi.isEmpty)
                  Container(
                    decoration: const BoxDecoration(
                        borderRadius: BorderRadius.all(Radius.circular(20))),
                    child: Container(
                      decoration: const BoxDecoration(
                          borderRadius:
                              BorderRadius.all(Radius.circular(20))),
                      child: Image.asset(
                        appLogoApi,
                        height: 250.h,
                      ),
                    ),
                  )
                else
                  Container(
                    decoration: BoxDecoration(
                      borderRadius:
                          const BorderRadius.all(Radius.circular(30)),
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black.withOpacity(0.3),
                          spreadRadius: 2,
                          blurRadius: 5,
                          offset: const Offset(
                              4, 10), // changes position of shadow
                        ),
                      ],
                    ),
                    child: ClipRRect(
                      borderRadius:
                          const BorderRadius.all(Radius.circular(30)),
                      child: InkWell(
                        splashColor: Colors.transparent,
                        highlightColor: Colors.transparent,
                        onTap: () async {
                          var packageid = appWebsiteUrl.split("?id=");

                          await LaunchApp.openApp(
                              androidPackageName: packageid[1],
                              iosUrlScheme: 'pulsesecure://',
                              appStoreLink:
                                  'itms-apps://itunes.apple.com/us/app/pulse-secure/id945832041');
                          // launch(appWebsiteUrl);
                        },
                        child: Image.network(
                          appLogoApi,
                          fit: BoxFit.fill,
                          height: 190.h,
                          width: 190.h,
                        ),
                      ),
                    ),
                  ),
              ],
            ),
          ],
        ),
        actions: [
          Column(
            children: [
              SizedBox(
                height: 20.h,
              ),
              Text(appNameApi.tr,
                  style: const TextStyle(
                      color: Colors.black, fontWeight: FontWeight.bold)),
              SizedBox(
                height: 10.h,
              ),
              Text(subtitleAppApi.tr, textAlign: TextAlign.center),
              SizedBox(
                height: 5.h,
              )
            ],
          )
        ],
        backgroundColor: Colors.white,
        titleStyle: const TextStyle(
            color: Colors.black, fontWeight: FontWeight.bold, height: 00),
        middleTextStyle: const TextStyle(
          color: Colors.white,
        ),
        confirm: Padding(
          padding: EdgeInsets.only(bottom: 10.h),
          child: Stack(
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Container(
                    // height: 60.h,
                    decoration: const BoxDecoration(
                      borderRadius: BorderRadius.all(Radius.circular(20)),
                    ),
                    width: 150.w,
                    child: Column(
                      children: [
                        InkWell(
                          splashColor: Colors.transparent,
                          highlightColor: Colors.transparent,
                          child: Container(
                            width: 150.w,
                            height: 50.h,
                            decoration: const BoxDecoration(
                              image: DecorationImage(
                                image: AssetImage(
                                    "packages/arbis_flutter/assets/playstore.png"),
                                fit: BoxFit.fitWidth,
                                alignment: Alignment.topCenter,
                              ),
                            ),
                          ),
                          onTap: () async {
                            var packageid = appWebsiteUrl.split("?id=");
                            await LaunchApp.openApp(
                                androidPackageName: packageid[1],
                                iosUrlScheme: 'pulsesecure://',
                                appStoreLink:
                                    'itms-apps://itunes.apple.com/us/app/pulse-secure/id945832041');
                          },
                        ),
                        InkWell(
                          splashColor: Colors.transparent,
                          highlightColor: Colors.transparent,
                          onTap: () {
                            Get.back();
                          },
                          child: Text(
                            "No Thanks".tr,
                            style: const TextStyle(
                                color: Color(0xff007A3D),
                                fontWeight: FontWeight.bold),
                          ),
                        ),
                      ],
                    ),
                  ),
                  SizedBox(
                    height: 20.h,
                  )
                ],
              ),
            ],
          ),
        ),
        // confirm: Container(
        //   child: Text("Download App"),
        // ),
        radius: 10);
  }
}