diff --git a/lib/pages/buy_view/buy_form.dart b/lib/pages/buy_view/buy_form.dart index 83b47e136..8dd2773fd 100644 --- a/lib/pages/buy_view/buy_form.dart +++ b/lib/pages/buy_view/buy_form.dart @@ -40,6 +40,7 @@ import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart'; import 'package:stackwallet/widgets/icon_widgets/x_icon.dart'; import 'package:stackwallet/widgets/rounded_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart'; +import 'package:stackwallet/widgets/stack_dialog.dart'; import 'package:stackwallet/widgets/stack_text_field.dart'; import 'package:stackwallet/widgets/textfield_icon_button.dart'; @@ -360,8 +361,6 @@ class _BuyFormState extends ConsumerState { } Future previewQuote(SimplexQuote quote) async { - // if (ref.read(simplexProvider).quote.id == "someID") { - // // TODO make a better way of detecting a default SimplexQuote bool shouldPop = false; unawaited( showDialog( @@ -395,17 +394,86 @@ class _BuyFormState extends ConsumerState { if (mounted) { Navigator.of(context, rootNavigator: isDesktop).pop(); } - // } - await _showFloatingBuyQuotePreviewSheet( - quote: ref.read(simplexProvider).quote, - onSelected: (quote) { - // setState(() { - // selectedFiat = fiat; - // }); - // TODO launch URL - }, - ); + if (quote.id == 'someID') { + // TODO detect default quote better + await _showFloatingBuyQuotePreviewSheet( + quote: ref.read(simplexProvider).quote, + onSelected: (quote) { + // setState(() { + // selectedFiat = fiat; + // }); + // TODO launch URL + }, + ); + } else { + await showDialog( + context: context, + barrierDismissible: true, + builder: (context) { + if (isDesktop) { + return DesktopDialog( + maxWidth: 450, + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Simplex API unresponsive", + style: STextStyles.desktopH3(context), + ), + const SizedBox( + height: 24, + ), + Text( + "Simplex API unresponsive, please try again later", + style: STextStyles.smallMed14(context), + ), + const SizedBox( + height: 56, + ), + Row( + children: [ + const Spacer(), + Expanded( + child: PrimaryButton( + buttonHeight: ButtonHeight.l, + label: "Ok", + onPressed: Navigator.of(context).pop, + ), + ), + ], + ) + ], + ), + ), + ); + } else { + return StackDialog( + title: "Simplex API unresponsive", + message: "Simplex API unresponsive, please try again later", + rightButton: TextButton( + style: Theme.of(context) + .extension()! + .getSecondaryEnabledButtonStyle(context), + child: Text( + "Ok", + style: STextStyles.button(context).copyWith( + color: Theme.of(context) + .extension()! + .accentColorDark), + ), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ); + } + }, + ); + } } Future _loadQuote(SimplexQuote quote) async {