/* * This file is part of Stack Wallet. * * Copyright (c) 2023 Cypher Stack * All Rights Reserved. * The code is distributed under GPLv3 license, see LICENSE file for details. * Generated by Cypher Stack on 2023-05-26 * */ import 'package:flutter/material.dart'; import '../../../themes/stack_colors.dart'; import '../../../utilities/text_styles.dart'; import '../../../utilities/util.dart'; import '../../../widgets/animated_widgets/rotating_arrows.dart'; import '../../../widgets/desktop/desktop_dialog.dart'; import '../../../widgets/desktop/desktop_dialog_close_button.dart'; import '../../../widgets/desktop/secondary_button.dart'; import '../../../widgets/stack_dialog.dart'; class FetchMonkeyDialog extends StatefulWidget { const FetchMonkeyDialog({ super.key, required this.onCancel, }); final Future Function() onCancel; @override State createState() => _FetchMonkeyDialogState(); } class _FetchMonkeyDialogState extends State { late final Future Function() onCancel; @override void initState() { onCancel = widget.onCancel; super.initState(); } @override Widget build(BuildContext context) { if (Util.isDesktop) { return DesktopDialog( child: Column( children: [ DesktopDialogCloseButton( onPressedOverride: () async { await onCancel.call(); if (mounted) { Navigator.of(context).pop(); } }, ), const Spacer( flex: 1, ), const RotatingArrows( width: 40, height: 40, ), const Spacer( flex: 2, ), Text( "Fetching MonKey", style: STextStyles.desktopH2(context), textAlign: TextAlign.center, ), const SizedBox( height: 16, ), Text( "We are fetching your MonKey", style: STextStyles.desktopTextMedium(context).copyWith( color: Theme.of(context).extension()!.textDark3, ), textAlign: TextAlign.center, ), const Spacer( flex: 2, ), Padding( padding: const EdgeInsets.only( left: 32, right: 32, bottom: 32, ), child: SecondaryButton( label: "Cancel", width: 272.5, onPressed: () async { await onCancel.call(); if (mounted) { Navigator.of(context).pop(); } }, ), ), ], ), ); } else { return WillPopScope( onWillPop: () async { return false; }, child: StackDialog( title: "Fetching MonKey", message: "We are fetching your MonKey", icon: const RotatingArrows( width: 24, height: 24, ), rightButton: TextButton( style: Theme.of(context) .extension()! .getSecondaryEnabledButtonStyle(context), child: Text( "Cancel", style: STextStyles.itemSubtitle12(context), ), onPressed: () async { await onCancel.call(); if (mounted) { Navigator.of(context).pop(); } }, ), ), ); } } }