2023-01-24 23:00:53 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import 'package:stackwallet/models/buy/response_objects/order.dart';
|
|
|
|
import 'package:stackwallet/utilities/assets.dart';
|
|
|
|
import 'package:stackwallet/utilities/text_styles.dart';
|
|
|
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
|
|
|
import 'package:stackwallet/utilities/util.dart';
|
|
|
|
import 'package:stackwallet/widgets/background.dart';
|
|
|
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
|
|
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
|
|
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
|
|
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
|
|
|
|
2023-01-24 23:17:34 +00:00
|
|
|
class BuyOrderDetailsView extends StatefulWidget {
|
|
|
|
const BuyOrderDetailsView({
|
2023-01-24 23:00:53 +00:00
|
|
|
Key? key,
|
|
|
|
required this.order,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
final SimplexOrder order;
|
|
|
|
|
2023-01-24 23:17:34 +00:00
|
|
|
static const String routeName = "/buyOrderDetails";
|
2023-01-24 23:00:53 +00:00
|
|
|
|
|
|
|
@override
|
2023-01-24 23:17:34 +00:00
|
|
|
State<BuyOrderDetailsView> createState() => _BuyOrderDetailsViewState();
|
2023-01-24 23:00:53 +00:00
|
|
|
}
|
|
|
|
|
2023-01-24 23:17:34 +00:00
|
|
|
class _BuyOrderDetailsViewState extends State<BuyOrderDetailsView> {
|
2023-01-24 23:00:53 +00:00
|
|
|
final isDesktop = Util.isDesktop;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ConditionalParent(
|
|
|
|
condition: !isDesktop,
|
|
|
|
builder: (child) {
|
|
|
|
return Background(
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).extension<StackColors>()!.background,
|
|
|
|
appBar: AppBar(
|
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).extension<StackColors>()!.backgroundAppBar,
|
|
|
|
leading: const AppBarBackButton(),
|
|
|
|
title: Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"Order details",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.navBarTitle(context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: LayoutBuilder(
|
|
|
|
builder: (builderContext, constraints) {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
left: 12,
|
|
|
|
top: 12,
|
|
|
|
right: 12,
|
|
|
|
),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: ConstrainedBox(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
minHeight: constraints.maxHeight - 24,
|
|
|
|
),
|
|
|
|
child: IntrinsicHeight(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"Simplex order",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.pageTitleH1(context),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 16,
|
|
|
|
),
|
|
|
|
RoundedWhiteContainer(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"Purchase ID",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context),
|
|
|
|
),
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
widget.order.paymentId,
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context).copyWith(
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
RoundedWhiteContainer(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"User ID",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context),
|
|
|
|
),
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
widget.order.userId,
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context).copyWith(
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
RoundedWhiteContainer(
|
2023-01-24 23:15:36 +00:00
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
2023-01-24 23:00:53 +00:00
|
|
|
children: [
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"Quote ID",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context),
|
|
|
|
),
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
widget.order.quote.id,
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context).copyWith(
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
RoundedWhiteContainer(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"Quoted cost",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context),
|
|
|
|
),
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"${widget.order.quote.youPayFiatPrice.toStringAsFixed(2)} ${widget.order.quote.fiat.ticker.toUpperCase()}",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context).copyWith(
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
2023-01-24 23:15:36 +00:00
|
|
|
// RoundedWhiteContainer(
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
// children: [
|
|
|
|
// Text(
|
|
|
|
// "You pay with",
|
|
|
|
// style: STextStyles.label(context),
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// widget.quote.fiat.name,
|
|
|
|
// style: STextStyles.label(context).copyWith(
|
|
|
|
// color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// const SizedBox(
|
|
|
|
// height: 8,
|
|
|
|
// ),
|
2023-01-24 23:00:53 +00:00
|
|
|
RoundedWhiteContainer(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"Quoted amount",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context),
|
|
|
|
),
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"${widget.order.quote.youReceiveCryptoAmount} ${widget.order.quote.crypto.ticker.toUpperCase()}",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context).copyWith(
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
RoundedWhiteContainer(
|
2023-01-24 23:15:36 +00:00
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2023-01-24 23:00:53 +00:00
|
|
|
children: [
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"Receiving ${widget.order.quote.crypto.ticker.toUpperCase()} address",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context),
|
|
|
|
),
|
|
|
|
Text(
|
2023-01-24 23:15:36 +00:00
|
|
|
"${widget.order.quote.receivingAddress} ",
|
2023-01-24 23:00:53 +00:00
|
|
|
style: STextStyles.label(context).copyWith(
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
RoundedWhiteContainer(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"Provider",
|
|
|
|
style: STextStyles.label(context),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 64,
|
|
|
|
height: 32,
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
Assets.buy.simplexLogo(context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 24,
|
|
|
|
),
|
|
|
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
|
|
|
Text(
|
|
|
|
"This information is not saved,\nscreenshot it now for your records",
|
|
|
|
style: STextStyles.label(context).copyWith(
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
const Spacer(),
|
|
|
|
PrimaryButton(
|
|
|
|
label: "Dismiss",
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context, rootNavigator: isDesktop).pop();
|
|
|
|
},
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|