app/lib/screens/about_screen.dart
John Mizerek 85e8e1a290 Add saved runs feature with history, comparison, and about screen (v1.2)
Features:
- Save calculation runs with custom labels for later retrieval
- View saved runs list with dominant factor summary
- View detailed results of any saved run
- View original inputs in read-only mode
- Use any saved run as starting point for new calculation
- Compare two saved runs side-by-side
- About screen with app info, help links, privacy policy
- Metric/Imperial unit toggle persisted across sessions
- Info icon in app bar on all screens

Technical:
- New SavedRun model with full serialization
- SQLite saved_runs table with CRUD operations
- readOnly mode for all input screens
- Unit preference stored in LocalStorage
- Database schema upgraded to v2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-21 09:59:58 -08:00

196 lines
6.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import '../theme.dart';
class AboutScreen extends StatelessWidget {
const AboutScreen({super.key});
static const String _helpUrl = 'https://addmonths.app/help';
static const String _privacyUrl = 'https://addmonths.app/privacy';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('About'),
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context),
),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// App name and version
Center(
child: Column(
children: [
Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: AppColors.surfaceVariant,
borderRadius: BorderRadius.circular(20),
),
child: const Icon(
Icons.timeline,
size: 40,
color: AppColors.primary,
),
),
const SizedBox(height: 16),
Text(
'Add Months',
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(height: 4),
Text(
'Version 1.2',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: AppColors.textSecondary,
),
),
],
),
),
const SizedBox(height: 32),
// Description
Text(
'What is Add Months?',
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 8),
Text(
'Add Months uses evidence-based hazard ratios from peer-reviewed '
'meta-analyses to identify which single lifestyle change could '
'have the biggest impact on your lifespan.',
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 16),
Text(
'Answer simple questions about your demographics and habits, '
'and the app calculates which modifiable factor offers the '
'greatest potential benefit.',
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 32),
// Privacy note
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: AppColors.surfaceVariant,
borderRadius: BorderRadius.circular(12),
),
child: Row(
children: [
const Icon(
Icons.lock_outline,
color: AppColors.primary,
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Your data stays on your device',
style: Theme.of(context).textTheme.titleSmall,
),
const SizedBox(height: 4),
Text(
'No accounts, no cloud sync, no analytics. '
'Everything is stored locally.',
style: Theme.of(context).textTheme.bodySmall,
),
],
),
),
],
),
),
const SizedBox(height: 32),
// Links
_buildLinkButton(
context,
icon: Icons.help_outline,
label: 'How it works',
onTap: () => _launchUrl(_helpUrl),
),
const SizedBox(height: 12),
_buildLinkButton(
context,
icon: Icons.privacy_tip_outlined,
label: 'Privacy Policy',
onTap: () => _launchUrl(_privacyUrl),
),
const SizedBox(height: 32),
// Disclaimer
Text(
'Disclaimer',
style: Theme.of(context).textTheme.titleSmall?.copyWith(
color: AppColors.textSecondary,
),
),
const SizedBox(height: 8),
Text(
'This app provides general information based on population-level '
'research and is not medical advice. Individual results vary widely. '
'Consult a healthcare provider for personalized guidance.',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: AppColors.textSecondary,
),
),
],
),
),
);
}
Widget _buildLinkButton(
BuildContext context, {
required IconData icon,
required String label,
required VoidCallback onTap,
}) {
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(12),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
decoration: BoxDecoration(
border: Border.all(color: AppColors.divider),
borderRadius: BorderRadius.circular(12),
),
child: Row(
children: [
Icon(icon, color: AppColors.primary),
const SizedBox(width: 12),
Text(
label,
style: Theme.of(context).textTheme.bodyLarge,
),
const Spacer(),
const Icon(
Icons.open_in_new,
size: 18,
color: AppColors.textSecondary,
),
],
),
),
);
}
Future<void> _launchUrl(String url) async {
final uri = Uri.parse(url);
if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
}
}