feat: English and Chinese, and selectable chat text
- settings → general → language picks system, Chinese or English; the choice is stored on the device and read before the first frame - our Chinese strings are translated through tr()/trArgs() and AppText, with the English in lib/l10n/en_*.dart; a missing entry falls back to Chinese and a test checks that every literal in lib has one - AppText rebuilds on a language change (it depends on the resolved locale), so const text and whole pages switch at once; the built-in date/time pickers and selection menu follow the same language - server and user data (titles, messages, prompts, paths) is never translated - the chat list sits in a SelectionArea: long-press selects message text and shows the copy/select-all menu - bump to 0.5.2
This commit is contained in:
1 parent
da4bfb6826
commit
7b5bccf28f
42 files changed
+1943
-735
No files matched your search
@@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart'
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../api/models.dart';
|
||||
import '../l10n.dart';
|
||||
import '../appearance_prefs.dart';
|
||||
import '../pets/pet_library.dart';
|
||||
import '../pets/pet_pack.dart';
|
||||
@@ -20,12 +21,18 @@ class SettingsScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('设置')),
|
||||
appBar: AppBar(title: const AppText('设置')),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.only(top: 4, bottom: 32),
|
||||
children: [
|
||||
const _SectionHeader('常规'),
|
||||
_Section(children: [
|
||||
_NavTile(
|
||||
icon: Icons.translate,
|
||||
title: '语言',
|
||||
subtitle: '跟随系统、中文或 English',
|
||||
builder: (_) => const LanguageSettingsPage(),
|
||||
),
|
||||
_NavTile(
|
||||
icon: Icons.tune,
|
||||
title: '通用',
|
||||
@@ -114,7 +121,9 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
final ok = await app.setAgentToolSetting(key, value);
|
||||
if (!ok && mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('保存失败:${app.lastError ?? '未知错误'}')),
|
||||
SnackBar(
|
||||
content: AppText(
|
||||
trArgs('保存失败:{0}', [app.lastError ?? tr('未知错误')]))),
|
||||
);
|
||||
app.clearLastError();
|
||||
}
|
||||
@@ -124,7 +133,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('通用')),
|
||||
appBar: AppBar(title: const AppText('通用')),
|
||||
body: ListenableBuilder(
|
||||
listenable: app,
|
||||
builder: (context, _) => ListView(
|
||||
@@ -149,8 +158,8 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
if (app.imageToolEnabled)
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.fromLTRB(52, 0, 16, 4),
|
||||
title: const Text('图像模型'),
|
||||
subtitle: Text(_imageModelName(),
|
||||
title: const AppText('图像模型'),
|
||||
subtitle: AppText(_imageModelName(),
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
trailing: const Icon(Icons.chevron_right, size: 20),
|
||||
onTap: _pickImageModel,
|
||||
@@ -214,8 +223,8 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
value: value,
|
||||
onChanged: (v) => _save(key, v),
|
||||
secondary: Icon(icon, size: 20),
|
||||
title: Text(title),
|
||||
subtitle: Text(subtitle),
|
||||
title: AppText(title),
|
||||
subtitle: AppText(subtitle),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -248,10 +257,10 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
onChanged: (v) =>
|
||||
_save('agentMemoryDreamingEnabled', v ?? false),
|
||||
),
|
||||
Expanded(child: Text('整理记忆')),
|
||||
Expanded(child: AppText('整理记忆')),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.info_outline, size: 18),
|
||||
tooltip: '整理记忆',
|
||||
tooltip: tr('整理记忆'),
|
||||
onPressed: _dreamingInfo,
|
||||
),
|
||||
],
|
||||
@@ -270,7 +279,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
),
|
||||
child: Text(name,
|
||||
child: AppText(name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 13)),
|
||||
@@ -286,9 +295,9 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: theme.colorScheme.onSurface),
|
||||
items: [
|
||||
const DropdownMenuItem(value: '', child: Text('默认')),
|
||||
const DropdownMenuItem(value: '', child: AppText('默认')),
|
||||
for (final v in variants)
|
||||
DropdownMenuItem(value: v, child: Text(v)),
|
||||
DropdownMenuItem(value: v, child: AppText(v)),
|
||||
],
|
||||
onChanged: (v) => _save('agentMemoryDreamingVariant', v ?? ''),
|
||||
),
|
||||
@@ -312,12 +321,12 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialog) => AlertDialog(
|
||||
title: const Text('整理记忆'),
|
||||
content: const Text(
|
||||
title: const AppText('整理记忆'),
|
||||
content: const AppText(
|
||||
'每天一次,在没有会话运行时,智能体会在后台整理记忆:合并重复条目,删除已过时或项目文档中已有的内容。'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialog), child: const Text('知道了')),
|
||||
onPressed: () => Navigator.pop(dialog), child: const AppText('知道了')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -328,7 +337,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
if (!mounted) return;
|
||||
if (models.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('你的提供商中没有图像模型')),
|
||||
const SnackBar(content: AppText('你的提供商中没有图像模型')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -398,7 +407,7 @@ Future<String?> _chooseFromSheet({
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: Text(title,
|
||||
child: AppText(title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
@@ -407,7 +416,7 @@ Future<String?> _chooseFromSheet({
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(noneLabel),
|
||||
title: AppText(noneLabel),
|
||||
trailing: selected.isEmpty
|
||||
? const Icon(Icons.check, size: 20)
|
||||
: null,
|
||||
@@ -415,9 +424,9 @@ Future<String?> _chooseFromSheet({
|
||||
),
|
||||
for (final option in options)
|
||||
ListTile(
|
||||
title: Text(option.name,
|
||||
title: AppText(option.name,
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
subtitle: option.note.isEmpty ? null : Text(option.note),
|
||||
subtitle: option.note.isEmpty ? null : AppText(option.note),
|
||||
trailing: selected == option.value
|
||||
? const Icon(Icons.check, size: 20)
|
||||
: null,
|
||||
@@ -432,6 +441,62 @@ Future<String?> _chooseFromSheet({
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------- language
|
||||
|
||||
/// The UI language: follow the system, or pin Chinese or English.
|
||||
class LanguageSettingsPage extends StatelessWidget {
|
||||
const LanguageSettingsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = L10n.instance;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppText('语言')),
|
||||
body: ListenableBuilder(
|
||||
listenable: l10n,
|
||||
builder: (context, _) {
|
||||
final english = l10n.isEnglish;
|
||||
final systemName = l10n.locale.languageCode == 'zh'
|
||||
? AppLanguage.zh.labelFor(english)
|
||||
: AppLanguage.en.labelFor(english);
|
||||
return ListView(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 32),
|
||||
children: [
|
||||
RadioGroup<AppLanguage>(
|
||||
groupValue: l10n.choice,
|
||||
onChanged: (value) {
|
||||
if (value != null) l10n.setLanguage(value);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
for (final choice in AppLanguage.values)
|
||||
RadioListTile<AppLanguage>(
|
||||
value: choice,
|
||||
title: AppText(choice.labelFor(english)),
|
||||
subtitle: choice == AppLanguage.system
|
||||
? AppText(trArgs('当前:{0}', [systemName]))
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
|
||||
child: AppText(
|
||||
'界面文字与系统自带的日期、时间选择器会一起切换。',
|
||||
style: TextStyle(
|
||||
fontSize: 12.5,
|
||||
color: Theme.of(context).hintColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------- chat
|
||||
|
||||
class ChatSettingsPage extends StatefulWidget {
|
||||
@@ -454,7 +519,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('聊天')),
|
||||
appBar: AppBar(title: const AppText('聊天')),
|
||||
body: ListenableBuilder(
|
||||
listenable: widget.app,
|
||||
builder: (context, _) {
|
||||
@@ -463,8 +528,8 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 32),
|
||||
children: [
|
||||
const ListTile(
|
||||
title: Text('追问处理行为'),
|
||||
subtitle: Text('运行中按发送时,消息默认怎么处理。与网页端设置同步。'),
|
||||
title: AppText('追问处理行为'),
|
||||
subtitle: AppText('运行中按发送时,消息默认怎么处理。与网页端设置同步。'),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 6),
|
||||
@@ -473,12 +538,12 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
ChoiceChip(
|
||||
label: const Text('转向'),
|
||||
label: const AppText('转向'),
|
||||
selected: steer,
|
||||
onSelected: (_) => _setFollowUp('steer'),
|
||||
),
|
||||
ChoiceChip(
|
||||
label: const Text('排队'),
|
||||
label: const AppText('排队'),
|
||||
selected: !steer,
|
||||
onSelected: (_) => _setFollowUp('queue'),
|
||||
),
|
||||
@@ -487,7 +552,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: Text(
|
||||
child: AppText(
|
||||
steer ? '转向:在下一步加入当前回合,工作继续。' : '排队:等当前回合结束后再发送。',
|
||||
style: TextStyle(fontSize: 12.5, color: theme.hintColor),
|
||||
),
|
||||
@@ -503,7 +568,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
final ok = await widget.app.setFollowUpBehavior(value);
|
||||
if (!ok && mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(widget.app.lastError ?? '保存失败')),
|
||||
SnackBar(content: AppText(widget.app.lastError ?? '保存失败')),
|
||||
);
|
||||
widget.app.clearLastError();
|
||||
}
|
||||
@@ -525,7 +590,7 @@ class ThemeSettingsPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final look = AppearancePrefs.instance;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('主题')),
|
||||
appBar: AppBar(title: const AppText('主题')),
|
||||
body: ListenableBuilder(
|
||||
listenable: look,
|
||||
builder: (context, _) {
|
||||
@@ -535,7 +600,7 @@ class ThemeSettingsPage extends StatelessWidget {
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: Text('主题只保存在本机,不随服务器同步。',
|
||||
child: AppText('主题只保存在本机,不随服务器同步。',
|
||||
style: TextStyle(fontSize: 12.5)),
|
||||
),
|
||||
const _Label('主题模式'),
|
||||
@@ -547,7 +612,7 @@ class ThemeSettingsPage extends StatelessWidget {
|
||||
children: [
|
||||
for (final (mode, label) in _modes)
|
||||
ChoiceChip(
|
||||
label: Text(label),
|
||||
label: AppText(label),
|
||||
selected: look.themeMode == mode,
|
||||
onSelected: (_) => look.setThemeMode(mode),
|
||||
),
|
||||
@@ -579,7 +644,7 @@ class ThemeSettingsPage extends StatelessWidget {
|
||||
return Semantics(
|
||||
button: true,
|
||||
selected: selected,
|
||||
label: '主题色 ${seed.toRadixString(16)}',
|
||||
label: trArgs('主题色 {0}', [seed.toRadixString(16)]),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
onTap: () => look.setSeedColor(seed),
|
||||
@@ -625,7 +690,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('宠物')),
|
||||
appBar: AppBar(title: const AppText('宠物')),
|
||||
body: ListenableBuilder(
|
||||
listenable: PetLibrary.instance,
|
||||
builder: (context, _) {
|
||||
@@ -636,7 +701,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: Text('默认不提供宠物;宠物包只存放在本机。',
|
||||
child: AppText('默认不提供宠物;宠物包只存放在本机。',
|
||||
style: TextStyle(fontSize: 12.5)),
|
||||
),
|
||||
if (pack == null) ..._empty(theme) else ..._loaded(theme, pack),
|
||||
@@ -649,15 +714,15 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
|
||||
List<Widget> _empty(ThemeData theme) => [
|
||||
const ListTile(
|
||||
title: Text('尚未导入宠物'),
|
||||
subtitle: Text('导入一个宠物包(.zip)后,它会站在输入框上方。'),
|
||||
title: AppText('尚未导入宠物'),
|
||||
subtitle: AppText('导入一个宠物包(.zip)后,它会站在输入框上方。'),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: FilledButton.tonalIcon(
|
||||
onPressed: _importPet,
|
||||
icon: const Icon(Icons.file_upload_outlined, size: 18),
|
||||
label: const Text('导入宠物包'),
|
||||
label: const AppText('导入宠物包'),
|
||||
),
|
||||
),
|
||||
];
|
||||
@@ -668,14 +733,14 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
[pack.author, pack.license].where((s) => s.trim().isNotEmpty).join(' · ');
|
||||
return [
|
||||
ListTile(
|
||||
title: Text(pack.name.isEmpty ? pack.id : pack.name),
|
||||
title: AppText(pack.name.isEmpty ? pack.id : pack.name),
|
||||
subtitle: info.isEmpty
|
||||
? null
|
||||
: Text(info, maxLines: 2, overflow: TextOverflow.ellipsis),
|
||||
: AppText(info, maxLines: 2, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
SwitchListTile(
|
||||
title: const Text('启用宠物'),
|
||||
subtitle: const Text('站在输入框上方,默认关闭'),
|
||||
title: const AppText('启用宠物'),
|
||||
subtitle: const AppText('站在输入框上方,默认关闭'),
|
||||
value: library.enabled,
|
||||
onChanged: (v) => library.setEnabled(v),
|
||||
),
|
||||
@@ -691,7 +756,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
(64.0, '大'),
|
||||
])
|
||||
ChoiceChip(
|
||||
label: Text(label),
|
||||
label: AppText(label),
|
||||
selected: (library.size - size).abs() < 0.5,
|
||||
onSelected: (_) => library.setSize(size),
|
||||
),
|
||||
@@ -705,12 +770,12 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
FilledButton.tonalIcon(
|
||||
onPressed: _importPet,
|
||||
icon: const Icon(Icons.swap_horiz, size: 18),
|
||||
label: const Text('更换宠物包'),
|
||||
label: const AppText('更换宠物包'),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
TextButton(
|
||||
onPressed: _confirmRemovePet,
|
||||
child: const Text('移除'),
|
||||
child: const AppText('移除'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -721,7 +786,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
Future<void> _importPet() async {
|
||||
try {
|
||||
final file = await FilePicker.pickFile(
|
||||
dialogTitle: '选择宠物包(.zip)',
|
||||
dialogTitle: tr('选择宠物包(.zip)'),
|
||||
type: FileType.custom,
|
||||
allowedExtensions: const ['zip'],
|
||||
);
|
||||
@@ -730,12 +795,14 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
final pack = await PetLibrary.instance.importZip(bytes);
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('已导入 ${pack.name.isEmpty ? pack.id : pack.name}')),
|
||||
SnackBar(
|
||||
content: AppText(trArgs(
|
||||
'已导入 {0}', [pack.name.isEmpty ? pack.id : pack.name]))),
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('导入失败:$e')),
|
||||
SnackBar(content: AppText(trArgs('导入失败:{0}', [e]))),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -744,15 +811,15 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
final ok = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (dialog) => AlertDialog(
|
||||
title: const Text('移除宠物?'),
|
||||
content: const Text('本机保存的宠物包会被删除。'),
|
||||
title: const AppText('移除宠物?'),
|
||||
content: const AppText('本机保存的宠物包会被删除。'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialog, false),
|
||||
child: const Text('取消')),
|
||||
child: const AppText('取消')),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(dialog, true),
|
||||
child: const Text('移除')),
|
||||
child: const AppText('移除')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -812,7 +879,7 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
: value.isEmpty
|
||||
? '未获取到'
|
||||
: value;
|
||||
return Text(text,
|
||||
return AppText(text,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: text == value && value.isNotEmpty
|
||||
@@ -826,11 +893,11 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
final versions = _versions;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('关于'),
|
||||
title: const AppText('关于'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
tooltip: '重新获取服务端版本',
|
||||
tooltip: tr('重新获取服务端版本'),
|
||||
onPressed: _loading ? null : _load,
|
||||
),
|
||||
],
|
||||
@@ -857,10 +924,10 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('OpenChamber',
|
||||
AppText('OpenChamber',
|
||||
style: theme.textTheme.titleLarge
|
||||
?.copyWith(fontWeight: FontWeight.w600)),
|
||||
Text('手机客户端',
|
||||
AppText('手机客户端',
|
||||
style: TextStyle(
|
||||
fontSize: 12.5, color: theme.hintColor)),
|
||||
],
|
||||
@@ -873,16 +940,16 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
_Section(children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.tag, size: 20),
|
||||
title: const Text('版本'),
|
||||
trailing: Text(
|
||||
title: const AppText('版本'),
|
||||
trailing: AppText(
|
||||
appVersion.isEmpty ? '未知' : appVersion,
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.description_outlined, size: 20),
|
||||
title: const Text('开源许可'),
|
||||
subtitle: const Text('本应用使用的第三方组件与它们的许可证'),
|
||||
title: const AppText('开源许可'),
|
||||
subtitle: const AppText('本应用使用的第三方组件与它们的许可证'),
|
||||
trailing: const Icon(Icons.chevron_right, size: 20),
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (_) => const LicensesPage(),
|
||||
@@ -893,12 +960,12 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
_Section(children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.terminal, size: 20),
|
||||
title: const Text('OpenCode'),
|
||||
title: const AppText('OpenCode'),
|
||||
trailing: _version(context, versions?.opencode ?? ''),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.hub_outlined, size: 20),
|
||||
title: const Text('OpenChamber'),
|
||||
title: const AppText('OpenChamber'),
|
||||
trailing: _version(context, versions?.openchamber ?? ''),
|
||||
),
|
||||
]),
|
||||
@@ -948,7 +1015,7 @@ class _LicensesPageState extends State<LicensesPage> {
|
||||
final theme = Theme.of(context);
|
||||
final licenses = _licenses;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('开源许可')),
|
||||
appBar: AppBar(title: const AppText('开源许可')),
|
||||
body: licenses == null
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: ListView.separated(
|
||||
@@ -960,7 +1027,7 @@ class _LicensesPageState extends State<LicensesPage> {
|
||||
if (i == 0) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 14, 20, 14),
|
||||
child: Text(
|
||||
child: AppText(
|
||||
'下面列出随本应用打包的第三方组件;点开可阅读完整许可证。',
|
||||
style:
|
||||
TextStyle(fontSize: 12.5, color: theme.hintColor),
|
||||
@@ -969,7 +1036,7 @@ class _LicensesPageState extends State<LicensesPage> {
|
||||
}
|
||||
final name = licenses.keys.elementAt(i - 1);
|
||||
return ListTile(
|
||||
title: Text(name),
|
||||
title: AppText(name),
|
||||
trailing: const Icon(Icons.chevron_right, size: 20),
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (_) => _LicenseTextPage(
|
||||
@@ -1006,11 +1073,11 @@ class _LicenseTextPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(name)),
|
||||
appBar: AppBar(title: AppText(name)),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: SelectableText(
|
||||
text.isEmpty ? '该组件没有附带许可证文本。' : text,
|
||||
text.isEmpty ? tr('该组件没有附带许可证文本。') : text,
|
||||
style: const TextStyle(fontSize: 12, fontFamily: 'monospace', height: 1.45),
|
||||
),
|
||||
),
|
||||
@@ -1065,8 +1132,8 @@ class _NavTile extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(icon, size: 22),
|
||||
title: Text(title),
|
||||
subtitle: Text(subtitle),
|
||||
title: AppText(title),
|
||||
subtitle: AppText(subtitle),
|
||||
trailing: const Icon(Icons.chevron_right, size: 20),
|
||||
onTap: () => Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: builder)),
|
||||
@@ -1087,7 +1154,7 @@ class _SectionHeader extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title,
|
||||
AppText(title,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -1096,7 +1163,7 @@ class _SectionHeader extends StatelessWidget {
|
||||
if (note != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: Text(note!,
|
||||
child: AppText(note!,
|
||||
style: TextStyle(fontSize: 11.5, color: theme.hintColor)),
|
||||
),
|
||||
],
|
||||
@@ -1113,7 +1180,7 @@ class _Label extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 2, 20, 6),
|
||||
child: Text(text,
|
||||
child: AppText(text,
|
||||
style: const TextStyle(fontSize: 13.5, fontWeight: FontWeight.w500)),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user