111 lines
3.1 KiB
Dart
111 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
import '../i18n/strings.g.dart';
|
|
import 'theme.dart';
|
|
|
|
/// Where the full legal documents are published. The masters live in the
|
|
/// repository under `docs/legal/` and must stay in sync with these pages.
|
|
const String legalBaseUrl = 'https://tane.comunes.org/legal';
|
|
|
|
/// "Privacy & rules": in-app, human-language summaries of the privacy policy,
|
|
/// the terms + community rules, and the seed-legality notice, each linking to
|
|
/// the full published text.
|
|
class LegalScreen extends StatelessWidget {
|
|
const LegalScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final t = context.t;
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(t.legal.title)),
|
|
body: ListView(
|
|
padding: const EdgeInsets.fromLTRB(20, 16, 20, 32),
|
|
children: [
|
|
_Section(
|
|
icon: Icons.lock_outline,
|
|
title: t.legal.privacyTitle,
|
|
body: t.legal.privacyBody,
|
|
url: '$legalBaseUrl/privacy',
|
|
),
|
|
_Section(
|
|
icon: Icons.handshake_outlined,
|
|
title: t.legal.rulesTitle,
|
|
body: t.legal.rulesBody,
|
|
url: '$legalBaseUrl/rules',
|
|
),
|
|
_Section(
|
|
icon: Icons.grass_outlined,
|
|
title: t.legal.seedsTitle,
|
|
body: t.legal.seedsBody,
|
|
url: '$legalBaseUrl/seeds',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// One titled summary block with its "read the full text" link.
|
|
class _Section extends StatelessWidget {
|
|
const _Section({
|
|
required this.icon,
|
|
required this.title,
|
|
required this.body,
|
|
required this.url,
|
|
});
|
|
|
|
final IconData icon;
|
|
final String title;
|
|
final String body;
|
|
final String url;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final t = context.t;
|
|
final theme = Theme.of(context);
|
|
return Padding(
|
|
padding: const EdgeInsetsDirectional.only(bottom: 24),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(icon, color: seedGreen),
|
|
const SizedBox(width: 10),
|
|
Expanded(
|
|
child: Text(
|
|
title,
|
|
style: theme.textTheme.titleMedium?.copyWith(
|
|
color: seedOnSurface,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
body,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: seedOnSurface,
|
|
height: 1.5,
|
|
),
|
|
),
|
|
TextButton.icon(
|
|
style: TextButton.styleFrom(
|
|
padding: EdgeInsets.zero,
|
|
foregroundColor: seedGreen,
|
|
),
|
|
icon: const Icon(Icons.open_in_new, size: 16),
|
|
label: Text(t.legal.readFull),
|
|
onPressed: () => launchUrl(
|
|
Uri.parse(url),
|
|
mode: LaunchMode.externalApplication,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|