new: cpu view settings

This commit is contained in:
lollipopkit
2024-04-12 23:53:37 +08:00
parent 39cd8ff63e
commit b989953b7a
15 changed files with 150 additions and 19 deletions

View File

@@ -27,7 +27,7 @@ abstract final class BioAuth {
/// [biometrics] on Android and Windows is returned with error
/// Handle it specially
if (isAndroid | isWindows) return biometrics.isNotEmpty;
if (isAndroid || isWindows) return biometrics.isNotEmpty;
return biometrics.contains(BiometricType.face) ||
biometrics.contains(BiometricType.fingerprint);
}

View File

@@ -262,6 +262,11 @@ class SettingStore extends PersistentStore {
/// Hide title bar on desktop
late final hideTitleBar = property('hideTitleBar', isDesktop);
/// Display CPU view as progress, also called as old CPU view
late final cpuViewAsProgress = property('cpuViewAsProgress', false);
late final displayCpuIndex = property('displayCpuIndex', true);
// Never show these settings for users
//
// ------BEGIN------

View File

@@ -52,6 +52,7 @@
"convert": "Konvertieren",
"copy": "Kopieren",
"copyPath": "Pfad kopieren",
"cpuViewAsProgressTip": "Zeigen Sie die Auslastung jedes CPUs in einem Fortschrittsbalken-Stil an (alter Stil)",
"createFile": "Datei erstellen",
"createFolder": "Ordner erstellen",
"cursorType": "Cursor-Typ",
@@ -71,6 +72,7 @@
"disconnected": "Disconnected",
"disk": "Festplatte",
"diskIgnorePath": "Pfad für Datenträger ignorieren",
"displayCpuIndex": "Zeigen Sie den CPU-Index an",
"displayName": "Name anzeigen",
"dl2Local": "Datei \"{fileName}\" herunterladen?",
"doc": "Dokumentation",
@@ -166,6 +168,7 @@
"newContainer": "Neuer Container",
"noClient": "Kein Client",
"noInterface": "Kein Interface",
"noLineChart": "Verwenden Sie keine Liniendiagramme",
"noNotiPerm": "Keine Benachrichtigungsrechte, möglicherweise keine Fortschrittsanzeige beim Herunterladen von App-Updates.",
"noOptions": "Keine Optionen verfügbar",
"noResult": "Kein Ergebnis",
@@ -181,6 +184,7 @@
"nullToken": "Null token",
"ok": "OK",
"onServerDetailPage": "in Detailansicht des Servers",
"onlyWhenCoreBiggerThan8": "Wirksam nur, wenn die Anzahl der Kerne > 8 ist.",
"open": "Öffnen",
"openLastPath": "Öffnen Sie den letzten Pfad",
"openLastPathTip": "Verschiedene Server haben unterschiedliche Einträge, und der Eintrag ist der Pfad zum Ausgang",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "Gefunden: v1.0.{build}, klicke zum Aktualisieren",
"versionUnknownUpdate": "Aktuell: v1.0.{build}. Klicken Sie hier, um nach Updates zu suchen",
"versionUpdated": "v1.0.{build} ist bereits die neueste Version",
"view": "Ansicht",
"viewErr": "Fehler anzeigen",
"virtKeyHelpClipboard": "In die Zwischenablage kopieren, wenn das ausgewählte Terminal nicht leer ist, andernfalls den Inhalt der Zwischenablage in das Terminal einfügen.",
"virtKeyHelpSFTP": "Aktuelles Verzeichnis in SFTP öffnen.",

View File

@@ -52,6 +52,7 @@
"convert": "Convert",
"copy": "Copy",
"copyPath": "Copy path",
"cpuViewAsProgressTip": "Display the usage rate of each CPU in a progress bar style (old style)",
"createFile": "Create file",
"createFolder": "Create folder",
"cursorType": "Cursor type",
@@ -71,6 +72,7 @@
"disconnected": "Disconnected",
"disk": "Disk",
"diskIgnorePath": "Ignore path for disk",
"displayCpuIndex": "Display CPU index",
"displayName": "Display name",
"dl2Local": "Download {fileName} to local?",
"doc": "Documentation",
@@ -166,6 +168,7 @@
"newContainer": "New container",
"noClient": "No client",
"noInterface": "No interface",
"noLineChart": "Do not use line charts",
"noNotiPerm": "No notification permissions, possibly no progress indication when downloading app updates.",
"noOptions": "No options",
"noResult": "No result",
@@ -181,6 +184,7 @@
"nullToken": "Null token",
"ok": "OK",
"onServerDetailPage": "On server detail page",
"onlyWhenCoreBiggerThan8": "Works only when the number of cores > 8",
"open": "Open",
"openLastPath": "Open the last path",
"openLastPathTip": "Different servers will have different logs, and the log is the path to the exit",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "Found: v1.0.{build}, click to update",
"versionUnknownUpdate": "Current: v1.0.{build}, click to check updates",
"versionUpdated": "Current: v1.0.{build}, is up to date",
"view": "View",
"viewErr": "See error",
"virtKeyHelpClipboard": "Copy to the clipboard if terminal selected is not empty, otherwise paste the contents of the clipboard to the terminal.",
"virtKeyHelpSFTP": "Open current directory in SFTP.",

View File

@@ -52,6 +52,7 @@
"convert": "Convertir",
"copy": "Copiar",
"copyPath": "Copiar ruta",
"cpuViewAsProgressTip": "Muestre la tasa de uso de cada CPU en estilo de barra de progreso (estilo antiguo)",
"createFile": "Crear archivo",
"createFolder": "Crear carpeta",
"cursorType": "Tipo de cursor",
@@ -71,6 +72,7 @@
"disconnected": "Desconectado",
"disk": "Disco",
"diskIgnorePath": "Rutas de disco ignoradas",
"displayCpuIndex": "Muestre el índice de CPU",
"displayName": "Nombre a mostrar",
"dl2Local": "¿Descargar {fileName} a local?",
"doc": "Documentación",
@@ -166,6 +168,7 @@
"newContainer": "Crear contenedor nuevo",
"noClient": "No hay conexión SSH",
"noInterface": "No hay interfaz disponible",
"noLineChart": "No utilice gráficos de líneas",
"noNotiPerm": "Sin permisos de notificación, posiblemente sin indicación de progreso al descargar actualizaciones de la aplicación.",
"noOptions": "Sin opciones disponibles",
"noResult": "Sin resultados",
@@ -181,6 +184,7 @@
"nullToken": "Token nulo",
"ok": "Ok",
"onServerDetailPage": "En la página de detalles del servidor",
"onlyWhenCoreBiggerThan8": "Efectivo solo cuando el número de núcleos > 8",
"open": "Abrir",
"openLastPath": "Abrir el último camino",
"openLastPathTip": "Los diferentes servidores tendrán diferentes registros, y lo que se registra es la ruta de salida",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "Nueva versión encontrada: v1.0.{build}, haz clic para actualizar",
"versionUnknownUpdate": "Actual: v1.0.{build}, haz clic para verificar actualizaciones",
"versionUpdated": "Actual: v1.0.{build}, ya estás en la última versión",
"view": "Vista",
"viewErr": "Ver error",
"virtKeyHelpClipboard": "Si el terminal tiene caracteres seleccionados, entonces copiará los caracteres seleccionados al portapapeles, de lo contrario, pegará el contenido del portapapeles al terminal.",
"virtKeyHelpSFTP": "Abrir la ruta actual en SFTP.",

View File

@@ -52,6 +52,7 @@
"convert": "Convertir",
"copy": "Copier",
"copyPath": "Copier le chemin",
"cpuViewAsProgressTip": "Affichez le taux d'utilisation de chaque CPU dans un style de barre de progression (ancien style)",
"createFile": "Créer un fichier",
"createFolder": "Créer un dossier",
"cursorType": "Type de curseur",
@@ -71,6 +72,7 @@
"disconnected": "Déconnecté",
"disk": "Disque",
"diskIgnorePath": "Ignorer le chemin pour le disque",
"displayCpuIndex": "Affichez l'indice CPU",
"displayName": "Nom affiché",
"dl2Local": "Télécharger {fileName} en local?",
"doc": "Documentation",
@@ -166,6 +168,7 @@
"newContainer": "Nouveau conteneur",
"noClient": "Aucun client",
"noInterface": "Aucune interface",
"noLineChart": "N'utilisez pas de graphiques en ligne",
"noNotiPerm": "Pas de permissions de notification, il est possible qu'il n'y ait pas de notification de progression lors du téléchargement des mises à jour des applications.",
"noOptions": "Aucune option",
"noResult": "Aucun résultat",
@@ -181,6 +184,7 @@
"nullToken": "Jeton nul",
"ok": "OK",
"onServerDetailPage": "Sur la page de détails du serveur",
"onlyWhenCoreBiggerThan8": "Efficace seulement lorsque le nombre de cœurs > 8",
"open": "Ouvrir",
"openLastPath": "Ouvrir le dernier chemin",
"openLastPathTip": "Les serveurs différents auront des journaux différents, et le journal est le chemin de sortie",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "Trouvé : v1.0.{build}, cliquez pour mettre à jour",
"versionUnknownUpdate": "Actuel : v1.0.{build}, cliquez pour vérifier les mises à jour",
"versionUpdated": "Actuel : v1.0.{build}, à jour",
"view": "Vue",
"viewErr": "Voir l'erreur",
"virtKeyHelpClipboard": "Copier dans le presse-papiers si le terminal sélectionné n'est pas vide, sinon coller le contenu du presse-papiers dans le terminal.",
"virtKeyHelpSFTP": "Ouvrir le répertoire actuel dans SFTP.",

View File

@@ -52,6 +52,7 @@
"convert": "Mengubah",
"copy": "Menyalin",
"copyPath": "Path Copy",
"cpuViewAsProgressTip": "Tampilkan tingkat penggunaan setiap CPU dalam gaya bilah kemajuan (gaya lama)",
"createFile": "Buat file",
"createFolder": "Membuat folder",
"cursorType": "Jenis kursor",
@@ -71,6 +72,7 @@
"disconnected": "Terputus",
"disk": "Disk",
"diskIgnorePath": "Abaikan jalan untuk disk",
"displayCpuIndex": "Tampilkan indeks CPU",
"displayName": "Nama tampilan",
"dl2Local": "Unduh {fileName} ke lokal?",
"doc": "Dokumentasi",
@@ -166,6 +168,7 @@
"newContainer": "Wadah baru",
"noClient": "Tidak ada klien",
"noInterface": "Tidak ada antarmuka",
"noLineChart": "Jangan gunakan grafik garis",
"noNotiPerm": "Tidak ada izin notifikasi, mungkin tidak ada indikasi kemajuan saat mengunduh pembaruan aplikasi.",
"noOptions": "Tidak ada opsi",
"noResult": "Tidak ada hasil",
@@ -181,6 +184,7 @@
"nullToken": "Token NULL",
"ok": "OKE",
"onServerDetailPage": "Di halaman detail server",
"onlyWhenCoreBiggerThan8": "Berlaku hanya ketika jumlah inti > 8",
"open": "Membuka",
"openLastPath": "Buka jalur terakhir",
"openLastPathTip": "Server yang berbeda akan memiliki catatan yang berbeda, dan catatan tersebut adalah jalur menuju pintu keluar",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "Ditemukan: v1.0.{build}, klik untuk memperbarui",
"versionUnknownUpdate": "Saat ini: v1.0.{build}. Klik untuk memeriksa pembaruan.",
"versionUpdated": "Saat ini: v1.0.{build}, mutakhir",
"view": "Tampilan",
"viewErr": "Lihat kesalahan",
"virtKeyHelpClipboard": "Salin ke clipboard jika terminal yang dipilih tidak kosong, jika tidak, tempel isi clipboard ke terminal.",
"virtKeyHelpSFTP": "Buka direktori saat ini di SFTP.",

View File

@@ -52,6 +52,7 @@
"convert": "変換",
"copy": "コピー",
"copyPath": "パスをコピー",
"cpuViewAsProgressTip": "各CPUの使用率をプログレスバースタイルで表示する旧スタイル",
"createFile": "ファイルを作成",
"createFolder": "フォルダーを作成",
"cursorType": "カーソルタイプ",
@@ -71,6 +72,7 @@
"disconnected": "接続が切断されました",
"disk": "ディスク",
"diskIgnorePath": "無視されたディスクパス",
"displayCpuIndex": "CPUインデックスを表示する",
"displayName": "表示名",
"dl2Local": "{fileName}をローカルにダウンロードしますか?",
"doc": "ドキュメント",
@@ -166,6 +168,7 @@
"newContainer": "新しいコンテナを作成",
"noClient": "SSH接続がありません",
"noInterface": "使用可能なインターフェースがありません",
"noLineChart": "折れ線グラフを使用しない",
"noNotiPerm": "通知の権限がないため、アプリの更新のダウンロード中に進行状況が表示されない場合があります。",
"noOptions": "選択肢がありません",
"noResult": "結果なし",
@@ -181,6 +184,7 @@
"nullToken": "トークンなし",
"ok": "OK",
"onServerDetailPage": "サーバーの詳細ページで",
"onlyWhenCoreBiggerThan8": "コア数が8より大きい場合にのみ有効",
"open": "開く",
"openLastPath": "最後のパスを開く",
"openLastPathTip": "異なるサーバーには異なる記録があり、記録されているのは退出時のパスです",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "新しいバージョンが見つかりましたv1.0.{build}、クリックして更新",
"versionUnknownUpdate": "現在v1.0.{build}、更新をチェックするためにクリック",
"versionUpdated": "現在v1.0.{build}、最新バージョンです",
"view": "ビュー",
"viewErr": "エラーを表示",
"virtKeyHelpClipboard": "端末に選択された文字がある場合は、選択された文字をクリップボードにコピーします。そうでない場合は、クリップボードの内容を端末に貼り付けます。",
"virtKeyHelpSFTP": "現在のパスでSFTPを開く。",

View File

@@ -52,6 +52,7 @@
"convert": "Converteren",
"copy": "Kopiëren",
"copyPath": "Pad kopiëren",
"cpuViewAsProgressTip": "Toon het gebruik van elke CPU in een voortgangsbalkstijl (oude stijl)",
"createFile": "Bestand aanmaken",
"createFolder": "Map aanmaken",
"cursorType": "Cursortype",
@@ -71,6 +72,7 @@
"disconnected": "Verbroken",
"disk": "Schijf",
"diskIgnorePath": "Pad negeren voor schijf",
"displayCpuIndex": "Toon de CPU-index",
"displayName": "Weergavenaam",
"dl2Local": "Download {fileName} naar lokaal?",
"doc": "Documentatie",
@@ -181,6 +183,7 @@
"nullToken": "Null-token",
"ok": "OK",
"onServerDetailPage": "Op serverdetailspagina",
"onlyWhenCoreBiggerThan8": "Alleen effectief wanneer het aantal cores > 8",
"open": "Openen",
"openLastPath": "Open het laatste pad",
"openLastPathTip": "Verschillende servers hebben verschillende logs, en de log is het pad naar de uitgang",
@@ -303,6 +306,7 @@
"versionHaveUpdate": "Gevonden: v1.0.{build}, klik om bij te werken",
"versionUnknownUpdate": "Huidig: v1.0.{build}, klik om te kijken naar een nieuwere versie",
"versionUpdated": "Huidig: v1.0.{build}, is bijgewerkt naar de laatste versie",
"view": "Weergave",
"viewErr": "Zie foutmelding",
"virtKeyHelpClipboard": "Kopiëren naar het klembord als de geselecteerde terminal niet leeg is, anders de inhoud van het klembord plakken in de terminal.",
"virtKeyHelpSFTP": "Huidige map openen in SFTP.",

View File

@@ -52,6 +52,7 @@
"convert": "Converter",
"copy": "Copiar",
"copyPath": "Copiar caminho",
"cpuViewAsProgressTip": "Exiba a taxa de uso de cada CPU em estilo de barra de progresso (estilo antigo)",
"createFile": "Criar arquivo",
"createFolder": "Criar pasta",
"cursorType": "Tipo de cursor",
@@ -71,6 +72,7 @@
"disconnected": "Desconectado",
"disk": "Disco",
"diskIgnorePath": "Caminhos de disco ignorados",
"displayCpuIndex": "Exiba o índice de CPU",
"displayName": "Nome de exibição",
"dl2Local": "Baixar {fileName} para o local?",
"doc": "Documentação",
@@ -166,6 +168,7 @@
"newContainer": "Novo contêiner",
"noClient": "Sem conexão SSH",
"noInterface": "Sem interface disponível",
"noLineChart": "Gebruik geen lijndiagrammen",
"noNotiPerm": "Sem permissão de notificação, possivelmente sem indicação de progresso ao baixar atualizações de aplicativos.",
"noOptions": "Sem opções",
"noResult": "Sem resultados",
@@ -181,6 +184,7 @@
"nullToken": "Token nulo",
"ok": "OK",
"onServerDetailPage": "Na página de detalhes do servidor",
"onlyWhenCoreBiggerThan8": "Efetivo apenas quando o número de núcleos > 8",
"open": "Abrir",
"openLastPath": "Abrir o último caminho",
"openLastPathTip": "Registros diferentes para servidores diferentes, e registra o caminho ao sair",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "Nova versão encontrada: v1.0.{build}, clique para atualizar",
"versionUnknownUpdate": "Versão atual: v1.0.{build}, clique para verificar atualizações",
"versionUpdated": "Versão atual: v1.0.{build}, já está atualizado",
"view": "Visualização",
"viewErr": "Ver erro",
"virtKeyHelpClipboard": "Se houver texto selecionado no terminal, copia para a área de transferência, caso contrário, cola o conteúdo da área de transferência no terminal.",
"virtKeyHelpSFTP": "Abre o caminho atual em SFTP.",

View File

@@ -52,6 +52,7 @@
"convert": "конвертировать",
"copy": "копировать",
"copyPath": "копировать путь",
"cpuViewAsProgressTip": "Отобразите уровень использования каждого процессора в виде индикатора выполнения (старый стиль)",
"createFile": "создать файл",
"createFolder": "создать папку",
"cursorType": "Тип курсора",
@@ -71,6 +72,7 @@
"disconnected": "отключено",
"disk": "диск",
"diskIgnorePath": "путь игнорирования диска",
"displayCpuIndex": "Показать индекс ЦПУ",
"displayName": "отображаемое имя",
"dl2Local": "Загрузить {fileName} на локальный диск?",
"doc": "Документация",
@@ -166,6 +168,7 @@
"newContainer": "создать контейнер",
"noClient": "нет SSH соединения",
"noInterface": "нет доступных интерфейсов",
"noLineChart": "Não use gráficos de linha",
"noNotiPerm": "Нет разрешения на уведомления, возможно отсутствие индикации прогресса при загрузке обновлений приложений.",
"noOptions": "нет доступных опций",
"noResult": "нет результатов",
@@ -181,6 +184,7 @@
"nullToken": "нет токена",
"ok": "ок",
"onServerDetailPage": "на странице деталей сервера",
"onlyWhenCoreBiggerThan8": "Действует только при количестве ядер > 8",
"open": "открыть",
"openLastPath": "открыть последний путь",
"openLastPathTip": "Для разных серверов будут сохранены разные записи, записывается путь при выходе",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "Найдена новая версия: v1.0.{build}, нажмите для обновления",
"versionUnknownUpdate": "Текущая: v1.0.{build}, нажмите для проверки обновлений",
"versionUpdated": "Текущая: v1.0.{build}, последняя версия",
"view": "Вид",
"viewErr": "просмотр ошибок",
"virtKeyHelpClipboard": "Если в терминале выделен текст, то он копируется в буфер обмена, в противном случае содержимое буфера вставляется в терминал.",
"virtKeyHelpSFTP": "Открыть текущий путь в SFTP.",

View File

@@ -52,6 +52,7 @@
"convert": "转换",
"copy": "复制",
"copyPath": "复制路径",
"cpuViewAsProgressTip": "以进度条样式显示每个CPU的使用率旧版样式",
"createFile": "创建文件",
"createFolder": "创建文件夹",
"cursorType": "光标类型",
@@ -71,6 +72,7 @@
"disconnected": "连接断开",
"disk": "硬盘",
"diskIgnorePath": "忽略的磁盘路径",
"displayCpuIndex": "显示CPU索引",
"displayName": "显示名称",
"dl2Local": "下载 {fileName} 到本地?",
"doc": "文档",
@@ -166,6 +168,7 @@
"newContainer": "新建容器",
"noClient": "没有SSH连接",
"noInterface": "没有可用的接口",
"noLineChart": "不使用折线图",
"noNotiPerm": "无通知权限可能下载App更新时无进度提示。",
"noOptions": "无可选项",
"noResult": "无结果",
@@ -181,6 +184,7 @@
"nullToken": "无Token",
"ok": "好",
"onServerDetailPage": "在服务器详情页",
"onlyWhenCoreBiggerThan8": "仅当核心数>8时生效",
"open": "打开",
"openLastPath": "打开上次的路径",
"openLastPathTip": "不同的服务器会有不同的记录,且记录的是退出时的路径",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "找到新版本v1.0.{build}, 点击更新",
"versionUnknownUpdate": "当前v1.0.{build},点击检查更新",
"versionUpdated": "当前v1.0.{build}, 已是最新版本",
"view": "视图",
"viewErr": "查看错误",
"virtKeyHelpClipboard": "如果终端有选中字符,则复制选中字符至剪切板,否则粘贴剪切板内容至终端。",
"virtKeyHelpSFTP": "在 SFTP 中打开当前路径。",

View File

@@ -52,6 +52,7 @@
"convert": "轉換",
"copy": "複製",
"copyPath": "複製路徑",
"cpuViewAsProgressTip": "以進度條樣式顯示每個CPU的使用率舊版樣式",
"createFile": "創建文件",
"createFolder": "創建文件夾",
"cursorType": "光標類型",
@@ -71,6 +72,7 @@
"disconnected": "連接斷開",
"disk": "硬盤",
"diskIgnorePath": "忽略的磁盤路徑",
"displayCpuIndex": "顯示CPU索引",
"displayName": "顯示名稱",
"dl2Local": "下載 {fileName} 到本地?",
"doc": "文檔",
@@ -166,6 +168,7 @@
"newContainer": "新建容器",
"noClient": "沒有SSH連接",
"noInterface": "沒有可用的接口",
"noLineChart": "不使用折線圖",
"noNotiPerm": "無通知權限,可能在下載應用程式更新時沒有進度提示。",
"noOptions": "無可選項",
"noResult": "無結果",
@@ -181,6 +184,7 @@
"nullToken": "無Token",
"ok": "好",
"onServerDetailPage": "在服務器詳情頁",
"onlyWhenCoreBiggerThan8": "僅當核心數>8時生效",
"open": "打開",
"openLastPath": "打開上次的路徑",
"openLastPathTip": "不同的服務器會有不同的記錄,且記錄的是退出時的路徑",
@@ -303,6 +307,7 @@
"versionHaveUpdate": "找到新版本v1.0.{build}, 點擊更新",
"versionUnknownUpdate": "當前v1.0.{build},點擊檢查更新",
"versionUpdated": "當前v1.0.{build}, 已是最新版本",
"view": "視圖",
"viewErr": "查看錯誤",
"virtKeyHelpClipboard": "如果終端有選中字符,則復製選中字符至剪切板,否則粘貼剪切板內容至終端。",
"virtKeyHelpSFTP": "在 SFTP 中打開當前路徑。",

View File

@@ -5,9 +5,11 @@ import 'package:provider/provider.dart';
import 'package:toolbox/core/extension/context/common.dart';
import 'package:toolbox/core/extension/context/dialog.dart';
import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/core/extension/listx.dart';
import 'package:toolbox/data/model/app/server_detail_card.dart';
import 'package:toolbox/data/model/app/shell_func.dart';
import 'package:toolbox/data/model/server/battery.dart';
import 'package:toolbox/data/model/server/cpu.dart';
import 'package:toolbox/data/model/server/disk.dart';
import 'package:toolbox/data/model/server/net_speed.dart';
import 'package:toolbox/data/model/server/nvdia.dart';
@@ -190,20 +192,23 @@ class _ServerDetailPageState extends State<ServerDetailPage>
mainAxisSize: MainAxisSize.min,
children: details,
),
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 13),
child: SizedBox(
height: 137,
width: _media.size.width - 26 - 34,
child: _buildLineChart(
ss.cpu.spots,
//ss.cpu.rangeX,
tooltipPrefix: 'CPU',
),
),
),
],
children: Stores.setting.cpuViewAsProgress.fetch()
? _buildCPUProgress(ss.cpu)
: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 17, vertical: 13),
child: SizedBox(
height: 137,
width: _media.size.width - 26 - 34,
child: _buildLineChart(
ss.cpu.spots,
//ss.cpu.rangeX,
tooltipPrefix: 'CPU',
),
),
),
],
),
);
}
@@ -228,6 +233,56 @@ class _ServerDetailPageState extends State<ServerDetailPage>
);
}
List<Widget> _buildCPUProgress(Cpus cs) {
const kMaxColumn = 2;
const kRowThreshold = 4;
const kCoresCount = kMaxColumn * kRowThreshold;
final children = <Widget>[];
if (cs.coresCount > kCoresCount) {
final rows = cs.coresCount ~/ kMaxColumn;
for (var i = 0; i < rows; i++) {
final rowChildren = <Widget>[];
for (var j = 0; j < kMaxColumn; j++) {
final idx = i * kMaxColumn + j + 1;
if (idx >= cs.coresCount) break;
if (Stores.setting.displayCpuIndex.fetch()) {
rowChildren.add(Text('${idx + 1}', style: UIs.text13Grey));
}
rowChildren.add(
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 3),
child: _buildProgress(cs.usedPercent(coreIdx: idx)),
),
),
);
}
rowChildren.joinWith(UIs.width7);
children.add(
Padding(
padding: const EdgeInsets.symmetric(horizontal: 17),
child: Row(
children: rowChildren,
),
),
);
}
} else {
for (var i = 0; i < cs.coresCount; i++) {
if (i == 0) continue;
children.add(
Padding(
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 17),
child: _buildProgress(cs.usedPercent(coreIdx: i)),
),
);
}
}
return children;
}
Widget _buildProgress(double percent) {
if (percent > 100) percent = 100;
final percentWithinOne = percent / 100;

View File

@@ -119,13 +119,12 @@ class _SettingPageState extends State<SettingPage> {
_buildAppColor(),
//_buildLaunchPage(),
_buildCheckUpdate(),
/// Platform specific settings
if (OS.hasSpecSetting) _buildPlatformSetting(),
_buildAppMore(),
];
/// Platform specific settings
if (OS.hasSpecSetting) {
children.add(_buildPlatformSetting());
}
return Column(
children: children.map((e) => CardX(child: e)).toList(),
);
@@ -150,6 +149,7 @@ class _SettingPageState extends State<SettingPage> {
_buildServerDetailCardSeq(),
//_buildDiskIgnorePath(),
_buildDeleteServers(),
_buildCpuView(),
_buildServerMore(),
].map((e) => CardX(child: e)).toList(),
);
@@ -1094,4 +1094,21 @@ class _SettingPageState extends State<SettingPage> {
trailing: StoreSwitch(prop: _setting.hideTitleBar),
);
}
Widget _buildCpuView() {
return ExpandTile(
title: Text('CPU ${l10n.view}'),
children: [
ListTile(
title: Text(l10n.noLineChart),
subtitle: Text(l10n.cpuViewAsProgressTip, style: UIs.textGrey),
trailing: StoreSwitch(prop: _setting.cpuViewAsProgress),
),
ListTile(
title: Text(l10n.displayCpuIndex),
trailing: StoreSwitch(prop: _setting.displayCpuIndex),
),
],
);
}
}