Reviewed-on: #2 Co-authored-by: Felipe M. <me@fmartingr.com> Co-committed-by: Felipe M. <me@fmartingr.com>
65 lines
2.3 KiB
Dart
65 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:worldhopper/l10n/app_localizations.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
import 'package:worldhopper/providers/package_info_provider.dart';
|
|
import 'package:worldhopper/widgets/worldhopper_app_bar.dart';
|
|
|
|
class AboutScreen extends ConsumerWidget {
|
|
const AboutScreen({super.key});
|
|
|
|
static const String _repoUrl =
|
|
'https://git.nakama.town/fmartingr/worldhopper';
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final l10n = AppLocalizations.of(context);
|
|
final packageInfoAsync = ref.watch(packageInfoProvider);
|
|
|
|
return Scaffold(
|
|
appBar: WorldhopperAppBar(
|
|
title: Text(l10n.aboutTitle),
|
|
),
|
|
body: ListView(
|
|
children: [
|
|
const SizedBox(height: 8),
|
|
Card(
|
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
child: Column(
|
|
children: [
|
|
ListTile(
|
|
leading: const Icon(Icons.label_outline),
|
|
title: Text(l10n.aboutVersion),
|
|
subtitle: Text(packageInfoAsync.when(
|
|
data: (info) => info.version,
|
|
loading: () => '...',
|
|
error: (_, __) => l10n.aboutVersionUnknown,
|
|
)),
|
|
),
|
|
const Divider(height: 1),
|
|
ListTile(
|
|
leading: const Icon(Icons.code),
|
|
title: Text(l10n.aboutSourceCode),
|
|
subtitle: const Text(_repoUrl),
|
|
trailing: const Icon(Icons.open_in_new),
|
|
onTap: () => launchUrl(Uri.parse(_repoUrl),
|
|
mode: LaunchMode.externalApplication),
|
|
),
|
|
const Divider(height: 1),
|
|
ListTile(
|
|
leading: const Icon(Icons.bug_report_outlined),
|
|
title: Text(l10n.aboutReportIssue),
|
|
subtitle: Text(l10n.aboutReportIssueSubtitle),
|
|
trailing: const Icon(Icons.open_in_new),
|
|
onTap: () => launchUrl(Uri.parse('$_repoUrl/issues'),
|
|
mode: LaunchMode.externalApplication),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|