mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-18 16:44:32 +00:00
show n confirmations on tx details screen
This commit is contained in:
parent
80d6a1bed7
commit
4acfbde791
2 changed files with 332 additions and 137 deletions
|
@ -15,14 +15,12 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:tuple/tuple.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import '../../../models/isar/models/blockchain_data/transaction.dart';
|
import '../../../models/isar/models/blockchain_data/transaction.dart';
|
||||||
import '../../../models/isar/models/ethereum/eth_contract.dart';
|
import '../../../models/isar/models/ethereum/eth_contract.dart';
|
||||||
import '../../../notifications/show_flush_bar.dart';
|
import '../../../notifications/show_flush_bar.dart';
|
||||||
import '../../receive_view/addresses/address_details_view.dart';
|
|
||||||
import '../sub_widgets/tx_icon.dart';
|
|
||||||
import 'dialogs/cancelling_transaction_progress_dialog.dart';
|
|
||||||
import 'edit_note_view.dart';
|
|
||||||
import '../wallet_view.dart';
|
|
||||||
import '../../../providers/db/main_db_provider.dart';
|
import '../../../providers/db/main_db_provider.dart';
|
||||||
import '../../../providers/global/address_book_service_provider.dart';
|
import '../../../providers/global/address_book_service_provider.dart';
|
||||||
import '../../../providers/providers.dart';
|
import '../../../providers/providers.dart';
|
||||||
|
@ -52,8 +50,11 @@ import '../../../widgets/icon_widgets/copy_icon.dart';
|
||||||
import '../../../widgets/icon_widgets/pencil_icon.dart';
|
import '../../../widgets/icon_widgets/pencil_icon.dart';
|
||||||
import '../../../widgets/rounded_white_container.dart';
|
import '../../../widgets/rounded_white_container.dart';
|
||||||
import '../../../widgets/stack_dialog.dart';
|
import '../../../widgets/stack_dialog.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
import '../../receive_view/addresses/address_details_view.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import '../sub_widgets/tx_icon.dart';
|
||||||
|
import '../wallet_view.dart';
|
||||||
|
import 'dialogs/cancelling_transaction_progress_dialog.dart';
|
||||||
|
import 'edit_note_view.dart';
|
||||||
|
|
||||||
class TransactionDetailsView extends ConsumerStatefulWidget {
|
class TransactionDetailsView extends ConsumerStatefulWidget {
|
||||||
const TransactionDetailsView({
|
const TransactionDetailsView({
|
||||||
|
@ -1157,59 +1158,95 @@ class _TransactionDetailsViewState
|
||||||
: const SizedBox(
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
Builder(
|
||||||
padding: isDesktop
|
builder: (context) {
|
||||||
? const EdgeInsets.all(16)
|
final String height;
|
||||||
: const EdgeInsets.all(12),
|
final String confirmations;
|
||||||
child: Builder(
|
final confirms = _transaction.getConfirmations(
|
||||||
builder: (context) {
|
currentHeight,
|
||||||
final String height;
|
);
|
||||||
|
|
||||||
if (widget.coin is Bitcoincash ||
|
if (widget.coin is Bitcoincash ||
|
||||||
widget.coin is Ecash) {
|
widget.coin is Ecash) {
|
||||||
|
height = _transaction.height != null &&
|
||||||
|
_transaction.height! > 0
|
||||||
|
? "${_transaction.height!}"
|
||||||
|
: "Pending";
|
||||||
|
confirmations = confirms.toString();
|
||||||
|
} else if (widget.coin is Epiccash &&
|
||||||
|
_transaction.slateId == null) {
|
||||||
|
confirmations = "Unknown";
|
||||||
|
height = "Unknown";
|
||||||
|
} else {
|
||||||
|
final confirmed = _transaction.isConfirmed(
|
||||||
|
currentHeight,
|
||||||
|
minConfirms,
|
||||||
|
);
|
||||||
|
if (widget.coin is! Epiccash && confirmed) {
|
||||||
height =
|
height =
|
||||||
"${_transaction.height != null && _transaction.height! > 0 ? _transaction.height! : "Pending"}";
|
"${_transaction.height == 0 ? "Unknown" : _transaction.height}";
|
||||||
} else {
|
} else {
|
||||||
height = widget.coin is! Epiccash &&
|
height = confirms > 0
|
||||||
_transaction.isConfirmed(
|
? "${_transaction.height}"
|
||||||
currentHeight,
|
: "Pending";
|
||||||
minConfirms,
|
|
||||||
)
|
|
||||||
? "${_transaction.height == 0 ? "Unknown" : _transaction.height}"
|
|
||||||
: _transaction.getConfirmations(
|
|
||||||
currentHeight,
|
|
||||||
) >
|
|
||||||
0
|
|
||||||
? "${_transaction.height}"
|
|
||||||
: "Pending";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Row(
|
confirmations = confirms.toString();
|
||||||
mainAxisAlignment:
|
}
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment:
|
return Column(
|
||||||
CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
RoundedWhiteContainer(
|
||||||
Column(
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Column(
|
||||||
"Block height",
|
crossAxisAlignment:
|
||||||
style: isDesktop
|
CrossAxisAlignment.start,
|
||||||
? STextStyles
|
children: [
|
||||||
.desktopTextExtraExtraSmall(
|
Text(
|
||||||
context,
|
"Block height",
|
||||||
)
|
style: isDesktop
|
||||||
: STextStyles.itemSubtitle(
|
? STextStyles
|
||||||
context,
|
.desktopTextExtraExtraSmall(
|
||||||
),
|
context,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
SelectableText(
|
||||||
|
height,
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles
|
||||||
|
.desktopTextExtraExtraSmall(
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
color: Theme.of(
|
||||||
|
context)
|
||||||
|
.extension<
|
||||||
|
StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles
|
||||||
|
.itemSubtitle12(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
if (isDesktop)
|
if (!isDesktop)
|
||||||
const SizedBox(
|
|
||||||
height: 2,
|
|
||||||
),
|
|
||||||
if (isDesktop)
|
|
||||||
SelectableText(
|
SelectableText(
|
||||||
height,
|
height,
|
||||||
style: isDesktop
|
style: isDesktop
|
||||||
|
@ -1226,30 +1263,91 @@ class _TransactionDetailsViewState
|
||||||
context,
|
context,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
IconCopyButton(data: height),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!isDesktop)
|
),
|
||||||
SelectableText(
|
isDesktop
|
||||||
height,
|
? const _Divider()
|
||||||
style: isDesktop
|
: const SizedBox(
|
||||||
? STextStyles
|
height: 12,
|
||||||
.desktopTextExtraExtraSmall(
|
),
|
||||||
context,
|
RoundedWhiteContainer(
|
||||||
).copyWith(
|
padding: isDesktop
|
||||||
color: Theme.of(context)
|
? const EdgeInsets.all(16)
|
||||||
.extension<StackColors>()!
|
: const EdgeInsets.all(12),
|
||||||
.textDark,
|
child: Row(
|
||||||
)
|
mainAxisAlignment:
|
||||||
: STextStyles.itemSubtitle12(
|
MainAxisAlignment.spaceBetween,
|
||||||
context,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Confirmations",
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles
|
||||||
|
.desktopTextExtraExtraSmall(
|
||||||
|
context,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
),
|
),
|
||||||
),
|
if (isDesktop)
|
||||||
if (isDesktop)
|
SelectableText(
|
||||||
IconCopyButton(data: height),
|
confirmations,
|
||||||
],
|
style: isDesktop
|
||||||
);
|
? STextStyles
|
||||||
},
|
.desktopTextExtraExtraSmall(
|
||||||
),
|
context,
|
||||||
|
).copyWith(
|
||||||
|
color: Theme.of(
|
||||||
|
context)
|
||||||
|
.extension<
|
||||||
|
StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles
|
||||||
|
.itemSubtitle12(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
|
SelectableText(
|
||||||
|
confirmations,
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles
|
||||||
|
.desktopTextExtraExtraSmall(
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<
|
||||||
|
StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle12(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
IconCopyButton(data: height),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
if (coin is Ethereum)
|
if (coin is Ethereum)
|
||||||
isDesktop
|
isDesktop
|
||||||
|
|
|
@ -1463,59 +1463,95 @@ class _TransactionV2DetailsViewState
|
||||||
: const SizedBox(
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
Builder(
|
||||||
padding: isDesktop
|
builder: (context) {
|
||||||
? const EdgeInsets.all(16)
|
final String height;
|
||||||
: const EdgeInsets.all(12),
|
final String confirmations;
|
||||||
child: Builder(
|
final confirms = _transaction.getConfirmations(
|
||||||
builder: (context) {
|
currentHeight,
|
||||||
final String height;
|
);
|
||||||
|
|
||||||
if (widget.coin is Bitcoincash ||
|
if (widget.coin is Bitcoincash ||
|
||||||
widget.coin is Ecash) {
|
widget.coin is Ecash) {
|
||||||
|
height = _transaction.height != null &&
|
||||||
|
_transaction.height! > 0
|
||||||
|
? "${_transaction.height!}"
|
||||||
|
: "Pending";
|
||||||
|
confirmations = confirms.toString();
|
||||||
|
} else if (widget.coin is Epiccash &&
|
||||||
|
_transaction.slateId == null) {
|
||||||
|
confirmations = "Unknown";
|
||||||
|
height = "Unknown";
|
||||||
|
} else {
|
||||||
|
final confirmed = _transaction.isConfirmed(
|
||||||
|
currentHeight,
|
||||||
|
minConfirms,
|
||||||
|
);
|
||||||
|
if (widget.coin is! Epiccash && confirmed) {
|
||||||
height =
|
height =
|
||||||
"${_transaction.height != null && _transaction.height! > 0 ? _transaction.height! : "Pending"}";
|
"${_transaction.height == 0 ? "Unknown" : _transaction.height}";
|
||||||
} else {
|
} else {
|
||||||
height = widget.coin is! Epiccash &&
|
height = confirms > 0
|
||||||
_transaction.isConfirmed(
|
? "${_transaction.height}"
|
||||||
currentHeight,
|
: "Pending";
|
||||||
minConfirms,
|
|
||||||
)
|
|
||||||
? "${_transaction.height == 0 ? "Unknown" : _transaction.height}"
|
|
||||||
: _transaction.getConfirmations(
|
|
||||||
currentHeight,
|
|
||||||
) >
|
|
||||||
0
|
|
||||||
? "${_transaction.height}"
|
|
||||||
: "Pending";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Row(
|
confirmations = confirms.toString();
|
||||||
mainAxisAlignment:
|
}
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment:
|
return Column(
|
||||||
CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
RoundedWhiteContainer(
|
||||||
Column(
|
padding: isDesktop
|
||||||
|
? const EdgeInsets.all(16)
|
||||||
|
: const EdgeInsets.all(12),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Column(
|
||||||
"Block height",
|
crossAxisAlignment:
|
||||||
style: isDesktop
|
CrossAxisAlignment.start,
|
||||||
? STextStyles
|
children: [
|
||||||
.desktopTextExtraExtraSmall(
|
Text(
|
||||||
context,
|
"Block height",
|
||||||
)
|
style: isDesktop
|
||||||
: STextStyles.itemSubtitle(
|
? STextStyles
|
||||||
context,
|
.desktopTextExtraExtraSmall(
|
||||||
),
|
context,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
SelectableText(
|
||||||
|
height,
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles
|
||||||
|
.desktopTextExtraExtraSmall(
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
color: Theme.of(
|
||||||
|
context)
|
||||||
|
.extension<
|
||||||
|
StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles
|
||||||
|
.itemSubtitle12(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
if (isDesktop)
|
if (!isDesktop)
|
||||||
const SizedBox(
|
|
||||||
height: 2,
|
|
||||||
),
|
|
||||||
if (isDesktop)
|
|
||||||
SelectableText(
|
SelectableText(
|
||||||
height,
|
height,
|
||||||
style: isDesktop
|
style: isDesktop
|
||||||
|
@ -1532,30 +1568,91 @@ class _TransactionV2DetailsViewState
|
||||||
context,
|
context,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
IconCopyButton(data: height),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!isDesktop)
|
),
|
||||||
SelectableText(
|
isDesktop
|
||||||
height,
|
? const _Divider()
|
||||||
style: isDesktop
|
: const SizedBox(
|
||||||
? STextStyles
|
height: 12,
|
||||||
.desktopTextExtraExtraSmall(
|
),
|
||||||
context,
|
RoundedWhiteContainer(
|
||||||
).copyWith(
|
padding: isDesktop
|
||||||
color: Theme.of(context)
|
? const EdgeInsets.all(16)
|
||||||
.extension<StackColors>()!
|
: const EdgeInsets.all(12),
|
||||||
.textDark,
|
child: Row(
|
||||||
)
|
mainAxisAlignment:
|
||||||
: STextStyles.itemSubtitle12(
|
MainAxisAlignment.spaceBetween,
|
||||||
context,
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Confirmations",
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles
|
||||||
|
.desktopTextExtraExtraSmall(
|
||||||
|
context,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
),
|
),
|
||||||
),
|
if (isDesktop)
|
||||||
if (isDesktop)
|
SelectableText(
|
||||||
IconCopyButton(data: height),
|
confirmations,
|
||||||
],
|
style: isDesktop
|
||||||
);
|
? STextStyles
|
||||||
},
|
.desktopTextExtraExtraSmall(
|
||||||
),
|
context,
|
||||||
|
).copyWith(
|
||||||
|
color: Theme.of(
|
||||||
|
context)
|
||||||
|
.extension<
|
||||||
|
StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles
|
||||||
|
.itemSubtitle12(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
|
SelectableText(
|
||||||
|
confirmations,
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles
|
||||||
|
.desktopTextExtraExtraSmall(
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<
|
||||||
|
StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
)
|
||||||
|
: STextStyles.itemSubtitle12(
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
IconCopyButton(data: height),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
if (kDebugMode)
|
if (kDebugMode)
|
||||||
|
|
Loading…
Reference in a new issue