copyText static method
Implementation
static void copyText(
{required String text, String? message, required BuildContext context}) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
FlutterClipboard.copy(text).then((_) {
// ignore: use_build_context_synchronously
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Row(
children: [
const Icon(Icons.copy, size: 20, color: Colors.white),
const SizedBox(width: 8),
Text(message ?? 'Copied to clipboard'),
],
),
duration: const Duration(seconds: 2),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
);
});
}