mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
simplex buy warning popup
This commit is contained in:
parent
9286ae9902
commit
6d338b68a1
2 changed files with 55 additions and 4 deletions
|
@ -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<BuyQuotePreviewView> {
|
||||
final isDesktop = Util.isDesktop;
|
||||
|
||||
Future<void> _buy() async {
|
||||
// do buy/redirect to simplex page
|
||||
Future<void> _buyWarning() async {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => BuyWarningPopup(
|
||||
ticker: widget.quote.crypto.ticker.toUpperCase(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -177,7 +183,10 @@ class _BuyQuotePreviewViewState extends State<BuyQuotePreviewView> {
|
|||
),
|
||||
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<BuyQuotePreviewView> {
|
|||
const Spacer(),
|
||||
PrimaryButton(
|
||||
label: "Buy",
|
||||
onPressed: _buy,
|
||||
onPressed: _buyWarning,
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
42
lib/pages/buy_view/sub_widgets/buy_warning_popup.dart
Normal file
42
lib/pages/buy_view/sub_widgets/buy_warning_popup.dart
Normal file
|
@ -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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue