fix, dialog button, reconnect cancel in a short time

1. Two `reconnect` is called.
2. The window cannot be closed.

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-09-29 21:42:49 +08:00
parent 3e61b89499
commit 69062dca16
7 changed files with 33 additions and 12 deletions

View File

@@ -996,11 +996,20 @@ void msgBox(SessionID sessionId, String type, String title, String text,
}));
}
if (reconnect != null && title == "Connection Error") {
buttons.insert(
0,
dialogButton('Reconnect', isOutline: true, onPressed: () {
reconnect(dialogManager, sessionId, false);
}));
final enabled = true.obs;
final button = Obx(
() => dialogButton(
'Reconnect',
isOutline: true,
onPressed: enabled.isTrue
? () {
enabled.value = false;
reconnect(dialogManager, sessionId, false);
}
: null,
),
);
buttons.insert(0, button);
}
if (link.isNotEmpty) {
buttons.insert(0, dialogButton('JumpLink', onPressed: jumplink));