utxo details copy fixes

This commit is contained in:
julian 2023-03-28 09:44:51 -06:00
parent 4afa344965
commit f033bb8aa0

View file

@ -138,270 +138,228 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
),
),
child: StreamBuilder<UTXO?>(
stream: streamUTXO,
builder: (context, snapshot) {
if (snapshot.hasData) {
utxo = snapshot.data!;
}
return ConditionalParent(
condition: isDesktop,
builder: (child) {
return DesktopDialog(
maxHeight: double.infinity,
child: Column(
stream: streamUTXO,
builder: (context, snapshot) {
if (snapshot.hasData) {
utxo = snapshot.data!;
}
return ConditionalParent(
condition: isDesktop,
builder: (child) {
return DesktopDialog(
maxHeight: double.infinity,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(left: 32),
child: Text(
"Output details",
style: STextStyles.desktopH3(context),
),
),
DesktopDialogCloseButton(
onPressedOverride: () {
Navigator.of(context)
.pop(_popWithRefresh ? "refresh" : null);
},
),
],
),
IntrinsicHeight(
child: Padding(
padding: const EdgeInsets.only(
left: 32,
right: 32,
bottom: 32,
top: 10,
),
child: Column(
children: [
IntrinsicHeight(
child: RoundedContainer(
padding: EdgeInsets.zero,
color: Colors.transparent,
borderColor: Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
child: child,
),
),
const SizedBox(
height: 20,
),
SecondaryButton(
buttonHeight: ButtonHeight.l,
label: utxo!.isBlocked ? "Unfreeze" : "Freeze",
onPressed: _toggleFreeze,
),
],
),
),
),
],
),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (!isDesktop)
const SizedBox(
height: 10,
),
RoundedContainer(
padding: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(left: 32),
child: Text(
"Output details",
style: STextStyles.desktopH3(context),
if (isDesktop)
UTXOStatusIcon(
blocked: utxo!.isBlocked,
status: confirmed
? UTXOStatusIconStatus.confirmed
: UTXOStatusIconStatus.unconfirmed,
background: Theme.of(context)
.extension<StackColors>()!
.popupBG,
selected: false,
width: 32,
height: 32,
),
),
DesktopDialogCloseButton(
onPressedOverride: () {
Navigator.of(context)
.pop(_popWithRefresh ? "refresh" : null);
},
if (isDesktop)
const SizedBox(
width: 16,
),
Text(
"${Format.satoshisToAmount(
utxo!.value,
coin: coin,
).toStringAsFixed(
coin.decimals,
)} ${coin.ticker}",
style: STextStyles.pageTitleH2(context),
),
],
),
IntrinsicHeight(
child: Padding(
padding: const EdgeInsets.only(
left: 32,
right: 32,
bottom: 32,
top: 10,
),
child: Column(
children: [
IntrinsicHeight(
child: RoundedContainer(
padding: EdgeInsets.zero,
color: Colors.transparent,
borderColor: Theme.of(context)
Text(
utxo!.isBlocked
? "Frozen"
: confirmed
? "Available"
: "Unconfirmed",
style: STextStyles.w500_14(context).copyWith(
color: utxo!.isBlocked
? const Color(0xFF7FA2D4) // todo theme
: confirmed
? Theme.of(context)
.extension<StackColors>()!
.textFieldDefaultBG,
child: child,
),
),
const SizedBox(
height: 20,
),
SecondaryButton(
buttonHeight: ButtonHeight.l,
label: utxo!.isBlocked ? "Unfreeze" : "Freeze",
onPressed: _toggleFreeze,
),
],
),
.accentColorGreen
: Theme.of(context)
.extension<StackColors>()!
.accentColorYellow,
),
),
],
),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (!isDesktop)
const SizedBox(
height: 10,
),
RoundedContainer(
padding: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
if (isDesktop)
UTXOStatusIcon(
blocked: utxo!.isBlocked,
status: confirmed
? UTXOStatusIconStatus.confirmed
: UTXOStatusIconStatus.unconfirmed,
background: Theme.of(context)
.extension<StackColors>()!
.popupBG,
selected: false,
width: 32,
height: 32,
),
if (isDesktop)
const SizedBox(
width: 16,
),
Text(
"${Format.satoshisToAmount(
utxo!.value,
coin: coin,
).toStringAsFixed(
coin.decimals,
)} ${coin.ticker}",
style: STextStyles.pageTitleH2(context),
),
],
),
Text(
utxo!.isBlocked
? "Frozen"
: confirmed
? "Available"
: "Unconfirmed",
style: STextStyles.w500_14(context).copyWith(
color: utxo!.isBlocked
? const Color(0xFF7FA2D4) // todo theme
: confirmed
? Theme.of(context)
.extension<StackColors>()!
.accentColorGreen
: Theme.of(context)
.extension<StackColors>()!
.accentColorYellow,
),
),
],
),
),
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Label",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
SimpleEditButton(
editValue: utxo!.name,
editLabel: "label",
onValueChanged: (newName) {
MainDB.instance.putUTXO(
utxo!.copyWith(
name: newName,
),
);
},
),
],
),
const SizedBox(
height: 4,
),
Text(
utxo!.name,
style: STextStyles.w500_14(context),
),
],
),
),
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Address",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
isDesktop
? IconCopyButton(
data: utxo!.address!,
)
: SimpleCopyButton(
data: utxo!.address!,
),
],
),
const SizedBox(
height: 4,
),
Text(
utxo!.address!,
style: STextStyles.w500_14(context),
),
],
),
),
if (label != null && label!.value.isNotEmpty) const _Div(),
if (label != null && label!.value.isNotEmpty)
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
),
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Address label",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
isDesktop
? IconCopyButton(
data: utxo!.address!,
)
: SimpleCopyButton(
data: label!.value,
),
],
),
const SizedBox(
height: 4,
),
Text(
label!.value,
style: STextStyles.w500_14(context),
"Label",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
SimpleEditButton(
editValue: utxo!.name,
editLabel: "label",
onValueChanged: (newName) {
MainDB.instance.putUTXO(
utxo!.copyWith(
name: newName,
),
);
},
),
],
),
),
const _Div(),
const SizedBox(
height: 4,
),
Text(
utxo!.name,
style: STextStyles.w500_14(context),
),
],
),
),
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Address",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
isDesktop
? IconCopyButton(
data: utxo!.address!,
)
: SimpleCopyButton(
data: utxo!.address!,
),
],
),
const SizedBox(
height: 4,
),
Text(
utxo!.address!,
style: STextStyles.w500_14(context),
),
],
),
),
if (label != null && label!.value.isNotEmpty) const _Div(),
if (label != null && label!.value.isNotEmpty)
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
@ -417,7 +375,7 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Transaction ID",
"Address label",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
@ -426,10 +384,10 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
),
isDesktop
? IconCopyButton(
data: utxo!.address!,
data: label!.value,
)
: SimpleCopyButton(
data: utxo!.txid,
data: label!.value,
),
],
),
@ -437,114 +395,155 @@ class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
height: 4,
),
Text(
utxo!.txid,
label!.value,
style: STextStyles.w500_14(context),
),
],
),
),
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Confirmations",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
const SizedBox(
height: 4,
),
Text(
"${utxo!.getConfirmations(currentHeight)}",
style: STextStyles.w500_14(context),
),
],
),
),
if (utxo!.isBlocked) const _Div(),
if (utxo!.isBlocked)
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context)
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Transaction ID",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
"Freeze reason",
style:
STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
SimpleEditButton(
editValue: utxo!.blockedReason ?? "",
editLabel: "freeze reason",
onValueChanged: (newReason) {
MainDB.instance.putUTXO(
utxo!.copyWith(
blockedReason: newReason,
),
);
},
),
],
),
const SizedBox(
height: 4,
),
Text(
utxo!.blockedReason ?? "",
style: STextStyles.w500_14(context),
),
],
.textSubtitle1,
),
),
isDesktop
? IconCopyButton(
data: utxo!.txid,
)
: SimpleCopyButton(
data: utxo!.txid,
),
],
),
const SizedBox(
height: 4,
),
Text(
utxo!.txid,
style: STextStyles.w500_14(context),
),
],
),
),
const _Div(),
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Confirmations",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
if (!isDesktop) const _Div(),
],
),
if (!isDesktop) const Spacer(),
if (!isDesktop)
SecondaryButton(
label: utxo!.isBlocked ? "Unfreeze" : "Freeze",
onPressed: _toggleFreeze,
),
if (!isDesktop)
const SizedBox(
height: 16,
),
],
),
);
}),
),
const SizedBox(
height: 4,
),
Text(
"${utxo!.getConfirmations(currentHeight)}",
style: STextStyles.w500_14(context),
),
],
),
),
if (utxo!.isBlocked) const _Div(),
if (utxo!.isBlocked)
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
RoundedContainer(
padding: isDesktop
? const EdgeInsets.all(16)
: const EdgeInsets.all(12),
color: isDesktop
? Colors.transparent
: Theme.of(context)
.extension<StackColors>()!
.popupBG,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Freeze reason",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
SimpleEditButton(
editValue: utxo!.blockedReason ?? "",
editLabel: "freeze reason",
onValueChanged: (newReason) {
MainDB.instance.putUTXO(
utxo!.copyWith(
blockedReason: newReason,
),
);
},
),
],
),
const SizedBox(
height: 4,
),
Text(
utxo!.blockedReason ?? "",
style: STextStyles.w500_14(context),
),
],
),
),
if (!isDesktop) const _Div(),
],
),
if (!isDesktop) const Spacer(),
if (!isDesktop)
SecondaryButton(
label: utxo!.isBlocked ? "Unfreeze" : "Freeze",
onPressed: _toggleFreeze,
),
if (!isDesktop)
const SizedBox(
height: 16,
),
],
),
);
},
),
);
}
}