Copy code on long press as well as on tap
This commit is contained in:
parent
08ad496975
commit
2b5f349b2f
1 changed files with 10 additions and 3 deletions
|
@ -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)),
|
||||
|
|
Loading…
Add table
Reference in a new issue