stack_wallet/lib/pages/buy_view/buy_order_details.dart

287 lines
8.9 KiB
Dart
Raw Normal View History

2023-05-26 21:21:16 +00:00
/*
* 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';
2023-07-01 21:06:49 +00:00
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
2024-05-27 23:56:22 +00:00
import '../../models/buy/response_objects/order.dart';
import '../../themes/stack_colors.dart';
import '../../themes/theme_providers.dart';
import '../../utilities/assets.dart';
import '../../utilities/text_styles.dart';
import '../../utilities/util.dart';
import '../../widgets/background.dart';
import '../../widgets/conditional_parent.dart';
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
import '../../widgets/desktop/primary_button.dart';
import '../../widgets/rounded_white_container.dart';
2023-07-01 21:06:49 +00:00
class BuyOrderDetailsView extends ConsumerStatefulWidget {
2023-01-24 23:17:34 +00:00
const BuyOrderDetailsView({
2024-05-27 23:56:22 +00:00
super.key,
required this.order,
2024-05-27 23:56:22 +00:00
});
final SimplexOrder order;
2023-01-24 23:17:34 +00:00
static const String routeName = "/buyOrderDetails";
@override
2023-07-01 21:06:49 +00:00
ConsumerState<BuyOrderDetailsView> createState() =>
_BuyOrderDetailsViewState();
}
2023-07-01 21:06:49 +00:00
class _BuyOrderDetailsViewState extends ConsumerState<BuyOrderDetailsView> {
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(
"Order details",
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(
"Simplex order",
style: STextStyles.pageTitleH1(context),
),
const SizedBox(
height: 16,
),
RoundedWhiteContainer(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Purchase ID",
style: STextStyles.label(context),
),
Text(
widget.order.paymentId,
style: STextStyles.label(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark,
),
),
],
),
),
const SizedBox(
height: 8,
),
RoundedWhiteContainer(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"User ID",
style: STextStyles.label(context),
),
Text(
widget.order.userId,
style: STextStyles.label(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark,
),
),
],
),
),
const SizedBox(
height: 8,
),
RoundedWhiteContainer(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Quote ID",
style: STextStyles.label(context),
),
Text(
widget.order.quote.id,
style: STextStyles.label(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark,
),
),
],
),
),
const SizedBox(
height: 8,
),
RoundedWhiteContainer(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Quoted cost",
style: STextStyles.label(context),
),
Text(
"${widget.order.quote.youPayFiatPrice.toStringAsFixed(2)} ${widget.order.quote.fiat.ticker.toUpperCase()}",
style: STextStyles.label(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark,
),
),
],
),
),
const SizedBox(
height: 8,
),
// 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,
// ),
RoundedWhiteContainer(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Quoted amount",
style: STextStyles.label(context),
),
Text(
"${widget.order.quote.youReceiveCryptoAmount} ${widget.order.quote.crypto.ticker.toUpperCase()}",
style: STextStyles.label(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark,
),
),
],
),
),
const SizedBox(
height: 8,
),
RoundedWhiteContainer(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Receiving ${widget.order.quote.crypto.ticker.toUpperCase()} address",
style: STextStyles.label(context),
),
Text(
"${widget.order.quote.receivingAddress} ",
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(
2023-07-01 21:06:49 +00:00
Assets.buy.simplexLogo(
ref.watch(themeProvider).brightness,
),
),
),
],
),
),
const SizedBox(
height: 24,
),
2024-05-27 23:56:22 +00:00
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,
),
2024-05-27 23:56:22 +00:00
],
),
const Spacer(),
PrimaryButton(
label: "Dismiss",
onPressed: () {
Navigator.of(context, rootNavigator: isDesktop).pop();
},
2024-05-27 23:56:22 +00:00
),
],
),
);
}
}