diff --git a/lib/app.dart b/lib/app.dart index c5f9a8e4d..2ae7064e0 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -80,36 +80,21 @@ class MyApp extends StatelessWidget { themeMode: themeMode, theme: light, darkTheme: tMode < 3 ? dark : dark.toAmoled, - home: _buildAppContent(ctx), - ); - } - - Widget _buildAppContent(BuildContext ctx) { - //if (Pros.app.isWearOS) return const WearHome(); - return const _AppContent( - intro: _IntroPage(), - child: HomePage(), - ); - } -} + home: Builder( + builder: (context) { + context.setLibL10n(); + final appL10n = AppLocalizations.of(context); + if (appL10n != null) l10n = appL10n; -/// It's used for init settings related to [BuildContext] -final class _AppContent extends StatelessWidget { - final Widget child; - final Widget intro; + final intros = _IntroPage.builders; + if (intros.isNotEmpty) { + return _IntroPage(intros); + } - const _AppContent({required this.child, required this.intro}); - - @override - Widget build(BuildContext context) { - context.setLibL10n(); - final appL10n = AppLocalizations.of(context); - if (appL10n != null) l10n = appL10n; - - final showIntro = Stores.setting.showIntro.fetch(); - if (showIntro) return intro; - - return child; + return const HomePage(); + }, + ), + ); } } diff --git a/lib/data/store/setting.dart b/lib/data/store/setting.dart index 82165e241..640808e56 100644 --- a/lib/data/store/setting.dart +++ b/lib/data/store/setting.dart @@ -280,7 +280,9 @@ class SettingStore extends PersistentStore { /// Format: {width}x{height} late final windowSize = property('windowSize', ''); - late final showIntro = property('showIntro', true); + late final introVer = property('introVer', 0); + + late final letterCache = property('letterCache', false); // Never show these settings for users // diff --git a/lib/intro.dart b/lib/intro.dart index 4e99e7fc4..08d8b3fe2 100644 --- a/lib/intro.dart +++ b/lib/intro.dart @@ -1,24 +1,26 @@ part of 'app.dart'; final class _IntroPage extends StatelessWidget { - const _IntroPage(); + final List pages; - static final _setting = Stores.setting; - static const _kIconSize = 23.0; - static const _introListPad = EdgeInsets.symmetric(horizontal: 17); + const _IntroPage(this.pages); + + static const _builders = { + 1: _buildAppSettings, + 2: _buildRecommended, + 1006: _buildTermLetterCache, + }; @override Widget build(BuildContext context) { return LayoutBuilder( builder: (context, cons) { - final padTop = cons.maxHeight * .2; + final padTop = cons.maxHeight * .16; + final pages_ = pages.map((e) => e(context, padTop)).toList(); return IntroPage( - pages: [ - _buildAppSettings(context, padTop), - _buildRecommended(context, padTop), - ], + pages: pages_, onDone: (ctx) { - Stores.setting.showIntro.put(false); + Stores.setting.introVer.put(BuildData.build); Navigator.of(ctx).pushReplacement( MaterialPageRoute(builder: (_) => const HomePage()), ); @@ -28,12 +30,29 @@ final class _IntroPage extends StatelessWidget { ); } - Widget _buildRecommended(BuildContext context, double padTop) { + static Widget _buildTermLetterCache(BuildContext context, double padTop) { + return ListView( + padding: _introListPad, + children: [ + SizedBox(height: padTop), + IntroPage.title(icon: BoxIcons.bxs_terminal, big: true), + SizedBox(height: padTop), + ListTile( + leading: const Icon(Bootstrap.input_cursor), + title: Text(l10n.letterCache), + subtitle: Text(l10n.letterCacheTip, style: UIs.textGrey), + trailing: StoreSwitch(prop: _setting.letterCache), + ).cardx, + ], + ); + } + + static Widget _buildRecommended(BuildContext context, double padTop) { return ListView( padding: _introListPad, children: [ SizedBox(height: padTop), - const Icon(Bootstrap.stars, size: 35), + IntroPage.title(icon: Bootstrap.stars, big: true), SizedBox(height: padTop), ListTile( leading: const Icon(MingCute.delete_2_fill), @@ -57,12 +76,12 @@ final class _IntroPage extends StatelessWidget { ); } - Widget _buildAppSettings(BuildContext ctx, double padTop) { + static Widget _buildAppSettings(BuildContext ctx, double padTop) { return ListView( padding: _introListPad, children: [ SizedBox(height: padTop), - _buildTitle(l10n.init, big: true), + IntroPage.title(text: l10n.init, big: true), SizedBox(height: padTop), ListTile( leading: const Icon(IonIcons.language), @@ -94,14 +113,15 @@ final class _IntroPage extends StatelessWidget { ); } - Widget _buildTitle(String text, {bool big = false}) { - return Center( - child: Text( - text, - style: big - ? const TextStyle(fontSize: 41, fontWeight: FontWeight.w500) - : UIs.textGrey, - ), - ); + static List get builders { + final storedVer = _setting.introVer.fetch(); + return _builders.entries + .where((e) => e.key > storedVer) + .map((e) => e.value) + .toList(); } + + static final _setting = Stores.setting; + static const _kIconSize = 23.0; + static const _introListPad = EdgeInsets.symmetric(horizontal: 17); } diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 8a7f5cd66..8598afc8d 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -67,7 +67,6 @@ "decode": "Decode", "decompress": "Dekomprimieren", "delete": "Löschen", - "deleteScripts": "Gleichzeitiges Löschen von Server-Skripten", "deleteServers": "Batch-Löschung von Servern", "deviceName": "Gerätename", "dirEmpty": "Stelle sicher, dass der Ordner leer ist.", @@ -154,6 +153,8 @@ "languageName": "Deutsch", "lastTry": "Letzter Versuch", "launchPage": "Startseite", + "letterCache": "Buchstaben-Caching", + "letterCacheTip": "Empfohlen zu aktivieren, aber die Aktivierung verhindert die Eingabe von CJK (Chinesisch, Japanisch, Koreanisch) Zeichen", "license": "Lizenzen", "light": "Hell", "loadingFiles": "Lädt Dateien...", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 00d66caf5..a6bb2e1a6 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -67,7 +67,6 @@ "decode": "Decode", "decompress": "Decompress", "delete": "Delete", - "deleteScripts": "Delete server scripts at the same time", "deleteServers": "Batch delete servers", "deviceName": "Device name", "dirEmpty": "Make sure the folder is empty.", @@ -154,6 +153,8 @@ "languageName": "English", "lastTry": "Last try", "launchPage": "Launch page", + "letterCache": "Letter caching", + "letterCacheTip": "Recommended to enable, but enabling it prevents the input of CJK (Chinese, Japanese, Korean) characters", "license": "License", "light": "Light", "loadingFiles": "Loading files...", diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index e1b395687..2dc15eae4 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -67,7 +67,6 @@ "decode": "Decodificar", "decompress": "Descomprimir", "delete": "Eliminar", - "deleteScripts": "Eliminar scripts del servidor simultáneamente", "deleteServers": "Eliminar servidores en lote", "deviceName": "Nombre del dispositivo", "dirEmpty": "Asegúrate de que el directorio esté vacío", @@ -154,6 +153,8 @@ "languageName": "Español", "lastTry": "Último intento", "launchPage": "Página de lanzamiento", + "letterCache": "Caché de letras", + "letterCacheTip": "Se recomienda activar, pero al activarlo se impide la introducción de caracteres CJK (chino, japonés, coreano)", "license": "Licencia de código abierto", "light": "Claro", "loadingFiles": "Cargando directorio...", diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index d6571e677..c81882aee 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -67,7 +67,6 @@ "decode": "Décoder", "decompress": "Décompresser", "delete": "Supprimer", - "deleteScripts": "Supprimer les scripts du serveur en même temps", "deleteServers": "Supprimer des serveurs en lot", "deviceName": "Nom de l'appareil", "dirEmpty": "Assurez-vous que le répertoire est vide.", @@ -154,6 +153,8 @@ "languageName": "Français", "lastTry": "Dernière tentative", "launchPage": "Page de lancement", + "letterCache": "Mise en cache des lettres", + "letterCacheTip": "Recommandé à activer, mais son activation empêche la saisie de caractères CJK (chinois, japonais, coréen)", "license": "Licence", "light": "Clair", "loadingFiles": "Chargement des fichiers...", diff --git a/lib/l10n/app_id.arb b/lib/l10n/app_id.arb index 5925eb1e1..2e2af510a 100644 --- a/lib/l10n/app_id.arb +++ b/lib/l10n/app_id.arb @@ -67,7 +67,6 @@ "decode": "Membaca sandi", "decompress": "Dekompresi", "delete": "Menghapus", - "deleteScripts": "Menghapus skrip server secara bersamaan", "deleteServers": "Penghapusan server secara batch", "deviceName": "Nama perangkat", "dirEmpty": "Pastikan dir kosong.", @@ -154,6 +153,8 @@ "languageName": "Indonesia", "lastTry": "Percobaan terakhir", "launchPage": "Halaman peluncuran", + "letterCache": "Caching huruf", + "letterCacheTip": "Disarankan untuk diaktifkan, tetapi mengaktifkannya mencegah input karakter CJK (Cina, Jepang, Korea)", "license": "Lisensi", "light": "Terang", "loadingFiles": "Memuat file ...", diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 217fa2254..4c27b8361 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -67,7 +67,6 @@ "decode": "デコード", "decompress": "解凍", "delete": "削除", - "deleteScripts": "サーバースクリプトも削除", "deleteServers": "サーバーを一括削除", "deviceName": "デバイス名", "dirEmpty": "フォルダーが空であることを確認してください", @@ -154,6 +153,8 @@ "languageName": "日本語", "lastTry": "最後の試み", "launchPage": "起動ページ", + "letterCache": "文字キャッシング", + "letterCacheTip": "有効化を推奨しますが、有効にするとCJK(中国語、日本語、韓国語)の文字の入力ができなくなります", "license": "オープンソースライセンス", "light": "ライト", "loadingFiles": "ディレクトリを読み込んでいます...", diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index ff28abe1a..8fe3c9442 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -67,7 +67,6 @@ "decode": "Decoderen", "decompress": "Decomprimeren", "delete": "Verwijderen", - "deleteScripts": "Verwijder tegelijkertijd serverscripts", "deleteServers": "Servers batchgewijs verwijderen", "deviceName": "Apparaatnaam", "dirEmpty": "Zorg ervoor dat de map leeg is.", @@ -154,6 +153,8 @@ "languageName": "Nederlands", "lastTry": "Laatste poging", "launchPage": "Startpagina", + "letterCache": "Lettercaching", + "letterCacheTip": "Aanbevolen om in te schakelen, maar bij inschakeling wordt de invoer van CJK (Chinees, Japans, Koreaans) tekens voorkomen", "license": "Licentie", "light": "Licht", "loadingFiles": "Bestanden laden...", diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 87a5aa5ff..9dcc6db55 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -67,7 +67,6 @@ "decode": "Decodificar", "decompress": "Descomprimir", "delete": "Excluir", - "deleteScripts": "Excluir scripts do servidor simultaneamente", "deleteServers": "Excluir servidores em lote", "deviceName": "Nome do dispositivo", "dirEmpty": "Certifique-se de que a pasta está vazia", @@ -154,6 +153,8 @@ "languageName": "Português", "lastTry": "Última tentativa", "launchPage": "Página de lançamento", + "letterCache": "Cache de letras", + "letterCacheTip": "Recomendado para ativar, mas a ativação impede a entrada de caracteres CJK (chinês, japonês, coreano)", "license": "Licença de código aberto", "light": "Claro", "loadingFiles": "Carregando diretórios...", diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 7345dd689..048ff62d5 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -67,7 +67,6 @@ "decode": "декодировать", "decompress": "разархивировать", "delete": "удалить", - "deleteScripts": "удалить скрипты с сервера", "deleteServers": "удалить серверы пакетно", "deviceName": "Название устройства", "dirEmpty": "Пожалуйста, убедитесь, что папка пуста", @@ -154,6 +153,8 @@ "languageName": "Русский", "lastTry": "последняя попытка", "launchPage": "стартовая страница", + "letterCache": "Кэширование букв", + "letterCacheTip": "Рекомендуется включить, но его активация препятствует вводу символов CJK (китайский, японский, корейский)", "license": "лицензия", "light": "светлая", "loadingFiles": "Загрузка файлов...", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index e378dd4e6..9a19abda4 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -67,7 +67,6 @@ "decode": "解码", "decompress": "解压缩", "delete": "删除", - "deleteScripts": "同时删除服务器脚本", "deleteServers": "批量删除服务器", "deviceName": "设备名", "dirEmpty": "请确保文件夹为空", @@ -154,6 +153,8 @@ "languageName": "简体中文", "lastTry": "最后尝试", "launchPage": "启动页", + "letterCache": "输入法字符缓存", + "letterCacheTip": "推荐开启,但是开启后无法输入 CJK 等文字", "license": "开源许可证", "light": "亮", "loadingFiles": "正在加载目录。。。", diff --git a/lib/l10n/app_zh_tw.arb b/lib/l10n/app_zh_tw.arb index be09f108c..a61428ef3 100644 --- a/lib/l10n/app_zh_tw.arb +++ b/lib/l10n/app_zh_tw.arb @@ -67,7 +67,6 @@ "decode": "解碼", "decompress": "解壓縮", "delete": "刪除", - "deleteScripts": "同時刪除伺服器腳本", "deleteServers": "批量刪除伺服器", "deviceName": "設備名", "dirEmpty": "請確保資料夾為空", @@ -154,6 +153,8 @@ "languageName": "繁體中文", "lastTry": "最後嘗試", "launchPage": "啓動頁", + "letterCache": "输入法字符緩存", + "letterCacheTip": "推薦開啟,但是開啟後無法輸入CJK(中文、日文、韓文)等文字", "license": "開源許可證", "light": "亮", "loadingFiles": "正在加載目錄...", diff --git a/lib/view/page/setting/entry.dart b/lib/view/page/setting/entry.dart index 33e69b0f3..938f881db 100644 --- a/lib/view/page/setting/entry.dart +++ b/lib/view/page/setting/entry.dart @@ -156,6 +156,7 @@ class _SettingPageState extends State { Widget _buildSSH() { return Column( children: [ + _buildLetterCache(), _buildSSHWakeLock(), _buildTermTheme(), _buildFont(), @@ -1178,4 +1179,16 @@ class _SettingPageState extends State { trailing: StoreSwitch(prop: _setting.betaTest), ); } + + Widget _buildLetterCache() { + return ListTile( + leading: const Icon(Bootstrap.input_cursor), + title: Text(l10n.letterCache), + subtitle: Text( + '${l10n.letterCacheTip}\n${l10n.needRestart}', + style: UIs.textGrey, + ), + trailing: StoreSwitch(prop: _setting.letterCache), + ); + } } diff --git a/lib/view/page/ssh/page.dart b/lib/view/page/ssh/page.dart index 86d6354af..6111f9e88 100644 --- a/lib/view/page/ssh/page.dart +++ b/lib/view/page/ssh/page.dart @@ -129,6 +129,7 @@ class SSHPageState extends State } Widget _buildBody() { + final letterCache = Stores.setting.letterCache.fetch(); return SizedBox( height: _media.size.height - _virtKeysHeight - @@ -144,8 +145,10 @@ class SSHPageState extends State _terminal, key: _termKey, controller: _terminalController, - keyboardType: TextInputType.text, - enableSuggestions: true, + keyboardType: letterCache + ? TextInputType.text + : TextInputType.visiblePassword, + enableSuggestions: !letterCache, textStyle: _terminalStyle, theme: _terminalTheme, deleteDetection: isMobile, diff --git a/pubspec.lock b/pubspec.lock index 881479cf4..30d534056 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -385,8 +385,8 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.0.59" - resolved-ref: aaca37cb7052e301bbd723615f6827371ad7f2b8 + ref: "v1.0.60" + resolved-ref: "5a88f7c6901e8f2c556a1d79ceaf7be9fb518233" url: "https://github.com/lppcg/fl_lib" source: git version: "0.0.1" diff --git a/pubspec.yaml b/pubspec.yaml index 7a113fcfb..559caa3ef 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -58,7 +58,7 @@ dependencies: fl_lib: git: url: https://github.com/lppcg/fl_lib - ref: v1.0.59 + ref: v1.0.60 dependency_overrides: # dartssh2: