Copy next code to clipboard on tap

This commit is contained in:
vishnukvmd 2023-09-08 18:33:03 +05:30
parent 91cd77ad8d
commit cdb615b0ba
2 changed files with 34 additions and 22 deletions

View file

@ -183,6 +183,7 @@
"enterDetailsManually": "Enter details manually",
"edit": "Edit",
"copiedToClipboard": "Copied to clipboard",
"copiedNextToClipboard": "Copied next code to clipboard",
"error": "Error",
"recoveryKeyCopiedToClipboard": "Recovery key copied to clipboard",
"recoveryKeyOnForgotPassword": "If you forget your password, the only way you can recover your data is with this key.",

View file

@ -214,7 +214,11 @@ class _CodeWidgetState extends State<CodeWidget> {
),
),
widget.code.type == Type.totp
? Column(
? GestureDetector(
onTap: () {
_copyNextToClipboard();
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
@ -237,6 +241,7 @@ class _CodeWidgetState extends State<CodeWidget> {
},
),
],
),
)
: Column(
crossAxisAlignment: CrossAxisAlignment.end,
@ -333,6 +338,12 @@ class _CodeWidgetState extends State<CodeWidget> {
.then((value) => showToast(context, context.l10n.copiedToClipboard));
}
void _copyNextToClipboard() {
FlutterClipboard.copy(_getNextTotp()).then(
(value) => showToast(context, context.l10n.copiedNextToClipboard),
);
}
void _onNextHotpTapped() {
if (widget.code.type == Type.hotp) {
CodeStore.instance