feat: 全量英文界面(i18n 翻译表接入全部页面与服务层文案)
This commit is contained in:
1 parent
2eb3f42731
commit
71e76b1c2b
26 files changed
+775
-325
No files matched your search
@@ -0,0 +1,425 @@
|
||||
// 轻量 i18n:集中式文案翻译表 + Text 包装组件 + 模板插值。
|
||||
// 用法:静态文案 Text('取消') → T('取消');参数文案 S.f('在线 · {0}ms', [ms])。
|
||||
// 英文模式下命中映射表返回英文,未收录自动回退中文,不会出现空白文案。
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class S {
|
||||
S._();
|
||||
|
||||
/// 是否英文模式(由 LanguageProvider 同步)。
|
||||
static bool en = false;
|
||||
|
||||
static const Map<String, String> _en = {
|
||||
// ---- 通用 ----
|
||||
'取消': 'Cancel',
|
||||
'确定': 'OK',
|
||||
'删除': 'Delete',
|
||||
'编辑': 'Edit',
|
||||
'保存': 'Save',
|
||||
'刷新': 'Refresh',
|
||||
'同步': 'Sync',
|
||||
'上传': 'Upload',
|
||||
'搜索': 'Search',
|
||||
'知道了': 'Got it',
|
||||
'添加': 'Add',
|
||||
'无': 'None',
|
||||
'未知': 'Unknown',
|
||||
// ---- 底部导航 ----
|
||||
'服务器': 'Servers',
|
||||
'控制台': 'Console',
|
||||
'玩家': 'Players',
|
||||
'模组': 'Mods',
|
||||
'终端': 'Terminal',
|
||||
'我的': 'Me',
|
||||
// ---- Dashboard ----
|
||||
'添加服务器': 'Add Server',
|
||||
'还没有服务器,点击下方按钮添加吧': 'No servers yet. Tap the button below to add one.',
|
||||
'请先在「服务器」页选择一台服务器': 'Select a server on the Servers tab first',
|
||||
'在线': 'Online',
|
||||
'离线': 'Offline',
|
||||
'在线人数': 'Players online',
|
||||
'磁盘': 'Disk',
|
||||
'需 SSH 终端': 'Needs SSH terminal',
|
||||
'下载中心': 'Downloads',
|
||||
'Modrinth 搜索 · 镜像加速': 'Modrinth search · mirror boost',
|
||||
'远程终端': 'Remote Terminal',
|
||||
'SSH Shell': 'SSH Shell',
|
||||
'模组管理': 'Mod Manager',
|
||||
'上传 / 删除 / 查看依赖': 'Upload / delete / view dependencies',
|
||||
'编辑服务器': 'Edit Server',
|
||||
'删除服务器': 'Delete Server',
|
||||
'刷新状态': 'Refresh status',
|
||||
'未选择': 'None',
|
||||
'切换': 'Switch',
|
||||
// ---- 服务器表单 ----
|
||||
'服务器名称': 'Server name',
|
||||
'例如: 我的生存服': 'e.g. My survival server',
|
||||
'主机地址': 'Host',
|
||||
'IP 或域名': 'IP or domain',
|
||||
'RCON 端口': 'RCON port',
|
||||
'默认 25575': 'default 25575',
|
||||
'RCON 密码': 'RCON password',
|
||||
'SSH 连接(可选)': 'SSH connection (optional)',
|
||||
'用于模组插件管理与远程终端': 'For mod management & remote terminal',
|
||||
'SSH 端口': 'SSH port',
|
||||
'默认 22': 'default 22',
|
||||
'SSH 用户名': 'SSH username',
|
||||
'例如 root': 'e.g. root',
|
||||
'SSH 密码': 'SSH password',
|
||||
// ---- 模组管理 ----
|
||||
'依赖仓库': 'Dependency Repo',
|
||||
'按名称': 'By name',
|
||||
'按大小': 'By size',
|
||||
'按修改时间': 'By mtime',
|
||||
'目录下没有 .jar 文件': 'No .jar files in this directory',
|
||||
'详情': 'Details',
|
||||
'重命名': 'Rename',
|
||||
'上传 jar': 'Upload jar',
|
||||
'确认删除': 'Confirm delete',
|
||||
'文件名': 'File',
|
||||
'大小': 'Size',
|
||||
'修改时间': 'Modified',
|
||||
'作者': 'Authors',
|
||||
'元数据来源': 'Metadata source',
|
||||
'描述': 'Description',
|
||||
'硬依赖': 'Hard dependencies',
|
||||
'软依赖': 'Soft dependencies',
|
||||
// ---- 依赖仓库 ----
|
||||
'该模组依赖:': 'Depends on:',
|
||||
'被以下模组依赖:': 'Required by:',
|
||||
'缺失依赖(可一键补齐):': 'Missing dependencies (one-click fetch):',
|
||||
'从 Modrinth 补齐': 'Fetch from Modrinth',
|
||||
'版本冲突 / 重复 jar': 'Conflicts / duplicate jars',
|
||||
'未发现重复': 'No duplicates found',
|
||||
'重复检测': 'Duplicate check',
|
||||
'点击「同步」增量扫描服务器 mods/plugins 并建立依赖索引':
|
||||
'Tap Sync to incrementally scan server mods/plugins and build the dependency index',
|
||||
'索引为空,先点击「同步」': 'Index is empty. Tap Sync first',
|
||||
'(该服务器未配置 SSH,无法同步)': '(No SSH on this server; sync unavailable)',
|
||||
// ---- 下载中心 ----
|
||||
'搜索下载': 'Search',
|
||||
'{0} · 依赖 {1} · 软依赖 {2}': '{0} · deps {1} · soft deps {2}',
|
||||
'已清除背景': 'Background cleared',
|
||||
'检查更新失败:{0}': 'Update check failed: {0}',
|
||||
'正在获取版本列表...': 'Loading version list...',
|
||||
'获取更新信息失败': 'Failed to get update info',
|
||||
'任务队列': 'Queue',
|
||||
'搜索 Modrinth 模组/插件,如 sodium': 'Search Modrinth mods/plugins, e.g. sodium',
|
||||
'插件': 'Plugins',
|
||||
'MC 版本': 'MC version',
|
||||
'加载器': 'Loader',
|
||||
'输入关键词开始搜索': 'Type a keyword to start searching',
|
||||
'没有结果': 'No results',
|
||||
'暂无下载任务': 'No download tasks',
|
||||
'暂停': 'Pause',
|
||||
'继续': 'Resume',
|
||||
'重试': 'Retry',
|
||||
'排队中': 'Queued',
|
||||
'下载中': 'Downloading',
|
||||
'已暂停': 'Paused',
|
||||
'已完成': 'Completed',
|
||||
'失败': 'Failed',
|
||||
'已取消': 'Canceled',
|
||||
// ---- 下载与镜像设置 ----
|
||||
'镜像线路': 'Mirror',
|
||||
'MCIM 国内镜像(推荐)': 'MCIM China mirror (recommended)',
|
||||
'modrinth.mcimirror.top,无需科学上网': 'modrinth.mcimirror.top, no VPN needed',
|
||||
'Modrinth 官方': 'Modrinth official',
|
||||
'直连官方源,适合海外网络': 'Direct official source, best overseas',
|
||||
'自定义镜像': 'Custom mirror',
|
||||
'使用自建/第三方镜像地址': 'Use your own/third-party mirror URL',
|
||||
'一键测速并选择最快线路': 'Speed test & pick fastest',
|
||||
'自动在官方与镜像之间选择延迟最低的线路': 'Auto-pick lowest latency between official & mirrors',
|
||||
'下载队列': 'Queue',
|
||||
'同时下载任务数': 'Concurrent downloads',
|
||||
'说明:下载完成的文件保存在应用目录 downloads/ 下;':
|
||||
'Note: finished files are saved in the app directory downloads/;',
|
||||
'若服务器配置了 SSH,会自动上传到对应服务器的 mods/plugins 目录。':
|
||||
'if the server has SSH, they are auto-uploaded to its mods/plugins directory.',
|
||||
'自定义镜像地址': 'Custom mirror URL',
|
||||
// ---- 终端 ----
|
||||
'新会话': 'New session',
|
||||
'选择一台服务器开始会话': 'Pick a server to start a session',
|
||||
'没有配置 SSH 的服务器。\n\n请在「服务器」页编辑服务器,开启 SSH 后即可使用终端。':
|
||||
'No servers with SSH configured.\n\nEdit a server on the Servers tab and enable SSH to use the terminal.',
|
||||
// ---- 设置 ----
|
||||
'设置': 'Settings',
|
||||
'外观主题': 'Theme',
|
||||
'应用背景': 'Background',
|
||||
'未设置': 'Not set',
|
||||
'视频声音': 'Video sound',
|
||||
'开启后背景视频将播放声音': 'Play sound for background video',
|
||||
'下载与镜像设置': 'Download & mirror settings',
|
||||
'镜像线路、测速选线、同时下载任务数': 'Mirror, speed test, concurrent downloads',
|
||||
'使用教程': 'Tutorials',
|
||||
'如何开启 RCON / SSH、模组管理、下载与终端': 'How to enable RCON / SSH, mods, downloads & terminal',
|
||||
'检查更新': 'Check updates',
|
||||
'关于': 'About',
|
||||
'开发者:Z有3笔,协作者:venti1112': 'Developer: Z有3笔, Collaborator: venti1112',
|
||||
'开源许可': 'Open-source licenses',
|
||||
'语言 / Language': '语言 / Language',
|
||||
'跟随系统 / System': '跟随系统 / System',
|
||||
'简体中文': '简体中文',
|
||||
'English': 'English',
|
||||
'选择图片': 'Pick image',
|
||||
'选择视频': 'Pick video',
|
||||
'清除背景': 'Clear background',
|
||||
'使用教程(模组/终端等)': 'Tutorials (mods / terminal etc.)',
|
||||
// ---- 模板插值 ----
|
||||
'服务器「{0}」已断开连接!': 'Server "{0}" disconnected!',
|
||||
'确定要删除「{0}」吗?仅删除本应用中的连接配置,不影响服务器本身。':
|
||||
'Delete "{0}"? Only removes the connection profile in this app; the server itself is unaffected.',
|
||||
'在线 · {0}ms · {1} 人': 'Online · {0}ms · {1} players',
|
||||
'RCON 连接失败:{0}': 'RCON connection failed: {0}',
|
||||
'{0}不能为空': '{0} cannot be empty',
|
||||
'在线 · {0}ms': 'Online · {0}ms',
|
||||
'版本 {0}': 'Version {0}',
|
||||
'加载失败:{0}': 'Load failed: {0}',
|
||||
'上传失败:{0}': 'Upload failed: {0}',
|
||||
'确定要删除 {0} 吗?此操作不可恢复。': 'Delete {0}? This cannot be undone.',
|
||||
'{0} 未配置 SSH': '{0} has no SSH configured',
|
||||
'模组管理需要 SSH 连接。请在「服务器」页编辑该服务器,\n开启 SSH 并填写用户名和密码。':
|
||||
'Mod management needs SSH. Edit the server on the Servers tab,\nenable SSH and fill in username & password.',
|
||||
'已下载 {0}({1})': 'Downloaded {0} ({1})',
|
||||
'补齐失败:{0}': 'Fetch failed: {0}',
|
||||
'未找到 {0}': '{0} not found',
|
||||
'获取版本失败:{0}': 'Failed to fetch versions: {0}',
|
||||
'已加入下载队列:{0}': 'Queued: {0}',
|
||||
'搜索失败:{0}': 'Search failed: {0}',
|
||||
'选择 {0} 的版本': 'Choose a version of {0}',
|
||||
'该版本没有可用文件': 'No files for this version',
|
||||
'上次测速:{0}ms({1})': 'Last test: {0}ms ({1})',
|
||||
'已选择最快线路:{0}({1}ms)': 'Fastest route: {0} ({1}ms)',
|
||||
'当前:{0} 个(越大越占带宽,建议 1-3)': 'Now: {0} (more uses more bandwidth; 1-3 recommended)',
|
||||
'{0} 个版本共存': '{0} versions coexist',
|
||||
'同步失败:{0}': 'Sync failed: {0}',
|
||||
'当前版本: {0}': 'Current version: {0}',
|
||||
'已设置 {0}': 'Set: {0}',
|
||||
'{0} 视频': '{0} video',
|
||||
'{0} 图片': '{0} image',
|
||||
'壁纸已更新': 'Wallpaper updated',
|
||||
'背景已更新 ': 'Background updated ',
|
||||
'已恢复默认壁纸': 'Default wallpaper restored',
|
||||
'保存失败,请重试': 'Save failed, please retry',
|
||||
'壁纸设置保存失败,请重试': 'Failed to save wallpaper settings, please retry',
|
||||
'背景已更新': 'Background updated',
|
||||
' rcon.password=你的RCON密码': ' rcon.password=your RCON password',
|
||||
'1. SSH 终端拥有服务器完全控制能力,您执行的任何命令(含删除文件、重启系统)后果由您自行承担。': '1. The SSH terminal grants full control of your server. You bear all consequences of any command you run (including deleting files or rebooting the system).',
|
||||
'1. 下载功能数据来自 Modrinth 公开接口及其镜像线路(如 MCIM)。镜像线路由第三方维护,其可用性与安全性不由开发者控制。': '1. Download data comes from the public Modrinth API and its mirrors (e.g. MCIM). Mirrors are maintained by third parties; the developer does not control their availability or safety.',
|
||||
'1. 仅管理您有权管理的服务器。严禁连接、探测、控制任何未获授权的第三方服务器——未经授权访问计算机系统属于违法行为。': '1. Only manage servers you are authorized to. Connecting to, probing or controlling any unauthorized third-party server is strictly prohibited — unauthorized access to computer systems is illegal.',
|
||||
'1. 本软件不收集、不上传您的任何个人数据,全部数据保存在设备本地,卸载即删除。': '1. This app does not collect or upload any personal data. All data is stored locally on your device and removed on uninstall.',
|
||||
'1. 本软件为免费开源软件,不提供商业担保。在法律允许的最大范围内,开发者不对因使用或无法使用本软件造成的任何直接或间接损失负责(包括数据丢失、服务器宕机、存档损坏、经济损失)。': '1. This software is free and open source, provided without commercial warranty. To the maximum extent permitted by law, the developer is not liable for any direct or indirect loss arising from use or inability to use (including data loss, server downtime, world corruption or financial loss).',
|
||||
'1. 本软件按开源协议发布,可依协议使用、修改和分发;"ZV Manager"名称与图标版权归作者所有。': '1. This software is released under an open source license and may be used, modified and distributed accordingly. The name and logo "ZV Manager" are copyrighted by the author.',
|
||||
'1. 连接凭据(RCON 密码、SSH 用户名/密码等)仅保存在您的设备本地(加密存储),本软件无云端账号系统,不会将凭据上传至开发者或任何第三方。': '1. Connection credentials (RCON password, SSH username/password, etc.) are stored only on your device (encrypted). This app has no cloud account system and never uploads credentials to the developer or any third party.',
|
||||
'2. Minecraft 是 Mojang Studios 的商标,本软件与 Mojang、微软无任何隶属关系。': '2. Minecraft is a trademark of Mojang Studios. This software is not affiliated with Mojang or Microsoft.',
|
||||
'2. 因第三方服务(Modrinth、镜像源、托管商、网络)变更或故障导致的异常,开发者不承担责任。': '2. The developer is not responsible for issues caused by changes or failures of third-party services (Modrinth, mirrors, hosting providers, networks).',
|
||||
'2. 应用仅联网检查更新(Gitee 发布页)及访问 Modrinth/镜像接口,无其他网络请求。': '2. The app only connects to the network to check updates (Gitee releases) and access the Modrinth/mirror APIs; there are no other network requests.',
|
||||
'2. 建议不要以 root 账户长期连接,执行不熟悉的命令前请先确认其作用。': '2. Avoid staying connected as root for long periods, and confirm what a command does before running unfamiliar ones.',
|
||||
'2. 第三方模组/插件可能影响服务器稳定性,安装前请备份重要数据;"依赖仓库"查询结果仅供参考。': '2. Third-party mods/plugins may affect server stability. Back up important data before installing; "Dependency Index" results are for reference only.',
|
||||
'2. 请妥善保管设备与凭据,因主动泄露、设备被他人使用、越狱/Root 等造成的损失由您自行承担。': '2. Keep your device and credentials safe. Losses caused by voluntary disclosure, unauthorized device use, jailbreak/Root, etc. are borne by you.',
|
||||
'2. 遵守《网络安全法》《计算机信息系统安全保护条例》等法律法规及 Minecraft EULA 与服务器规则。': '2. Comply with applicable laws and regulations (e.g. the Cybersecurity Law) as well as the Minecraft EULA and server rules.',
|
||||
'3. 不得利用本软件传播违法信息、破坏他人服务器、恶意攻击或盗取数据。': '3. Do not use this software to spread unlawful information, sabotage others\' servers, launch attacks or steal data.',
|
||||
'3. 仅连接您拥有管理权限的服务器,并使用强密码、定期更换。': '3. Only connect to servers you administer, using strong passwords changed regularly.',
|
||||
'3. 命令历史仅保存在设备本地,可在应用内清除,本软件不做任何云端记录。': '3. Command history is stored locally only, can be cleared in the app, and is never recorded in the cloud.',
|
||||
'4. 下载中心获取的模组/插件版权归原作者所有,请遵守对应开源协议,不得下载、分发盗版或破解内容。': '4. Mods/plugins obtained from the Download Center belong to their authors. Follow the corresponding licenses; pirated or cracked content must not be downloaded or distributed.',
|
||||
'Fabric 模组放 mods 目录;Paper/Spigot 插件放 plugins 目录': 'Fabric mods go in the mods directory; Paper/Spigot plugins go in the plugins directory',
|
||||
'Q:TPS 显示 —?→ 原版服务端不支持 tps 命令,Paper/Purpur 等服务端才支持': 'Q: TPS shows "—"? → Vanilla servers do not support the tps command; only Paper/Purpur and similar do',
|
||||
'Q:上传模组后不生效?→ 需要重启服务器': 'Q: Mod upload not taking effect? → Restart the server',
|
||||
'Q:控制台能连但模组页提示无 SSH?→ 编辑服务器开启 SSH 并填好账号密码': 'Q: Console connects but the mods page says no SSH? → Edit the server, enable SSH and fill in the credentials',
|
||||
'Q:连接失败?→ 检查防火墙是否放行端口、地址端口是否填对、服务器是否在线': 'Q: Connection failed? → Check firewall rules for the port, verify address/port, and confirm the server is online',
|
||||
'SSH 拥有服务器完全控制权,请勿随意执行不熟悉的命令': 'SSH grants full server control; do not run unfamiliar commands carelessly',
|
||||
'SSH 是服务器自带的远程管理服务,绝大多数独立服务器默认已开启(端口 22)': 'SSH is a built-in remote management service, enabled by default on most standalone servers (port 22)',
|
||||
'ZV Manager 是一款 Minecraft 服务器远程管理工具,通过 RCON、SSH/SFTP 等协议连接到您有权管理的服务器,提供服务器控制、玩家管理、模组插件管理、文件下载与远程终端等功能。本软件按"现状"提供。': 'ZV Manager is a remote management tool for Minecraft servers. It connects to servers you are authorized to manage via RCON, SSH/SFTP and other protocols, offering server control, player management, mod/plugin management, file downloads and a remote terminal. The software is provided "as is".',
|
||||
'ZV Manager:服务器页 → 编辑服务器 → 打开「SSH 连接」开关 → 填端口(默认 22)、用户名、密码 → 保存': 'ZV Manager: Servers → Edit server → enable "SSH Connection" → fill in port (default 22), username and password → Save',
|
||||
'screen -r 可以进入服务器控制台会话(开服时用了 screen 的话)': 'screen -r reattaches to the server console session (if you started the server inside screen)',
|
||||
'© 2026 ZV Team · 与 Mojang 无关': '© 2026 ZV Team · Not affiliated with Mojang',
|
||||
'一、如何开启 RCON(必配,控制台/玩家管理需要)': '1. How to enable RCON (required for console/player management)',
|
||||
'一、软件性质与用途': '1. Nature and Purpose of the Software',
|
||||
'七、常见问题': '7. FAQ',
|
||||
'七、数据与隐私': '7. Data and Privacy',
|
||||
'三、合法使用(重要)': '3. Lawful Use (Important)',
|
||||
'三、模组 / 插件管理怎么用': '3. Using Mod / Plugin Management',
|
||||
'上传后需重启服务器才会加载新模组(可在终端执行,或控制台发 stop 后重开)': 'The server must be restarted after uploading to load new mods (via terminal, or send stop in console and start again)',
|
||||
'下载完成且配置了 SSH 时,会自动上传到服务器的 mods/plugins 目录': 'When the download finishes and SSH is configured, files upload automatically to the server\'s mods/plugins directory',
|
||||
'不建议把 25575 端口直接暴露公网,强烈建议设置强密码': 'Do not expose port 25575 directly to the public internet; a strong password is strongly recommended',
|
||||
'不确定的话:用电脑终端执行 ssh 用户名@服务器IP 试试能否登录': 'If unsure: run ssh user@server-ip in a desktop terminal to test login',
|
||||
'九、守则变更': '9. Changes to This Agreement',
|
||||
'二、如何开启 SSH(模组管理 / 终端 / 下载自动上传需要)': '2. How to enable SSH (required for mod management / terminal / auto upload)',
|
||||
'二、账号与凭据安全': '2. Account and Credential Security',
|
||||
'云服务器/虚拟主机需在防火墙或安全组放行 rcon.port 端口': 'For cloud servers/VPS, open rcon.port in the firewall or security group',
|
||||
'五、模组管理与下载功能说明': '5. Mod Management and Downloads',
|
||||
'五、远程终端': '5. Remote Terminal',
|
||||
'保存后重启服务器生效': 'Restart the server after saving for changes to take effect',
|
||||
'修改/添加以下三行:': 'Add or modify the following three lines:',
|
||||
'八、知识产权': '8. Intellectual Property',
|
||||
'六、依赖仓库(查询模组依赖)': '6. Dependency Index (query mod dependencies)',
|
||||
'六、免责声明': '6. Disclaimer',
|
||||
'前提:该服务器已配置 SSH': 'Prerequisite: SSH is configured for this server',
|
||||
'十、其他': '10. Miscellaneous',
|
||||
'同意并进入': 'Agree and Continue',
|
||||
'命令历史只保存在手机本地,可放心使用': 'Command history is stored on your phone only; use it with confidence',
|
||||
'四、SSH / 终端功能风险提示': '4. SSH / Terminal Risk Notice',
|
||||
'四、下载中心与镜像加速': '4. Download Center and Mirror Acceleration',
|
||||
'回到 ZV Manager:服务器页 → 添加/编辑服务器,填入主机地址、端口(默认 25575)和 RCON 密码': 'Back in ZV Manager: Servers → Add/Edit server, fill in the host, port (default 25575) and RCON password',
|
||||
'国内网络慢时:点右上角测速图标 →「一键测速并选择最快线路」,或改用自定义镜像地址': 'If the network is slow in China: tap the speed-test icon in the top right → "Test and pick the fastest route", or use a custom mirror URL',
|
||||
'在服务器目录找到 server.properties 文件(与启动 jar 同目录)': 'Find server.properties in the server directory (same folder as the startup jar)',
|
||||
'底部快捷键栏:Tab 补全、Ctrl+C 中断、Ctrl+D 退出、↑↓ 调历史,以及 htop / df -h / screen -r 常用命令': 'Bottom shortcut bar: Tab completion, Ctrl+C interrupt, Ctrl+D exit, ↑↓ history, plus htop / df -h / screen -r quick commands',
|
||||
'开发者可能随版本更新修订本守则并在应用内展示;不同意修订内容请停止使用,继续使用即视为接受。': 'The developer may revise this agreement with version updates and display it in the app. If you disagree, stop using the app; continued use constitutes acceptance.',
|
||||
'我已阅读并同意《用户守则》': 'I have read and agree to the User Agreement',
|
||||
'拿到 SSH 用户名(如 root)和密码': 'Obtain the SSH username (e.g. root) and password',
|
||||
'断网会自动重连(最多 3 次)': 'Reconnects automatically after network loss (up to 3 times)',
|
||||
'有的托管商需要先在控制台开启 SSH/SFTP 功能': 'Some hosting providers require enabling SSH/SFTP in their control panel first',
|
||||
'本守则最终解释权归 ZV Team 所有。如有疑问或发现漏洞,欢迎通过 Gitee 仓库(gitee.com/driftinblock/zvmanager)或官方 QQ 群反馈。': 'The final interpretation of this agreement belongs to ZV Team. For questions or vulnerability reports, reach us via the Gitee repo (gitee.com/driftinblock/zvmanager) or the official QQ group.',
|
||||
'本页教您一步步开启并使用 ZV Manager 的各项功能。': 'This guide walks you through enabling and using ZV Manager step by step.',
|
||||
'点「上传 jar」从手机选择文件上传;长按/点菜单可删除、重命名': 'Tap "Upload jar" to pick a file from your phone; long-press/menu to delete or rename',
|
||||
'点「同步」扫描服务器 mods/plugins,建立本地依赖索引': 'Tap "Sync" to scan the server\'s mods/plugins and build the local dependency index',
|
||||
'点击任意模组查看:它依赖什么、被谁依赖、缺失哪些依赖': 'Tap any mod to see what it depends on, what depends on it, and which dependencies are missing',
|
||||
'点击文件名可查看详情:模组名、版本、作者、依赖': 'Tap a file name for details: mod name, version, author, dependencies',
|
||||
'点右上角重复检测按钮重复安装 / 版本冲突的 jar': 'Tap the duplicate-check button in the top right to find duplicated or conflicting jars',
|
||||
'点结果选版本即可加入下载队列,支持暂停/继续/取消': 'Tap a result, pick a version and add it to the download queue; pause/resume/cancel supported',
|
||||
'版本 v2.0 · 下载、安装或使用本软件,即视为您已阅读并同意本守则全部条款。': 'Version v2.0 · By downloading, installing or using this software, you are deemed to have read and agreed to all terms of this agreement.',
|
||||
'版本要和 MC 版本、加载器匹配,否则服务器起不来': 'Versions must match the MC version and loader, or the server will fail to start',
|
||||
'用户守则': 'User Agreement',
|
||||
'等同于电脑上的 SSH 终端,可以执行任意命令': 'Works like a desktop SSH terminal; you can run any command',
|
||||
'缺失依赖可一键从 Modrinth 下载补齐': 'Missing dependencies can be downloaded from Modrinth with one tap',
|
||||
'请仔细阅读守则({0}s)': 'Please read carefully ({0}s)',
|
||||
'请先滑动阅读至守则底部': 'Please scroll to the bottom of the agreement first',
|
||||
'请阅读至守则底部': 'Please read to the bottom of the agreement',
|
||||
'输入关键词搜索 Modrinth 上的模组/插件,可用 MC 版本、加载器筛选': 'Search Modrinth mods/plugins by keyword; filter by MC version and loader',
|
||||
'进入「服务器」页 → 下载中心(或首页快捷入口)': 'Go to the "Servers" page → Download Center (or the home shortcut)',
|
||||
'进入「模组」页签 → 右上角依赖仓库': 'Go to the "Mods" tab → Dependency Index in the top right',
|
||||
'进入「模组」页签,顶部切换 mods(模组)/ plugins(插件)目录': 'In the "Mods" tab, switch between mods and plugins directories at the top',
|
||||
'进入「终端」页签,点右上角 + 新建会话并选择服务器': 'In the "Terminal" tab, tap + in the top right to create a session and pick a server',
|
||||
'部分面板服 / 虚拟主机只提供网页面板,不提供 SSH,此时模组和终端功能不可用(入口会提示)': 'Some panel-hosted/virtual hosts offer only a web panel without SSH; mod management and terminal are unavailable then (the entry will tell you)',
|
||||
'阅读倒计时 {0} 秒…': 'Reading countdown {0}s…',
|
||||
'默认使用 MCIM 国内镜像,无需科学上网': 'Uses the MCIM China mirror by default; no VPN needed',
|
||||
'首次使用建议按「一 → 二」顺序配置,其余功能即可解锁。': 'For first use, configure sections 1 → 2 in order to unlock the remaining features.',
|
||||
'和平难度': 'Peaceful',
|
||||
'在线公告': 'Online notice',
|
||||
'在线列表': 'Online list',
|
||||
'晴天': 'Clear weather',
|
||||
'查看种子': 'Show seed',
|
||||
'白名单列表': 'Whitelist',
|
||||
'立即存档': 'Save now',
|
||||
'设为白天': 'Set day',
|
||||
'设为黑夜': 'Set night',
|
||||
'关闭': 'Close',
|
||||
'更新失败:{0}': 'Update failed: {0}',
|
||||
'未找到可下载的安装包': 'No downloadable package found',
|
||||
'正在下载更新': 'Downloading update',
|
||||
'正在下载,请稍候…': 'Downloading, please wait…',
|
||||
'立即更新': 'Update now',
|
||||
'例如:save-all': 'e.g. save-all',
|
||||
'例如:立即存档': 'e.g. Save now',
|
||||
'发送': 'Send',
|
||||
'命令': 'Command',
|
||||
'完成': 'Done',
|
||||
'快速命令': 'Quick Commands',
|
||||
'新增': 'Add',
|
||||
'暂无预设,点击下方按钮添加': 'No presets yet. Tap the button below to add one',
|
||||
'服务器控制台': 'Server Console',
|
||||
'标签': 'Label',
|
||||
'标签和命令都不能为空': 'Label and command cannot be empty',
|
||||
'点击标签一键发送,点击右侧按钮编辑': 'Tap a tag to send instantly; tap the button on the right to edit',
|
||||
'玩家管理': 'Players',
|
||||
'管理快速命令': 'Manage quick commands',
|
||||
'输入命令...': 'Enter command...',
|
||||
'{0}失败:{1}': '{0} failed: {1}',
|
||||
'{0}完成:成功 {1} 人': '{0} done: {1} succeeded',
|
||||
',失败 {0} 人': ', {0} failed',
|
||||
'全选': 'Select all',
|
||||
'原因(可选)': 'Reason (optional)',
|
||||
'取消 OP': 'Deop',
|
||||
'封禁': 'Ban',
|
||||
'将对「{0}」执行该操作': 'This will run the action on "{0}"',
|
||||
'批量操作': 'Batch actions',
|
||||
'操作': 'Actions',
|
||||
'暂无在线玩家': 'No players online',
|
||||
'确认': 'Confirm',
|
||||
'给予 OP': 'Op',
|
||||
'踢出': 'Kick',
|
||||
'退出选择': 'Exit selection',
|
||||
'无法连接': 'Cannot connect',
|
||||
'更多操作': 'More actions',
|
||||
'正在获取状态': 'Fetching status',
|
||||
'正在连接...': 'Connecting...',
|
||||
'确定要删除服务器「{0}」吗?': 'Delete server "{0}"?',
|
||||
'连接失败:{0}': 'Connection failed: {0}',
|
||||
'从相册选择图片作为应用背景': 'Pick an image from the gallery as the app background',
|
||||
'壁纸设置': 'Wallpaper',
|
||||
'当前为默认壁纸': 'Using the default wallpaper',
|
||||
'恢复默认': 'Restore default',
|
||||
'恢复默认壁纸': 'Restore default wallpaper',
|
||||
'点击下方「选择图片」自定义': 'Tap "Choose image" below to customize',
|
||||
'确定要恢复默认壁纸吗?': 'Restore the default wallpaper?',
|
||||
'确认重置': 'Confirm reset',
|
||||
'自定义壁纸已应用': 'Custom wallpaper applied',
|
||||
'选择壁纸': 'Choose wallpaper',
|
||||
'重置': 'Reset',
|
||||
'重置壁纸': 'Reset wallpaper',
|
||||
'发现新版本': 'New version available',
|
||||
'已是最新': 'Up to date',
|
||||
'当前版本 {0} 已是最新': 'Current version {0} is up to date',
|
||||
'正在下载安装包…': 'Downloading package…',
|
||||
'下载中:{0}%': 'Downloading: {0}%',
|
||||
'(无响应)': '(no response)',
|
||||
'{0}:{1}': '{0}: {1}',
|
||||
'无响应': 'No response',
|
||||
'{0} 名玩家': '{0} players',
|
||||
'已选 {0} 人': '{0} selected',
|
||||
'检测中': 'Checking',
|
||||
'点击重试': 'Tap to retry',
|
||||
'{0} 人': '{0} players',
|
||||
'进入控制台': 'Open console',
|
||||
'该项目没有可用版本': 'No available versions for this project',
|
||||
'没有可用文件': 'No available files',
|
||||
'未知名称': 'Unknown name',
|
||||
'网络错误': 'Network error',
|
||||
'MCIM 国内镜像 (mcimirror.top)': 'MCIM China mirror (mcimirror.top)',
|
||||
'自定义 ({0})': 'Custom ({0})',
|
||||
'SFTP 未连接,请先调用 connect()': 'SFTP not connected; call connect() first',
|
||||
'RCON 未连接或未认证': 'RCON not connected or not authenticated',
|
||||
'新增 {0} · 更新 {1} · 未变化 {2} · 共 {3} 条': 'Added {0} · Updated {1} · Unchanged {2} · {3} total',
|
||||
'[警告] 连接断开,正在重连...': '[Warning] Connection lost, reconnecting...',
|
||||
'[信息] 重连成功': '[Info] Reconnected',
|
||||
'[错误] {0}': '[Error] {0}',
|
||||
'建议:{0}': 'Suggestions: {0}',
|
||||
'新增预设': 'Add preset',
|
||||
'编辑预设': 'Edit preset',
|
||||
'给予OP': 'Op',
|
||||
'取消OP': 'Deop',
|
||||
'端口不能为空': 'Port cannot be empty',
|
||||
'端口范围 1-65535': 'Port range 1-65535',
|
||||
'还没有添加服务器': 'No servers added yet',
|
||||
'填入主机地址与 RCON 密码,即可在手机上管理': 'Enter the host and RCON password to manage it from your phone',
|
||||
'视频': 'Video',
|
||||
'图片': 'Image',
|
||||
'连接凭据已加密保存,仅存于本机': 'Credentials are encrypted and stored on this device only',
|
||||
};
|
||||
|
||||
static String t(String zh) => en ? (_en[zh] ?? zh) : zh;
|
||||
|
||||
/// 模板插值:S.f('在线 · {0}ms', [ms])
|
||||
static String f(String zh, List<Object> args) {
|
||||
var s = t(zh);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
s = s.replaceAll('{$i}', '${args[i]}');
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
/// Text 的翻译包装:T('取消') 等价 Text(S.t('取消'))。
|
||||
class T extends StatelessWidget {
|
||||
final String zh;
|
||||
final TextStyle? style;
|
||||
final TextAlign? textAlign;
|
||||
final int? maxLines;
|
||||
final TextOverflow? overflow;
|
||||
|
||||
const T(this.zh, {super.key, this.style, this.textAlign, this.maxLines, this.overflow});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
Text(S.t(zh), style: style, textAlign: textAlign, maxLines: maxLines, overflow: overflow);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'jar_metadata.dart';
|
||||
import 'sftp_service.dart';
|
||||
import 'package:dartssh2/dartssh2.dart' show SftpName;
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 本地依赖索引库(SQLite):
|
||||
/// 1. 记录服务器 mods/plugins 下每个 jar 的元数据与依赖;
|
||||
@@ -167,7 +168,7 @@ class SyncResult {
|
||||
int unchanged = 0;
|
||||
int total = 0;
|
||||
@override
|
||||
String toString() => '新增 $added · 更新 $updated · 未变化 $unchanged · 共 $total 条';
|
||||
String toString() => S.f('新增 {0} · 更新 {1} · 未变化 {2} · 共 {3} 条', [added, updated, unchanged, total]);
|
||||
}
|
||||
|
||||
class IndexedMod {
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'sftp_service.dart';
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
enum DownloadStatus { queued, running, paused, completed, failed, canceled }
|
||||
|
||||
@@ -219,7 +220,7 @@ class DownloadManager extends ChangeNotifier {
|
||||
} on DioException catch (e) {
|
||||
if (token.isCancelled) return; // 暂停/取消
|
||||
attempt++;
|
||||
task.error = e.message ?? '网络错误';
|
||||
task.error = e.message ?? S.t('网络错误');
|
||||
if (attempt > maxRetry) {
|
||||
_updateStatus(task.id, DownloadStatus.failed);
|
||||
notifyListeners();
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 镜像源服务:内置 MCIM(Modrinth 国内镜像),支持自定义线路与一键测速。
|
||||
class MirrorService extends ChangeNotifier {
|
||||
static const _prefKey = 'mirror_line';
|
||||
|
||||
/// 内置镜像线路:id → 名称。'official' 为 Modrinth 官方源。
|
||||
static const builtinMirrors = {
|
||||
'official': 'Modrinth 官方',
|
||||
'mcim': 'MCIM 国内镜像 (mcimirror.top)',
|
||||
static Map<String, String> get builtinMirrors => {
|
||||
'official': S.t('Modrinth 官方'),
|
||||
'mcim': S.t('MCIM 国内镜像 (mcimirror.top)'),
|
||||
};
|
||||
|
||||
String _current = 'mcim';
|
||||
@@ -20,7 +21,7 @@ class MirrorService extends ChangeNotifier {
|
||||
String get customUrl => _customUrl;
|
||||
|
||||
String get currentName {
|
||||
if (_current == 'custom') return '自定义 ($_customUrl)';
|
||||
if (_current == 'custom') return S.f('自定义 ({0})', [_customUrl]);
|
||||
return builtinMirrors[_current] ?? _current;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:typed_data';
|
||||
import 'package:dartssh2/dartssh2.dart';
|
||||
import 'dart:io' as io;
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 基于 dartssh2 的 SFTP 文件服务。
|
||||
/// 一次连接同时支持列目录 / 上传 / 下载 / 删除 / 重命名,
|
||||
@@ -103,7 +104,7 @@ class SftpService {
|
||||
SftpClient _requireSftp() {
|
||||
final sftp = _sftp;
|
||||
if (sftp == null || !isConnected) {
|
||||
throw StateError('SFTP 未连接,请先调用 connect()');
|
||||
throw StateError(S.t('SFTP 未连接,请先调用 connect()'));
|
||||
}
|
||||
return sftp;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 快速命令预设。
|
||||
class QuickCommandPreset {
|
||||
@@ -22,16 +23,16 @@ class CommandPresetService {
|
||||
static const _key = 'mc_quick_commands_v1';
|
||||
|
||||
/// 默认预设,首次使用或清空后恢复。
|
||||
static const defaultPresets = <QuickCommandPreset>[
|
||||
QuickCommandPreset(label: '在线列表', command: 'list'),
|
||||
QuickCommandPreset(label: '立即存档', command: 'save-all'),
|
||||
QuickCommandPreset(label: '查看种子', command: 'seed'),
|
||||
QuickCommandPreset(label: '晴天', command: 'weather clear'),
|
||||
QuickCommandPreset(label: '设为白天', command: 'time set day'),
|
||||
QuickCommandPreset(label: '设为黑夜', command: 'time set night'),
|
||||
QuickCommandPreset(label: '和平难度', command: 'difficulty peaceful'),
|
||||
QuickCommandPreset(label: '白名单列表', command: 'whitelist list'),
|
||||
QuickCommandPreset(label: '在线公告', command: 'say 服务器已在线,欢迎游玩!'),
|
||||
static List<QuickCommandPreset> get defaultPresets => <QuickCommandPreset>[
|
||||
QuickCommandPreset(label: S.t('在线列表'), command: 'list'),
|
||||
QuickCommandPreset(label: S.t('立即存档'), command: 'save-all'),
|
||||
QuickCommandPreset(label: S.t('查看种子'), command: 'seed'),
|
||||
QuickCommandPreset(label: S.t('晴天'), command: 'weather clear'),
|
||||
QuickCommandPreset(label: S.t('设为白天'), command: 'time set day'),
|
||||
QuickCommandPreset(label: S.t('设为黑夜'), command: 'time set night'),
|
||||
QuickCommandPreset(label: S.t('和平难度'), command: 'difficulty peaceful'),
|
||||
QuickCommandPreset(label: S.t('白名单列表'), command: 'whitelist list'),
|
||||
QuickCommandPreset(label: S.t('在线公告'), command: 'say 服务器已在线,欢迎游玩!'),
|
||||
];
|
||||
|
||||
static Future<List<QuickCommandPreset>> load() async {
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'rcon_stream_parser.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 去除 Minecraft 消息中的颜色/格式码(§ 后跟一个有效字符)。
|
||||
String stripMinecraftCodes(String input) {
|
||||
@@ -72,7 +73,7 @@ class RconClient {
|
||||
|
||||
Future<String?> executeCommand(String command) async {
|
||||
if (!_isAuthenticated || _socket == null) {
|
||||
throw Exception('RCON 未连接或未认证');
|
||||
throw Exception(S.t('RCON 未连接或未认证'));
|
||||
}
|
||||
final response = await _sendPacket(2, command);
|
||||
return response?.payload;
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 软件更新信息,由 Gitee 发布接口的 tag_name 与 assets 解析而来
|
||||
class UpdateInfo {
|
||||
@@ -91,20 +92,20 @@ class UpdateService {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: Text(hasUpdate ? '发现新版本' : '已是最新'),
|
||||
title: Text(hasUpdate ? S.t('发现新版本') : S.t('已是最新')),
|
||||
content: Text(hasUpdate
|
||||
? '最新版本: ${info.latestVersion}\n当前版本: $currentVersion'
|
||||
: '当前版本 $currentVersion 已是最新'),
|
||||
: S.f('当前版本 {0} 已是最新', [currentVersion])),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context), child: const Text('关闭')),
|
||||
onPressed: () => Navigator.pop(context), child: T('关闭')),
|
||||
if (hasUpdate)
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
downloadAndInstall(context, info);
|
||||
},
|
||||
child: const Text('立即更新'),
|
||||
child: T('立即更新'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -116,13 +117,13 @@ class UpdateService {
|
||||
BuildContext context, UpdateInfo info) async {
|
||||
if (_downloading) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('正在下载,请稍候…')),
|
||||
SnackBar(content: T('正在下载,请稍候…')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (info.downloadUrl.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('未找到可下载的安装包')),
|
||||
const SnackBar(content: T('未找到可下载的安装包')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -152,7 +153,7 @@ class UpdateService {
|
||||
builder: (_) => PopScope(
|
||||
canPop: false,
|
||||
child: AlertDialog(
|
||||
title: const Text('正在下载更新'),
|
||||
title: T('正在下载更新'),
|
||||
content: ValueListenableBuilder<double?>(
|
||||
valueListenable: progress,
|
||||
builder: (context, value, _) {
|
||||
@@ -163,7 +164,7 @@ class UpdateService {
|
||||
CircularProgressIndicator(value: value),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
percent == null ? '正在下载安装包…' : '下载中:$percent%',
|
||||
percent == null ? S.t('正在下载安装包…') : S.f('下载中:{0}%', [percent]),
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
],
|
||||
@@ -183,7 +184,7 @@ class UpdateService {
|
||||
final message = e.message?.toString() ?? e.code;
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('更新失败:$message')),
|
||||
SnackBar(content: Text(S.f('更新失败:{0}', [message]))),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../l10n/strings.dart';
|
||||
|
||||
class UserAgreementDialog extends StatefulWidget {
|
||||
final VoidCallback onAgree;
|
||||
@@ -50,9 +51,9 @@ class _UserAgreementDialogState extends State<UserAgreementDialog> {
|
||||
bool get _canAgree => _isChecked && _countdown <= 0 && _readToEnd;
|
||||
|
||||
String get _buttonLabel {
|
||||
if (_countdown > 0) return '请仔细阅读守则(${_countdown}s)';
|
||||
if (!_readToEnd) return '请阅读至守则底部';
|
||||
return '同意并进入';
|
||||
if (_countdown > 0) return S.f('请仔细阅读守则({0}s)', [_countdown]);
|
||||
if (!_readToEnd) return S.t('请阅读至守则底部');
|
||||
return S.t('同意并进入');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -73,8 +74,8 @@ class _UserAgreementDialogState extends State<UserAgreementDialog> {
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// 标题
|
||||
const Text(
|
||||
'用户守则',
|
||||
Text(
|
||||
S.t('用户守则'),
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -97,52 +98,52 @@ class _UserAgreementDialogState extends State<UserAgreementDialog> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_SectionText('版本 v2.0 · 下载、安装或使用本软件,即视为您已阅读并同意本守则全部条款。'),
|
||||
_SectionText(S.t('版本 v2.0 · 下载、安装或使用本软件,即视为您已阅读并同意本守则全部条款。')),
|
||||
|
||||
_SectionTitle('一、软件性质与用途'),
|
||||
_SectionText('ZV Manager 是一款 Minecraft 服务器远程管理工具,通过 RCON、SSH/SFTP 等协议连接到您有权管理的服务器,提供服务器控制、玩家管理、模组插件管理、文件下载与远程终端等功能。本软件按"现状"提供。'),
|
||||
_SectionTitle(S.t('一、软件性质与用途')),
|
||||
_SectionText(S.t('ZV Manager 是一款 Minecraft 服务器远程管理工具,通过 RCON、SSH/SFTP 等协议连接到您有权管理的服务器,提供服务器控制、玩家管理、模组插件管理、文件下载与远程终端等功能。本软件按"现状"提供。')),
|
||||
|
||||
_SectionTitle('二、账号与凭据安全'),
|
||||
_SectionText('1. 连接凭据(RCON 密码、SSH 用户名/密码等)仅保存在您的设备本地(加密存储),本软件无云端账号系统,不会将凭据上传至开发者或任何第三方。'),
|
||||
_SectionText('2. 请妥善保管设备与凭据,因主动泄露、设备被他人使用、越狱/Root 等造成的损失由您自行承担。'),
|
||||
_SectionText('3. 仅连接您拥有管理权限的服务器,并使用强密码、定期更换。'),
|
||||
_SectionTitle(S.t('二、账号与凭据安全')),
|
||||
_SectionText(S.t('1. 连接凭据(RCON 密码、SSH 用户名/密码等)仅保存在您的设备本地(加密存储),本软件无云端账号系统,不会将凭据上传至开发者或任何第三方。')),
|
||||
_SectionText(S.t('2. 请妥善保管设备与凭据,因主动泄露、设备被他人使用、越狱/Root 等造成的损失由您自行承担。')),
|
||||
_SectionText(S.t('3. 仅连接您拥有管理权限的服务器,并使用强密码、定期更换。')),
|
||||
|
||||
_SectionTitle('三、合法使用(重要)'),
|
||||
_SectionText('1. 仅管理您有权管理的服务器。严禁连接、探测、控制任何未获授权的第三方服务器——未经授权访问计算机系统属于违法行为。'),
|
||||
_SectionText('2. 遵守《网络安全法》《计算机信息系统安全保护条例》等法律法规及 Minecraft EULA 与服务器规则。'),
|
||||
_SectionText('3. 不得利用本软件传播违法信息、破坏他人服务器、恶意攻击或盗取数据。'),
|
||||
_SectionText('4. 下载中心获取的模组/插件版权归原作者所有,请遵守对应开源协议,不得下载、分发盗版或破解内容。'),
|
||||
_SectionTitle(S.t('三、合法使用(重要)')),
|
||||
_SectionText(S.t('1. 仅管理您有权管理的服务器。严禁连接、探测、控制任何未获授权的第三方服务器——未经授权访问计算机系统属于违法行为。')),
|
||||
_SectionText(S.t('2. 遵守《网络安全法》《计算机信息系统安全保护条例》等法律法规及 Minecraft EULA 与服务器规则。')),
|
||||
_SectionText(S.t('3. 不得利用本软件传播违法信息、破坏他人服务器、恶意攻击或盗取数据。')),
|
||||
_SectionText(S.t('4. 下载中心获取的模组/插件版权归原作者所有,请遵守对应开源协议,不得下载、分发盗版或破解内容。')),
|
||||
|
||||
_SectionTitle('四、SSH / 终端功能风险提示'),
|
||||
_SectionText('1. SSH 终端拥有服务器完全控制能力,您执行的任何命令(含删除文件、重启系统)后果由您自行承担。'),
|
||||
_SectionText('2. 建议不要以 root 账户长期连接,执行不熟悉的命令前请先确认其作用。'),
|
||||
_SectionText('3. 命令历史仅保存在设备本地,可在应用内清除,本软件不做任何云端记录。'),
|
||||
_SectionTitle(S.t('四、SSH / 终端功能风险提示')),
|
||||
_SectionText(S.t('1. SSH 终端拥有服务器完全控制能力,您执行的任何命令(含删除文件、重启系统)后果由您自行承担。')),
|
||||
_SectionText(S.t('2. 建议不要以 root 账户长期连接,执行不熟悉的命令前请先确认其作用。')),
|
||||
_SectionText(S.t('3. 命令历史仅保存在设备本地,可在应用内清除,本软件不做任何云端记录。')),
|
||||
|
||||
_SectionTitle('五、模组管理与下载功能说明'),
|
||||
_SectionText('1. 下载功能数据来自 Modrinth 公开接口及其镜像线路(如 MCIM)。镜像线路由第三方维护,其可用性与安全性不由开发者控制。'),
|
||||
_SectionText('2. 第三方模组/插件可能影响服务器稳定性,安装前请备份重要数据;"依赖仓库"查询结果仅供参考。'),
|
||||
_SectionTitle(S.t('五、模组管理与下载功能说明')),
|
||||
_SectionText(S.t('1. 下载功能数据来自 Modrinth 公开接口及其镜像线路(如 MCIM)。镜像线路由第三方维护,其可用性与安全性不由开发者控制。')),
|
||||
_SectionText(S.t('2. 第三方模组/插件可能影响服务器稳定性,安装前请备份重要数据;"依赖仓库"查询结果仅供参考。')),
|
||||
|
||||
_SectionTitle('六、免责声明'),
|
||||
_SectionText('1. 本软件为免费开源软件,不提供商业担保。在法律允许的最大范围内,开发者不对因使用或无法使用本软件造成的任何直接或间接损失负责(包括数据丢失、服务器宕机、存档损坏、经济损失)。'),
|
||||
_SectionText('2. 因第三方服务(Modrinth、镜像源、托管商、网络)变更或故障导致的异常,开发者不承担责任。'),
|
||||
_SectionTitle(S.t('六、免责声明')),
|
||||
_SectionText(S.t('1. 本软件为免费开源软件,不提供商业担保。在法律允许的最大范围内,开发者不对因使用或无法使用本软件造成的任何直接或间接损失负责(包括数据丢失、服务器宕机、存档损坏、经济损失)。')),
|
||||
_SectionText(S.t('2. 因第三方服务(Modrinth、镜像源、托管商、网络)变更或故障导致的异常,开发者不承担责任。')),
|
||||
|
||||
_SectionTitle('七、数据与隐私'),
|
||||
_SectionText('1. 本软件不收集、不上传您的任何个人数据,全部数据保存在设备本地,卸载即删除。'),
|
||||
_SectionText('2. 应用仅联网检查更新(Gitee 发布页)及访问 Modrinth/镜像接口,无其他网络请求。'),
|
||||
_SectionTitle(S.t('七、数据与隐私')),
|
||||
_SectionText(S.t('1. 本软件不收集、不上传您的任何个人数据,全部数据保存在设备本地,卸载即删除。')),
|
||||
_SectionText(S.t('2. 应用仅联网检查更新(Gitee 发布页)及访问 Modrinth/镜像接口,无其他网络请求。')),
|
||||
|
||||
_SectionTitle('八、知识产权'),
|
||||
_SectionText('1. 本软件按开源协议发布,可依协议使用、修改和分发;"ZV Manager"名称与图标版权归作者所有。'),
|
||||
_SectionText('2. Minecraft 是 Mojang Studios 的商标,本软件与 Mojang、微软无任何隶属关系。'),
|
||||
_SectionTitle(S.t('八、知识产权')),
|
||||
_SectionText(S.t('1. 本软件按开源协议发布,可依协议使用、修改和分发;"ZV Manager"名称与图标版权归作者所有。')),
|
||||
_SectionText(S.t('2. Minecraft 是 Mojang Studios 的商标,本软件与 Mojang、微软无任何隶属关系。')),
|
||||
|
||||
_SectionTitle('九、守则变更'),
|
||||
_SectionText('开发者可能随版本更新修订本守则并在应用内展示;不同意修订内容请停止使用,继续使用即视为接受。'),
|
||||
_SectionTitle(S.t('九、守则变更')),
|
||||
_SectionText(S.t('开发者可能随版本更新修订本守则并在应用内展示;不同意修订内容请停止使用,继续使用即视为接受。')),
|
||||
|
||||
_SectionTitle('十、其他'),
|
||||
_SectionText('本守则最终解释权归 ZV Team 所有。如有疑问或发现漏洞,欢迎通过 Gitee 仓库(gitee.com/driftinblock/zvmanager)或官方 QQ 群反馈。'),
|
||||
_SectionTitle(S.t('十、其他')),
|
||||
_SectionText(S.t('本守则最终解释权归 ZV Team 所有。如有疑问或发现漏洞,欢迎通过 Gitee 仓库(gitee.com/driftinblock/zvmanager)或官方 QQ 群反馈。')),
|
||||
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'© 2026 ZV Team · 与 Mojang 无关',
|
||||
S.t('© 2026 ZV Team · 与 Mojang 无关'),
|
||||
style: TextStyle(fontSize: 12, color: Color(0xFF999999)),
|
||||
),
|
||||
],
|
||||
@@ -183,8 +184,8 @@ class _UserAgreementDialogState extends State<UserAgreementDialog> {
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
_countdown > 0
|
||||
? '阅读倒计时 $_countdown 秒…'
|
||||
: (_readToEnd ? '我已阅读并同意《用户守则》' : '请先滑动阅读至守则底部'),
|
||||
? S.f('阅读倒计时 {0} 秒…', [_countdown])
|
||||
: (_readToEnd ? S.t('我已阅读并同意《用户守则》') : S.t('请先滑动阅读至守则底部')),
|
||||
style: const TextStyle(fontSize: 14, color: Color(0xFF555555)),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import '../../core/utils/command_preset_service.dart';
|
||||
import '../../core/utils/rcon_client.dart';
|
||||
import '../player_management/player_list_page.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
class ConsolePage extends StatefulWidget {
|
||||
final RconClient rconClient;
|
||||
@@ -30,12 +31,12 @@ class _ConsolePageState extends State<ConsolePage> {
|
||||
super.initState();
|
||||
widget.rconClient.onDisconnected = () {
|
||||
if (mounted) {
|
||||
setState(() => _outputLines.add(_LogLine(text: '[警告] 连接断开,正在重连...', isError: true)));
|
||||
setState(() => _outputLines.add(_LogLine(text: S.t('[警告] 连接断开,正在重连...'), isError: true)));
|
||||
}
|
||||
};
|
||||
widget.rconClient.onReconnected = () {
|
||||
if (mounted) {
|
||||
setState(() => _outputLines.add(_LogLine(text: '[信息] 重连成功', isCommand: false)));
|
||||
setState(() => _outputLines.add(_LogLine(text: S.t('[信息] 重连成功'), isCommand: false)));
|
||||
}
|
||||
};
|
||||
_loadPresets();
|
||||
@@ -85,13 +86,13 @@ class _ConsolePageState extends State<ConsolePage> {
|
||||
final response = await widget.rconClient.executeCommand(cmd);
|
||||
setState(() {
|
||||
_outputLines.add(_LogLine(
|
||||
text: stripMinecraftCodes(response ?? '(无响应)'),
|
||||
text: stripMinecraftCodes(response ?? S.t('(无响应)')),
|
||||
isCommand: false,
|
||||
));
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
_outputLines.add(_LogLine(text: '[错误] $e', isCommand: false, isError: true));
|
||||
_outputLines.add(_LogLine(text: S.f('[错误] {0}', [e.toString()]), isCommand: false, isError: true));
|
||||
});
|
||||
}
|
||||
_scrollToBottom();
|
||||
@@ -107,7 +108,7 @@ class _ConsolePageState extends State<ConsolePage> {
|
||||
_controller.selection = TextSelection.fromPosition(TextPosition(offset: matches.first.length));
|
||||
} else if (matches.length > 1) {
|
||||
setState(() {
|
||||
_outputLines.add(_LogLine(text: '建议:${matches.join(", ")}', isCommand: false));
|
||||
_outputLines.add(_LogLine(text: S.f('建议:{0}', [matches.join(", ")]), isCommand: false));
|
||||
});
|
||||
_scrollToBottom();
|
||||
}
|
||||
@@ -148,11 +149,11 @@ class _ConsolePageState extends State<ConsolePage> {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('服务器控制台'),
|
||||
title: T('服务器控制台'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.people_outline),
|
||||
tooltip: '玩家管理',
|
||||
tooltip: S.t('玩家管理'),
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => PlayerListPage(rconClient: widget.rconClient)),
|
||||
@@ -212,7 +213,7 @@ class _ConsolePageState extends State<ConsolePage> {
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
decoration: InputDecoration(
|
||||
hintText: '输入命令...',
|
||||
hintText: S.t('输入命令...'),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
),
|
||||
style: const TextStyle(fontFamily: 'monospace', fontSize: 14),
|
||||
@@ -224,7 +225,7 @@ class _ConsolePageState extends State<ConsolePage> {
|
||||
FilledButton.icon(
|
||||
onPressed: _executeCommand,
|
||||
icon: const Icon(Icons.send_rounded, size: 18),
|
||||
label: const Text('发送'),
|
||||
label: T('发送'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -298,7 +299,7 @@ class _PresetBar extends StatelessWidget {
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.tune_rounded, size: 20),
|
||||
tooltip: '管理快速命令',
|
||||
tooltip: S.t('管理快速命令'),
|
||||
onPressed: onManage,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
@@ -350,15 +351,15 @@ class _PresetManageSheetState extends State<_PresetManageSheet> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
child: Text('快速命令', style: theme.textTheme.titleMedium),
|
||||
child: T('快速命令', style: theme.textTheme.titleMedium),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text('点击标签一键发送,点击右侧按钮编辑'),
|
||||
child: T('点击标签一键发送,点击右侧按钮编辑'),
|
||||
),
|
||||
Expanded(
|
||||
child: _presets.isEmpty
|
||||
? const Center(child: Text('暂无预设,点击下方按钮添加'))
|
||||
? const Center(child: T('暂无预设,点击下方按钮添加'))
|
||||
: ListView.builder(
|
||||
itemCount: _presets.length,
|
||||
itemBuilder: (context, i) {
|
||||
@@ -377,17 +378,17 @@ class _PresetManageSheetState extends State<_PresetManageSheet> {
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.send_rounded, size: 20),
|
||||
tooltip: '发送',
|
||||
tooltip: S.t('发送'),
|
||||
onPressed: () => widget.onSend(preset.command),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit_outlined, size: 20),
|
||||
tooltip: '编辑',
|
||||
tooltip: S.t('编辑'),
|
||||
onPressed: () => _editPreset(preset: preset),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_outline, size: 20),
|
||||
tooltip: '删除',
|
||||
tooltip: S.t('删除'),
|
||||
onPressed: () => setState(() => _presets.removeAt(i)),
|
||||
),
|
||||
],
|
||||
@@ -403,12 +404,12 @@ class _PresetManageSheetState extends State<_PresetManageSheet> {
|
||||
OutlinedButton.icon(
|
||||
onPressed: () => _editPreset(),
|
||||
icon: const Icon(Icons.add, size: 18),
|
||||
label: const Text('新增'),
|
||||
label: T('新增'),
|
||||
),
|
||||
const Spacer(),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(context, _presets),
|
||||
child: const Text('完成'),
|
||||
child: T('完成'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -448,19 +449,19 @@ class _PresetEditDialogState extends State<_PresetEditDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(widget.preset == null ? '新增预设' : '编辑预设'),
|
||||
title: Text(widget.preset == null ? S.t('新增预设') : S.t('编辑预设')),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: _labelController,
|
||||
decoration: const InputDecoration(labelText: '标签', hintText: '例如:立即存档'),
|
||||
decoration: InputDecoration(labelText: S.t('标签'), hintText: S.t('例如:立即存档')),
|
||||
autofocus: true,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: _commandController,
|
||||
decoration: const InputDecoration(labelText: '命令', hintText: '例如:save-all'),
|
||||
decoration: InputDecoration(labelText: S.t('命令'), hintText: S.t('例如:save-all')),
|
||||
style: const TextStyle(fontFamily: 'monospace'),
|
||||
),
|
||||
],
|
||||
@@ -468,7 +469,7 @@ class _PresetEditDialogState extends State<_PresetEditDialog> {
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('取消'),
|
||||
child: T('取消'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
@@ -476,13 +477,13 @@ class _PresetEditDialogState extends State<_PresetEditDialog> {
|
||||
final command = _commandController.text.trim();
|
||||
if (label.isEmpty || command.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('标签和命令都不能为空')),
|
||||
const SnackBar(content: T('标签和命令都不能为空')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
Navigator.pop(context, _PresetEditResult(label: label, command: command));
|
||||
},
|
||||
child: const Text('保存'),
|
||||
child: T('保存'),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -10,6 +10,7 @@ import '../download/download_page.dart';
|
||||
import '../mod_manager/mod_list_page.dart';
|
||||
import '../terminal/terminal_page.dart';
|
||||
import 'server_picker_bar.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 服务器 Dashboard:卡片式布局展示选中服务器的
|
||||
/// 在线状态 / 延迟 / 在线人数 / TPS / 磁盘(后续 Shell 采集)+ 快捷入口(M4)。
|
||||
@@ -96,14 +97,14 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('删除服务器'),
|
||||
content: Text('确定要删除「${s.name}」吗?仅删除本应用中的连接配置,不影响服务器本身。'),
|
||||
title: T('删除服务器'),
|
||||
content: Text(S.f('确定要删除「{0}」吗?仅删除本应用中的连接配置,不影响服务器本身。', [s.name])),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context, false), child: const Text('取消')),
|
||||
TextButton(onPressed: () => Navigator.pop(context, false), child: T('取消')),
|
||||
FilledButton(
|
||||
style: FilledButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('删除'),
|
||||
child: T('删除'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -132,11 +133,11 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
children: [
|
||||
const Icon(Icons.warning_amber_rounded, color: Colors.white),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text('服务器「$serverName」已断开连接!')),
|
||||
Expanded(child: Text(S.f('服务器「{0}」已断开连接!', [serverName]))),
|
||||
],
|
||||
),
|
||||
action: SnackBarAction(
|
||||
label: '知道了',
|
||||
label: S.t('知道了'),
|
||||
textColor: Colors.white,
|
||||
onPressed: messenger.hideCurrentSnackBar,
|
||||
),
|
||||
@@ -159,19 +160,19 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
tooltip: '刷新状态',
|
||||
tooltip: S.t('刷新状态'),
|
||||
onPressed: _refreshAll,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
tooltip: '添加服务器',
|
||||
tooltip: S.t('添加服务器'),
|
||||
onPressed: _addServer,
|
||||
),
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _addServer,
|
||||
tooltip: '添加服务器',
|
||||
tooltip: S.t('添加服务器'),
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
body: servers.isEmpty
|
||||
@@ -179,11 +180,11 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text('还没有服务器,点击下方按钮添加吧'),
|
||||
T('还没有服务器,点击下方按钮添加吧'),
|
||||
const SizedBox(height: 16),
|
||||
FilledButton.icon(
|
||||
icon: const Icon(Icons.add),
|
||||
label: const Text('添加服务器'),
|
||||
label: T('添加服务器'),
|
||||
onPressed: _addServer,
|
||||
),
|
||||
],
|
||||
@@ -200,7 +201,7 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
subtitle: Text('${selected?.host ?? '-'}:${selected?.port ?? '-'}'),
|
||||
trailing: DropdownButton<ServerConfig>(
|
||||
underline: const SizedBox.shrink(),
|
||||
hint: const Text('切换'),
|
||||
hint: T('切换'),
|
||||
items: servers
|
||||
.map((s) => DropdownMenuItem(value: s, child: Text(s.name)))
|
||||
.toList(),
|
||||
@@ -230,7 +231,7 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
_statusCard(
|
||||
icon: Icons.person,
|
||||
color: Colors.blue,
|
||||
label: '在线人数',
|
||||
label: S.t('在线人数'),
|
||||
sub: '${status?.playerCount ?? 0}',
|
||||
),
|
||||
_statusCard(
|
||||
@@ -242,14 +243,14 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
_statusCard(
|
||||
icon: Icons.storage,
|
||||
color: Colors.purple,
|
||||
label: '磁盘',
|
||||
label: S.t('磁盘'),
|
||||
sub: '需 SSH 终端',
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 服务器卡片列表(点击选中)
|
||||
Text('服务器', style: Theme.of(context).textTheme.titleMedium),
|
||||
T('服务器', style: Theme.of(context).textTheme.titleMedium),
|
||||
...servers.map((s) {
|
||||
final st = _status[s.id];
|
||||
final isSel = selected?.id == s.id;
|
||||
@@ -264,9 +265,8 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
title: Text(s.name),
|
||||
subtitle: Text(
|
||||
st?.online == true
|
||||
? '在线 · ${st!.latencyMs}ms · ${st.playerCount} 人'
|
||||
'${st.tps != null ? " · TPS ${st.tps!.toStringAsFixed(1)}" : ""}'
|
||||
: '离线',
|
||||
? S.f('在线 · {0}ms · {1} 人', [st!.latencyMs, st.playerCount]) + (st.tps != null ? ' · TPS ${st.tps!.toStringAsFixed(1)}' : '')
|
||||
: S.t('离线'),
|
||||
),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -275,8 +275,8 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
PopupMenuButton<String>(
|
||||
onSelected: (a) => _onServerAction(context, s, a),
|
||||
itemBuilder: (_) => const [
|
||||
PopupMenuItem(value: 'edit', child: Text('编辑')),
|
||||
PopupMenuItem(value: 'delete', child: Text('删除')),
|
||||
PopupMenuItem(value: 'edit', child: T('编辑')),
|
||||
PopupMenuItem(value: 'delete', child: T('删除')),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -295,8 +295,8 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.download_outlined),
|
||||
title: const Text('下载中心'),
|
||||
subtitle: const Text('Modrinth 搜索 · 镜像加速'),
|
||||
title: T('下载中心'),
|
||||
subtitle: T('Modrinth 搜索 · 镜像加速'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
@@ -305,7 +305,7 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.terminal),
|
||||
title: const Text('远程终端'),
|
||||
title: T('远程终端'),
|
||||
subtitle: const Text('SSH Shell'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
@@ -315,8 +315,8 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.extension_outlined),
|
||||
title: const Text('模组管理'),
|
||||
subtitle: const Text('上传 / 删除 / 查看依赖'),
|
||||
title: T('模组管理'),
|
||||
subtitle: T('上传 / 删除 / 查看依赖'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
|
||||
@@ -5,6 +5,7 @@ import '../../core/services/modrinth_api.dart';
|
||||
import '../../providers/download_provider.dart';
|
||||
import '../../core/services/download_manager.dart';
|
||||
import '../settings/download_settings_page.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 下载中心:Modrinth 搜索 + 镜像线路选择 + 下载任务队列(M2)。
|
||||
class DownloadPage extends StatefulWidget {
|
||||
@@ -54,7 +55,7 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
setState(() => _searching = false);
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('搜索失败:$e')));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(S.f('搜索失败:{0}', [e]))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,11 +68,11 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
child: Scaffold(
|
||||
backgroundColor: hasWallpaper ? Colors.transparent : null,
|
||||
appBar: AppBar(
|
||||
title: const Text('下载中心'),
|
||||
title: T('下载中心'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
tooltip: '下载与镜像设置',
|
||||
tooltip: S.t('下载与镜像设置'),
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const DownloadSettingsPage()),
|
||||
@@ -95,8 +96,8 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _searchCtrl,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '搜索 Modrinth 模组/插件,如 sodium',
|
||||
decoration: InputDecoration(
|
||||
hintText: S.t('搜索 Modrinth 模组/插件,如 sodium'),
|
||||
prefixIcon: Icon(Icons.search),
|
||||
border: OutlineInputBorder(),
|
||||
isDense: true,
|
||||
@@ -105,7 +106,7 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
FilledButton(onPressed: _searching ? null : _search, child: const Text('搜索')),
|
||||
FilledButton(onPressed: _searching ? null : _search, child: T('搜索')),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -139,9 +140,9 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
child: _searching
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: _results == null
|
||||
? const Center(child: Text('输入关键词开始搜索'))
|
||||
? const Center(child: T('输入关键词开始搜索'))
|
||||
: _results!.isEmpty
|
||||
? const Center(child: Text('没有结果'))
|
||||
? const Center(child: T('没有结果'))
|
||||
: ListView.builder(
|
||||
itemCount: _results!.length,
|
||||
itemBuilder: (context, i) {
|
||||
@@ -184,7 +185,7 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
Future<void> _showVersionSheet(ModrinthSearchResult r) async {
|
||||
final dp = context.read<DownloadProvider>();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('正在获取版本列表...'), duration: Duration(seconds: 1)),
|
||||
SnackBar(content: T('正在获取版本列表...'), duration: Duration(seconds: 1)),
|
||||
);
|
||||
try {
|
||||
final versions = await dp.versions(r.projectId);
|
||||
@@ -197,7 +198,7 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text('选择 ${r.title} 的版本', style: Theme.of(context).textTheme.titleMedium),
|
||||
child: Text(S.f('选择 {0} 的版本', [r.title]), style: Theme.of(context).textTheme.titleMedium),
|
||||
),
|
||||
...versions.take(15).map((v) => ListTile(
|
||||
title: Text(v.versionNumber),
|
||||
@@ -211,7 +212,7 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
);
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('获取版本失败:$e')));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(S.f('获取版本失败:{0}', [e]))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +223,7 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
// 取主 jar 文件
|
||||
final files = v.files;
|
||||
if (files.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('该版本没有可用文件')));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: T('该版本没有可用文件')));
|
||||
return;
|
||||
}
|
||||
final primary = files.firstWhere((f) => f['primary'] == true, orElse: () => files.first);
|
||||
@@ -230,7 +231,7 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
final fileName = primary['filename'] as String;
|
||||
await dp.download(url: url, fileName: fileName, projectType: _projectType);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('已加入下载队列:$fileName')));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(S.f('已加入下载队列:{0}', [fileName]))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +240,7 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
animation: dp.manager,
|
||||
builder: (context, _) {
|
||||
final tasks = dp.manager.tasks;
|
||||
if (tasks.isEmpty) return const Center(child: Text('暂无下载任务'));
|
||||
if (tasks.isEmpty) return const Center(child: T('暂无下载任务'));
|
||||
return ListView.builder(
|
||||
itemCount: tasks.length,
|
||||
itemBuilder: (context, i) {
|
||||
@@ -271,24 +272,24 @@ class _DownloadPageState extends State<DownloadPage> {
|
||||
if (t.status == DownloadStatus.running)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.pause),
|
||||
tooltip: '暂停',
|
||||
tooltip: S.t('暂停'),
|
||||
onPressed: () => dp.manager.pause(t.id),
|
||||
),
|
||||
if (t.status == DownloadStatus.paused)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.play_arrow),
|
||||
tooltip: '继续',
|
||||
tooltip: S.t('继续'),
|
||||
onPressed: () => dp.manager.resume(t.id),
|
||||
),
|
||||
if (t.status == DownloadStatus.failed)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.replay),
|
||||
tooltip: '重试',
|
||||
tooltip: S.t('重试'),
|
||||
onPressed: () => dp.manager.retry(t.id),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
tooltip: '取消',
|
||||
tooltip: S.t('取消'),
|
||||
onPressed: () => dp.manager.cancel(t.id),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
||||
import '../../core/services/dependency_index_service.dart';
|
||||
import '../../providers/download_provider.dart';
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 依赖仓库页:服务器本地仓库增量同步 + 依赖树查询 + 缺失依赖一键补齐 + 重复检测。
|
||||
class DependencyTreePage extends StatefulWidget {
|
||||
@@ -48,7 +49,7 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_syncing = false;
|
||||
_syncInfo = '同步失败:$e';
|
||||
_syncInfo = S.f('同步失败:{0}', [e]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -66,24 +67,24 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
Text('${tree.mod.name ?? tree.mod.fileName} ${tree.mod.version ?? ''}',
|
||||
style: Theme.of(context).textTheme.titleMedium),
|
||||
const Divider(),
|
||||
const Text('该模组依赖:'),
|
||||
T('该模组依赖:'),
|
||||
...tree.dependsOn.map((m) => ListTile(
|
||||
dense: true,
|
||||
leading: const Icon(Icons.link, size: 18),
|
||||
title: Text('${m.name ?? m.fileName} ${m.version ?? ''}'),
|
||||
)),
|
||||
if (tree.dependsOn.isEmpty) const Text('无', style: TextStyle(color: Colors.grey)),
|
||||
if (tree.dependsOn.isEmpty) T('无', style: TextStyle(color: Colors.grey)),
|
||||
const SizedBox(height: 8),
|
||||
const Text('被以下模组依赖:'),
|
||||
T('被以下模组依赖:'),
|
||||
...tree.dependents.map((m) => ListTile(
|
||||
dense: true,
|
||||
leading: const Icon(Icons.link, size: 18),
|
||||
title: Text('${m.name ?? m.fileName} ${m.version ?? ''}'),
|
||||
)),
|
||||
if (tree.dependents.isEmpty) const Text('无', style: TextStyle(color: Colors.grey)),
|
||||
if (tree.dependents.isEmpty) T('无', style: TextStyle(color: Colors.grey)),
|
||||
if (tree.missing.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
const Text('缺失依赖(可一键补齐):',
|
||||
T('缺失依赖(可一键补齐):',
|
||||
style: TextStyle(color: Colors.red, fontWeight: FontWeight.w600)),
|
||||
...tree.missing.map((d) => ListTile(
|
||||
dense: true,
|
||||
@@ -91,7 +92,7 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
title: Text(d),
|
||||
trailing: TextButton(
|
||||
onPressed: () => _fetchMissing(d),
|
||||
child: const Text('从 Modrinth 补齐'),
|
||||
child: T('从 Modrinth 补齐'),
|
||||
),
|
||||
)),
|
||||
],
|
||||
@@ -105,21 +106,21 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
final dp = context.read<DownloadProvider>();
|
||||
try {
|
||||
final results = await dp.search(name, projectType: 'mod', limit: 1);
|
||||
if (results.isEmpty) throw '未找到 $name';
|
||||
if (results.isEmpty) throw S.f('未找到 {0}', [name]);
|
||||
final project = results.first;
|
||||
final versions = await dp.versions(project.projectId);
|
||||
if (versions.isEmpty) throw '该项目没有可用版本';
|
||||
if (versions.isEmpty) throw S.t('该项目没有可用版本');
|
||||
final v = versions.first;
|
||||
if (v.files.isEmpty) throw '没有可用文件';
|
||||
if (v.files.isEmpty) throw S.t('没有可用文件');
|
||||
final primary = v.files.firstWhere((f) => f['primary'] == true, orElse: () => v.files.first);
|
||||
await dp.download(url: primary['url'], fileName: primary['filename'], projectType: 'mod');
|
||||
if (mounted) {
|
||||
Navigator.pop(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('已下载 $name(${v.versionNumber})')));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(S.f('已下载 {0}({1})', [name, v.versionNumber]))));
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('补齐失败:$e')));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(S.f('补齐失败:{0}', [e]))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,18 +135,18 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
shrinkWrap: true,
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
Text('版本冲突 / 重复 jar', style: Theme.of(context).textTheme.titleMedium),
|
||||
Text(S.t('版本冲突 / 重复 jar'), style: Theme.of(context).textTheme.titleMedium),
|
||||
const Divider(),
|
||||
if (dups.isEmpty) const Text('未发现重复'),
|
||||
if (dups.isEmpty) T('未发现重复'),
|
||||
...dups.map((g) => ExpansionTile(
|
||||
title: Text(g.modId,
|
||||
style: const TextStyle(color: Colors.orange, fontWeight: FontWeight.w600)),
|
||||
subtitle: Text('${g.items.length} 个版本共存'),
|
||||
subtitle: Text(S.f('{0} 个版本共存', [g.items.length])),
|
||||
children: g.items
|
||||
.map((m) => ListTile(
|
||||
dense: true,
|
||||
title: Text(m.fileName),
|
||||
subtitle: Text('版本 ${m.version ?? '未知'} · ${m.remotePath}'),
|
||||
subtitle: Text('${m.version ?? S.t('未知')} · ${m.remotePath}'),
|
||||
))
|
||||
.toList(),
|
||||
)),
|
||||
@@ -159,11 +160,11 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('依赖仓库'),
|
||||
title: T('依赖仓库'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.rule),
|
||||
tooltip: '重复检测',
|
||||
tooltip: S.t('重复检测'),
|
||||
onPressed: _checkDuplicates,
|
||||
),
|
||||
],
|
||||
@@ -181,7 +182,7 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
icon: _syncing
|
||||
? const SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: const Icon(Icons.sync),
|
||||
label: const Text('同步'),
|
||||
label: T('同步'),
|
||||
onPressed: _syncing ? null : _sync,
|
||||
),
|
||||
],
|
||||
@@ -195,11 +196,11 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text('索引为空,先点击「同步」'),
|
||||
T('索引为空,先点击「同步」'),
|
||||
if (!widget.server.hasSsh)
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Text('(该服务器未配置 SSH,无法同步)',
|
||||
child: T('(该服务器未配置 SSH,无法同步)',
|
||||
style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
@@ -213,7 +214,7 @@ class _DependencyTreePageState extends State<DependencyTreePage> {
|
||||
leading: const Icon(Icons.inventory_2_outlined),
|
||||
title: Text('${m.name ?? m.fileName} ${m.version ?? ''}'),
|
||||
subtitle: Text(
|
||||
'${m.fileName} · 依赖 ${m.depends.length} · 软依赖 ${m.softDepends.length}',
|
||||
S.f('{0} · 依赖 {1} · 软依赖 {2}', [m.fileName, m.depends.length, m.softDepends.length]),
|
||||
),
|
||||
trailing: const Icon(Icons.account_tree_outlined),
|
||||
onTap: () => _showTree(m),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../mod_manager/mod_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 模组详情页:展示 jar 元数据(名称 / 版本 / 作者 / 依赖 / 描述)。
|
||||
class ModDetailPage extends StatelessWidget {
|
||||
@@ -18,9 +19,9 @@ class ModDetailPage extends StatelessWidget {
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.extension),
|
||||
title: Text(meta.name ?? '未知名称',
|
||||
title: Text(meta.name ?? S.t('未知名称'),
|
||||
style: Theme.of(context).textTheme.titleLarge),
|
||||
subtitle: Text('版本 ${meta.version ?? '未知'}'),
|
||||
subtitle: Text(S.f('版本 {0}', [meta.version ?? '未知'])),
|
||||
),
|
||||
const Divider(),
|
||||
_kv('文件名', file.fileName),
|
||||
@@ -30,10 +31,10 @@ class ModDetailPage extends StatelessWidget {
|
||||
_kv('元数据来源', meta.source),
|
||||
if (meta.description != null) _kv('描述', meta.description!),
|
||||
const Divider(),
|
||||
Text('硬依赖', style: Theme.of(context).textTheme.titleMedium),
|
||||
T('硬依赖', style: Theme.of(context).textTheme.titleMedium),
|
||||
const SizedBox(height: 4),
|
||||
if (meta.depends.isEmpty)
|
||||
const Text('无')
|
||||
T('无')
|
||||
else
|
||||
Wrap(
|
||||
spacing: 6,
|
||||
@@ -42,10 +43,10 @@ class ModDetailPage extends StatelessWidget {
|
||||
.toList(),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text('软依赖', style: Theme.of(context).textTheme.titleMedium),
|
||||
T('软依赖', style: Theme.of(context).textTheme.titleMedium),
|
||||
const SizedBox(height: 4),
|
||||
if (meta.softDepends.isEmpty)
|
||||
const Text('无')
|
||||
T('无')
|
||||
else
|
||||
Wrap(spacing: 6, children: meta.softDepends.map((d) => Chip(label: Text(d))).toList()),
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@ import '../dashboard/server_picker_bar.dart';
|
||||
import 'mod_provider.dart';
|
||||
import 'mod_detail_page.dart';
|
||||
import 'dependency_tree_page.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 模组/插件管理页:列出服务器 mods / plugins 目录中的 jar 文件,
|
||||
/// 支持上传 / 删除 / 重命名 / 查看详情(M1)。
|
||||
@@ -53,7 +54,7 @@ class _ModListPageState extends State<ModListPage>
|
||||
super.build(context);
|
||||
final server = context.watch<SelectedServerHolder>().server;
|
||||
if (server == null) {
|
||||
return const Center(child: Text('请先在「服务器」页选择一台服务器'));
|
||||
return const Center(child: T('请先在「服务器」页选择一台服务器'));
|
||||
}
|
||||
if (!server.hasSsh) {
|
||||
return _NoSshHint(serverName: server.name);
|
||||
@@ -67,16 +68,16 @@ class _ModListPageState extends State<ModListPage>
|
||||
return Scaffold(
|
||||
backgroundColor: hasWallpaper ? Colors.transparent : null,
|
||||
appBar: AppBar(
|
||||
title: const Text('模组管理'),
|
||||
title: T('模组管理'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: mod.loading ? null : mod.refresh,
|
||||
tooltip: '刷新',
|
||||
tooltip: S.t('刷新'),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.account_tree_outlined),
|
||||
tooltip: '依赖仓库',
|
||||
tooltip: S.t('依赖仓库'),
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@@ -107,9 +108,9 @@ class _ModListPageState extends State<ModListPage>
|
||||
icon: const Icon(Icons.sort),
|
||||
onSelected: (m) => mod.setSortMode(m),
|
||||
itemBuilder: (_) => const [
|
||||
PopupMenuItem(value: ModSortMode.name, child: Text('按名称')),
|
||||
PopupMenuItem(value: ModSortMode.size, child: Text('按大小')),
|
||||
PopupMenuItem(value: ModSortMode.mtime, child: Text('按修改时间')),
|
||||
PopupMenuItem(value: ModSortMode.name, child: T('按名称')),
|
||||
PopupMenuItem(value: ModSortMode.size, child: T('按大小')),
|
||||
PopupMenuItem(value: ModSortMode.mtime, child: T('按修改时间')),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -119,12 +120,12 @@ class _ModListPageState extends State<ModListPage>
|
||||
if (mod.error != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Text('加载失败:${mod.error}',
|
||||
child: Text(S.f('加载失败:{0}', [mod.error.toString()]),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error)),
|
||||
),
|
||||
Expanded(
|
||||
child: mod.files.isEmpty && !mod.loading
|
||||
? const Center(child: Text('目录下没有 .jar 文件'))
|
||||
? const Center(child: T('目录下没有 .jar 文件'))
|
||||
: ListView.builder(
|
||||
itemCount: mod.files.length,
|
||||
itemBuilder: (context, i) {
|
||||
@@ -139,9 +140,9 @@ class _ModListPageState extends State<ModListPage>
|
||||
trailing: PopupMenuButton<String>(
|
||||
onSelected: (a) => _onAction(context, mod, f, a),
|
||||
itemBuilder: (_) => const [
|
||||
PopupMenuItem(value: 'detail', child: Text('详情')),
|
||||
PopupMenuItem(value: 'rename', child: Text('重命名')),
|
||||
PopupMenuItem(value: 'delete', child: Text('删除')),
|
||||
PopupMenuItem(value: 'detail', child: T('详情')),
|
||||
PopupMenuItem(value: 'rename', child: T('重命名')),
|
||||
PopupMenuItem(value: 'delete', child: T('删除')),
|
||||
],
|
||||
),
|
||||
onTap: () => Navigator.push(
|
||||
@@ -158,7 +159,7 @@ class _ModListPageState extends State<ModListPage>
|
||||
),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
icon: const Icon(Icons.upload_file),
|
||||
label: const Text('上传 jar'),
|
||||
label: T('上传 jar'),
|
||||
onPressed: mod.loading ? null : () => _upload(context, mod),
|
||||
),
|
||||
);
|
||||
@@ -177,7 +178,7 @@ class _ModListPageState extends State<ModListPage>
|
||||
} catch (e) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(content: Text('上传失败:$e')));
|
||||
.showSnackBar(SnackBar(content: Text(S.f('上传失败:{0}', [e.toString()]))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,11 +190,11 @@ class _ModListPageState extends State<ModListPage>
|
||||
final ok = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('确认删除'),
|
||||
content: Text('确定要删除 ${f.fileName} 吗?此操作不可恢复。'),
|
||||
title: T('确认删除'),
|
||||
content: Text(S.f('确定要删除 {0} 吗?此操作不可恢复。', [f.fileName])),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context, false), child: const Text('取消')),
|
||||
FilledButton(onPressed: () => Navigator.pop(context, true), child: const Text('删除')),
|
||||
TextButton(onPressed: () => Navigator.pop(context, false), child: T('取消')),
|
||||
FilledButton(onPressed: () => Navigator.pop(context, true), child: T('删除')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -204,13 +205,13 @@ class _ModListPageState extends State<ModListPage>
|
||||
final newName = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('重命名'),
|
||||
title: T('重命名'),
|
||||
content: TextField(controller: ctrl, autofocus: true),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: const Text('取消')),
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: T('取消')),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(context, ctrl.text.trim()),
|
||||
child: const Text('确定')),
|
||||
child: T('确定')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -242,7 +243,7 @@ class _NoSshHint extends StatelessWidget {
|
||||
children: [
|
||||
const Icon(Icons.no_encryption_outlined, size: 56),
|
||||
const SizedBox(height: 12),
|
||||
Text('$serverName 未配置 SSH'),
|
||||
Text(S.f('{0} 未配置 SSH', [serverName])),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'模组管理需要 SSH 连接。请在「服务器」页编辑该服务器,\n开启 SSH 并填写用户名和密码。',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../core/utils/rcon_client.dart';
|
||||
import 'player_service.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 玩家管理页:展示当前在线玩家的完整列表(含 UUID)。
|
||||
class PlayerListPage extends StatefulWidget {
|
||||
@@ -52,12 +53,12 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
final result = await action();
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(content: Text('$actionName:${stripMinecraftCodes(result ?? '无响应')}'), duration: const Duration(seconds: 2)));
|
||||
.showSnackBar(SnackBar(content: Text(S.f('{0}:{1}', [actionName, stripMinecraftCodes(result ?? S.t('无响应'))])), duration: const Duration(seconds: 2)));
|
||||
await _load();
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(SnackBar(content: Text('$actionName失败:$e'), backgroundColor: Colors.red));
|
||||
.showSnackBar(SnackBar(content: Text(S.f('{0}失败:{1}', [actionName, e.toString()])), backgroundColor: Colors.red));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,11 +102,11 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
});
|
||||
}
|
||||
|
||||
static const _actionLabels = {
|
||||
'op': '给予OP',
|
||||
'deop': '取消OP',
|
||||
'kick': '踢出',
|
||||
'ban': '封禁',
|
||||
static Map<String, String> get _actionLabels => {
|
||||
'op': S.t('给予OP'),
|
||||
'deop': S.t('取消OP'),
|
||||
'kick': S.t('踢出'),
|
||||
'ban': S.t('封禁'),
|
||||
};
|
||||
|
||||
/// 对选中的所有玩家执行批量操作。
|
||||
@@ -118,7 +119,7 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
|
||||
String? reason;
|
||||
if (action == 'kick' || action == 'ban') {
|
||||
reason = await _showReasonDialog(_actionLabels[action]!, '${names.length}名玩家');
|
||||
reason = await _showReasonDialog(_actionLabels[action]!, S.f('{0} 名玩家', [names.length]));
|
||||
if (reason == null) return; // 用户取消
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
if (!mounted) return;
|
||||
final label = _actionLabels[action]!;
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text('$label完成:成功 $success 人${fail > 0 ? ',失败 $fail 人' : ''}'),
|
||||
content: Text(S.f('{0}完成:成功 {1} 人', [label, success]) + (fail > 0 ? S.f(',失败 {0} 人', [fail]) : '')),
|
||||
duration: const Duration(seconds: 2),
|
||||
));
|
||||
await _load();
|
||||
@@ -163,20 +164,20 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('将对「$player」执行该操作'),
|
||||
Text(S.f('将对「{0}」执行该操作', [player])),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: controller,
|
||||
autofocus: true,
|
||||
decoration: const InputDecoration(hintText: '原因(可选)'),
|
||||
decoration: InputDecoration(hintText: S.t('原因(可选)')),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(ctx, false), child: const Text('取消')),
|
||||
TextButton(onPressed: () => Navigator.pop(ctx, false), child: T('取消')),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
child: const Text('确认', style: TextStyle(color: Colors.red)),
|
||||
child: T('确认', style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -196,16 +197,16 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
leading: _selecting
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
tooltip: '退出选择',
|
||||
tooltip: S.t('退出选择'),
|
||||
onPressed: _exitSelection,
|
||||
)
|
||||
: null,
|
||||
title: Text(_selecting ? '已选 ${_selected.length} 人' : '玩家管理'),
|
||||
title: Text(_selecting ? S.f('已选 {0} 人', [_selected.length]) : S.t('玩家管理')),
|
||||
actions: [
|
||||
if (_selecting) ...[
|
||||
IconButton(
|
||||
icon: const Icon(Icons.select_all),
|
||||
tooltip: '全选',
|
||||
tooltip: S.t('全选'),
|
||||
onPressed: () {
|
||||
setState(() => _selected
|
||||
..clear()
|
||||
@@ -215,12 +216,12 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
] else
|
||||
IconButton(
|
||||
icon: const Icon(Icons.checklist_outlined),
|
||||
tooltip: '批量操作',
|
||||
tooltip: S.t('批量操作'),
|
||||
onPressed: _loading ? null : _enterSelection,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
tooltip: '刷新',
|
||||
tooltip: S.t('刷新'),
|
||||
onPressed: _loading ? null : _load,
|
||||
),
|
||||
],
|
||||
@@ -238,10 +239,10 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
_buildBatchButton('op', Icons.admin_panel_settings_outlined, '给予OP', Colors.green),
|
||||
_buildBatchButton('deop', Icons.remove_moderator_outlined, '取消OP', Colors.orange),
|
||||
_buildBatchButton('kick', Icons.logout, '踢出', Colors.blue),
|
||||
_buildBatchButton('ban', Icons.block, '封禁', Colors.red),
|
||||
_buildBatchButton('op', Icons.admin_panel_settings_outlined, S.t('给予OP'), Colors.green),
|
||||
_buildBatchButton('deop', Icons.remove_moderator_outlined, S.t('取消OP'), Colors.orange),
|
||||
_buildBatchButton('kick', Icons.logout, S.t('踢出'), Colors.blue),
|
||||
_buildBatchButton('ban', Icons.block, S.t('封禁'), Colors.red),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -276,16 +277,16 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text('加载失败:$_error', textAlign: TextAlign.center),
|
||||
Text(S.f('加载失败:{0}', [_error.toString()]), textAlign: TextAlign.center),
|
||||
const SizedBox(height: 12),
|
||||
FilledButton(onPressed: _load, child: const Text('重试')),
|
||||
FilledButton(onPressed: _load, child: T('重试')),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
final players = _players ?? [];
|
||||
if (players.isEmpty) {
|
||||
return Center(child: Text('暂无在线玩家', style: theme.textTheme.bodyLarge));
|
||||
return Center(child: T('暂无在线玩家', style: theme.textTheme.bodyLarge));
|
||||
}
|
||||
return RefreshIndicator(
|
||||
onRefresh: _load,
|
||||
@@ -320,13 +321,13 @@ class _PlayerListPageState extends State<PlayerListPage> {
|
||||
visualDensity: VisualDensity.compact,
|
||||
),
|
||||
PopupMenuButton<String>(
|
||||
tooltip: '操作',
|
||||
tooltip: S.t('操作'),
|
||||
onSelected: (action) => _handleAction(p, action),
|
||||
itemBuilder: (_) => [
|
||||
const PopupMenuItem(value: 'op', child: Text('给予 OP')),
|
||||
const PopupMenuItem(value: 'deop', child: Text('取消 OP')),
|
||||
const PopupMenuItem(value: 'kick', child: Text('踢出')),
|
||||
const PopupMenuItem(value: 'ban', child: Text('封禁')),
|
||||
const PopupMenuItem(value: 'op', child: T('给予 OP')),
|
||||
const PopupMenuItem(value: 'deop', child: T('取消 OP')),
|
||||
const PopupMenuItem(value: 'kick', child: T('踢出')),
|
||||
const PopupMenuItem(value: 'ban', child: T('封禁')),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 服务器卡片的数据状态。
|
||||
enum ServerCardState {
|
||||
@@ -75,7 +76,7 @@ class ServerCard extends StatelessWidget {
|
||||
case ServerCardState.offline:
|
||||
return '离线';
|
||||
case ServerCardState.loading:
|
||||
return '检测中';
|
||||
return S.t('检测中');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +193,7 @@ class ServerCard extends StatelessWidget {
|
||||
|
||||
Widget _buildMenu(BuildContext context, ColorScheme scheme) {
|
||||
return PopupMenuButton<String>(
|
||||
tooltip: '更多操作',
|
||||
tooltip: S.t('更多操作'),
|
||||
icon: Icon(Icons.more_vert, size: 20, color: scheme.onSurfaceVariant),
|
||||
padding: EdgeInsets.zero,
|
||||
itemBuilder: (context) => [
|
||||
@@ -203,7 +204,7 @@ class ServerCard extends StatelessWidget {
|
||||
children: [
|
||||
Icon(Icons.edit_outlined, size: 19),
|
||||
SizedBox(width: 12),
|
||||
Text('编辑'),
|
||||
T('编辑'),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -214,7 +215,7 @@ class ServerCard extends StatelessWidget {
|
||||
children: [
|
||||
Icon(Icons.delete_outline, size: 19, color: scheme.error),
|
||||
const SizedBox(width: 12),
|
||||
Text('删除', style: TextStyle(color: scheme.error)),
|
||||
T('删除', style: TextStyle(color: scheme.error)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -255,9 +256,9 @@ class ServerCard extends StatelessWidget {
|
||||
|
||||
if (state == ServerCardState.loading) {
|
||||
return _pillRow(context, [
|
||||
const _Pill(
|
||||
_Pill(
|
||||
icon: Icons.autorenew_rounded,
|
||||
label: '正在获取状态',
|
||||
label: S.t('正在获取状态'),
|
||||
color: Color(0xFF94A3B8),
|
||||
),
|
||||
]);
|
||||
@@ -266,16 +267,16 @@ class ServerCard extends StatelessWidget {
|
||||
if (!online) {
|
||||
return Row(
|
||||
children: [
|
||||
const Flexible(
|
||||
Flexible(
|
||||
child: _Pill(
|
||||
icon: Icons.cloud_off_outlined,
|
||||
label: '无法连接',
|
||||
label: S.t('无法连接'),
|
||||
color: Color(0xFFF87171),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'点击重试',
|
||||
S.t('点击重试'),
|
||||
style: theme.textTheme.labelSmall?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -291,7 +292,7 @@ class ServerCard extends StatelessWidget {
|
||||
icon: Icons.people_alt_outlined,
|
||||
label: maxPlayers != null
|
||||
? '${playerCount ?? 0}/$maxPlayers'
|
||||
: '${playerCount ?? 0} 人',
|
||||
: S.f('{0} 人', [playerCount ?? 0]),
|
||||
color: scheme.primary,
|
||||
emphasized: true,
|
||||
),
|
||||
@@ -313,7 +314,7 @@ class ServerCard extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'进入控制台',
|
||||
S.t('进入控制台'),
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: scheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
class ServerFormDialog extends StatefulWidget {
|
||||
final ServerConfig? existingServer;
|
||||
@@ -53,14 +54,14 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
|
||||
}
|
||||
|
||||
String? _validateRequired(String? value, String field) {
|
||||
if (value == null || value.trim().isEmpty) return '$field不能为空';
|
||||
if (value == null || value.trim().isEmpty) return S.f('{0}不能为空', [field]);
|
||||
return null;
|
||||
}
|
||||
|
||||
String? _validatePort(String? value) {
|
||||
if (value == null || value.trim().isEmpty) return '端口不能为空';
|
||||
if (value == null || value.trim().isEmpty) return S.t('端口不能为空');
|
||||
final port = int.tryParse(value.trim());
|
||||
if (port == null || port < 1 || port > 65535) return '端口范围 1-65535';
|
||||
if (port == null || port < 1 || port > 65535) return S.t('端口范围 1-65535');
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -94,21 +95,21 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _nameCtrl,
|
||||
decoration: const InputDecoration(labelText: '服务器名称', hintText: '例如: 我的生存服'),
|
||||
decoration: InputDecoration(labelText: S.t('服务器名称'), hintText: S.t('例如: 我的生存服')),
|
||||
validator: (v) => _validateRequired(v, '服务器名称'),
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
controller: _hostCtrl,
|
||||
decoration: const InputDecoration(labelText: '主机地址', hintText: 'IP 或域名'),
|
||||
decoration: InputDecoration(labelText: S.t('主机地址'), hintText: S.t('IP 或域名')),
|
||||
validator: (v) => _validateRequired(v, '主机地址'),
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
controller: _portCtrl,
|
||||
decoration: const InputDecoration(labelText: 'RCON 端口', hintText: '默认 25575'),
|
||||
decoration: InputDecoration(labelText: S.t('RCON 端口'), hintText: S.t('默认 25575')),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: _validatePort,
|
||||
textInputAction: TextInputAction.next,
|
||||
@@ -118,7 +119,7 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
|
||||
controller: _passCtrl,
|
||||
obscureText: _obscurePassword,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'RCON 密码',
|
||||
labelText: S.t('RCON 密码'),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_obscurePassword ? Icons.visibility_off_outlined : Icons.visibility_outlined),
|
||||
onPressed: () => setState(() => _obscurePassword = !_obscurePassword),
|
||||
@@ -131,15 +132,15 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
|
||||
const SizedBox(height: 8),
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: const Text('SSH 连接(可选)'),
|
||||
subtitle: const Text('用于模组插件管理与远程终端'),
|
||||
title: T('SSH 连接(可选)'),
|
||||
subtitle: T('用于模组插件管理与远程终端'),
|
||||
value: _sshEnabled,
|
||||
onChanged: (v) => setState(() => _sshEnabled = v),
|
||||
),
|
||||
if (_sshEnabled) ...[
|
||||
TextFormField(
|
||||
controller: _sshPortCtrl,
|
||||
decoration: const InputDecoration(labelText: 'SSH 端口', hintText: '默认 22'),
|
||||
decoration: InputDecoration(labelText: S.t('SSH 端口'), hintText: S.t('默认 22')),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (v) {
|
||||
if (!_sshEnabled) return null;
|
||||
@@ -150,7 +151,7 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
|
||||
const SizedBox(height: 12),
|
||||
TextFormField(
|
||||
controller: _sshUserCtrl,
|
||||
decoration: const InputDecoration(labelText: 'SSH 用户名', hintText: '例如 root'),
|
||||
decoration: InputDecoration(labelText: S.t('SSH 用户名'), hintText: S.t('例如 root')),
|
||||
validator: (v) => _sshEnabled ? _validateRequired(v, 'SSH 用户名') : null,
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
@@ -159,7 +160,7 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
|
||||
controller: _sshPasswordCtrl,
|
||||
obscureText: _obscureSshPassword,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'SSH 密码',
|
||||
labelText: S.t('SSH 密码'),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_obscureSshPassword
|
||||
? Icons.visibility_off_outlined
|
||||
@@ -178,7 +179,7 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: const Text('取消')),
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: T('取消')),
|
||||
FilledButton(onPressed: _submit, child: Text(isEditing ? '保存' : '添加')),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -9,6 +9,7 @@ import '../console/console_page.dart';
|
||||
import '../settings/settings_page.dart';
|
||||
import 'server_card.dart';
|
||||
import 'server_form_dialog.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
class ServerListPage extends StatefulWidget {
|
||||
const ServerListPage({super.key});
|
||||
@@ -101,7 +102,7 @@ class _ServerListPageState extends State<ServerListPage> {
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(height: 16),
|
||||
Text('正在连接...'),
|
||||
T('正在连接...'),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -128,7 +129,7 @@ class _ServerListPageState extends State<ServerListPage> {
|
||||
);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('连接失败:$error')),
|
||||
SnackBar(content: Text(S.f('连接失败:{0}', [error.toString()]))),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -165,16 +166,16 @@ class _ServerListPageState extends State<ServerListPage> {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('确认删除'),
|
||||
content: Text('确定要删除服务器「${server.name}」吗?'),
|
||||
title: T('确认删除'),
|
||||
content: Text(S.f('确定要删除服务器「{0}」吗?', [server.name])),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('取消'),
|
||||
child: T('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('删除', style: TextStyle(color: Colors.red)),
|
||||
child: T('删除', style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -198,7 +199,7 @@ class _ServerListPageState extends State<ServerListPage> {
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
tooltip: '设置',
|
||||
tooltip: S.t('设置'),
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const SettingsPage()),
|
||||
@@ -239,7 +240,7 @@ class _ServerListPageState extends State<ServerListPage> {
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
onPressed: _addServer,
|
||||
icon: const Icon(Icons.add),
|
||||
label: const Text('添加服务器'),
|
||||
label: T('添加服务器'),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -274,14 +275,14 @@ class _EmptyState extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'还没有添加服务器',
|
||||
S.t('还没有添加服务器'),
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'填入主机地址与 RCON 密码,即可在手机上管理',
|
||||
S.t('填入主机地址与 RCON 密码,即可在手机上管理'),
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
@@ -291,7 +292,7 @@ class _EmptyState extends StatelessWidget {
|
||||
FilledButton.icon(
|
||||
onPressed: onAdd,
|
||||
icon: const Icon(Icons.add),
|
||||
label: const Text('添加服务器'),
|
||||
label: T('添加服务器'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../providers/download_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 下载与镜像设置页:镜像线路选择、测速自动选线、并发数(原下载页内设置移入此处)。
|
||||
class DownloadSettingsPage extends StatefulWidget {
|
||||
@@ -24,13 +25,13 @@ class _DownloadSettingsPageState extends State<DownloadSettingsPage> {
|
||||
final dp = context.watch<DownloadProvider>();
|
||||
final mirror = dp.mirror;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('下载与镜像设置')),
|
||||
appBar: AppBar(title: T('下载与镜像设置')),
|
||||
body: ListView(
|
||||
children: [
|
||||
const SectionHeader('镜像线路'),
|
||||
RadioListTile<String>(
|
||||
title: const Text('MCIM 国内镜像(推荐)'),
|
||||
subtitle: const Text('modrinth.mcimirror.top,无需科学上网'),
|
||||
title: T('MCIM 国内镜像(推荐)'),
|
||||
subtitle: T('modrinth.mcimirror.top,无需科学上网'),
|
||||
value: 'mcim',
|
||||
groupValue: mirror.currentId,
|
||||
onChanged: (v) async {
|
||||
@@ -39,8 +40,8 @@ class _DownloadSettingsPageState extends State<DownloadSettingsPage> {
|
||||
},
|
||||
),
|
||||
RadioListTile<String>(
|
||||
title: const Text('Modrinth 官方'),
|
||||
subtitle: const Text('直连官方源,适合海外网络'),
|
||||
title: T('Modrinth 官方'),
|
||||
subtitle: T('直连官方源,适合海外网络'),
|
||||
value: 'official',
|
||||
groupValue: mirror.currentId,
|
||||
onChanged: (v) async {
|
||||
@@ -49,7 +50,7 @@ class _DownloadSettingsPageState extends State<DownloadSettingsPage> {
|
||||
},
|
||||
),
|
||||
RadioListTile<String>(
|
||||
title: const Text('自定义镜像'),
|
||||
title: T('自定义镜像'),
|
||||
subtitle: Text(mirror.currentId == 'custom' && mirror.customUrl.isNotEmpty
|
||||
? mirror.customUrl
|
||||
: '使用自建/第三方镜像地址'),
|
||||
@@ -61,9 +62,9 @@ class _DownloadSettingsPageState extends State<DownloadSettingsPage> {
|
||||
leading: _testing
|
||||
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: const Icon(Icons.speed),
|
||||
title: const Text('一键测速并选择最快线路'),
|
||||
title: T('一键测速并选择最快线路'),
|
||||
subtitle: Text(mirror.lastSpeedMs > 0
|
||||
? '上次测速:${mirror.lastSpeedMs}ms(${mirror.currentName})'
|
||||
? S.f('上次测速:{0}ms({1})', [mirror.lastSpeedMs, mirror.currentName])
|
||||
: '自动在官方与镜像之间选择延迟最低的线路'),
|
||||
onTap: _testing
|
||||
? null
|
||||
@@ -74,7 +75,7 @@ class _DownloadSettingsPageState extends State<DownloadSettingsPage> {
|
||||
if (!mounted) return;
|
||||
setState(() => _testing = false);
|
||||
messenger.showSnackBar(SnackBar(
|
||||
content: Text('已选择最快线路:${mirror.currentName}(${mirror.lastSpeedMs}ms)'),
|
||||
content: Text(S.f('已选择最快线路:{0}({1}ms)', [mirror.currentName, mirror.lastSpeedMs])),
|
||||
));
|
||||
},
|
||||
),
|
||||
@@ -82,8 +83,8 @@ class _DownloadSettingsPageState extends State<DownloadSettingsPage> {
|
||||
const SectionHeader('下载队列'),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.playlist_play),
|
||||
title: const Text('同时下载任务数'),
|
||||
subtitle: Text('当前:${dp.concurrency} 个(越大越占带宽,建议 1-3)'),
|
||||
title: T('同时下载任务数'),
|
||||
subtitle: Text(S.f('当前:{0} 个(越大越占带宽,建议 1-3)', [dp.concurrency])),
|
||||
trailing: DropdownButton<int>(
|
||||
value: dp.concurrency,
|
||||
underline: const SizedBox.shrink(),
|
||||
@@ -117,14 +118,14 @@ class _DownloadSettingsPageState extends State<DownloadSettingsPage> {
|
||||
final url = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
title: const Text('自定义镜像地址'),
|
||||
title: T('自定义镜像地址'),
|
||||
content: TextField(
|
||||
controller: ctrl,
|
||||
decoration: const InputDecoration(hintText: 'https://your-mirror.example.com'),
|
||||
decoration: InputDecoration(hintText: 'https://your-mirror.example.com'),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: const Text('取消')),
|
||||
FilledButton(onPressed: () => Navigator.pop(context, ctrl.text.trim()), child: const Text('确定')),
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: T('取消')),
|
||||
FilledButton(onPressed: () => Navigator.pop(context, ctrl.text.trim()), child: T('确定')),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 使用教程页:教用户如何开启 RCON、SSH、使用模组管理/下载/终端等功能。
|
||||
class HelpPage extends StatelessWidget {
|
||||
@@ -7,7 +8,7 @@ class HelpPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('使用教程')),
|
||||
appBar: AppBar(title: Text(S.t('使用教程'))),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
children: const [
|
||||
@@ -124,8 +125,7 @@ class _Intro extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
child: Text(
|
||||
'本页教您一步步开启并使用 ZV Manager 的各项功能。\n'
|
||||
'首次使用建议按「一 → 二」顺序配置,其余功能即可解锁。',
|
||||
'''${S.t('本页教您一步步开启并使用 ZV Manager 的各项功能。')}\n${S.t('首次使用建议按「一 → 二」顺序配置,其余功能即可解锁。')}''',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
@@ -153,7 +153,7 @@ class _TutorialCard extends StatelessWidget {
|
||||
margin: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: ExpansionTile(
|
||||
leading: Icon(icon),
|
||||
title: Text(title, style: theme.textTheme.titleSmall),
|
||||
title: Text(S.t(title), style: theme.textTheme.titleSmall),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(16, 0, 16, 14),
|
||||
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -166,7 +166,7 @@ class _TutorialCard extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: theme.colorScheme.primary)),
|
||||
Expanded(child: Text(e.value)),
|
||||
Expanded(child: Text(S.t(e.value))),
|
||||
],
|
||||
),
|
||||
)),
|
||||
@@ -184,7 +184,7 @@ class _TutorialCard extends StatelessWidget {
|
||||
children: tips
|
||||
.map((t) => Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||
child: Text(t, style: theme.textTheme.bodySmall),
|
||||
child: Text(S.t(t), style: theme.textTheme.bodySmall),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
|
||||
@@ -14,6 +14,7 @@ import '../../providers/wallpaper_provider.dart';
|
||||
import 'help_page.dart';
|
||||
import 'download_settings_page.dart';
|
||||
import '../../providers/language_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
class SettingsPage extends StatefulWidget {
|
||||
const SettingsPage({super.key});
|
||||
@@ -65,7 +66,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
|
||||
if (updateInfo == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('获取更新信息失败')),
|
||||
SnackBar(content: T('获取更新信息失败')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +76,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
if (!mounted) return;
|
||||
setState(() => _checkingUpdate = false);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('检查更新失败:$e')),
|
||||
SnackBar(content: Text(S.f('检查更新失败:{0}', [e]))),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +91,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.photo, color: Colors.blue),
|
||||
title: const Text('选择图片'),
|
||||
title: T('选择图片'),
|
||||
onTap: () {
|
||||
Navigator.pop(ctx);
|
||||
_pickImage();
|
||||
@@ -98,7 +99,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.videocam, color: Colors.green),
|
||||
title: const Text('选择视频'),
|
||||
title: T('选择视频'),
|
||||
onTap: () {
|
||||
Navigator.pop(ctx);
|
||||
_pickVideo();
|
||||
@@ -108,7 +109,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete, color: Colors.red),
|
||||
title: const Text('清除背景', style: TextStyle(color: Colors.red)),
|
||||
title: T('清除背景', style: TextStyle(color: Colors.red)),
|
||||
onTap: () {
|
||||
Navigator.pop(ctx);
|
||||
_clearBackground();
|
||||
@@ -145,7 +146,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
final mode = await showDialog<LanguageMode>(
|
||||
context: context,
|
||||
builder: (_) => SimpleDialog(
|
||||
title: const Text('语言 / Language'),
|
||||
title: T('语言 / Language'),
|
||||
children: [
|
||||
for (final m in LanguageMode.values)
|
||||
RadioListTile<LanguageMode>(
|
||||
@@ -184,7 +185,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
debugPrint('保存壁纸设置失败: $e');
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('壁纸设置保存失败,请重试')),
|
||||
SnackBar(content: T('壁纸设置保存失败,请重试')),
|
||||
);
|
||||
}
|
||||
return false;
|
||||
@@ -209,7 +210,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
debugPrint('保存失败: $e');
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('保存失败,请重试')),
|
||||
SnackBar(content: T('保存失败,请重试')),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@@ -244,7 +245,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(_currentBgPath == null ? '已清除背景' : '背景已更新 '),
|
||||
content: Text(_currentBgPath == null ? S.t('已清除背景') : S.t('背景已更新')),
|
||||
duration: const Duration(seconds: 1),
|
||||
),
|
||||
);
|
||||
@@ -258,13 +259,13 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
final themeProvider = context.watch<ThemeProvider>();
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('设置')),
|
||||
appBar: AppBar(title: T('设置')),
|
||||
body: ListView(
|
||||
children: [
|
||||
// ---------- 外观主题 ----------
|
||||
ListTile(
|
||||
leading: const Icon(Icons.palette_outlined),
|
||||
title: const Text('外观主题'),
|
||||
title: T('外观主题'),
|
||||
trailing: SegmentedButton<AppThemeMode>(
|
||||
segments: const [
|
||||
ButtonSegment(value: AppThemeMode.light, icon: Icon(Icons.light_mode, size: 18)),
|
||||
@@ -281,11 +282,11 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
// ---------- 应用背景(新增) ----------
|
||||
ListTile(
|
||||
leading: const Icon(Icons.wallpaper),
|
||||
title: const Text('应用背景'),
|
||||
title: T('应用背景'),
|
||||
subtitle: Text(
|
||||
_currentBgPath == null
|
||||
? '未设置'
|
||||
: '已设置 ${_currentBgType == 'video' ? ' 视频' : ' 图片'}',
|
||||
: S.f('已设置 {0}', [_currentBgType == 'video' ? S.t('视频') : S.t('图片')]),
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||
onTap: _showBackgroundPicker,
|
||||
@@ -294,8 +295,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
if (_currentBgType == 'video') ...[
|
||||
SwitchListTile(
|
||||
secondary: const Icon(Icons.volume_up),
|
||||
title: const Text('视频声音'),
|
||||
subtitle: const Text('开启后背景视频将播放声音'),
|
||||
title: T('视频声音'),
|
||||
subtitle: T('开启后背景视频将播放声音'),
|
||||
value: _videoSoundEnabled,
|
||||
onChanged: (value) async {
|
||||
await BackgroundService.setVideoSound(value);
|
||||
@@ -310,7 +311,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
// ---------- 语言 ----------
|
||||
ListTile(
|
||||
leading: const Icon(Icons.language),
|
||||
title: const Text('语言 / Language'),
|
||||
title: T('语言 / Language'),
|
||||
subtitle: Text(_languageName(context.watch<LanguageProvider>().mode)),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => _pickLanguage(),
|
||||
@@ -320,8 +321,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
// ---------- 下载与镜像 ----------
|
||||
ListTile(
|
||||
leading: const Icon(Icons.download_outlined),
|
||||
title: const Text('下载与镜像设置'),
|
||||
subtitle: const Text('镜像线路、测速选线、同时下载任务数'),
|
||||
title: T('下载与镜像设置'),
|
||||
subtitle: T('镜像线路、测速选线、同时下载任务数'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
@@ -333,8 +334,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
// ---------- 使用教程 ----------
|
||||
ListTile(
|
||||
leading: const Icon(Icons.menu_book_outlined),
|
||||
title: const Text('使用教程'),
|
||||
subtitle: const Text('如何开启 RCON / SSH、模组管理、下载与终端'),
|
||||
title: T('使用教程'),
|
||||
subtitle: T('如何开启 RCON / SSH、模组管理、下载与终端'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
@@ -346,8 +347,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
// ---------- 检查更新 ----------
|
||||
ListTile(
|
||||
leading: const Icon(Icons.system_update_outlined),
|
||||
title: const Text('检查更新'),
|
||||
subtitle: Text('当前版本: $_currentVersion'),
|
||||
title: T('检查更新'),
|
||||
subtitle: Text(S.f('当前版本: {0}', [_currentVersion])),
|
||||
trailing: _checkingUpdate
|
||||
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: const Icon(Icons.chevron_right),
|
||||
@@ -358,15 +359,15 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
// ---------- 关于 ----------
|
||||
const ListTile(
|
||||
leading: Icon(Icons.info_outline),
|
||||
title: Text('关于'),
|
||||
subtitle: Text('开发者:Z有3笔,协作者:venti1112'),
|
||||
title: T('关于'),
|
||||
subtitle: T('开发者:Z有3笔,协作者:venti1112'),
|
||||
),
|
||||
const Divider(),
|
||||
|
||||
// ---------- 开源许可 ----------
|
||||
ListTile(
|
||||
leading: const Icon(Icons.fact_check_outlined),
|
||||
title: const Text('开源许可'),
|
||||
title: T('开源许可'),
|
||||
onTap: () => showLicensePage(context: context),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:image_picker/image_picker.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'dart:io';
|
||||
import '../../providers/wallpaper_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
class WallpaperSettings extends StatelessWidget {
|
||||
const WallpaperSettings({super.key});
|
||||
@@ -15,7 +16,7 @@ class WallpaperSettings extends StatelessWidget {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('壁纸设置'),
|
||||
title: T('壁纸设置'),
|
||||
backgroundColor: theme.colorScheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
@@ -42,8 +43,8 @@ class WallpaperSettings extends StatelessWidget {
|
||||
children: [
|
||||
Icon(Icons.wallpaper, size: 48, color: Colors.grey),
|
||||
SizedBox(height: 8),
|
||||
Text('当前为默认壁纸', style: TextStyle(color: Colors.grey)),
|
||||
Text('点击下方「选择图片」自定义', style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
T('当前为默认壁纸', style: TextStyle(color: Colors.grey)),
|
||||
T('点击下方「选择图片」自定义', style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -53,7 +54,7 @@ class WallpaperSettings extends StatelessWidget {
|
||||
children: [
|
||||
Icon(Icons.check_circle, size: 48, color: Colors.white),
|
||||
SizedBox(height: 8),
|
||||
Text('自定义壁纸已应用', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w600)),
|
||||
T('自定义壁纸已应用', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w600)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -61,9 +62,9 @@ class WallpaperSettings extends StatelessWidget {
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 选择图片
|
||||
const Text('选择壁纸', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
T('选择壁纸', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 4),
|
||||
const Text('从相册选择图片作为应用背景', style: TextStyle(fontSize: 12, color: Colors.grey)),
|
||||
T('从相册选择图片作为应用背景', style: TextStyle(fontSize: 12, color: Colors.grey)),
|
||||
const SizedBox(height: 12),
|
||||
FilledButton.icon(
|
||||
onPressed: () async {
|
||||
@@ -77,14 +78,14 @@ class WallpaperSettings extends StatelessWidget {
|
||||
await provider.setCustomWallpaper(savedPath);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('壁纸已更新'), backgroundColor: Colors.green),
|
||||
const SnackBar(content: T('壁纸已更新'), backgroundColor: Colors.green),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.photo_library),
|
||||
label: const Text('选择图片'),
|
||||
label: T('选择图片'),
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
@@ -93,16 +94,16 @@ class WallpaperSettings extends StatelessWidget {
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 重置
|
||||
const Text('重置壁纸', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
T('重置壁纸', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 4),
|
||||
const Text('恢复默认壁纸', style: TextStyle(fontSize: 12, color: Colors.grey)),
|
||||
T('恢复默认壁纸', style: TextStyle(fontSize: 12, color: Colors.grey)),
|
||||
const SizedBox(height: 12),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
_showResetDialog(context, provider);
|
||||
},
|
||||
icon: const Icon(Icons.restore),
|
||||
label: const Text('恢复默认'),
|
||||
label: T('恢复默认'),
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
side: const BorderSide(color: Colors.red),
|
||||
@@ -131,7 +132,7 @@ class WallpaperSettings extends StatelessWidget {
|
||||
} catch (e) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('保存失败,请重试')),
|
||||
const SnackBar(content: T('保存失败,请重试')),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@@ -159,12 +160,12 @@ class WallpaperSettings extends StatelessWidget {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('确认重置'),
|
||||
content: const Text('确定要恢复默认壁纸吗?'),
|
||||
title: T('确认重置'),
|
||||
content: T('确定要恢复默认壁纸吗?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('取消'),
|
||||
child: T('取消'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () async {
|
||||
@@ -172,12 +173,12 @@ class WallpaperSettings extends StatelessWidget {
|
||||
if (context.mounted) {
|
||||
Navigator.pop(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('已恢复默认壁纸'), backgroundColor: Colors.green),
|
||||
const SnackBar(content: T('已恢复默认壁纸'), backgroundColor: Colors.green),
|
||||
);
|
||||
}
|
||||
},
|
||||
style: FilledButton.styleFrom(backgroundColor: Colors.red),
|
||||
child: const Text('重置'),
|
||||
child: T('重置'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -11,6 +11,7 @@ import '../mod_manager/mod_list_page.dart';
|
||||
import '../player_management/player_list_page.dart';
|
||||
import '../settings/settings_page.dart';
|
||||
import '../terminal/terminal_page.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
/// 主导航壳:底部导航「服务器 · 控制台 · 玩家 · 模组 · 终端 · 我的」(M4)。
|
||||
class MainShell extends StatefulWidget {
|
||||
@@ -111,23 +112,23 @@ class _ConsoleTab extends StatelessWidget {
|
||||
final rcon = context.read<RconProvider>();
|
||||
final server = holder.server;
|
||||
if (server == null) {
|
||||
return const _TabScaffold(title: '控制台', child: _NeedServerHint());
|
||||
return _TabScaffold(title: S.t('控制台'), child: const _NeedServerHint());
|
||||
}
|
||||
return FutureBuilder<RconClient>(
|
||||
future: rcon.getClient(server),
|
||||
builder: (context, snap) {
|
||||
if (snap.connectionState != ConnectionState.done) {
|
||||
return _TabScaffold(
|
||||
title: '控制台',
|
||||
title: S.t('控制台'),
|
||||
subtitle: server.name,
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
}
|
||||
if (snap.hasError) {
|
||||
return _TabScaffold(
|
||||
title: '控制台',
|
||||
title: S.t('控制台'),
|
||||
subtitle: server.name,
|
||||
child: Center(child: Text('RCON 连接失败:${snap.error}')),
|
||||
child: Center(child: Text(S.f('RCON 连接失败:{0}', [snap.error.toString()]))),
|
||||
);
|
||||
}
|
||||
return ConsolePage(rconClient: snap.data!); // 自带 AppBar
|
||||
@@ -146,23 +147,23 @@ class _PlayerTab extends StatelessWidget {
|
||||
final rcon = context.read<RconProvider>();
|
||||
final server = holder.server;
|
||||
if (server == null) {
|
||||
return const _TabScaffold(title: '玩家', child: _NeedServerHint());
|
||||
return _TabScaffold(title: S.t('玩家'), child: const _NeedServerHint());
|
||||
}
|
||||
return FutureBuilder<RconClient>(
|
||||
future: rcon.getClient(server),
|
||||
builder: (context, snap) {
|
||||
if (snap.connectionState != ConnectionState.done) {
|
||||
return _TabScaffold(
|
||||
title: '玩家',
|
||||
title: S.t('玩家'),
|
||||
subtitle: server.name,
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
}
|
||||
if (snap.hasError) {
|
||||
return _TabScaffold(
|
||||
title: '玩家',
|
||||
title: S.t('玩家'),
|
||||
subtitle: server.name,
|
||||
child: Center(child: Text('RCON 连接失败:${snap.error}')),
|
||||
child: Center(child: Text(S.f('RCON 连接失败:{0}', [snap.error.toString()]))),
|
||||
);
|
||||
}
|
||||
return PlayerListPage(rconClient: snap.data!); // 自带 AppBar
|
||||
@@ -176,6 +177,6 @@ class _NeedServerHint extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(child: Text('请先在「服务器」页选择一台服务器'));
|
||||
return const Center(child: T('请先在「服务器」页选择一台服务器'));
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'package:xterm/ui.dart' show TerminalView;
|
||||
import '../../core/services/ssh_shell_service.dart';
|
||||
|
||||
import '../../providers/server_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
|
||||
/// SSH 终端页:xterm 终端 + 快捷键栏 + 多服务器会话标签(M3)。
|
||||
@@ -83,7 +84,7 @@ class _TerminalPageState extends State<TerminalPage>
|
||||
return const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Text('没有配置 SSH 的服务器。\n\n请在「服务器」页编辑服务器,开启 SSH 后即可使用终端。',
|
||||
child: T('没有配置 SSH 的服务器。\n\n请在「服务器」页编辑服务器,开启 SSH 后即可使用终端。',
|
||||
textAlign: TextAlign.center),
|
||||
),
|
||||
);
|
||||
@@ -93,11 +94,11 @@ class _TerminalPageState extends State<TerminalPage>
|
||||
return Scaffold(
|
||||
backgroundColor: hasWallpaper ? Colors.transparent : null,
|
||||
appBar: AppBar(
|
||||
title: const Text('终端'),
|
||||
title: T('终端'),
|
||||
actions: [
|
||||
PopupMenuButton<ServerConfig>(
|
||||
icon: const Icon(Icons.add),
|
||||
tooltip: '新会话',
|
||||
tooltip: S.t('新会话'),
|
||||
onSelected: _openSession,
|
||||
itemBuilder: (_) => _sshServers
|
||||
.map((s) => PopupMenuItem(value: s, child: Text(s.name)))
|
||||
@@ -128,7 +129,7 @@ class _TerminalPageState extends State<TerminalPage>
|
||||
),
|
||||
),
|
||||
body: active == null
|
||||
? const Center(child: Text('选择一台服务器开始会话'))
|
||||
? const Center(child: T('选择一台服务器开始会话'))
|
||||
: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../core/l10n/strings.dart';
|
||||
|
||||
/// 应用语言设置:跟随系统 / 简体中文 / English,持久化保存。
|
||||
class LanguageProvider extends ChangeNotifier {
|
||||
@@ -26,10 +27,12 @@ class LanguageProvider extends ChangeNotifier {
|
||||
(m) => m.name == v,
|
||||
orElse: () => LanguageMode.system,
|
||||
);
|
||||
S.en = _mode == LanguageMode.en;
|
||||
}
|
||||
|
||||
Future<void> setMode(LanguageMode mode) async {
|
||||
_mode = mode;
|
||||
S.en = mode == LanguageMode.en;
|
||||
notifyListeners();
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString(_key, mode.name);
|
||||
|
||||
Reference in new issue
Block a user