feat: write the UI in English, select only conversation content
- source strings are English again; Chinese comes from lib/l10n/zh.dart through tr()/trArgs() and AppText, and a language without a table (Spanish, ...) reads English instead of Chinese - server and user data (titles, messages, file names, notes, task names) is drawn with plain Text, so it is never looked up in the table - SelectionArea moved from the whole message list to the messages, the answer text, an opened tool call's details and the turn footer; status lines and folded tool rows no longer start a selection - a message the transcript does not know (its start event was lost while the stream was down) fetches the tail once, so a turn continued from another client comes in with its prompt - bump to 0.5.3
This commit is contained in:
1 parent
7b5bccf28f
commit
511c3b006b
43 files changed
+1620
-1791
No files matched your search
+110
-111
@@ -21,52 +21,52 @@ class SettingsScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppText('设置')),
|
||||
appBar: AppBar(title: const AppText('Settings')),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.only(top: 4, bottom: 32),
|
||||
children: [
|
||||
const _SectionHeader('常规'),
|
||||
const _SectionHeader('General'),
|
||||
_Section(children: [
|
||||
_NavTile(
|
||||
icon: Icons.translate,
|
||||
title: '语言',
|
||||
subtitle: '跟随系统、中文或 English',
|
||||
title: 'Language',
|
||||
subtitle: 'Follow the system, Chinese or English',
|
||||
builder: (_) => const LanguageSettingsPage(),
|
||||
),
|
||||
_NavTile(
|
||||
icon: Icons.tune,
|
||||
title: '通用',
|
||||
subtitle: '智能体工具与记忆',
|
||||
title: 'Agent tools',
|
||||
subtitle: 'Agent tools and memory',
|
||||
builder: (_) => GeneralSettingsPage(app: app),
|
||||
),
|
||||
_NavTile(
|
||||
icon: Icons.chat_bubble_outline,
|
||||
title: '聊天',
|
||||
subtitle: '追问处理行为',
|
||||
title: 'Chat',
|
||||
subtitle: 'Follow-up behavior',
|
||||
builder: (_) => ChatSettingsPage(app: app),
|
||||
),
|
||||
]),
|
||||
const _SectionHeader('外观', note: '仅当前设备生效,不同步到服务器'),
|
||||
const _SectionHeader('Appearance', note: 'Applies to this device only; not synced to the server'),
|
||||
_Section(children: [
|
||||
_NavTile(
|
||||
icon: Icons.palette_outlined,
|
||||
title: '主题',
|
||||
subtitle: '主题模式与主题色',
|
||||
title: 'Theme',
|
||||
subtitle: 'Theme mode and color',
|
||||
builder: (_) => const ThemeSettingsPage(),
|
||||
),
|
||||
_NavTile(
|
||||
icon: Icons.pets_outlined,
|
||||
title: '宠物',
|
||||
subtitle: '导入、启用与大小',
|
||||
title: 'Pet',
|
||||
subtitle: 'Import, enable and size',
|
||||
builder: (_) => const PetSettingsPage(),
|
||||
),
|
||||
]),
|
||||
const _SectionHeader('帮助与关于'),
|
||||
const _SectionHeader('Help & about'),
|
||||
_Section(children: [
|
||||
_NavTile(
|
||||
icon: Icons.info_outline,
|
||||
title: '关于',
|
||||
subtitle: '版本、服务端与开源许可',
|
||||
title: 'About',
|
||||
subtitle: 'Version, server and open-source licenses',
|
||||
builder: (_) => AboutSettingsPage(app: app),
|
||||
),
|
||||
]),
|
||||
@@ -123,7 +123,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: AppText(
|
||||
trArgs('保存失败:{0}', [app.lastError ?? tr('未知错误')]))),
|
||||
trArgs('Couldn\'t save: {0}', [app.lastError ?? tr('Unknown error')]))),
|
||||
);
|
||||
app.clearLastError();
|
||||
}
|
||||
@@ -133,32 +133,32 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppText('通用')),
|
||||
appBar: AppBar(title: const AppText('Agent tools')),
|
||||
body: ListenableBuilder(
|
||||
listenable: app,
|
||||
builder: (context, _) => ListView(
|
||||
padding: const EdgeInsets.only(top: 4, bottom: 32),
|
||||
children: [
|
||||
const _SectionHeader('在聊天中'),
|
||||
const _SectionHeader('In chat'),
|
||||
_Section(children: [
|
||||
_switch(
|
||||
icon: Icons.bar_chart,
|
||||
title: '图表和原型',
|
||||
subtitle: '让智能体在聊天中展示图表、表格、示意图和界面草图(与你的文件隔离),并请你在其中选择一个选项。',
|
||||
title: 'Charts and prototypes',
|
||||
subtitle: 'Let the agent show charts, tables, diagrams and UI sketches in chat (isolated from your files) and ask you to pick one of them.',
|
||||
value: app.renderToolEnabled,
|
||||
key: 'agentRenderToolEnabled',
|
||||
),
|
||||
_switch(
|
||||
icon: Icons.image_outlined,
|
||||
title: '图像',
|
||||
subtitle: '让智能体用你选择的模型生成和编辑图像,费用由该模型的提供商收取。',
|
||||
title: 'Images',
|
||||
subtitle: 'Let the agent generate and edit images with the model you choose; the model\'s provider charges for it.',
|
||||
value: app.imageToolEnabled,
|
||||
key: 'agentImageToolEnabled',
|
||||
),
|
||||
if (app.imageToolEnabled)
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.fromLTRB(52, 0, 16, 4),
|
||||
title: const AppText('图像模型'),
|
||||
title: const AppText('Image model'),
|
||||
subtitle: AppText(_imageModelName(),
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
trailing: const Icon(Icons.chevron_right, size: 20),
|
||||
@@ -166,26 +166,26 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
),
|
||||
_switch(
|
||||
icon: Icons.shield_outlined,
|
||||
title: '密钥',
|
||||
subtitle: '允许智能体在聊天中的私密卡片上向你索取 API 密钥、令牌或密码。值不会进入对话。',
|
||||
title: 'Secrets',
|
||||
subtitle: 'Let the agent ask you for API keys, tokens or passwords on a private card in chat. Values never enter the conversation.',
|
||||
value: app.secretToolEnabled,
|
||||
key: 'agentSecretToolEnabled',
|
||||
),
|
||||
_switch(
|
||||
icon: Icons.notifications_none,
|
||||
title: '通知',
|
||||
subtitle: '工作完成或卡住时,智能体会通知你。',
|
||||
title: 'Notifications',
|
||||
subtitle: 'The agent notifies you when work finishes or gets stuck.',
|
||||
value: app.notifyToolEnabled,
|
||||
key: 'agentNotifyToolEnabled',
|
||||
),
|
||||
]),
|
||||
const _SectionHeader('智能体知道的内容'),
|
||||
const _SectionHeader('What the agent knows'),
|
||||
_Section(children: [
|
||||
if (app.memoryToolsAvailable) ...[
|
||||
_switch(
|
||||
icon: Icons.psychology_outlined,
|
||||
title: '记忆',
|
||||
subtitle: '跨会话记住关于你和每个项目的事实。',
|
||||
title: 'Memory',
|
||||
subtitle: 'Remember facts about you and each project across sessions.',
|
||||
value: app.memoryToolEnabled,
|
||||
key: 'agentMemoryToolEnabled',
|
||||
),
|
||||
@@ -193,15 +193,15 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
],
|
||||
_switch(
|
||||
icon: Icons.sticky_note_2_outlined,
|
||||
title: '项目知识',
|
||||
subtitle: '让智能体读取并更新项目的笔记、待办和计划。',
|
||||
title: 'Project knowledge',
|
||||
subtitle: 'Let the agent read and update the project\'s notes, todos and plans.',
|
||||
value: app.knowledgeToolEnabled,
|
||||
key: 'agentKnowledgeToolEnabled',
|
||||
),
|
||||
_switch(
|
||||
icon: Icons.insert_chart_outlined,
|
||||
title: '用量限额',
|
||||
subtitle: '让智能体查看各提供商的限额及重置时间。',
|
||||
title: 'Usage limits',
|
||||
subtitle: 'Let the agent check each provider\'s limits and reset times.',
|
||||
value: app.usageToolEnabled,
|
||||
key: 'agentUsageToolEnabled',
|
||||
),
|
||||
@@ -230,7 +230,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
|
||||
String _imageModelName() {
|
||||
final value = app.imageModel;
|
||||
if (value.isEmpty) return '未选择';
|
||||
if (value.isEmpty) return 'Not selected';
|
||||
for (final m in _imageModels ?? const <ModelInfo>[]) {
|
||||
if ('${m.providerId}/${m.id}' == value) return m.name;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
List<Widget> _dreaming(ThemeData theme) {
|
||||
final variants = _dreamingVariants();
|
||||
final name = app.memoryDreamingModel.isEmpty
|
||||
? '默认模型'
|
||||
? 'Default model'
|
||||
: (app.modelNames[app.memoryDreamingModel] ?? app.memoryDreamingModel);
|
||||
return [
|
||||
InkWell(
|
||||
@@ -257,10 +257,10 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
onChanged: (v) =>
|
||||
_save('agentMemoryDreamingEnabled', v ?? false),
|
||||
),
|
||||
Expanded(child: AppText('整理记忆')),
|
||||
Expanded(child: AppText('Tidy memory')),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.info_outline, size: 18),
|
||||
tooltip: tr('整理记忆'),
|
||||
tooltip: tr('Tidy memory'),
|
||||
onPressed: _dreamingInfo,
|
||||
),
|
||||
],
|
||||
@@ -279,7 +279,7 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
),
|
||||
child: AppText(name,
|
||||
child: Text(name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontSize: 13)),
|
||||
@@ -295,9 +295,9 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: theme.colorScheme.onSurface),
|
||||
items: [
|
||||
const DropdownMenuItem(value: '', child: AppText('默认')),
|
||||
const DropdownMenuItem(value: '', child: AppText('Default')),
|
||||
for (final v in variants)
|
||||
DropdownMenuItem(value: v, child: AppText(v)),
|
||||
DropdownMenuItem(value: v, child: Text(v)),
|
||||
],
|
||||
onChanged: (v) => _save('agentMemoryDreamingVariant', v ?? ''),
|
||||
),
|
||||
@@ -321,12 +321,12 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialog) => AlertDialog(
|
||||
title: const AppText('整理记忆'),
|
||||
title: const AppText('Tidy memory'),
|
||||
content: const AppText(
|
||||
'每天一次,在没有会话运行时,智能体会在后台整理记忆:合并重复条目,删除已过时或项目文档中已有的内容。'),
|
||||
'Once a day, when no session is running, the agent tidies memory in the background: merging duplicates and removing entries that are obsolete or already in the project docs.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialog), child: const AppText('知道了')),
|
||||
onPressed: () => Navigator.pop(dialog), child: const AppText('Got it')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -337,14 +337,14 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
if (!mounted) return;
|
||||
if (models.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: AppText('你的提供商中没有图像模型')),
|
||||
const SnackBar(content: AppText('Your provider has no image models')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
final picked = await _chooseFromSheet(
|
||||
context: context,
|
||||
title: '图像模型',
|
||||
noneLabel: '不指定',
|
||||
title: 'Image model',
|
||||
noneLabel: 'None',
|
||||
selected: app.imageModel,
|
||||
options: [
|
||||
for (final m in models)
|
||||
@@ -370,8 +370,8 @@ class _GeneralSettingsPageState extends State<GeneralSettingsPage> {
|
||||
if (!mounted) return;
|
||||
final picked = await _chooseFromSheet(
|
||||
context: context,
|
||||
title: '整理记忆使用的模型',
|
||||
noneLabel: '默认模型',
|
||||
title: 'Model for tidying memory',
|
||||
noneLabel: 'Default model',
|
||||
selected: app.memoryDreamingModel,
|
||||
options: [
|
||||
for (final m in app.modelList)
|
||||
@@ -451,14 +451,13 @@ class LanguageSettingsPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = L10n.instance;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppText('语言')),
|
||||
appBar: AppBar(title: const AppText('Language')),
|
||||
body: ListenableBuilder(
|
||||
listenable: l10n,
|
||||
builder: (context, _) {
|
||||
final english = l10n.isEnglish;
|
||||
final systemName = l10n.locale.languageCode == 'zh'
|
||||
? AppLanguage.zh.labelFor(english)
|
||||
: AppLanguage.en.labelFor(english);
|
||||
? l10n.languageLabel(AppLanguage.zh)
|
||||
: l10n.languageLabel(AppLanguage.en);
|
||||
return ListView(
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 32),
|
||||
children: [
|
||||
@@ -472,9 +471,9 @@ class LanguageSettingsPage extends StatelessWidget {
|
||||
for (final choice in AppLanguage.values)
|
||||
RadioListTile<AppLanguage>(
|
||||
value: choice,
|
||||
title: AppText(choice.labelFor(english)),
|
||||
title: AppText(l10n.languageLabel(choice)),
|
||||
subtitle: choice == AppLanguage.system
|
||||
? AppText(trArgs('当前:{0}', [systemName]))
|
||||
? AppText(trArgs('Current: {0}', [systemName]))
|
||||
: null,
|
||||
),
|
||||
],
|
||||
@@ -483,7 +482,7 @@ class LanguageSettingsPage extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
|
||||
child: AppText(
|
||||
'界面文字与系统自带的日期、时间选择器会一起切换。',
|
||||
'The UI text switches together with the system\'s date and time pickers.',
|
||||
style: TextStyle(
|
||||
fontSize: 12.5,
|
||||
color: Theme.of(context).hintColor),
|
||||
@@ -519,7 +518,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppText('聊天')),
|
||||
appBar: AppBar(title: const AppText('Chat')),
|
||||
body: ListenableBuilder(
|
||||
listenable: widget.app,
|
||||
builder: (context, _) {
|
||||
@@ -528,8 +527,8 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
padding: const EdgeInsets.only(top: 8, bottom: 32),
|
||||
children: [
|
||||
const ListTile(
|
||||
title: AppText('追问处理行为'),
|
||||
subtitle: AppText('运行中按发送时,消息默认怎么处理。与网页端设置同步。'),
|
||||
title: AppText('Follow-up behavior'),
|
||||
subtitle: AppText('What happens by default when you press send while a run is in progress. Synced with the web client\'s setting.'),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 6),
|
||||
@@ -538,12 +537,12 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
ChoiceChip(
|
||||
label: const AppText('转向'),
|
||||
label: const AppText('Steer'),
|
||||
selected: steer,
|
||||
onSelected: (_) => _setFollowUp('steer'),
|
||||
),
|
||||
ChoiceChip(
|
||||
label: const AppText('排队'),
|
||||
label: const AppText('Queue'),
|
||||
selected: !steer,
|
||||
onSelected: (_) => _setFollowUp('queue'),
|
||||
),
|
||||
@@ -553,7 +552,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: AppText(
|
||||
steer ? '转向:在下一步加入当前回合,工作继续。' : '排队:等当前回合结束后再发送。',
|
||||
steer ? 'Steer: joins the current turn at the next step and work continues.' : 'Queue: sends after the current turn ends.',
|
||||
style: TextStyle(fontSize: 12.5, color: theme.hintColor),
|
||||
),
|
||||
),
|
||||
@@ -568,7 +567,7 @@ class _ChatSettingsPageState extends State<ChatSettingsPage> {
|
||||
final ok = await widget.app.setFollowUpBehavior(value);
|
||||
if (!ok && mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: AppText(widget.app.lastError ?? '保存失败')),
|
||||
SnackBar(content: AppText(widget.app.lastError ?? 'Couldn\'t save')),
|
||||
);
|
||||
widget.app.clearLastError();
|
||||
}
|
||||
@@ -581,16 +580,16 @@ class ThemeSettingsPage extends StatelessWidget {
|
||||
const ThemeSettingsPage({super.key});
|
||||
|
||||
static const _modes = [
|
||||
(ThemeMode.system, '跟随系统'),
|
||||
(ThemeMode.light, '浅色'),
|
||||
(ThemeMode.dark, '深色'),
|
||||
(ThemeMode.system, 'Follow system'),
|
||||
(ThemeMode.light, 'Light'),
|
||||
(ThemeMode.dark, 'Dark'),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final look = AppearancePrefs.instance;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppText('主题')),
|
||||
appBar: AppBar(title: const AppText('Theme')),
|
||||
body: ListenableBuilder(
|
||||
listenable: look,
|
||||
builder: (context, _) {
|
||||
@@ -600,10 +599,10 @@ class ThemeSettingsPage extends StatelessWidget {
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: AppText('主题只保存在本机,不随服务器同步。',
|
||||
child: AppText('The theme is stored on this device only and does not sync with the server.',
|
||||
style: TextStyle(fontSize: 12.5)),
|
||||
),
|
||||
const _Label('主题模式'),
|
||||
const _Label('Theme mode'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 12),
|
||||
child: Wrap(
|
||||
@@ -619,7 +618,7 @@ class ThemeSettingsPage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
const _Label('主题色'),
|
||||
const _Label('Accent color'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: Wrap(
|
||||
@@ -644,7 +643,7 @@ class ThemeSettingsPage extends StatelessWidget {
|
||||
return Semantics(
|
||||
button: true,
|
||||
selected: selected,
|
||||
label: trArgs('主题色 {0}', [seed.toRadixString(16)]),
|
||||
label: trArgs('Accent color {0}', [seed.toRadixString(16)]),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
onTap: () => look.setSeedColor(seed),
|
||||
@@ -690,7 +689,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppText('宠物')),
|
||||
appBar: AppBar(title: const AppText('Pet')),
|
||||
body: ListenableBuilder(
|
||||
listenable: PetLibrary.instance,
|
||||
builder: (context, _) {
|
||||
@@ -701,7 +700,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: AppText('默认不提供宠物;宠物包只存放在本机。',
|
||||
child: AppText('No pet is included; pet packs stay on this device.',
|
||||
style: TextStyle(fontSize: 12.5)),
|
||||
),
|
||||
if (pack == null) ..._empty(theme) else ..._loaded(theme, pack),
|
||||
@@ -714,15 +713,15 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
|
||||
List<Widget> _empty(ThemeData theme) => [
|
||||
const ListTile(
|
||||
title: AppText('尚未导入宠物'),
|
||||
subtitle: AppText('导入一个宠物包(.zip)后,它会站在输入框上方。'),
|
||||
title: AppText('No pet imported'),
|
||||
subtitle: AppText('Import a pet pack (.zip) and it will stand above the input box.'),
|
||||
),
|
||||
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 AppText('导入宠物包'),
|
||||
label: const AppText('Import pet pack'),
|
||||
),
|
||||
),
|
||||
];
|
||||
@@ -733,27 +732,27 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
[pack.author, pack.license].where((s) => s.trim().isNotEmpty).join(' · ');
|
||||
return [
|
||||
ListTile(
|
||||
title: AppText(pack.name.isEmpty ? pack.id : pack.name),
|
||||
title: Text(pack.name.isEmpty ? pack.id : pack.name),
|
||||
subtitle: info.isEmpty
|
||||
? null
|
||||
: AppText(info, maxLines: 2, overflow: TextOverflow.ellipsis),
|
||||
: Text(info, maxLines: 2, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
SwitchListTile(
|
||||
title: const AppText('启用宠物'),
|
||||
subtitle: const AppText('站在输入框上方,默认关闭'),
|
||||
title: const AppText('Enable pet'),
|
||||
subtitle: const AppText('Stands above the input box; off by default'),
|
||||
value: library.enabled,
|
||||
onChanged: (v) => library.setEnabled(v),
|
||||
),
|
||||
const _Label('大小'),
|
||||
const _Label('Size'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 8),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
children: [
|
||||
for (final (size, label) in const [
|
||||
(40.0, '小'),
|
||||
(52.0, '中'),
|
||||
(64.0, '大'),
|
||||
(40.0, 'Small'),
|
||||
(52.0, 'Medium'),
|
||||
(64.0, 'Large'),
|
||||
])
|
||||
ChoiceChip(
|
||||
label: AppText(label),
|
||||
@@ -770,12 +769,12 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
FilledButton.tonalIcon(
|
||||
onPressed: _importPet,
|
||||
icon: const Icon(Icons.swap_horiz, size: 18),
|
||||
label: const AppText('更换宠物包'),
|
||||
label: const AppText('Change pet pack'),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
TextButton(
|
||||
onPressed: _confirmRemovePet,
|
||||
child: const AppText('移除'),
|
||||
child: const AppText('Remove'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -786,7 +785,7 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
Future<void> _importPet() async {
|
||||
try {
|
||||
final file = await FilePicker.pickFile(
|
||||
dialogTitle: tr('选择宠物包(.zip)'),
|
||||
dialogTitle: tr('Select a pet pack (.zip)'),
|
||||
type: FileType.custom,
|
||||
allowedExtensions: const ['zip'],
|
||||
);
|
||||
@@ -797,12 +796,12 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: AppText(trArgs(
|
||||
'已导入 {0}', [pack.name.isEmpty ? pack.id : pack.name]))),
|
||||
'Imported {0}', [pack.name.isEmpty ? pack.id : pack.name]))),
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: AppText(trArgs('导入失败:{0}', [e]))),
|
||||
SnackBar(content: AppText(trArgs('Import failed: {0}', [e]))),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -811,15 +810,15 @@ class _PetSettingsPageState extends State<PetSettingsPage> {
|
||||
final ok = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (dialog) => AlertDialog(
|
||||
title: const AppText('移除宠物?'),
|
||||
content: const AppText('本机保存的宠物包会被删除。'),
|
||||
title: const AppText('Remove pet?'),
|
||||
content: const AppText('The pet pack stored on this device will be deleted.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialog, false),
|
||||
child: const AppText('取消')),
|
||||
child: const AppText('Cancel')),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(dialog, true),
|
||||
child: const AppText('移除')),
|
||||
child: const AppText('Remove')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -873,11 +872,11 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
width: 14, height: 14, child: CircularProgressIndicator(strokeWidth: 1.6));
|
||||
}
|
||||
final text = !_loaded
|
||||
? '读取中…'
|
||||
? 'Loading…'
|
||||
: widget.app.client == null
|
||||
? '未连接'
|
||||
? 'Not connected'
|
||||
: value.isEmpty
|
||||
? '未获取到'
|
||||
? 'Not available'
|
||||
: value;
|
||||
return AppText(text,
|
||||
style: TextStyle(
|
||||
@@ -893,11 +892,11 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
final versions = _versions;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const AppText('关于'),
|
||||
title: const AppText('About'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
tooltip: tr('重新获取服务端版本'),
|
||||
tooltip: tr('Fetch the server version again'),
|
||||
onPressed: _loading ? null : _load,
|
||||
),
|
||||
],
|
||||
@@ -927,7 +926,7 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
AppText('OpenChamber',
|
||||
style: theme.textTheme.titleLarge
|
||||
?.copyWith(fontWeight: FontWeight.w600)),
|
||||
AppText('手机客户端',
|
||||
AppText('Mobile client',
|
||||
style: TextStyle(
|
||||
fontSize: 12.5, color: theme.hintColor)),
|
||||
],
|
||||
@@ -936,27 +935,27 @@ class _AboutSettingsPageState extends State<AboutSettingsPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
const _SectionHeader('应用'),
|
||||
const _SectionHeader('App'),
|
||||
_Section(children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.tag, size: 20),
|
||||
title: const AppText('版本'),
|
||||
title: const AppText('Version'),
|
||||
trailing: AppText(
|
||||
appVersion.isEmpty ? '未知' : appVersion,
|
||||
appVersion.isEmpty ? 'Unknown' : appVersion,
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.description_outlined, size: 20),
|
||||
title: const AppText('开源许可'),
|
||||
subtitle: const AppText('本应用使用的第三方组件与它们的许可证'),
|
||||
title: const AppText('Open-source licenses'),
|
||||
subtitle: const AppText('Third-party components used by this app and their licenses'),
|
||||
trailing: const Icon(Icons.chevron_right, size: 20),
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (_) => const LicensesPage(),
|
||||
)),
|
||||
),
|
||||
]),
|
||||
const _SectionHeader('服务端', note: '版本取自当前连接的服务器'),
|
||||
const _SectionHeader('Server', note: 'Version comes from the currently connected server'),
|
||||
_Section(children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.terminal, size: 20),
|
||||
@@ -1015,7 +1014,7 @@ class _LicensesPageState extends State<LicensesPage> {
|
||||
final theme = Theme.of(context);
|
||||
final licenses = _licenses;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const AppText('开源许可')),
|
||||
appBar: AppBar(title: const AppText('Open-source licenses')),
|
||||
body: licenses == null
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: ListView.separated(
|
||||
@@ -1028,7 +1027,7 @@ class _LicensesPageState extends State<LicensesPage> {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 14, 20, 14),
|
||||
child: AppText(
|
||||
'下面列出随本应用打包的第三方组件;点开可阅读完整许可证。',
|
||||
'Third-party components bundled with this app are listed below; tap one to read its full license.',
|
||||
style:
|
||||
TextStyle(fontSize: 12.5, color: theme.hintColor),
|
||||
),
|
||||
@@ -1036,7 +1035,7 @@ class _LicensesPageState extends State<LicensesPage> {
|
||||
}
|
||||
final name = licenses.keys.elementAt(i - 1);
|
||||
return ListTile(
|
||||
title: AppText(name),
|
||||
title: Text(name),
|
||||
trailing: const Icon(Icons.chevron_right, size: 20),
|
||||
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (_) => _LicenseTextPage(
|
||||
@@ -1073,11 +1072,11 @@ class _LicenseTextPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: AppText(name)),
|
||||
appBar: AppBar(title: Text(name)),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: SelectableText(
|
||||
text.isEmpty ? tr('该组件没有附带许可证文本。') : text,
|
||||
text.isEmpty ? tr('This component has no license text.') : text,
|
||||
style: const TextStyle(fontSize: 12, fontFamily: 'monospace', height: 1.45),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user