DietaryGuard/lib/screens/settings.dart

86 lines
3.0 KiB
Dart
Raw Permalink Normal View History

2024-08-14 15:43:21 +00:00
import 'package:flutter/material.dart';
2024-08-14 17:26:42 +00:00
import 'package:get/get.dart';
import 'package:go_router/go_router.dart';
2024-08-15 13:12:23 +00:00
import 'package:google_fonts/google_fonts.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher_string.dart';
2024-08-14 15:43:21 +00:00
class SettingsScreen extends StatelessWidget {
2024-08-14 15:43:21 +00:00
const SettingsScreen({super.key});
@override
Widget build(BuildContext context) {
2024-08-15 03:53:01 +00:00
return Material(
color: Theme.of(context).colorScheme.surface,
child: Scaffold(
appBar: AppBar(
title: Text('settings'.tr),
),
body: ListView(
children: [
2024-08-15 13:12:23 +00:00
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(16)),
child: Image.asset("assets/icon.png", width: 64, height: 64),
).paddingAll(8),
const SizedBox(height: 12),
Text(
'appName'.tr,
style: Theme.of(context).textTheme.headlineMedium,
),
Text('appDescription'.tr),
FutureBuilder(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Text('loading'.tr);
}
return Text(
'v${snapshot.data!.version} (${snapshot.data!.buildNumber})',
style: GoogleFonts.ibmPlexMono(fontSize: 12),
);
},
),
],
).paddingOnly(left: 24, right: 24, bottom: 16),
const Divider(height: 1, thickness: 0.3).paddingOnly(
bottom: 16,
top: 8,
),
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
trailing: const Icon(Icons.chevron_right),
title: Text('settingsAlertSection'.tr),
onTap: () {
GoRouter.of(context).pushNamed('settingsAlert');
},
),
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
trailing: const Icon(Icons.chevron_right),
title: Text('settingsDataSection'.tr),
onTap: () {
GoRouter.of(context).pushNamed('settingsDataSource');
},
),
2024-08-15 13:12:23 +00:00
const Divider(height: 1, thickness: 0.3)
.paddingOnly(top: 16, bottom: 8),
Center(
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(8)),
child: Text('appCopyright'.tr, textAlign: TextAlign.center)
.paddingAll(8),
onTap: () {
launchUrlString("https://solsynth.dev");
},
),
),
2024-08-15 03:53:01 +00:00
],
),
),
2024-08-14 17:26:42 +00:00
);
2024-08-14 15:43:21 +00:00
}
}