new: delete all servers btn

This commit is contained in:
lollipopkit
2023-07-27 13:04:49 +08:00
parent 08a4dba659
commit ed3201db6d
16 changed files with 82 additions and 26 deletions

View File

@@ -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),
)
],
),
);
}
}