open dialog from OATH menu

This commit is contained in:
Adam Velebil 2023-02-22 11:42:44 +01:00
parent bfd0f91c14
commit 54f816403b
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10
4 changed files with 19 additions and 15 deletions

View File

@ -71,7 +71,7 @@ class IconPackDialog extends ConsumerWidget {
} else {
showMessage(context, 'Error removing icon pack');
}
Navigator.pop(context);
// don't close the dialog Navigator.pop(context);
},
);
},

View File

@ -22,6 +22,8 @@ const setOrManagePasswordAction = Key('$_prefix.set_or_manage_oath_password');
const addAccountAction = Key('$_prefix.add_account');
const resetAction = Key('$_prefix.reset');
const customIconsAction = Key('$_prefix.custom_icons');
const noAccountsView = Key('$_prefix.no_accounts');
// This is global so we can access it from the global Ctrl+F shortcut.

View File

@ -17,9 +17,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:vector_graphics/vector_graphics.dart';
import 'package:yubico_authenticator/app/message.dart';
import 'package:yubico_authenticator/oath/icon_provider/icon_file_loader.dart';
import 'package:yubico_authenticator/oath/icon_provider/icon_pack_dialog.dart';
import 'package:yubico_authenticator/oath/icon_provider/icon_pack_manager.dart';
import 'package:yubico_authenticator/widgets/delayed_visibility.dart';
@ -36,7 +34,7 @@ class AccountIcon extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final issuerImageFile = ref.watch(iconPackManager).getFileForIssuer(issuer);
final issuerWidget = issuerImageFile != null
return issuerImageFile != null
? VectorGraphic(
width: 40,
height: 40,
@ -55,16 +53,5 @@ class AccountIcon extends ConsumerWidget {
);
})
: defaultWidget;
return IconButton(
onPressed: () async {
await showBlurDialog(
context: context,
builder: (context) => const IconPackDialog(),
);
},
icon: issuerWidget,
tooltip: 'Manage icons',
padding: const EdgeInsets.all(1.0),
);
}
}

View File

@ -19,6 +19,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:yubico_authenticator/oath/icon_provider/icon_pack_dialog.dart';
import '../../app/message.dart';
import '../../app/models.dart';
@ -91,6 +92,20 @@ Widget oathBuildActions(
),
ListTitle(AppLocalizations.of(context)!.general_manage,
textStyle: Theme.of(context).textTheme.bodyLarge),
ListTile(
key: keys.customIconsAction,
title: const Text('Custom icons'),
subtitle: const Text('Set icons for accounts'),
leading: const CircleAvatar(
child: Icon(Icons.image_outlined),
),
onTap: () async {
Navigator.of(context).pop();
await showBlurDialog(
context: context,
builder: (context) => const IconPackDialog(),
);
}),
ListTile(
key: keys.setOrManagePasswordAction,
title: Text(oathState.hasKey