diff --git a/lib/pages/buy_view/buy_quote_preview.dart b/lib/pages/buy_view/buy_quote_preview.dart index df21ad91a..311a676d1 100644 --- a/lib/pages/buy_view/buy_quote_preview.dart +++ b/lib/pages/buy_view/buy_quote_preview.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/models/buy/response_objects/quote.dart'; +import 'package:stackwallet/pages/buy_view/sub_widgets/buy_warning_popup.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart'; @@ -28,8 +29,13 @@ class BuyQuotePreviewView extends StatefulWidget { class _BuyQuotePreviewViewState extends State { final isDesktop = Util.isDesktop; - Future _buy() async { - // do buy/redirect to simplex page + Future _buyWarning() async { + await showDialog( + context: context, + builder: (context) => BuyWarningPopup( + ticker: widget.quote.crypto.ticker.toUpperCase(), + ), + ); } @override @@ -177,7 +183,10 @@ class _BuyQuotePreviewViewState extends State { ), SizedBox( width: 64, - child: SvgPicture.asset(Assets.buy.simplexLogo), + height: 32, + child: SvgPicture.asset( + Assets.buy.simplexLogo, + ), ), ], ), @@ -188,7 +197,7 @@ class _BuyQuotePreviewViewState extends State { const Spacer(), PrimaryButton( label: "Buy", - onPressed: _buy, + onPressed: _buyWarning, ) ], ), diff --git a/lib/pages/buy_view/sub_widgets/buy_warning_popup.dart b/lib/pages/buy_view/sub_widgets/buy_warning_popup.dart new file mode 100644 index 000000000..42a0554a8 --- /dev/null +++ b/lib/pages/buy_view/sub_widgets/buy_warning_popup.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:stackwallet/utilities/assets.dart'; +import 'package:stackwallet/widgets/desktop/primary_button.dart'; +import 'package:stackwallet/widgets/desktop/secondary_button.dart'; +import 'package:stackwallet/widgets/stack_dialog.dart'; + +class BuyWarningPopup extends StatelessWidget { + const BuyWarningPopup({ + Key? key, + required this.ticker, + }) : super(key: key); + + final String ticker; + + @override + Widget build(BuildContext context) { + return StackDialog( + title: "Buy $ticker", + message: "This purchase is provided and fulfilled by Simplex by nuvei " + "(a third party). You will be taken to their website. Please follow " + "their instructions.", + leftButton: SecondaryButton( + label: "Cancel", + onPressed: Navigator.of(context).pop, + ), + rightButton: PrimaryButton( + label: "Continue", + onPressed: () async { + // todo open simplex page in external browser + }, + ), + icon: SizedBox( + width: 64, + height: 32, + child: SvgPicture.asset( + Assets.buy.simplexLogo, + ), + ), + ); + } +}