infoDialog function

dynamic infoDialog(
  1. dynamic prefs,
  2. dynamic currentVersion
)

Info Dialog @param prefs: SharedPreferences @param currentVersion: String

Implementation

infoDialog(prefs, currentVersion) {
  plausible.event(page: 'info');

  // Get root context by Key
  final context = GlobalVariable.root.currentContext!;

  showDialog(
      context: context,
      builder: (context) {
        return ContentDialog(
          title: Center(child: Text('WSL Manager $currentVersion')),
          content: SizedBox(
            width: 400.0,
            height: 200.0,
            child: SingleChildScrollView(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  ClickableUrl(
                    clickEvent: "url_clicked",
                    url: 'https://bostrot.com',
                    text: 'createdby-text'.i18n(),
                  ),
                  ClickableUrl(
                      clickEvent: "git_clicked",
                      url: "https://github.com/bostrot/wsl2-distro-manager",
                      text: 'visitgithub-text'.i18n()),
                  ClickableUrl(
                      clickEvent: "changelog_clicked",
                      url: "https://github.com/bostrot/wsl2-distro-manager/"
                          "releases",
                      text: 'changelog-text'.i18n()),
                  ClickableUrl(
                      clickEvent: "donate_clicked",
                      url: "https://paypal.me/bostrot",
                      text: 'donate-text'.i18n()),
                  ClickableText(
                    clickEvent: "libraries_clicked",
                    onPressed: () {
                      dialog(
                        item: 'dependencies-text'.i18n(),
                        title: 'dependencies-text'.i18n(),
                        body: "",
                        bodyIsWidget: true,
                        bodyAsWidget: const DependencyList(),
                        submitInput: false,
                        centerText: true,
                      );
                    },
                    text: 'dependencies-text'.i18n(),
                  ),
                  shareUsageData(prefs),
                ],
              ),
            ),
          ),
          actions: [
            Button(
                child: Text('ok-text'.i18n()),
                onPressed: () {
                  Navigator.pop(context);
                }),
          ],
        );
      });
}