show method

void show(
  1. BuildContext context, {
  2. UpdateConfig? config,
})

Implementation

void show(BuildContext context,{UpdateConfig? config}) async {
  if (isShow()) {
    return;
  }
  maxRetryCount = config?.retryCount??4;
  CommonUtils.apkName = config?.apkName??'app_update.apk';
  CommonUtils.defaultEnLanguage= !(config?.chLanguage??false);
  String title = config?.title??
      getDefaultTitle(updateEntity!.versionName);
  String updateContent = getUpdateContent();
  if (Platform.isAndroid) {
    _apkFile = await CommonUtils.getApkFile();
  }
  _dialog = UpdateDialog.showUpdate(
    context,
    title: title,
    updateContent: updateContent,
    extraHeight: config?.extraHeight??10,
    enableIgnore: updateEntity!.isIgnorable,
    isForce: updateEntity!.isForce,
    onUpdate: onUpdate,
    onInstall: doInstall,
    progressBackgroundColor: config?.progressBackgroundColor?? const Color(0xFFFFCDD2),
    themeColor:  config?.themeColor?? Colors.red,
    topImage:  config?.topImage,
  );
}