mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 13:14:32 +00:00
WIP: trade details for desktop
This commit is contained in:
parent
af47c67231
commit
2aa8dd2bec
2 changed files with 872 additions and 530 deletions
|
@ -15,17 +15,23 @@ import 'package:stackwallet/pages/wallet_view/transaction_views/edit_note_view.d
|
||||||
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
|
import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart';
|
||||||
import 'package:stackwallet/providers/global/trades_service_provider.dart';
|
import 'package:stackwallet/providers/global/trades_service_provider.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
|
import 'package:stackwallet/route_generator.dart';
|
||||||
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
|
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
|
||||||
import 'package:stackwallet/services/exchange/exchange.dart';
|
import 'package:stackwallet/services/exchange/exchange.dart';
|
||||||
import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart';
|
import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
||||||
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||||
import 'package:stackwallet/utilities/format.dart';
|
import 'package:stackwallet/utilities/format.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_container.dart';
|
import 'package:stackwallet/widgets/rounded_container.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
@ -157,10 +163,15 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
final sendAmount =
|
final sendAmount =
|
||||||
Decimal.tryParse(trade.payInAmount) ?? Decimal.parse("-1");
|
Decimal.tryParse(trade.payInAmount) ?? Decimal.parse("-1");
|
||||||
|
|
||||||
return Scaffold(
|
final isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
|
return ConditionalParent(
|
||||||
|
condition: !isDesktop,
|
||||||
|
builder: (child) => Scaffold(
|
||||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
backgroundColor:
|
||||||
|
Theme.of(context).extension<StackColors>()!.background,
|
||||||
leading: AppBarBackButton(
|
leading: AppBarBackButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
@ -176,15 +187,89 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Column(
|
child: child,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.only(left: 32)
|
||||||
|
: const EdgeInsets.all(0),
|
||||||
|
child: BranchedParent(
|
||||||
|
condition: isDesktop,
|
||||||
|
conditionBranchBuilder: (children) => Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
right: 20,
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
right: 12,
|
||||||
|
),
|
||||||
|
child: RoundedWhiteContainer(
|
||||||
|
borderColor: isDesktop
|
||||||
|
? Theme.of(context).extension<StackColors>()!.background
|
||||||
|
: null,
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
child: ListView(
|
||||||
|
primary: false,
|
||||||
|
shrinkWrap: true,
|
||||||
|
children: children,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
otherBranchBuilder: (children) => Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
mainAxisSize: isDesktop ? MainAxisSize.min : MainAxisSize.max,
|
||||||
|
children: children,
|
||||||
|
),
|
||||||
children: [
|
children: [
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(0)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
|
child: Container(
|
||||||
|
decoration: isDesktop
|
||||||
|
? BoxDecoration(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.background,
|
||||||
|
borderRadius: BorderRadius.vertical(
|
||||||
|
top: Radius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
child: Padding(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(12)
|
||||||
|
: const EdgeInsets.all(0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
if (isDesktop)
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
_fetchIconAssetForStatus(trade.status),
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
SelectableText(
|
||||||
|
"Exchange",
|
||||||
|
style: STextStyles.desktopTextMedium(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: isDesktop
|
||||||
|
? CrossAxisAlignment.end
|
||||||
|
: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SelectableText(
|
SelectableText(
|
||||||
"${trade.payInCurrency.toUpperCase()} → ${trade.payOutCurrency.toUpperCase()}",
|
"${trade.payInCurrency.toUpperCase()} → ${trade.payOutCurrency.toUpperCase()}",
|
||||||
|
@ -194,7 +279,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
height: 4,
|
height: 4,
|
||||||
),
|
),
|
||||||
SelectableText(
|
SelectableText(
|
||||||
"${Format.localizedStringAsFixed(value: sendAmount, locale: ref.watch(
|
"-${Format.localizedStringAsFixed(value: sendAmount, locale: ref.watch(
|
||||||
localeServiceChangeNotifierProvider
|
localeServiceChangeNotifierProvider
|
||||||
.select((value) => value.locale),
|
.select((value) => value.locale),
|
||||||
), decimalPlaces: trade.payInCurrency.toLowerCase() == "xmr" ? 12 : 8)} ${trade.payInCurrency.toUpperCase()}",
|
), decimalPlaces: trade.payInCurrency.toLowerCase() == "xmr" ? 12 : 8)} ${trade.payInCurrency.toUpperCase()}",
|
||||||
|
@ -202,6 +287,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
if (!isDesktop)
|
||||||
Container(
|
Container(
|
||||||
width: 32,
|
width: 32,
|
||||||
height: 32,
|
height: 32,
|
||||||
|
@ -219,10 +305,17 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
|
),
|
||||||
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
@ -247,11 +340,16 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!sentFromStack && !hasTx)
|
if (!sentFromStack && !hasTx)
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (!sentFromStack && !hasTx)
|
if (!sentFromStack && !hasTx)
|
||||||
RoundedContainer(
|
RoundedContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.warningBackground,
|
.warningBackground,
|
||||||
|
@ -270,9 +368,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text:
|
text:
|
||||||
"If you send less than ${sendAmount.toStringAsFixed(
|
"If you send less than ${sendAmount.toStringAsFixed(
|
||||||
trade.payInCurrency.toLowerCase() == "xmr"
|
trade.payInCurrency.toLowerCase() == "xmr" ? 12 : 8,
|
||||||
? 12
|
|
||||||
: 8,
|
|
||||||
)} ${trade.payInCurrency.toUpperCase()}, your transaction may not be converted and it may not be refunded.",
|
)} ${trade.payInCurrency.toUpperCase()}, your transaction may not be converted and it may not be refunded.",
|
||||||
style: STextStyles.label(context).copyWith(
|
style: STextStyles.label(context).copyWith(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
|
@ -284,11 +380,16 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (sentFromStack)
|
if (sentFromStack)
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (sentFromStack)
|
if (sentFromStack)
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
@ -306,32 +407,58 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
GestureDetector(
|
BlueTextButton(
|
||||||
|
text: "View transaction",
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final Coin coin = coinFromTickerCaseInsensitive(
|
final Coin coin =
|
||||||
trade.payInCurrency);
|
coinFromTickerCaseInsensitive(trade.payInCurrency);
|
||||||
|
|
||||||
|
if (isDesktop) {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
FadePageRoute<void>(
|
||||||
|
DesktopDialog(
|
||||||
|
maxHeight:
|
||||||
|
MediaQuery.of(context).size.height - 64,
|
||||||
|
maxWidth: 580,
|
||||||
|
child: TransactionDetailsView(
|
||||||
|
coin: coin,
|
||||||
|
transaction: transactionIfSentFromStack!,
|
||||||
|
walletId: walletId!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const RouteSettings(
|
||||||
|
name: TransactionDetailsView.routeName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
TransactionDetailsView.routeName,
|
TransactionDetailsView.routeName,
|
||||||
arguments: Tuple3(
|
arguments: Tuple3(
|
||||||
transactionIfSentFromStack!, coin, walletId!),
|
transactionIfSentFromStack!, coin, walletId!),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
|
||||||
"View transaction",
|
|
||||||
style: STextStyles.link2(context),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (sentFromStack)
|
if (sentFromStack)
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (sentFromStack)
|
if (sentFromStack)
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
child: Column(
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
|
@ -347,13 +474,24 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
IconCopyButton(
|
||||||
|
data: trade.payInAddress,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (!sentFromStack && !hasTx)
|
if (!sentFromStack && !hasTx)
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (!sentFromStack && !hasTx)
|
if (!sentFromStack && !hasTx)
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
@ -364,7 +502,11 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
"Send ${trade.payInCurrency.toUpperCase()} to this address",
|
"Send ${trade.payInCurrency.toUpperCase()} to this address",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
isDesktop
|
||||||
|
? IconCopyButton(
|
||||||
|
data: trade.payInAddress,
|
||||||
|
)
|
||||||
|
: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final address = trade.payInAddress;
|
final address = trade.payInAddress;
|
||||||
await Clipboard.setData(
|
await Clipboard.setData(
|
||||||
|
@ -417,18 +559,15 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
useSafeArea: false,
|
useSafeArea: false,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
final width =
|
final width = MediaQuery.of(context).size.width / 2;
|
||||||
MediaQuery.of(context).size.width / 2;
|
|
||||||
return StackDialogBase(
|
return StackDialogBase(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"Send ${trade.payInCurrency.toUpperCase()} to this address",
|
"Send ${trade.payInCurrency.toUpperCase()} to this address",
|
||||||
style:
|
style: STextStyles.pageTitleH2(context),
|
||||||
STextStyles.pageTitleH2(context),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -443,12 +582,10 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
child: QrImage(
|
child: QrImage(
|
||||||
data: trade.payInAddress,
|
data: trade.payInAddress,
|
||||||
size: width,
|
size: width,
|
||||||
backgroundColor: Theme.of(
|
backgroundColor: Theme.of(context)
|
||||||
context)
|
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.popupBG,
|
.popupBG,
|
||||||
foregroundColor: Theme.of(
|
foregroundColor: Theme.of(context)
|
||||||
context)
|
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.accentColorDark),
|
.accentColorDark),
|
||||||
),
|
),
|
||||||
|
@ -474,8 +611,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
style: STextStyles.button(context)
|
style: STextStyles.button(context)
|
||||||
.copyWith(
|
.copyWith(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<
|
.extension<StackColors>()!
|
||||||
StackColors>()!
|
|
||||||
.accentColorDark),
|
.accentColorDark),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -510,10 +646,15 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
@ -524,7 +665,25 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
"Trade note",
|
"Trade note",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
isDesktop
|
||||||
|
? IconPencilButton(
|
||||||
|
onPressed: () {
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return DesktopDialog(
|
||||||
|
maxWidth: 580,
|
||||||
|
maxHeight: 360,
|
||||||
|
child: EditTradeNoteView(
|
||||||
|
tradeId: tradeId,
|
||||||
|
note: _note,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
EditTradeNoteView.routeName,
|
EditTradeNoteView.routeName,
|
||||||
|
@ -562,19 +721,24 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
height: 4,
|
height: 4,
|
||||||
),
|
),
|
||||||
SelectableText(
|
SelectableText(
|
||||||
ref.watch(tradeNoteServiceProvider.select(
|
ref.watch(tradeNoteServiceProvider
|
||||||
(value) => value.getNote(tradeId: tradeId))),
|
.select((value) => value.getNote(tradeId: tradeId))),
|
||||||
style: STextStyles.itemSubtitle12(context),
|
style: STextStyles.itemSubtitle12(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (sentFromStack)
|
if (sentFromStack)
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (sentFromStack)
|
if (sentFromStack)
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
@ -585,7 +749,27 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
"Transaction note",
|
"Transaction note",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
isDesktop
|
||||||
|
? IconPencilButton(
|
||||||
|
onPressed: () {
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return DesktopDialog(
|
||||||
|
maxWidth: 580,
|
||||||
|
maxHeight: 360,
|
||||||
|
child: EditNoteView(
|
||||||
|
txid:
|
||||||
|
transactionIfSentFromStack!.txid,
|
||||||
|
walletId: walletId!,
|
||||||
|
note: _note,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
EditNoteView.routeName,
|
EditNoteView.routeName,
|
||||||
|
@ -623,13 +807,12 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
),
|
),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: ref.watch(
|
future: ref.watch(
|
||||||
notesServiceChangeNotifierProvider(walletId!)
|
notesServiceChangeNotifierProvider(walletId!).select(
|
||||||
.select((value) => value.getNoteFor(
|
(value) => value.getNoteFor(
|
||||||
txid: transactionIfSentFromStack!.txid))),
|
txid: transactionIfSentFromStack!.txid))),
|
||||||
builder:
|
builder:
|
||||||
(builderContext, AsyncSnapshot<String> snapshot) {
|
(builderContext, AsyncSnapshot<String> snapshot) {
|
||||||
if (snapshot.connectionState ==
|
if (snapshot.connectionState == ConnectionState.done &&
|
||||||
ConnectionState.done &&
|
|
||||||
snapshot.hasData) {
|
snapshot.hasData) {
|
||||||
_note = snapshot.data ?? "";
|
_note = snapshot.data ?? "";
|
||||||
}
|
}
|
||||||
|
@ -642,42 +825,94 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Date",
|
"Date",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
),
|
),
|
||||||
// Flexible(
|
if (isDesktop)
|
||||||
// child: FittedBox(
|
const SizedBox(
|
||||||
// fit: BoxFit.scaleDown,
|
height: 2,
|
||||||
// child:
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
SelectableText(
|
||||||
|
Format.extractDateFrom(
|
||||||
|
trade.timestamp.millisecondsSinceEpoch ~/ 1000),
|
||||||
|
style: STextStyles.desktopTextExtraExtraSmall(context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
SelectableText(
|
SelectableText(
|
||||||
Format.extractDateFrom(
|
Format.extractDateFrom(
|
||||||
trade.timestamp.millisecondsSinceEpoch ~/ 1000),
|
trade.timestamp.millisecondsSinceEpoch ~/ 1000),
|
||||||
style: STextStyles.itemSubtitle12(context),
|
style: STextStyles.itemSubtitle12(context),
|
||||||
),
|
),
|
||||||
// ),
|
if (isDesktop)
|
||||||
// ),
|
IconCopyButton(
|
||||||
|
data: Format.extractDateFrom(
|
||||||
|
trade.timestamp.millisecondsSinceEpoch ~/ 1000),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Exchange",
|
"Exchange",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
),
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
SelectableText(
|
||||||
|
trade.exchangeName,
|
||||||
|
style: STextStyles.itemSubtitle12(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
IconCopyButton(
|
||||||
|
data: trade.exchangeName,
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
SelectableText(
|
SelectableText(
|
||||||
trade.exchangeName,
|
trade.exchangeName,
|
||||||
style: STextStyles.itemSubtitle12(context),
|
style: STextStyles.itemSubtitle12(context),
|
||||||
|
@ -685,17 +920,42 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Trade ID",
|
"Trade ID",
|
||||||
style: STextStyles.itemSubtitle(context),
|
style: STextStyles.itemSubtitle(context),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
if (isDesktop)
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
Text(
|
||||||
|
trade.tradeId,
|
||||||
|
style: STextStyles.itemSubtitle12(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
IconCopyButton(
|
||||||
|
data: trade.tradeId,
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
|
@ -724,14 +984,19 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
@ -770,7 +1035,9 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
isDesktop
|
||||||
|
? const _Divider()
|
||||||
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (isStackCoin(trade.payInCurrency) &&
|
if (isStackCoin(trade.payInCurrency) &&
|
||||||
|
@ -801,8 +1068,18 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _Divider extends StatelessWidget {
|
||||||
|
const _Divider({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.background,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,14 @@ import 'package:stackwallet/pages/exchange_view/trade_details_view.dart';
|
||||||
import 'package:stackwallet/pages/wallet_view/sub_widgets/no_transactions_found.dart';
|
import 'package:stackwallet/pages/wallet_view/sub_widgets/no_transactions_found.dart';
|
||||||
import 'package:stackwallet/providers/global/trades_service_provider.dart';
|
import 'package:stackwallet/providers/global/trades_service_provider.dart';
|
||||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||||
|
import 'package:stackwallet/route_generator.dart';
|
||||||
import 'package:stackwallet/services/coins/manager.dart';
|
import 'package:stackwallet/services/coins/manager.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||||
import 'package:stackwallet/widgets/loading_indicator.dart';
|
import 'package:stackwallet/widgets/loading_indicator.dart';
|
||||||
import 'package:stackwallet/widgets/trade_card.dart';
|
import 'package:stackwallet/widgets/trade_card.dart';
|
||||||
import 'package:stackwallet/widgets/transaction_card.dart';
|
import 'package:stackwallet/widgets/transaction_card.dart';
|
||||||
|
@ -94,7 +98,67 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
// this may mess with combined firo transactions
|
// this may mess with combined firo transactions
|
||||||
key: Key(tx.toString() + trade.uuid), //
|
key: Key(tx.toString() + trade.uuid), //
|
||||||
trade: trade,
|
trade: trade,
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
|
if (Util.isDesktop) {
|
||||||
|
await showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => Navigator(
|
||||||
|
initialRoute: TradeDetailsView.routeName,
|
||||||
|
onGenerateRoute: RouteGenerator.generateRoute,
|
||||||
|
onGenerateInitialRoutes: (_, __) {
|
||||||
|
return [
|
||||||
|
FadePageRoute(
|
||||||
|
DesktopDialog(
|
||||||
|
// maxHeight:
|
||||||
|
// MediaQuery.of(context).size.height - 64,
|
||||||
|
maxHeight: double.infinity,
|
||||||
|
maxWidth: 580,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 32,
|
||||||
|
bottom: 16,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Trade details",
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
),
|
||||||
|
DesktopDialogCloseButton(
|
||||||
|
onPressedOverride: Navigator.of(
|
||||||
|
context,
|
||||||
|
rootNavigator: true,
|
||||||
|
).pop,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: TradeDetailsView(
|
||||||
|
tradeId: trade.tradeId,
|
||||||
|
transactionIfSentFromStack: tx,
|
||||||
|
walletName:
|
||||||
|
ref.read(managerProvider).walletName,
|
||||||
|
walletId: widget.walletId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const RouteSettings(
|
||||||
|
name: TradeDetailsView.routeName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
unawaited(
|
unawaited(
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
TradeDetailsView.routeName,
|
TradeDetailsView.routeName,
|
||||||
|
@ -106,6 +170,7 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue