showMigrationDialog static method

void showMigrationDialog(
  1. BuildContext context,
  2. String url
)

Implementation

static void showMigrationDialog(BuildContext context, String url) {
  if (Platform.isIOS) {
    showCupertinoDialog(
      context: context,
      barrierDismissible: false,
      builder: (dialogContext) => CupertinoAlertDialog(
        title: const Text("App Moved!"),
        content: const Text(
          "We have moved to a new and improved app! Please download it to continue.",
        ),
        actions: <Widget>[
          CupertinoDialogAction(
            child: const Text("Download New App"),
            onPressed: () {
              launchUrl(Uri.parse(url));
            },
          ),
        ],
      ),
    );
  } else {
    showDialog(
      context: context,
      barrierDismissible: false,
      builder: (dialogContext) => AlertDialog(
        backgroundColor: Colors.white,
        surfaceTintColor: Colors.transparent,
        elevation: 10,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(20),
        ),
        icon: const Icon(Icons.rocket_launch_rounded, size: 60, color: Colors.deepPurpleAccent),
        title: const Text(
          "App Moved!",
          textAlign: TextAlign.center,
          style: TextStyle(
            fontWeight: FontWeight.bold,
            fontSize: 22,
            color: Colors.black87,
          ),
        ),
        content: const Text(
          "We have moved to a new and improved app! Please download it to continue.",
          textAlign: TextAlign.center,
          style: TextStyle(color: Colors.black54, fontSize: 16),
        ),
        actionsAlignment: MainAxisAlignment.center,
        actionsPadding: const EdgeInsets.only(bottom: 20, left: 20, right: 20),
        actions: <Widget>[
          ElevatedButton(
            style: ElevatedButton.styleFrom(
              backgroundColor: Colors.deepPurpleAccent,
              foregroundColor: Colors.white,
              minimumSize: const Size(double.infinity, 50),
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(15),
              ),
            ),
            child: const Text("DOWNLOAD NEW APP", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
            onPressed: () {
              launchUrl(Uri.parse(url));
            },
          ),
        ],
      ),
    );
  }
}