|
@@ -3,6 +3,7 @@ import 'dart:async';
|
|
|
import 'package:clipboard/clipboard.dart';
|
|
|
import 'package:ente_auth/ente_theme_data.dart';
|
|
|
import 'package:ente_auth/models/code.dart';
|
|
|
+import 'package:ente_auth/onboarding/view/setup_enter_secret_key_page.dart';
|
|
|
import 'package:ente_auth/store/code_store.dart';
|
|
|
import 'package:ente_auth/utils/toast_util.dart';
|
|
|
import 'package:ente_auth/utils/totp_util.dart';
|
|
@@ -55,6 +56,20 @@ class _CodeWidgetState extends State<CodeWidget> {
|
|
|
endActionPane: ActionPane(
|
|
|
motion: const ScrollMotion(),
|
|
|
children: [
|
|
|
+ SlidableAction(
|
|
|
+ onPressed: _onEditPressed,
|
|
|
+ backgroundColor: Colors.grey.withOpacity(0.1),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(12.0)),
|
|
|
+ foregroundColor:
|
|
|
+ Theme.of(context).colorScheme.inverseBackgroundColor,
|
|
|
+ icon: Icons.edit_outlined,
|
|
|
+ label: 'Edit',
|
|
|
+ padding: const EdgeInsets.only(left: 4, right: 0),
|
|
|
+ spacing: 8,
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ width: 4,
|
|
|
+ ),
|
|
|
SlidableAction(
|
|
|
onPressed: _onDeletePressed,
|
|
|
backgroundColor: Colors.grey.withOpacity(0.1),
|
|
@@ -63,6 +78,7 @@ class _CodeWidgetState extends State<CodeWidget> {
|
|
|
icon: Icons.delete,
|
|
|
label: 'Delete',
|
|
|
padding: const EdgeInsets.only(left: 0, right: 0),
|
|
|
+ spacing: 8,
|
|
|
),
|
|
|
],
|
|
|
),
|
|
@@ -194,6 +210,19 @@ class _CodeWidgetState extends State<CodeWidget> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Future<void> _onEditPressed(_) async {
|
|
|
+ final Code? code = await Navigator.of(context).push(
|
|
|
+ MaterialPageRoute(
|
|
|
+ builder: (BuildContext context) {
|
|
|
+ return SetupEnterSecretKeyPage(code: widget.code);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ if (code != null) {
|
|
|
+ CodeStore.instance.addCode(code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
void _onDeletePressed(_) {
|
|
|
final AlertDialog alert = AlertDialog(
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|