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
@@ -36,7 +36,7 @@ Future<List<ComposerAttachment>> pickComposerAttachments(
|
||||
if (bytes.length > 10 * 1024 * 1024) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: AppText('附件不能超过 10MB')));
|
||||
const SnackBar(content: AppText('Attachments cannot be larger than 10 MB')));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class AttachmentTray extends StatelessWidget {
|
||||
: const Icon(Icons.insert_drive_file, size: 16),
|
||||
label: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 160),
|
||||
child: AppText(items[i].name,
|
||||
child: Text(items[i].name,
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
onDeleted: () => onRemove(i),
|
||||
|
||||
@@ -247,8 +247,8 @@ class DiffView extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppText(
|
||||
file.path ?? trArgs('文件 {0}', [fileIndex + 1]),
|
||||
child: Text(
|
||||
file.path ?? trArgs('File {0}', [fileIndex + 1]),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
@@ -279,7 +279,7 @@ class DiffView extends StatelessWidget {
|
||||
rows.add(Container(
|
||||
color: background,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 1),
|
||||
child: AppText(
|
||||
child: Text(
|
||||
line.text.isEmpty ? ' ' : line.text,
|
||||
style: mono.copyWith(color: foreground),
|
||||
),
|
||||
@@ -290,7 +290,7 @@ class DiffView extends StatelessWidget {
|
||||
rows.add(Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
||||
child: AppText(
|
||||
trArgs('仅显示前 {0} 行,共 {1} 行', [maxLines, total]),
|
||||
trArgs('Showing the first {0} of {1} lines', [maxLines, total]),
|
||||
style: TextStyle(fontSize: 11, color: theme.hintColor),
|
||||
),
|
||||
));
|
||||
|
||||
@@ -31,7 +31,7 @@ class ModelPill extends StatelessWidget {
|
||||
info.variants.contains(model!.variant)
|
||||
? model!.variant
|
||||
: null;
|
||||
final name = model == null ? '模型' : app.modelName(model!);
|
||||
final name = model == null ? 'Model' : app.modelName(model!);
|
||||
final label = effort == null ? name : '$name · ${effortLabel(effort)}';
|
||||
return _Pill(
|
||||
icon: Icons.smart_toy_outlined,
|
||||
@@ -90,7 +90,7 @@ class ModeChip extends StatelessWidget {
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(20, 4, 20, 8),
|
||||
child: AppText('模式',
|
||||
child: AppText('Mode',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700)),
|
||||
),
|
||||
for (final id in ids)
|
||||
@@ -105,7 +105,7 @@ class ModeChip extends StatelessWidget {
|
||||
fontWeight: id == current ? FontWeight.w700 : FontWeight.w400,
|
||||
),
|
||||
),
|
||||
subtitle: AppText(id == 'plan' ? '先规划,不改动文件' : '直接构建',
|
||||
subtitle: AppText(id == 'plan' ? 'Plan first without changing files' : 'Build directly',
|
||||
style: const TextStyle(fontSize: 12)),
|
||||
trailing: id == current
|
||||
? Icon(Icons.check, size: 20, color: scheme.primary)
|
||||
@@ -151,7 +151,7 @@ class _Pill extends StatelessWidget {
|
||||
Icon(icon, size: 14, color: theme.hintColor),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: AppText(
|
||||
child: Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
@@ -70,7 +70,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(12, 12, 12, 4),
|
||||
child: AppText('选择模型',
|
||||
child: AppText('Select model',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
Padding(
|
||||
@@ -78,7 +78,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
child: TextField(
|
||||
onChanged: (v) => setState(() => _filter = v),
|
||||
decoration: InputDecoration(
|
||||
hintText: tr('搜索'),
|
||||
hintText: tr('Search'),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true),
|
||||
),
|
||||
@@ -93,7 +93,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
Widget _models() {
|
||||
final all = widget.app.modelList;
|
||||
if (all.isEmpty) {
|
||||
return const Center(child: AppText('正在载入模型…'));
|
||||
return const Center(child: AppText('Loading models…'));
|
||||
}
|
||||
final filter = _filter.trim().toLowerCase();
|
||||
final matching = filter.isEmpty
|
||||
@@ -104,7 +104,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
m.id.toLowerCase().contains(filter))
|
||||
m,
|
||||
];
|
||||
if (matching.isEmpty) return const Center(child: AppText('没有结果'));
|
||||
if (matching.isEmpty) return const Center(child: AppText('No results'));
|
||||
|
||||
final byKey = {
|
||||
for (final m in all) ModelPrefs.keyFor(m.providerId, m.id): m,
|
||||
@@ -126,7 +126,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
final children = <Widget>[];
|
||||
if (filter.isEmpty) {
|
||||
if (favorites.isNotEmpty) {
|
||||
children.add(_sectionHeader(tr('收藏'), 'favorites', count: favorites.length));
|
||||
children.add(_sectionHeader(tr('Favorites'), 'favorites', count: favorites.length));
|
||||
if (!_collapsed.contains('favorites')) {
|
||||
for (final model in favorites) {
|
||||
children.add(_modelRow(model));
|
||||
@@ -134,7 +134,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
}
|
||||
}
|
||||
if (recents.isNotEmpty) {
|
||||
children.add(_sectionHeader(tr('最近'), 'recents', count: recents.length));
|
||||
children.add(_sectionHeader(tr('Recent'), 'recents', count: recents.length));
|
||||
if (!_collapsed.contains('recents')) {
|
||||
for (final model in recents) {
|
||||
children.add(_modelRow(model));
|
||||
@@ -143,7 +143,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
}
|
||||
}
|
||||
for (final entry in providers.entries) {
|
||||
final label = entry.key.isEmpty ? tr('其它') : entry.key;
|
||||
final label = entry.key.isEmpty ? tr('Other') : entry.key;
|
||||
children.add(_sectionHeader(label, 'provider:${entry.key}',
|
||||
count: entry.value.length));
|
||||
if (!_collapsed.contains('provider:${entry.key}')) {
|
||||
@@ -174,7 +174,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
count == null ? label : trArgs('{0}({1})', [label, count]),
|
||||
count == null ? label : trArgs('{0} ({1})', [label, count]),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -200,7 +200,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
title: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: AppText(model.name,
|
||||
child: Text(model.name,
|
||||
maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
if (model.reasoning)
|
||||
@@ -213,7 +213,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
),
|
||||
subtitle: model.context > 0
|
||||
? AppText(
|
||||
trArgs('{0} 上下文', [formatTokenCount(model.context)]),
|
||||
trArgs('{0} context', [formatTokenCount(model.context)]),
|
||||
style: TextStyle(fontSize: 11, color: theme.hintColor))
|
||||
: null,
|
||||
trailing: Row(
|
||||
@@ -232,7 +232,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
size: 18,
|
||||
color: favorite ? theme.colorScheme.primary : theme.hintColor,
|
||||
),
|
||||
tooltip: favorite ? tr('取消收藏') : tr('收藏'),
|
||||
tooltip: favorite ? tr('Remove from favorites') : tr('Favorites'),
|
||||
onPressed: () async {
|
||||
await _prefs.toggleFavorite(key);
|
||||
if (mounted) setState(() {});
|
||||
@@ -289,12 +289,12 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const AppText('思考强度',
|
||||
const AppText('Thinking effort',
|
||||
style: TextStyle(
|
||||
fontSize: 13, fontWeight: FontWeight.w700)),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: AppText(model.name,
|
||||
child: Text(model.name,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style:
|
||||
@@ -302,7 +302,7 @@ class _PickerSheetState extends State<_PickerSheet> {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const AppText('完成'),
|
||||
child: const AppText('Done'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -122,14 +122,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppText(
|
||||
widget.initial == null ? '新建计划任务' : '编辑计划任务',
|
||||
widget.initial == null ? 'New scheduled task' : 'Edit scheduled task',
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _saving ? null : _save,
|
||||
child: AppText(_saving ? '保存中…' : '保存'),
|
||||
child: AppText(_saving ? 'Saving…' : 'Save'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -138,15 +138,15 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 32),
|
||||
children: [
|
||||
AppText(trArgs('运行位置:{0}', [widget.scopeLabel]),
|
||||
AppText(trArgs('Runs in: {0}', [widget.scopeLabel]),
|
||||
style: TextStyle(fontSize: 12.5, color: theme.hintColor)),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: _name,
|
||||
maxLength: 80,
|
||||
decoration: InputDecoration(
|
||||
labelText: tr('任务名称'),
|
||||
hintText: tr('每日同步'),
|
||||
labelText: tr('Task name'),
|
||||
hintText: tr('Daily sync'),
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
@@ -156,14 +156,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
minLines: 4,
|
||||
maxLines: 10,
|
||||
decoration: InputDecoration(
|
||||
labelText: tr('提示词'),
|
||||
hintText: tr('总结未完成任务并给出下一步建议'),
|
||||
labelText: tr('Prompt'),
|
||||
hintText: tr('Summarize unfinished tasks and suggest next steps'),
|
||||
border: const OutlineInputBorder(),
|
||||
alignLabelWithHint: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const _FieldLabel('计划类型'),
|
||||
const _FieldLabel('Schedule type'),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
@@ -181,23 +181,23 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
const SizedBox(height: 8),
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const AppText('使用默认模型与智能体'),
|
||||
subtitle: const AppText('关闭后可固定这次运行使用的模型和智能体。'),
|
||||
title: const AppText('Use default model and agent'),
|
||||
subtitle: const AppText('Turn off to pin the model and agent this run uses.'),
|
||||
value: _useDefaults,
|
||||
onChanged: (v) => setState(() => _useDefaults = v),
|
||||
),
|
||||
if (!_useDefaults) ..._executionFields(theme),
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const AppText('已启用'),
|
||||
subtitle: const AppText('暂停的任务不会按计划运行,但可以手动运行。'),
|
||||
title: const AppText('Enabled'),
|
||||
subtitle: const AppText('Paused tasks don\'t run on schedule but can still be run manually.'),
|
||||
value: _enabled,
|
||||
onChanged: (v) => setState(() => _enabled = v),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
FilledButton(
|
||||
onPressed: _saving ? null : _save,
|
||||
child: AppText(_saving ? '保存中…' : '保存'),
|
||||
child: AppText(_saving ? 'Saving…' : 'Save'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -213,7 +213,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
return [_timesField(theme)];
|
||||
case 'weekly':
|
||||
return [
|
||||
const _FieldLabel('星期'),
|
||||
const _FieldLabel('Weekdays'),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
@@ -239,14 +239,14 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
return [
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const AppText('日期'),
|
||||
trailing: AppText(_dateText(_date)),
|
||||
title: const AppText('Date'),
|
||||
trailing: Text(_dateText(_date)),
|
||||
onTap: _pickDate,
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const AppText('时间'),
|
||||
trailing: AppText(_time),
|
||||
title: const AppText('Time'),
|
||||
trailing: Text(_time),
|
||||
onTap: () async {
|
||||
final picked = await _pickTime(_time);
|
||||
if (picked != null) setState(() => _time = picked);
|
||||
@@ -258,7 +258,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
TextField(
|
||||
controller: _cron,
|
||||
decoration: InputDecoration(
|
||||
labelText: tr('Cron 表达式'),
|
||||
labelText: tr('Cron expression'),
|
||||
hintText: '*/5 * * * *',
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
@@ -269,11 +269,11 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
for (final example in const [
|
||||
('每 5 分钟', '*/5 * * * *'),
|
||||
('每小时', '0 * * * *'),
|
||||
('每天 9 点', '0 9 * * *'),
|
||||
('每周一 9 点', '0 9 * * 1'),
|
||||
('每月 1 日', '0 9 1 * *'),
|
||||
('Every 5 minutes', '*/5 * * * *'),
|
||||
('Every hour', '0 * * * *'),
|
||||
('Daily at 9', '0 9 * * *'),
|
||||
('Mondays at 9', '0 9 * * 1'),
|
||||
('1st of each month', '0 9 1 * *'),
|
||||
])
|
||||
ActionChip(
|
||||
label: AppText(example.$1),
|
||||
@@ -291,7 +291,7 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const _FieldLabel('时间点'),
|
||||
const _FieldLabel('Times'),
|
||||
for (var i = 0; i < _times.length; i++)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
@@ -303,12 +303,12 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
final picked = await _pickTime(_times[i]);
|
||||
if (picked != null) setState(() => _times[i] = picked);
|
||||
},
|
||||
child: AppText(_times[i]),
|
||||
child: Text(_times[i]),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.remove_circle_outline, size: 20),
|
||||
tooltip: tr('移除时间'),
|
||||
tooltip: tr('Remove time'),
|
||||
onPressed: _times.length <= 1
|
||||
? null
|
||||
: () => setState(() => _times.removeAt(i)),
|
||||
@@ -322,30 +322,30 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
if (picked != null) setState(() => _times.add(picked));
|
||||
},
|
||||
icon: const Icon(Icons.add, size: 18),
|
||||
label: const AppText('添加时间'),
|
||||
label: const AppText('Add time'),
|
||||
),
|
||||
AppText('时间按服务器所在时区。', style: TextStyle(fontSize: 11.5, color: theme.hintColor)),
|
||||
AppText('Times follow the server\'s time zone.', style: TextStyle(fontSize: 11.5, color: theme.hintColor)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _executionFields(ThemeData theme) {
|
||||
final model = _modelId.isEmpty
|
||||
? '选择模型'
|
||||
? 'Select model'
|
||||
: (widget.app.modelNames['$_providerId/$_modelId'] ?? '$_providerId/$_modelId');
|
||||
final agent = _agent.isEmpty ? '默认智能体' : _agent;
|
||||
final agent = _agent.isEmpty ? 'Default agent' : _agent;
|
||||
return [
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: const Icon(Icons.memory, size: 20),
|
||||
title: const AppText('模型'),
|
||||
trailing: AppText(model, overflow: TextOverflow.ellipsis),
|
||||
title: const AppText('Model'),
|
||||
trailing: Text(model, overflow: TextOverflow.ellipsis),
|
||||
onTap: _pickModel,
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: const Icon(Icons.smart_toy_outlined, size: 20),
|
||||
title: const AppText('智能体'),
|
||||
title: const AppText('Agent'),
|
||||
trailing: AppText(agent, overflow: TextOverflow.ellipsis),
|
||||
onTap: _pickAgent,
|
||||
),
|
||||
@@ -404,13 +404,13 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
ListTile(
|
||||
title: const AppText('默认智能体'),
|
||||
title: const AppText('Default agent'),
|
||||
trailing: _agent.isEmpty ? const Icon(Icons.check, size: 20) : null,
|
||||
onTap: () => Navigator.pop(sheet, ''),
|
||||
),
|
||||
for (final agent in widget.app.agentList)
|
||||
ListTile(
|
||||
title: AppText(agent.name.isEmpty ? agent.id : agent.name),
|
||||
title: Text(agent.name.isEmpty ? agent.id : agent.name),
|
||||
trailing: _agent == agent.id
|
||||
? const Icon(Icons.check, size: 20)
|
||||
: null,
|
||||
@@ -429,22 +429,22 @@ class _ScheduledTaskEditorState extends State<ScheduledTaskEditor> {
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
String? problem;
|
||||
if (name.isEmpty) {
|
||||
problem = '任务名称为必填项';
|
||||
problem = 'Task name is required';
|
||||
} else if (name.length > 80) {
|
||||
problem = '任务名称不能超过 80 个字符';
|
||||
problem = 'Task name can\'t exceed 80 characters';
|
||||
} else if (prompt.isEmpty) {
|
||||
problem = '提示词为必填项';
|
||||
problem = 'Prompt is required';
|
||||
} else if (prompt.length > 20000) {
|
||||
problem = '提示词不能超过 20000 个字符';
|
||||
problem = 'Prompt can\'t exceed 20,000 characters';
|
||||
} else if ((_kind == 'daily' || _kind == 'weekly') &&
|
||||
_times.any((t) => !RegExp(r'^([01]\d|2[0-3]):[0-5]\d$').hasMatch(t))) {
|
||||
problem = '时间格式必须是 HH:mm';
|
||||
problem = 'Time must be in HH:mm format';
|
||||
} else if (_kind == 'weekly' && _weekdays.isEmpty) {
|
||||
problem = '请至少选择一个星期';
|
||||
problem = 'Select at least one weekday';
|
||||
} else if (_kind == 'cron' && _cron.text.trim().isEmpty) {
|
||||
problem = 'Cron 表达式为必填项';
|
||||
problem = 'Cron expression is required';
|
||||
} else if (!_useDefaults && _modelId.isEmpty) {
|
||||
problem = '请选择模型,或改回使用默认模型';
|
||||
problem = 'Select a model, or switch back to the default model';
|
||||
}
|
||||
if (problem != null) {
|
||||
messenger.showSnackBar(SnackBar(content: AppText(problem)));
|
||||
|
||||
+26
-26
@@ -87,8 +87,8 @@ class _ShellTaskBarState extends State<ShellTaskBar> {
|
||||
Icon(Icons.terminal, size: 15, color: theme.hintColor),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
trArgs('正在执行 {0} 条命令', [count]),
|
||||
child: Text(
|
||||
trArgs('Running {0} commands', [count]),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
@@ -131,7 +131,7 @@ class _ShellTaskRow extends StatelessWidget {
|
||||
Icon(Icons.terminal, size: 15, color: theme.hintColor),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
child: Text(
|
||||
task.command.replaceAll(RegExp(r'\s+'), ' ').trim(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -141,7 +141,7 @@ class _ShellTaskRow extends StatelessWidget {
|
||||
),
|
||||
if (subagent) ...[
|
||||
const SizedBox(width: 6),
|
||||
AppText('子代理',
|
||||
AppText('Subagent',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
@@ -195,7 +195,7 @@ class _ShellElapsedState extends State<ShellElapsed> {
|
||||
if (widget.startedAt <= 0 || !widget.running) return const SizedBox.shrink();
|
||||
final label =
|
||||
formatElapsed(DateTime.now().millisecondsSinceEpoch - widget.startedAt);
|
||||
return AppText(
|
||||
return Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
@@ -338,7 +338,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
|
||||
Icon(Icons.terminal, size: 18, color: theme.hintColor),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: AppText(
|
||||
child: Text(
|
||||
widget.task.command,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -362,7 +362,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
|
||||
Icon(Icons.check_circle_outline,
|
||||
size: 15, color: theme.hintColor),
|
||||
const SizedBox(width: 6),
|
||||
AppText('已结束',
|
||||
AppText('Ended',
|
||||
style:
|
||||
TextStyle(fontSize: 12, color: theme.hintColor)),
|
||||
],
|
||||
@@ -371,7 +371,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
|
||||
TextButton.icon(
|
||||
onPressed: _stopping ? null : _stop,
|
||||
icon: const Icon(Icons.stop_rounded, size: 17),
|
||||
label: AppText(_stopping ? '停止中…' : '停止'),
|
||||
label: AppText(_stopping ? 'Stopping…' : 'Stop'),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: theme.colorScheme.error,
|
||||
minimumSize: const Size(0, 32),
|
||||
@@ -381,7 +381,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
|
||||
TextButton.icon(
|
||||
onPressed: _text.isEmpty ? null : _copy,
|
||||
icon: const Icon(Icons.copy, size: 15),
|
||||
label: const AppText('复制'),
|
||||
label: const AppText('Copy'),
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size(0, 32),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
@@ -412,10 +412,10 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
|
||||
AppText(
|
||||
_feed.error ??
|
||||
(!_feed.loaded
|
||||
? '读取输出…'
|
||||
? 'Reading output…'
|
||||
: running
|
||||
? '等待输出…'
|
||||
: '没有输出'),
|
||||
? 'Waiting for output…'
|
||||
: 'No output'),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: theme.hintColor),
|
||||
),
|
||||
@@ -447,7 +447,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
|
||||
_onFeed();
|
||||
},
|
||||
icon: const Icon(Icons.arrow_downward, size: 15),
|
||||
label: const AppText('回到最新'),
|
||||
label: const AppText('Jump to latest'),
|
||||
style: FilledButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
@@ -465,7 +465,7 @@ class _ShellOutputSheetState extends State<ShellOutputSheet> {
|
||||
await Clipboard.setData(ClipboardData(text: _text));
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(content: AppText('已复制输出')));
|
||||
.showSnackBar(const SnackBar(content: AppText('Output copied')));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,15 +542,15 @@ class _ShellOutputInlineState extends State<ShellOutputInline> {
|
||||
children: [
|
||||
Icon(Icons.terminal, size: 15, color: theme.hintColor),
|
||||
const SizedBox(width: 8),
|
||||
AppText('后台输出',
|
||||
AppText('Background output',
|
||||
style: TextStyle(fontSize: 12, color: theme.hintColor)),
|
||||
const SizedBox(width: 8),
|
||||
if (!ended)
|
||||
AppText('运行中',
|
||||
AppText('Running',
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: theme.colorScheme.primary)),
|
||||
if (ended && text.isEmpty)
|
||||
AppText('已结束',
|
||||
AppText('Ended',
|
||||
style:
|
||||
TextStyle(fontSize: 12, color: theme.hintColor)),
|
||||
const Spacer(),
|
||||
@@ -563,7 +563,7 @@ class _ShellOutputInlineState extends State<ShellOutputInline> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
textStyle: const TextStyle(fontSize: 12.5),
|
||||
),
|
||||
child: const AppText('停止'),
|
||||
child: const AppText('Stop'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: widget.onOpen,
|
||||
@@ -572,7 +572,7 @@ class _ShellOutputInlineState extends State<ShellOutputInline> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
textStyle: const TextStyle(fontSize: 12.5),
|
||||
),
|
||||
child: const AppText('查看全部'),
|
||||
child: const AppText('View all'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -580,7 +580,7 @@ class _ShellOutputInlineState extends State<ShellOutputInline> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: AppText(
|
||||
_feed.error ?? (ended ? '没有输出' : '等待输出…'),
|
||||
_feed.error ?? (ended ? 'No output' : 'Waiting for output…'),
|
||||
style: TextStyle(fontSize: 12, color: theme.hintColor)),
|
||||
)
|
||||
else
|
||||
@@ -615,8 +615,8 @@ Future<bool?> confirmStopShell(BuildContext context, String command) {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
builder: (dialog) => AlertDialog(
|
||||
title: const AppText('停止这个任务?'),
|
||||
content: AppText(
|
||||
title: const AppText('Stop this task?'),
|
||||
content: Text(
|
||||
command,
|
||||
maxLines: 4,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -625,14 +625,14 @@ Future<bool?> confirmStopShell(BuildContext context, String command) {
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialog, false),
|
||||
child: const AppText('取消')),
|
||||
child: const AppText('Cancel')),
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: Theme.of(dialog).colorScheme.error,
|
||||
foregroundColor: Theme.of(dialog).colorScheme.onError,
|
||||
),
|
||||
onPressed: () => Navigator.pop(dialog, true),
|
||||
child: const AppText('停止'),
|
||||
child: const AppText('Stop'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -728,11 +728,11 @@ class ShellOutputFeed {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
} else {
|
||||
error = trArgs('读取输出失败:{0}', [e.message]);
|
||||
error = trArgs('Could not read output: {0}', [e.message]);
|
||||
}
|
||||
_onUpdate?.call();
|
||||
} catch (e) {
|
||||
error = trArgs('读取输出失败:{0}', ['$e']);
|
||||
error = trArgs('Could not read output: {0}', ['$e']);
|
||||
_onUpdate?.call();
|
||||
} finally {
|
||||
_busy = false;
|
||||
|
||||
@@ -6,14 +6,14 @@ import '../state.dart';
|
||||
import '../l10n.dart';
|
||||
|
||||
const _slashLabels = {
|
||||
'compact': '压缩',
|
||||
'init': '初始化',
|
||||
'review': '审查',
|
||||
'goal': '目标',
|
||||
'new-extension': '新建扩展',
|
||||
'permission': '权限',
|
||||
'plan': '计划',
|
||||
'feedback': '反馈',
|
||||
'compact': 'Compact',
|
||||
'init': 'Init',
|
||||
'review': 'Review',
|
||||
'goal': 'Goal',
|
||||
'new-extension': 'New extension',
|
||||
'permission': 'Permission',
|
||||
'plan': 'Plans',
|
||||
'feedback': 'Feedback',
|
||||
};
|
||||
|
||||
String? slashLabel(SlashItem item) =>
|
||||
@@ -84,11 +84,11 @@ class SlashPalette extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(title,
|
||||
Text(title,
|
||||
style:
|
||||
TextStyle(fontSize: 14, color: scheme.onSurface)),
|
||||
if (subtitle.isNotEmpty)
|
||||
AppText(subtitle,
|
||||
Text(subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
@@ -119,7 +119,7 @@ class SlashPalette extends StatelessWidget {
|
||||
child: CircularProgressIndicator(strokeWidth: 2)),
|
||||
),
|
||||
)
|
||||
: row(Icons.search_off, '没有可用的指令', '这个目录还没有注册指令或技能'))
|
||||
: row(Icons.search_off, 'No commands available', 'This directory has no commands or skills yet'))
|
||||
: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6),
|
||||
@@ -176,7 +176,7 @@ class SlashPalette extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
if (item.description.isNotEmpty)
|
||||
AppText(item.description,
|
||||
Text(item.description,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
|
||||
Reference in new issue
Block a user