copyToClipboard static method
bool
copyToClipboard(
- String text, {
- String? successMessage,
- BuildContext? context,
- Function? successCallback,
拷贝文本内容到剪切板
Implementation
static bool copyToClipboard(String text,
{String? successMessage,
BuildContext? context,
Function? successCallback}) {
if (TextUtils.isNotEmpty(text)) {
Clipboard.setData(ClipboardData(text: text));
if (context != null) {
if (successCallback != null) {
successCallback();
}
return true;
} else {
return false;
}
}
return false;
}