Copy code on long press as well as on tap

This commit is contained in:
vishnukvmd 2022-11-14 20:30:15 +05:30
parent 08ad496975
commit 2b5f349b2f

View file

@ -79,9 +79,10 @@ class _CodeWidgetState extends State<CodeWidget> {
borderRadius: BorderRadius.circular(10),
),
onTap: () {
FlutterClipboard.copy(_getTotp()).then(
(value) => showToast(context, "Copied to clipboard"),
);
_copyToClipboard();
},
onLongPress: () {
_copyToClipboard();
},
child: SizedBox(
child: Column(
@ -155,6 +156,12 @@ class _CodeWidgetState extends State<CodeWidget> {
);
}
void _copyToClipboard() {
FlutterClipboard.copy(_getTotp()).then(
(value) => showToast(context, "Copied to clipboard"),
);
}
void _onDeletePressed(_) {
final AlertDialog alert = AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),