Files
zhinian_manage/lib/pages/policy_page.dart

115 lines
3.4 KiB
Dart

import 'package:flutter/material.dart';
import '../theme.dart';
import '../l10n/app_localizations.dart';
class PolicyPage extends StatelessWidget {
final String type;
const PolicyPage({super.key, required this.type});
bool get isAgreement => type == 'agreement';
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return Scaffold(
backgroundColor: AppColors.background,
appBar: AppBar(
title: Text(isAgreement ? l10n.userAgreement : l10n.privacyPolicy),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(20),
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: AppColors.surface,
borderRadius: BorderRadius.circular(16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
isAgreement ? l10n.agreementTitle : l10n.privacyTitle,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: AppColors.textPrimary,
),
),
const SizedBox(height: 8),
Text(
l10n.lastUpdated,
style: TextStyle(fontSize: 12, color: AppColors.textTertiary),
),
const SizedBox(height: 24),
if (isAgreement) ..._buildAgreementContent(context, l10n) else ..._buildPrivacyContent(context, l10n),
],
),
),
),
);
}
List<Widget> _buildAgreementContent(BuildContext context, AppLocalizations l10n) {
return [
_section(l10n.agreementSection1),
_paragraph(l10n.agreementPara1),
_section(l10n.agreementSection2),
_paragraph(l10n.agreementPara2),
_section(l10n.agreementSection3),
_paragraph(l10n.agreementPara3),
_section(l10n.agreementSection4),
_paragraph(l10n.agreementPara4),
_section(l10n.agreementSection5),
_paragraph(l10n.agreementPara5),
_section(l10n.agreementSection6),
_paragraph(l10n.agreementPara6),
_section(l10n.agreementSection7),
_paragraph(l10n.agreementPara7),
];
}
List<Widget> _buildPrivacyContent(BuildContext context, AppLocalizations l10n) {
return [
_section(l10n.privacySection1),
_paragraph(l10n.privacyPara1),
_section(l10n.privacySection2),
_paragraph(l10n.privacyPara2),
_section(l10n.privacySection3),
_paragraph(l10n.privacyPara3),
_section(l10n.privacySection4),
_paragraph(l10n.privacyPara4),
_section(l10n.privacySection5),
_paragraph(l10n.privacyPara5),
_section(l10n.privacySection6),
_paragraph(l10n.privacyPara6),
_section(l10n.privacySection7),
_paragraph(l10n.privacyPara7),
];
}
Widget _section(String title) {
return Padding(
padding: const EdgeInsets.only(top: 20, bottom: 8),
child: Text(
title,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: AppColors.textPrimary,
),
),
);
}
Widget _paragraph(String text) {
return Text(
text,
style: TextStyle(
fontSize: 14,
color: AppColors.textSecondary,
height: 1.7,
),
);
}
}