mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
15 lines
420 B
Dart
15 lines
420 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
Future<void> copyToClipboard(
|
|
BuildContext context,
|
|
String text, {
|
|
String message = 'Copied to clipboard',
|
|
}) async {
|
|
await Clipboard.setData(ClipboardData(text: text));
|
|
if (!context.mounted) return;
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(content: Text(message), duration: const Duration(seconds: 2)),
|
|
);
|
|
}
|