Add terms and privacy to about page

This commit is contained in:
problematicconsumer
2023-10-26 15:25:54 +03:30
parent ab4e6f8b77
commit 2152cc384c

View File

@@ -41,6 +41,33 @@ class AboutPage extends HookConsumerWidget {
}, },
); );
final conditionalTiles = [
if (appInfo.release.allowCustomUpdateChecker)
ListTile(
title: Text(t.about.checkForUpdate),
trailing: switch (appUpdate) {
AppUpdateStateChecking() => const SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(),
),
_ => const Icon(Icons.update),
},
onTap: () async {
await ref.read(appUpdateNotifierProvider.notifier).check();
},
),
if (PlatformUtils.isDesktop)
ListTile(
title: Text(t.settings.general.openWorkingDir),
trailing: const Icon(Icons.arrow_outward_outlined),
onTap: () async {
final path = ref.read(filesEditorServiceProvider).workingDir.uri;
await UriUtils.tryLaunch(path);
},
),
];
return Scaffold( return Scaffold(
body: CustomScrollView( body: CustomScrollView(
slivers: [ slivers: [
@@ -91,6 +118,8 @@ class AboutPage extends HookConsumerWidget {
SliverList( SliverList(
delegate: SliverChildListDelegate( delegate: SliverChildListDelegate(
[ [
...conditionalTiles,
if (conditionalTiles.isNotEmpty) const Divider(),
ListTile( ListTile(
title: Text(t.about.sourceCode), title: Text(t.about.sourceCode),
trailing: const Icon(Icons.open_in_new), trailing: const Icon(Icons.open_in_new),
@@ -109,33 +138,24 @@ class AboutPage extends HookConsumerWidget {
); );
}, },
), ),
if (appInfo.release.allowCustomUpdateChecker) ListTile(
ListTile( title: Text(t.about.termsAndConditions),
title: Text(t.about.checkForUpdate), trailing: const Icon(Icons.open_in_new),
trailing: switch (appUpdate) { onTap: () async {
AppUpdateStateChecking() => const SizedBox( await UriUtils.tryLaunch(
width: 24, Uri.parse(Constants.termsAndConditionsUrl),
height: 24, );
child: CircularProgressIndicator(), },
), ),
_ => const Icon(Icons.update), ListTile(
}, title: Text(t.about.privacyPolicy),
onTap: () async { trailing: const Icon(Icons.open_in_new),
await ref onTap: () async {
.read(appUpdateNotifierProvider.notifier) await UriUtils.tryLaunch(
.check(); Uri.parse(Constants.privacyPolicyUrl),
}, );
), },
if (PlatformUtils.isDesktop) ),
ListTile(
title: Text(t.settings.general.openWorkingDir),
trailing: const Icon(Icons.arrow_outward_outlined),
onTap: () async {
final path =
ref.read(filesEditorServiceProvider).workingDir.uri;
await UriUtils.tryLaunch(path);
},
),
], ],
), ),
), ),