infoDialog function Null safety
Rename Dialog @param context: context @param statusMsg: Function(String, {bool loading})
Implementation
infoDialog(context, prefs, Function(String, {bool loading}) statusMsg,
currentVersion) {
plausible.event(page: 'info');
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(
context: context,
item: 'dependencies-text'.i18n(),
statusMsg: statusMsg,
title: 'dependencies-text'.i18n(),
body: "",
bodyIsWidget: true,
bodyAsWidget: const DependencyList(),
submitInput: false,
centerText: true,
);
},
text: 'dependencies-text'.i18n(),
),
ClickableText(
clickEvent: "analytics_clicked",
onPressed: () {
bool privacyMode =
prefs.getBool('privacyMode') ?? false;
String privacyStatus = privacyMode
? 'notsharingdata-text'.i18n()
: 'sharingdata-text'.i18n();
dialog(
context: context,
item: 'allow-text'.i18n(),
statusMsg: statusMsg,
title: 'usagedata-text'.i18n(),
body: 'usagedatawarning-text'.i18n([privacyStatus]),
submitText: 'donotshare-text'.i18n(),
submitInput: false,
submitStyle: const ButtonStyle(),
cancelText: 'share-text'.i18n(),
onCancel: () {
plausible.event(name: "privacy_off");
prefs.setBool('privacyMode', false);
plausible.enabled = true;
},
onSubmit: (inputText) {
plausible.event(name: "privacy_on");
prefs.setBool('privacyMode', true);
plausible.enabled = false;
statusMsg('privacymodeenabled-text'.i18n());
});
},
text: 'privacy-text'.i18n()),
],
),
),
),
actions: [
Button(
child: Text('ok-text'.i18n()),
onPressed: () {
Navigator.pop(context);
}),
],
);
});
}