mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-02 14:24:44 +01:00
new: delete all servers btn
This commit is contained in:
@@ -29,7 +29,7 @@ class ServerPrivateInfo {
|
||||
required this.pwd,
|
||||
this.pubKeyId,
|
||||
this.tags,
|
||||
}) : id = '$name<$user@$ip:$port>';
|
||||
}) : id = '$user@$ip:$port';
|
||||
|
||||
ServerPrivateInfo.fromJson(Map<String, dynamic> json) {
|
||||
name = json["name"].toString();
|
||||
|
||||
@@ -167,6 +167,15 @@ class ServerProvider extends BusyProvider {
|
||||
_serverStore.delete(id);
|
||||
}
|
||||
|
||||
void deleteAll() {
|
||||
_servers.clear();
|
||||
_serverOrder.clear();
|
||||
_settingStore.serverOrder.put(_serverOrder);
|
||||
_updateTags();
|
||||
notifyListeners();
|
||||
_serverStore.deleteAll();
|
||||
}
|
||||
|
||||
Future<void> updateServer(
|
||||
ServerPrivateInfo old,
|
||||
ServerPrivateInfo newSpi,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 387;
|
||||
static const int build = 388;
|
||||
static const String engine = "3.10.6";
|
||||
static const String buildAt = "2023-07-21 18:06:24.239059";
|
||||
static const int modifications = 2;
|
||||
static const String buildAt = "2023-07-27 13:03:33.193528";
|
||||
static const int modifications = 16;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ class ServerStore extends PersistentStore {
|
||||
box.delete(id);
|
||||
}
|
||||
|
||||
void deleteAll() {
|
||||
box.clear();
|
||||
}
|
||||
|
||||
void update(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
|
||||
if (!have(old)) {
|
||||
throw Exception('Old spi: $old not found');
|
||||
|
||||
@@ -95,7 +95,8 @@ class SettingStore extends PersistentStore {
|
||||
|
||||
StoreProperty<NetViewType> get netViewType =>
|
||||
property('netViewType', defaultValue: NetViewType.speed);
|
||||
|
||||
|
||||
// Only valid on iOS
|
||||
StoreProperty<bool> get autoUpdateHomeWidget => property('autoUpdateHomeWidget', defaultValue: isIOS);
|
||||
StoreProperty<bool> get autoUpdateHomeWidget =>
|
||||
property('autoUpdateHomeWidget', defaultValue: isIOS);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"debug": "Debug",
|
||||
"decode": "Decode",
|
||||
"delete": "Löschen",
|
||||
"deleteAllServers": "Alle Server löschen",
|
||||
"disabled": "Behinderte",
|
||||
"disconnected": "Disconnected",
|
||||
"diskIgnorePath": "Pfad für Datenträger ignorieren",
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"debug": "Debug",
|
||||
"decode": "Decode",
|
||||
"delete": "Delete",
|
||||
"deleteAllServers": "Delete all servers",
|
||||
"disabled": "Disabled",
|
||||
"disconnected": "Disconnected",
|
||||
"diskIgnorePath": "Ignore path for disk",
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"debug": "调试",
|
||||
"decode": "解码",
|
||||
"delete": "删除",
|
||||
"deleteAllServers": "删除所有服务器",
|
||||
"disabled": "已禁用",
|
||||
"disconnected": "连接断开",
|
||||
"diskIgnorePath": "忽略的磁盘路径",
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"debug": "調試",
|
||||
"decode": "解碼",
|
||||
"delete": "刪除",
|
||||
"deleteAllServers": "刪除所有服務器",
|
||||
"disabled": "已禁用",
|
||||
"disconnected": "連接斷開",
|
||||
"diskIgnorePath": "忽略的磁盤路徑",
|
||||
|
||||
@@ -109,14 +109,14 @@ class _SettingPageState extends State<SettingPage> {
|
||||
children: [
|
||||
_buildTitle('App'),
|
||||
_buildApp(),
|
||||
_buildTitle(_s.fullScreen),
|
||||
_buildFullScreen(),
|
||||
_buildTitle(_s.server),
|
||||
_buildServer(),
|
||||
_buildTitle('SSH'),
|
||||
_buildSSH(),
|
||||
_buildTitle(_s.editor),
|
||||
_buildEditor(),
|
||||
_buildTitle(_s.fullScreen),
|
||||
_buildFullScreen(),
|
||||
const SizedBox(height: 37),
|
||||
],
|
||||
),
|
||||
@@ -173,6 +173,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
_buildUpdateInterval(),
|
||||
_buildMaxRetry(),
|
||||
_buildDiskIgnorePath(),
|
||||
_buildDeleteAllServers(),
|
||||
].map((e) => RoundRectCard(e)).toList(),
|
||||
);
|
||||
}
|
||||
@@ -801,6 +802,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
'none',
|
||||
];
|
||||
if (names.length != TextInputType.values.length) {
|
||||
// This notify me to update the code
|
||||
throw Exception('names.length != TextInputType.values.length');
|
||||
}
|
||||
final items = TextInputType.values.map(
|
||||
@@ -937,4 +939,22 @@ class _SettingPageState extends State<SettingPage> {
|
||||
trailing: buildSwitch(context, _setting.autoUpdateHomeWidget),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeleteAllServers() {
|
||||
return ListTile(
|
||||
title: Text(_s.deleteAllServers),
|
||||
trailing: const Icon(Icons.delete_forever),
|
||||
onTap: () => showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.attention),
|
||||
child: Text(_s.sureDelete(_s.all)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => _serverProvider.deleteAll(),
|
||||
child: Text(_s.ok),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user