worldhopper/lib/screens/settings/about_screen.dart

63 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.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 packageInfoAsync = ref.watch(packageInfoProvider);
return Scaffold(
appBar: const WorldhopperAppBar(
title: Text('About'),
),
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: const Text('Version'),
subtitle: Text(packageInfoAsync.when(
data: (info) => info.version,
loading: () => '...',
error: (_, __) => 'unknown',
)),
),
const Divider(height: 1),
ListTile(
leading: const Icon(Icons.code),
title: const Text('Source code'),
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: const Text('Report an issue'),
subtitle: const Text('Open an issue on the repository'),
trailing: const Icon(Icons.open_in_new),
onTap: () => launchUrl(Uri.parse('$_repoUrl/issues'),
mode: LaunchMode.externalApplication),
),
],
),
),
const SizedBox(height: 16),
],
),
);
}
}