loading indicator and delay for wallet keys

This commit is contained in:
ryleedavis 2022-11-21 15:17:26 -07:00
parent a10958b12d
commit 7a650c78d3

View file

@ -16,6 +16,7 @@ import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart'; import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart'; import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart'; import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
import 'package:stackwallet/widgets/stack_text_field.dart'; import 'package:stackwallet/widgets/stack_text_field.dart';
class UnlockWalletKeysDesktop extends ConsumerStatefulWidget { class UnlockWalletKeysDesktop extends ConsumerStatefulWidget {
@ -201,11 +202,32 @@ class _UnlockWalletKeysDesktopState
enabled: continueEnabled, enabled: continueEnabled,
onPressed: continueEnabled onPressed: continueEnabled
? () async { ? () async {
unawaited(
showDialog(
context: context,
builder: (context) => Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
LoadingIndicator(
width: 200,
height: 200,
),
],
),
),
);
await Future<void>.delayed(
const Duration(seconds: 1));
final verified = await ref final verified = await ref
.read(storageCryptoHandlerProvider) .read(storageCryptoHandlerProvider)
.verifyPassphrase(passwordController.text); .verifyPassphrase(passwordController.text);
if (verified) { if (verified) {
Navigator.of(context, rootNavigator: true).pop();
final words = await ref final words = await ref
.read(walletsChangeNotifierProvider) .read(walletsChangeNotifierProvider)
.getManager(widget.walletId) .getManager(widget.walletId)
@ -219,6 +241,11 @@ class _UnlockWalletKeysDesktopState
); );
} }
} else { } else {
Navigator.of(context, rootNavigator: true).pop();
await Future<void>.delayed(
const Duration(milliseconds: 300));
unawaited( unawaited(
showFloatingFlushBar( showFloatingFlushBar(
type: FlushBarType.warning, type: FlushBarType.warning,