mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
portable-service: better prompt message
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -627,7 +627,7 @@ class CustomAlertDialog extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
void msgBox(String type, String title, String text, String link,
|
||||
void msgBox(String id, String type, String title, String text, String link,
|
||||
OverlayDialogManager dialogManager,
|
||||
{bool? hasCancel}) {
|
||||
dialogManager.dismissAll();
|
||||
@@ -672,14 +672,17 @@ void msgBox(String type, String title, String text, String link,
|
||||
if (link.isNotEmpty) {
|
||||
buttons.insert(0, msgBoxButton(translate('JumpLink'), jumplink));
|
||||
}
|
||||
dialogManager.show((setState, close) => CustomAlertDialog(
|
||||
title: _msgBoxTitle(title),
|
||||
content: SelectableText(translate(text),
|
||||
style: const TextStyle(fontSize: 15)),
|
||||
actions: buttons,
|
||||
onSubmit: hasOk ? submit : null,
|
||||
onCancel: hasCancel == true ? cancel : null,
|
||||
));
|
||||
dialogManager.show(
|
||||
(setState, close) => CustomAlertDialog(
|
||||
title: _msgBoxTitle(title),
|
||||
content:
|
||||
SelectableText(translate(text), style: const TextStyle(fontSize: 15)),
|
||||
actions: buttons,
|
||||
onSubmit: hasOk ? submit : null,
|
||||
onCancel: hasCancel == true ? cancel : null,
|
||||
),
|
||||
tag: '$id-$type-$title-$text-$link',
|
||||
);
|
||||
}
|
||||
|
||||
Widget msgBoxButton(String text, void Function() onPressed) {
|
||||
|
||||
@@ -163,7 +163,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
super.build(context);
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
clientClose(_ffi.dialogManager);
|
||||
clientClose(widget.id, _ffi.dialogManager);
|
||||
return false;
|
||||
},
|
||||
child: MultiProvider(providers: [
|
||||
|
||||
@@ -489,7 +489,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
return IconButton(
|
||||
tooltip: translate('Close'),
|
||||
onPressed: () {
|
||||
clientClose(widget.ffi.dialogManager);
|
||||
clientClose(widget.id, widget.ffi.dialogManager);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.close,
|
||||
|
||||
@@ -63,7 +63,8 @@ class _FileManagerPageState extends State<FileManagerPage> {
|
||||
leading: Row(children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: () => clientClose(gFFI.dialogManager)),
|
||||
onPressed: () =>
|
||||
clientClose(widget.id, gFFI.dialogManager)),
|
||||
]),
|
||||
centerTitle: true,
|
||||
title: ToggleSwitch(
|
||||
|
||||
@@ -223,7 +223,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
clientClose(gFFI.dialogManager);
|
||||
clientClose(widget.id, gFFI.dialogManager);
|
||||
return false;
|
||||
},
|
||||
child: getRawPointerAndKeyBody(Scaffold(
|
||||
@@ -304,7 +304,7 @@ class _RemotePageState extends State<RemotePage> {
|
||||
color: Colors.white,
|
||||
icon: Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
clientClose(gFFI.dialogManager);
|
||||
clientClose(widget.id, gFFI.dialogManager);
|
||||
},
|
||||
)
|
||||
] +
|
||||
|
||||
@@ -5,9 +5,9 @@ import '../../common.dart';
|
||||
import '../../models/model.dart';
|
||||
import '../../models/platform_model.dart';
|
||||
|
||||
void clientClose(OverlayDialogManager dialogManager) {
|
||||
msgBox(
|
||||
'', 'Close', 'Are you sure to close the connection?', '', dialogManager);
|
||||
void clientClose(String id, OverlayDialogManager dialogManager) {
|
||||
msgBox(id, '', 'Close', 'Are you sure to close the connection?', '',
|
||||
dialogManager);
|
||||
}
|
||||
|
||||
void showSuccess() {
|
||||
|
||||
@@ -195,6 +195,8 @@ class FfiModel with ChangeNotifier {
|
||||
} else if (name == 'show_elevation') {
|
||||
final show = evt['show'].toString() == 'true';
|
||||
parent.target?.serverModel.setShowElevation(show);
|
||||
} else if (name == 'cancel_msgbox') {
|
||||
cancelMsgBox(evt, peerId);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -231,6 +233,13 @@ class FfiModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
cancelMsgBox(Map<String, dynamic> evt, String id) {
|
||||
if (parent.target == null) return;
|
||||
final dialogManager = parent.target!.dialogManager;
|
||||
final tag = '$id-${evt['tag']}';
|
||||
dialogManager.dismissByTag(tag);
|
||||
}
|
||||
|
||||
/// Handle the message box event based on [evt] and [id].
|
||||
handleMsgBox(Map<String, dynamic> evt, String id) {
|
||||
if (parent.target == null) return;
|
||||
@@ -256,7 +265,7 @@ class FfiModel with ChangeNotifier {
|
||||
showMsgBox(String id, String type, String title, String text, String link,
|
||||
bool hasRetry, OverlayDialogManager dialogManager,
|
||||
{bool? hasCancel}) {
|
||||
msgBox(type, title, text, link, dialogManager, hasCancel: hasCancel);
|
||||
msgBox(id, type, title, text, link, dialogManager, hasCancel: hasCancel);
|
||||
_timer?.cancel();
|
||||
if (hasRetry) {
|
||||
_timer = Timer(Duration(seconds: _reconnects), () {
|
||||
|
||||
Reference in New Issue
Block a user