tooltip for https://github.com/rustdesk/rustdesk/issues/8600, and change
dialog error to richtext with link support
This commit is contained in:
parent
8ced4ddaa2
commit
cba8aaa410
@ -1057,6 +1057,49 @@ class CustomAlertDialog extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget createDialogContent(String text) {
|
||||||
|
final RegExp linkRegExp = RegExp(r'(https?://[^\s]+)');
|
||||||
|
final List<TextSpan> spans = [];
|
||||||
|
int start = 0;
|
||||||
|
bool hasLink = false;
|
||||||
|
|
||||||
|
linkRegExp.allMatches(text).forEach((match) {
|
||||||
|
hasLink = true;
|
||||||
|
if (match.start > start) {
|
||||||
|
spans.add(TextSpan(text: text.substring(start, match.start)));
|
||||||
|
}
|
||||||
|
spans.add(TextSpan(
|
||||||
|
text: match.group(0) ?? '',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
),
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
String linkText = match.group(0) ?? '';
|
||||||
|
linkText = linkText.replaceAll(RegExp(r'[.,;!?]+$'), '');
|
||||||
|
launchUrl(Uri.parse(linkText));
|
||||||
|
},
|
||||||
|
));
|
||||||
|
start = match.end;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (start < text.length) {
|
||||||
|
spans.add(TextSpan(text: text.substring(start)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasLink) {
|
||||||
|
return SelectableText(text, style: const TextStyle(fontSize: 15));
|
||||||
|
}
|
||||||
|
|
||||||
|
return SelectableText.rich(
|
||||||
|
TextSpan(
|
||||||
|
style: TextStyle(color: Colors.black, fontSize: 15),
|
||||||
|
children: spans,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void msgBox(SessionID sessionId, String type, String title, String text,
|
void msgBox(SessionID sessionId, String type, String title, String text,
|
||||||
String link, OverlayDialogManager dialogManager,
|
String link, OverlayDialogManager dialogManager,
|
||||||
{bool? hasCancel, ReconnectHandle? reconnect, int? reconnectTimeout}) {
|
{bool? hasCancel, ReconnectHandle? reconnect, int? reconnectTimeout}) {
|
||||||
@ -1214,8 +1257,7 @@ Widget msgboxContent(String type, String title, String text) {
|
|||||||
translate(title),
|
translate(title),
|
||||||
style: TextStyle(fontSize: 21),
|
style: TextStyle(fontSize: 21),
|
||||||
).marginOnly(bottom: 10),
|
).marginOnly(bottom: 10),
|
||||||
SelectableText(translateText(text),
|
createDialogContent(translateText(text)),
|
||||||
style: const TextStyle(fontSize: 15)),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -593,7 +593,7 @@ pub fn request_remote_desktop() -> Result<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(Box::new(DBusError(
|
Err(Box::new(DBusError(
|
||||||
"Failed to obtain screen capture.".into(),
|
"Failed to obtain screen capture. You may need to upgrade the PipeWire library for better compatibility. Please check https://github.com/rustdesk/rustdesk/issues/8600#issuecomment-2254720954 for more details.".into()
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user