- 引入 DarkMode 工具类,提供系统栏、颜色、色调的暗色适配能力 - AppColors 调色板改为 CupertinoDynamicColor.withBrightness 自适应 - app.dart 增加 AnnotatedRegion 与 Material Theme 包裹以联动暗色系统栏 - 移除 system_ui_util 中硬编码的浅色图标配置,改由主题驱动 - CardBox、AppDivider、SectionTitle 等公共组件适配深色卡片与分割线 - settings_ui、change_mobile、change_password、login_devices、wechat_binding 等页面全面接入 DarkMode 颜色 - dio_client 新增 allowStale 响应缓存机制,网络异常时回退本地缓存 - token_storage 增加 currentAccountId(JWT 解析)及按用户隔离的设备偏好存取 - ApiException 改为通过私有构造持有真实 AppError 实例,appError getter 返回结构化错误 - 闹钟模块迁移至 FutureProvider.autoDispose.family,消除手动 loading 状态管理 - 闹钟编辑页 CupertinoTimerPicker 替换为 CupertinoDatePicker(24h 格式),标签输入改为 TextEditingController
70 lines
2.1 KiB
Dart
70 lines
2.1 KiB
Dart
import 'package:cupertino_ui/cupertino_ui.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:ttstd_family_care/core/widgets/app_page_scaffold.dart';
|
|
|
|
import '../../../l10n/app_localizations.dart';
|
|
|
|
/// 法律文档类型。
|
|
enum LegalDocumentType {
|
|
userAgreement,
|
|
privacyPolicy,
|
|
}
|
|
|
|
/// 用户协议 / 隐私政策内容页。
|
|
///
|
|
/// 通过路由 [extra] 的 `type` 字段区分展示内容。标题与正文均由 l10n 提供,
|
|
/// 随系统语言自动切换(见 [AppLocalizations])。
|
|
class LegalDocumentPage extends StatelessWidget {
|
|
const LegalDocumentPage({super.key, required this.type});
|
|
|
|
final LegalDocumentType type;
|
|
|
|
static LegalDocumentPage fromExtra(Object? extra) {
|
|
final map = extra as Map<String, dynamic>?;
|
|
final raw = map?['type'] as String? ?? 'userAgreement';
|
|
final type = LegalDocumentType.values.firstWhere(
|
|
(e) => e.name == raw,
|
|
orElse: () => LegalDocumentType.userAgreement,
|
|
);
|
|
return LegalDocumentPage(type: type);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = AppLocalizations.of(context);
|
|
final (title, content) = switch (type) {
|
|
LegalDocumentType.userAgreement =>
|
|
(l10n.userAgreement, l10n.userAgreementContent),
|
|
LegalDocumentType.privacyPolicy =>
|
|
(l10n.privacyPolicy, l10n.privacyPolicyContent),
|
|
};
|
|
|
|
return AppPageScaffold(
|
|
backgroundColor: CupertinoColors.systemGroupedBackground,
|
|
navigationBar: CupertinoNavigationBar(
|
|
middle: Text(title),
|
|
leading: CupertinoButton(
|
|
padding: EdgeInsets.zero,
|
|
child: const Icon(CupertinoIcons.back),
|
|
onPressed: () => context.pop(),
|
|
),
|
|
),
|
|
child: SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: SingleChildScrollView(
|
|
child: Text(
|
|
content,
|
|
style: const TextStyle(
|
|
fontSize: 15,
|
|
height: 1.6,
|
|
color: CupertinoColors.label,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|