App更新优化

This commit is contained in:
LollipopKit
2021-09-18 20:23:28 +08:00
parent b4d44c41e5
commit f457c7caee
3 changed files with 46 additions and 40 deletions

View File

@@ -38,7 +38,9 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
showSnackBarWithAction( showSnackBarWithAction(
context, context,
'${BuildData.name}有更新啦Ver${update.newest}\n${update.changelog}', update.min > BuildData.build
? '您的版本过旧,请及时更新'
: '${BuildData.name}有更新啦Ver${update.newest}\n${update.changelog}',
'更新', '更新',
() => openUrl(Platform.isAndroid ? update.android : update.ios)); () => openUrl(Platform.isAndroid ? update.android : update.ios));
} }

View File

@@ -184,44 +184,49 @@ class _ServerPageState extends State<ServerPage>
keyController.text = auth['privateKey']; keyController.text = auth['privateKey'];
} }
showRoundDialog(context, '修改服务器信息', _buildTextInputField(context), [ showRoundDialog(
TextButton( context,
onPressed: () { '修改服务器信息',
clearTextField(); _buildTextInputField(context),
Navigator.of(context).pop(); [
}, TextButton(
child: const Text('关闭')), onPressed: () {
TextButton( clearTextField();
onPressed: () { Navigator.of(context).pop();
final authorization = keyController.text.isEmpty },
? passwordController.text child: const Text('关闭')),
: { TextButton(
"privateKey": keyController.text, onPressed: () {
"passphrase": passwordController.text final authorization = keyController.text.isEmpty
}; ? passwordController.text
serverProvider.updateServer( : {
spi, "privateKey": keyController.text,
ServerPrivateInfo( "passphrase": passwordController.text
name: nameController.text, };
ip: ipController.text, serverProvider.updateServer(
port: int.parse(portController.text), spi,
user: usernameController.text, ServerPrivateInfo(
authorization: authorization)); name: nameController.text,
clearTextField(); ip: ipController.text,
Navigator.of(context).pop(); port: int.parse(portController.text),
}, user: usernameController.text,
child: const Text('保存')), authorization: authorization));
TextButton( clearTextField();
onPressed: () { Navigator.of(context).pop();
serverProvider.delServer(spi); },
clearTextField(); child: const Text('保存')),
Navigator.of(context).pop(); TextButton(
}, onPressed: () {
child: const Text( serverProvider.delServer(spi);
'删除', clearTextField();
style: TextStyle(color: Colors.red), Navigator.of(context).pop();
)) },
], barrierDismiss: false); child: const Text(
'删除',
style: TextStyle(color: Colors.red),
))
],
barrierDismiss: false);
}); });
} }

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env dart #!/usr/bin/env dart
// ignore_for_file: avoid_print // ignore_for_file: avoid_print
import 'dart:convert'; import 'dart:convert';