mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: add tip for upgrading pkgs (#326)
This commit is contained in:
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "Bitte gib eine Ziel-IP/Domain ein.",
|
||||
"pingNoServer": "Kein Server zum Anpingen.\nBitte füge einen Server hinzu.",
|
||||
"pkg": "Pkg",
|
||||
"pkgUpgradeTip": "Bitte sichern Sie Ihr System vor dem Update.",
|
||||
"platformNotSupportUpdate": "Die aktuelle Plattform unterstützt keine In-App-Updates.\nBitte kompiliere vom Quellcode und installiere sie.",
|
||||
"plugInType": "Einfügetyp",
|
||||
"plzEnterHost": "Bitte Host eingeben.",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "Please input a target IP / domain.",
|
||||
"pingNoServer": "No server to ping.\nPlease add a server in server tab.",
|
||||
"pkg": "Pkg",
|
||||
"pkgUpgradeTip": "Please backup your system before updating.",
|
||||
"platformNotSupportUpdate": "Current platform does not support in app update.\nPlease build from source and install it.",
|
||||
"plugInType": "Insertion Type",
|
||||
"plzEnterHost": "Please enter host.",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "Por favor, introduce la IP de destino o el dominio",
|
||||
"pingNoServer": "No hay servidores disponibles para hacer Ping\nPor favor, añade un servidor en la pestaña de servidores y vuelve a intentarlo",
|
||||
"pkg": "Gestión de paquetes",
|
||||
"pkgUpgradeTip": "Realice una copia de seguridad de su sistema antes de actualizar.",
|
||||
"platformNotSupportUpdate": "La plataforma actual no soporta actualizaciones, por favor instala manualmente la última versión del código fuente",
|
||||
"plugInType": "Tipo de inserción",
|
||||
"plzEnterHost": "Por favor, introduce el host",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "Veuillez saisir une adresse IP / un domaine cible.",
|
||||
"pingNoServer": "Aucun serveur pour ping.\nVeuillez ajouter un serveur dans l'onglet serveur.",
|
||||
"pkg": "Pkg",
|
||||
"pkgUpgradeTip": "Veuillez sauvegarder votre système avant de mettre à jour.",
|
||||
"platformNotSupportUpdate": "La plateforme actuelle ne prend pas en charge la mise à jour dans l'application. \nVeuillez le compiler à partir de la source et l'installer.",
|
||||
"plugInType": "Type d'insertion",
|
||||
"plzEnterHost": "Veuillez saisir l'hôte.",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "Harap masukkan IP / domain target.",
|
||||
"pingNoServer": "Tidak ada server untuk melakukan ping.\nHarap tambahkan server di tab Server.",
|
||||
"pkg": "Pkg",
|
||||
"pkgUpgradeTip": "Harap cadangkan sistem Anda sebelum memperbarui.",
|
||||
"platformNotSupportUpdate": "Platform saat ini tidak mendukung pembaruan aplikasi.\nSilakan bangun dari sumber dan instal.",
|
||||
"plugInType": "Jenis Penyisipan",
|
||||
"plzEnterHost": "Harap masukkan host.",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "対象のIPまたはドメインを入力してください",
|
||||
"pingNoServer": "Pingに使用するサーバーがありません\nサーバータブでサーバーを追加してから再試行してください",
|
||||
"pkg": "パッケージ管理",
|
||||
"pkgUpgradeTip": "アップデートする前にシステムのバックアップを取ってください。",
|
||||
"platformNotSupportUpdate": "現在のプラットフォームは更新をサポートしていません。最新のソースコードをコンパイルして手動でインストールしてください",
|
||||
"plugInType": "挿入タイプ",
|
||||
"plzEnterHost": "ホストを入力してください",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "Por favor, insira o IP ou domínio alvo",
|
||||
"pingNoServer": "Nenhum servidor disponível para Ping\nPor favor, adicione um servidor na aba de servidores e tente novamente",
|
||||
"pkg": "Gerenciamento de pacotes",
|
||||
"pkgUpgradeTip": "Por favor, faça backup do seu sistema antes de atualizar.",
|
||||
"platformNotSupportUpdate": "Atualização não suportada na plataforma atual, por favor, instale manualmente a versão mais recente do código-fonte",
|
||||
"plugInType": "Tipo de Inserção",
|
||||
"plzEnterHost": "Por favor, insira o host",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "Пожалуйста, введите целевой IP или доменное имя",
|
||||
"pingNoServer": "Нет доступных серверов для Ping\nПожалуйста, добавьте серверы на вкладке серверов и попробуйте снова",
|
||||
"pkg": "менеджер пакетов",
|
||||
"pkgUpgradeTip": "Пожалуйста, сделайте резервную копию системы перед обновлением.",
|
||||
"platformNotSupportUpdate": "Текущая платформа не поддерживает обновления, пожалуйста, вручную установите последнюю версию из исходного кода",
|
||||
"plugInType": "Тип вставки",
|
||||
"plzEnterHost": "Пожалуйста, введите хост",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "请输入目标IP或域名",
|
||||
"pingNoServer": "没有服务器可用于Ping\n请在服务器tab添加服务器后再试",
|
||||
"pkg": "包管理",
|
||||
"pkgUpgradeTip": "请在更新前备份系统。",
|
||||
"platformNotSupportUpdate": "当前平台不支持更新,请编译最新源码后手动安装",
|
||||
"plugInType": "插入类型",
|
||||
"plzEnterHost": "请输入主机",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"pingInputIP": "請輸入目標IP或域名",
|
||||
"pingNoServer": "沒有服務器可用於Ping\n請在服務器tab新增服務器後再試",
|
||||
"pkg": "包管理",
|
||||
"pkgUpgradeTip": "請在更新前備份系統。",
|
||||
"platformNotSupportUpdate": "當前平台不支持更新,請編譯最新源碼後手動安裝",
|
||||
"plugInType": "插入類型",
|
||||
"plzEnterHost": "請輸入主機",
|
||||
|
||||
69
lib/view/widget/count_down_btn.dart
Normal file
69
lib/view/widget/count_down_btn.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
|
||||
final class CountDownBtn extends StatefulWidget {
|
||||
final int seconds;
|
||||
final String text;
|
||||
final Color? afterColor;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const CountDownBtn({
|
||||
super.key,
|
||||
required this.onTap,
|
||||
this.seconds = 3,
|
||||
this.text = 'Go',
|
||||
this.afterColor,
|
||||
});
|
||||
|
||||
@override
|
||||
State<CountDownBtn> createState() => _CountDownBtnState();
|
||||
}
|
||||
|
||||
final class _CountDownBtnState extends State<CountDownBtn> {
|
||||
late int _seconds = widget.seconds;
|
||||
Timer? _timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_startCountDown();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_timer?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
bool get isCounting => _seconds > 0;
|
||||
|
||||
void _startCountDown() {
|
||||
if (isCounting) return;
|
||||
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
if (!isCounting) {
|
||||
_timer?.cancel();
|
||||
}
|
||||
setState(() {
|
||||
_seconds--;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
onPressed: () {
|
||||
if (isCounting) return;
|
||||
widget.onTap();
|
||||
},
|
||||
child: Text(
|
||||
isCounting ? '$_seconds${l10n.second}' : widget.text,
|
||||
style: TextStyle(
|
||||
color: _seconds > 0 ? Colors.grey : widget.afterColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import 'package:toolbox/data/res/path.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
import 'package:toolbox/view/widget/count_down_btn.dart';
|
||||
|
||||
import '../../core/route.dart';
|
||||
import '../../core/utils/server.dart';
|
||||
@@ -279,12 +280,13 @@ Future<void> _onPkg(BuildContext context, ServerPrivateInfo spi) async {
|
||||
final gotoUpgrade = await context.showRoundDialog<bool>(
|
||||
title: Text(l10n.attention),
|
||||
child: SingleChildScrollView(
|
||||
child: Text('${l10n.foundNUpdate(upgradeable.length)}\n\n$upgradeCmd'),
|
||||
child: Text('${l10n.pkgUpgradeTip}\n${l10n.foundNUpdate(upgradeable.length)}\n\n$upgradeCmd'),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(true),
|
||||
child: Text(l10n.update),
|
||||
CountDownBtn(
|
||||
onTap: () => context.pop(true),
|
||||
text: l10n.update,
|
||||
afterColor: Colors.red,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user