Files
GitJournal/lib/settings/settings_about.dart
Vishesh Handa 657721adc6 Update dart-git and stop using the Result class
Instead we're going to move back to standard exceptions.

Using a custom Result class has created far far more problems
- The Stacktraces aren't always right
- Sometimes one forgets to check the Result error
- All other exception throwing code needing to be converted to Results
- Non idiomatic Dart code

I think it's better to just go back to exceptions. They have their
problems, but overall, I think it's a better approach.
2023-11-24 14:03:30 +01:00

113 lines
3.0 KiB
Dart

/*
* SPDX-FileCopyrightText: 2021 Vishesh Handa <me@vhanda.in>
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:gitjournal/l10n.dart';
import 'package:gitjournal/settings/settings_screen.dart';
import 'package:gitjournal/settings/widgets/version_number_widgit.dart';
import 'package:url_launcher/url_launcher.dart';
const _privacyUrl = "https://gitjournal.io/privacy";
const _termsUrl = "https://gitjournal.io/terms";
class SettingsAboutPage extends StatelessWidget {
static const routePath = '/settings/about';
const SettingsAboutPage({super.key});
@override
Widget build(BuildContext context) {
var list = ListView(
children: [
const _AboutPageHeader(),
const Divider(),
const VersionNumberTile(),
SettingsTile(
iconData: FontAwesomeIcons.userShield,
title: context.loc.settingsPrivacy,
subtitle: _privacyUrl.replaceAll('https://', ''),
onTap: () {
launchUrl(
Uri.parse(_privacyUrl),
mode: LaunchMode.externalApplication,
);
},
),
SettingsTile(
iconData: FontAwesomeIcons.fileContract,
title: context.loc.settingsTerms,
subtitle: _termsUrl.replaceAll('https://', ''),
onTap: () {
launchUrl(
Uri.parse(_termsUrl),
mode: LaunchMode.externalApplication,
);
},
),
SettingsTile(
iconData: FontAwesomeIcons.circleInfo,
title: context.loc.settingsLicenseTitle,
subtitle: context.loc.settingsLicenseSubtitle,
onTap: () {
showLicensePage(
context: context,
applicationIcon: const GitJournalLogo(height: 32, width: 32),
);
},
),
],
);
return Scaffold(
appBar: AppBar(
title: Text(context.loc.settingsProjectAbout),
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
Navigator.of(context).pop();
},
),
),
body: list,
);
}
}
class _AboutPageHeader extends StatelessWidget {
const _AboutPageHeader();
@override
Widget build(BuildContext context) {
return const GitJournalLogo(width: 64 * 2, height: 64 * 2);
}
}
class GitJournalLogo extends StatelessWidget {
final int width;
final int height;
const GitJournalLogo({
super.key,
required this.width,
required this.height,
});
@override
Widget build(BuildContext context) {
return const Padding(
padding: EdgeInsets.all(32.0),
child: DecoratedBox(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/icon/icon.png'),
),
),
child: SizedBox(width: 64 * 2, height: 64 * 2),
),
);
}
}