11import 'package:flutter/foundation.dart' ;
22import 'package:flutter/material.dart' ;
33import 'package:flutter/services.dart' ;
4- import 'package:flutter_riverpod/flutter_riverpod.dart' ;
54import 'package:open_authenticator/i18n/translations.g.dart' ;
65import 'package:open_authenticator/model/totp/decrypted.dart' ;
76import 'package:open_authenticator/model/totp/totp.dart' ;
@@ -12,7 +11,7 @@ import 'package:open_authenticator/widgets/totp/code.dart';
1211import 'package:open_authenticator/widgets/totp/image.dart' ;
1312
1413/// Allows to display TOTPs in a [ListView] .
15- class TotpWidget extends ConsumerWidget {
14+ class TotpWidget extends StatelessWidget {
1615 /// The TOTP instance.
1716 final Totp totp;
1817
@@ -51,7 +50,7 @@ class TotpWidget extends ConsumerWidget {
5150 });
5251
5352 @override
54- Widget build (BuildContext context, WidgetRef ref ) {
53+ Widget build (BuildContext context) {
5554 Widget result = Padding (
5655 padding: contentPadding,
5756 child: Row (
@@ -126,22 +125,22 @@ class TotpWidget extends ConsumerWidget {
126125 );
127126 return (currentPlatform.isMobile || kDebugMode)
128127 ? InkWell (
129- onLongPress: () => _showMobileActionsMenu (context, ref ),
128+ onLongPress: () => _showMobileActionsMenu (context),
130129 child: result,
131130 )
132131 : result;
133132 }
134133
135134 /// Allows to copy the code to the clipboard.
136135 Future <void > _copyCode (BuildContext context) async {
137- await Clipboard .setData (ClipboardData (text: (totp as DecryptedTotp ).generator. value (). toString ()));
136+ await Clipboard .setData (ClipboardData (text: (totp as DecryptedTotp ).generateCode ()));
138137 if (context.mounted) {
139138 SnackBarIcon .showSuccessSnackBar (context, text: translations.totp.actions.copyConfirmation);
140139 }
141140 }
142141
143142 /// Triggered when the user long presses the widget on mobile.
144- Future <void > _showMobileActionsMenu (BuildContext context, WidgetRef ref ) async {
143+ Future <void > _showMobileActionsMenu (BuildContext context) async {
145144 if (! currentPlatform.isMobile && ! kDebugMode) {
146145 Navigator .pushNamed (context, TotpPage .name);
147146 return ;
0 commit comments