2021-04-26 07:33:54 +00:00
|
|
|
import 'package:clipboard/clipboard.dart';
|
|
|
|
import 'package:comunic/utils/intl_utils.dart';
|
|
|
|
import 'package:comunic/utils/ui_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
/// Icon used to copy content in clipboard
|
|
|
|
///
|
|
|
|
/// @author Pierre Hubert
|
|
|
|
|
|
|
|
class CopyIcon extends StatelessWidget {
|
|
|
|
final String value;
|
|
|
|
|
|
|
|
const CopyIcon(this.value) : assert(value != null);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return IconButton(
|
|
|
|
icon: Icon(Icons.content_copy),
|
|
|
|
onPressed: () {
|
|
|
|
FlutterClipboard.copy(value);
|
2022-03-10 18:39:57 +00:00
|
|
|
snack(context, tr("'%c%' was copied to clipboard", args: {"c": value})!);
|
2021-04-26 07:33:54 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|