Merge pull request #1641 from 21pages/optimize

optimize ui
This commit is contained in:
RustDesk 2022-09-29 10:52:48 +08:00 committed by GitHub
commit 0abda2edef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 13 deletions

View File

@ -642,7 +642,9 @@ void msgBox(
}
dialogManager.show((setState, close) => CustomAlertDialog(
title: _msgBoxTitle(title),
content: Text(translate(text), style: const TextStyle(fontSize: 15)),
content: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 500),
child: Text(translate(text), style: const TextStyle(fontSize: 15))),
actions: buttons,
onSubmit: hasOk ? submit : null,
onCancel: hasCancel == true ? cancel : null,

View File

@ -161,6 +161,20 @@ void enterPasswordDialog(String id, OverlayDialogManager dialogManager) async {
var remember = await bind.sessionGetRemember(id: id) ?? false;
dialogManager.dismissAll();
dialogManager.show((setState, close) {
cancel() {
close();
closeConnection();
}
submit() {
var text = controller.text.trim();
if (text == '') return;
gFFI.login(id, text, remember);
close();
dialogManager.showLoading(translate('Logging in...'),
onCancel: closeConnection);
}
return CustomAlertDialog(
title: Text(translate('Password Required')),
content: Column(mainAxisSize: MainAxisSize.min, children: [
@ -183,25 +197,17 @@ void enterPasswordDialog(String id, OverlayDialogManager dialogManager) async {
actions: [
TextButton(
style: flatButtonStyle,
onPressed: () {
close();
closeConnection();
},
onPressed: cancel,
child: Text(translate('Cancel')),
),
TextButton(
style: flatButtonStyle,
onPressed: () {
var text = controller.text.trim();
if (text == '') return;
gFFI.login(id, text, remember);
close();
dialogManager.showLoading(translate('Logging in...'),
onCancel: closeConnection);
},
onPressed: submit,
child: Text(translate('OK')),
),
],
onSubmit: submit,
onCancel: cancel,
);
});
}