mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 10:49:49 +08:00
Update button_copy.dart
This commit is contained in:
@@ -16,10 +16,16 @@ class CopyButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var sm = ScaffoldMessenger.of(context);
|
||||
String msg;
|
||||
onPressed() async {
|
||||
try {
|
||||
await Clipboard.setData(ClipboardData(text: toCopy));
|
||||
msg = "Copied";
|
||||
} catch (e) {
|
||||
msg = "An error occurred";
|
||||
}
|
||||
sm.hideCurrentSnackBar();
|
||||
sm.showSnackBar(getSnackBar("Copied"));
|
||||
sm.showSnackBar(getSnackBar(msg));
|
||||
}
|
||||
|
||||
return showLabel
|
||||
|
||||
Reference in New Issue
Block a user