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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-03-07 17:11:57 +00:00
|
|
|
import 'dart:async';
|
|
|
|
|
2023-03-07 15:39:34 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:isar/isar.dart';
|
2024-09-30 15:36:12 +00:00
|
|
|
|
2024-05-23 00:37:06 +00:00
|
|
|
import '../../db/isar/main_db.dart';
|
|
|
|
import '../../models/isar/models/isar_models.dart';
|
|
|
|
import '../../providers/global/wallets_provider.dart';
|
|
|
|
import '../../themes/stack_colors.dart';
|
|
|
|
import '../../utilities/amount/amount.dart';
|
|
|
|
import '../../utilities/amount/amount_formatter.dart';
|
|
|
|
import '../../utilities/text_styles.dart';
|
|
|
|
import '../../utilities/util.dart';
|
|
|
|
import '../../wallets/isar/providers/wallet_info_provider.dart';
|
|
|
|
import '../../widgets/background.dart';
|
|
|
|
import '../../widgets/conditional_parent.dart';
|
|
|
|
import '../../widgets/custom_buttons/app_bar_icon_button.dart';
|
|
|
|
import '../../widgets/custom_buttons/simple_copy_button.dart';
|
|
|
|
import '../../widgets/custom_buttons/simple_edit_button.dart';
|
|
|
|
import '../../widgets/desktop/desktop_dialog.dart';
|
|
|
|
import '../../widgets/desktop/desktop_dialog_close_button.dart';
|
|
|
|
import '../../widgets/desktop/secondary_button.dart';
|
|
|
|
import '../../widgets/icon_widgets/utxo_status_icon.dart';
|
|
|
|
import '../../widgets/rounded_container.dart';
|
2024-09-30 15:36:12 +00:00
|
|
|
import '../wallet_view/transaction_views/transaction_details_view.dart';
|
2023-03-07 15:39:34 +00:00
|
|
|
|
|
|
|
class UtxoDetailsView extends ConsumerStatefulWidget {
|
|
|
|
const UtxoDetailsView({
|
2024-05-15 21:20:45 +00:00
|
|
|
super.key,
|
2023-03-07 15:39:34 +00:00
|
|
|
required this.utxoId,
|
|
|
|
required this.walletId,
|
2024-05-15 21:20:45 +00:00
|
|
|
});
|
2023-03-07 15:39:34 +00:00
|
|
|
|
|
|
|
static const routeName = "/utxoDetails";
|
|
|
|
|
|
|
|
final Id utxoId;
|
|
|
|
final String walletId;
|
|
|
|
|
|
|
|
@override
|
|
|
|
ConsumerState<UtxoDetailsView> createState() => _UtxoDetailsViewState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _UtxoDetailsViewState extends ConsumerState<UtxoDetailsView> {
|
2023-03-13 23:09:14 +00:00
|
|
|
final isDesktop = Util.isDesktop;
|
2023-03-07 15:39:34 +00:00
|
|
|
|
2023-03-08 17:45:21 +00:00
|
|
|
late Stream<UTXO?> streamUTXO;
|
2023-03-07 15:39:34 +00:00
|
|
|
UTXO? utxo;
|
|
|
|
|
2023-03-08 17:45:21 +00:00
|
|
|
Stream<AddressLabel?>? streamLabel;
|
|
|
|
AddressLabel? label;
|
|
|
|
|
2023-03-07 17:11:57 +00:00
|
|
|
bool _popWithRefresh = false;
|
|
|
|
|
|
|
|
Future<void> _toggleFreeze() async {
|
|
|
|
_popWithRefresh = true;
|
|
|
|
await MainDB.instance.putUTXO(utxo!.copyWith(isBlocked: !utxo!.isBlocked));
|
|
|
|
}
|
|
|
|
|
2023-03-07 15:39:34 +00:00
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
utxo = MainDB.instance.isar.utxos
|
|
|
|
.where()
|
|
|
|
.idEqualTo(widget.utxoId)
|
|
|
|
.findFirstSync()!;
|
|
|
|
|
2023-03-08 17:45:21 +00:00
|
|
|
streamUTXO = MainDB.instance.watchUTXO(id: widget.utxoId);
|
|
|
|
|
|
|
|
if (utxo?.address != null) {
|
|
|
|
label = MainDB.instance.getAddressLabelSync(
|
|
|
|
widget.walletId,
|
|
|
|
utxo!.address!,
|
|
|
|
);
|
|
|
|
|
|
|
|
if (label != null) {
|
|
|
|
streamLabel = MainDB.instance.watchAddressLabel(id: label!.id);
|
|
|
|
}
|
|
|
|
}
|
2023-03-07 15:39:34 +00:00
|
|
|
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-11-03 19:46:55 +00:00
|
|
|
final coin = ref.watch(pWalletCoin(widget.walletId));
|
|
|
|
final currentHeight = ref.watch(pWalletChainHeight(widget.walletId));
|
2023-03-07 17:11:57 +00:00
|
|
|
|
2023-03-08 17:34:00 +00:00
|
|
|
final confirmed = utxo!.isConfirmed(
|
|
|
|
currentHeight,
|
2023-11-08 22:09:28 +00:00
|
|
|
ref.watch(pWallets).getWallet(widget.walletId).cryptoCurrency.minConfirms,
|
2024-11-21 15:40:40 +00:00
|
|
|
ref
|
|
|
|
.watch(pWallets)
|
|
|
|
.getWallet(widget.walletId)
|
|
|
|
.cryptoCurrency
|
|
|
|
.minCoinbaseConfirms,
|
2023-03-08 17:34:00 +00:00
|
|
|
);
|
|
|
|
|
2023-03-07 17:11:57 +00:00
|
|
|
return ConditionalParent(
|
2023-03-13 23:09:14 +00:00
|
|
|
condition: !isDesktop,
|
2023-03-07 17:11:57 +00:00
|
|
|
builder: (child) => Background(
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).extension<StackColors>()!.background,
|
|
|
|
appBar: AppBar(
|
|
|
|
backgroundColor:
|
|
|
|
Theme.of(context).extension<StackColors>()!.background,
|
|
|
|
leading: AppBarBackButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop(_popWithRefresh ? "refresh" : null);
|
|
|
|
},
|
|
|
|
),
|
2023-03-20 16:23:42 +00:00
|
|
|
title: Text(
|
|
|
|
"Output details",
|
|
|
|
style: STextStyles.navBarTitle(context),
|
|
|
|
),
|
2023-03-07 15:39:34 +00:00
|
|
|
),
|
2023-03-07 17:11:57 +00:00
|
|
|
body: SafeArea(
|
|
|
|
child: LayoutBuilder(
|
|
|
|
builder: (context, constraints) {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: ConstrainedBox(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
minHeight: constraints.maxHeight,
|
|
|
|
),
|
|
|
|
child: IntrinsicHeight(
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
),
|
2023-03-07 15:39:34 +00:00
|
|
|
),
|
2023-03-07 17:11:57 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-03-14 14:40:09 +00:00
|
|
|
child: StreamBuilder<UTXO?>(
|
2023-03-28 15:44:51 +00:00
|
|
|
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(
|
2023-03-14 14:40:09 +00:00
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
2023-03-28 15:44:51 +00:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 32),
|
|
|
|
child: Text(
|
|
|
|
"Output details",
|
|
|
|
style: STextStyles.desktopH3(context),
|
2023-03-09 22:50:25 +00:00
|
|
|
),
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
DesktopDialogCloseButton(
|
|
|
|
onPressedOverride: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pop(_popWithRefresh ? "refresh" : null);
|
|
|
|
},
|
|
|
|
),
|
2023-03-14 14:40:09 +00:00
|
|
|
],
|
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
IntrinsicHeight(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
left: 32,
|
|
|
|
right: 32,
|
|
|
|
bottom: 32,
|
|
|
|
top: 10,
|
|
|
|
),
|
|
|
|
child: Column(
|
2023-03-14 14:40:09 +00:00
|
|
|
children: [
|
2023-03-28 15:44:51 +00:00
|
|
|
IntrinsicHeight(
|
|
|
|
child: RoundedContainer(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
color: Colors.transparent,
|
|
|
|
borderColor: Theme.of(context)
|
2023-03-14 14:40:09 +00:00
|
|
|
.extension<StackColors>()!
|
2023-03-28 15:44:51 +00:00
|
|
|
.textFieldDefaultBG,
|
|
|
|
child: child,
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
SecondaryButton(
|
|
|
|
buttonHeight: ButtonHeight.l,
|
|
|
|
label: utxo!.isBlocked ? "Unfreeze" : "Freeze",
|
|
|
|
onPressed: _toggleFreeze,
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
),
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
if (!isDesktop)
|
|
|
|
const SizedBox(
|
|
|
|
height: 10,
|
2023-03-13 23:09:14 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
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,
|
2023-03-13 23:09:14 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
if (isDesktop)
|
|
|
|
const SizedBox(
|
|
|
|
width: 16,
|
|
|
|
),
|
|
|
|
Text(
|
2023-05-29 21:10:55 +00:00
|
|
|
ref.watch(pAmountFormatter(coin)).format(
|
|
|
|
utxo!.value.toAmountAsRaw(
|
2024-05-15 21:20:45 +00:00
|
|
|
fractionDigits: coin.fractionDigits,
|
2023-04-05 22:06:31 +00:00
|
|
|
),
|
2023-05-29 21:10:55 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
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,
|
2023-03-09 22:50:25 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
),
|
|
|
|
],
|
2023-03-13 23:09:14 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
),
|
|
|
|
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,
|
2023-03-07 17:11:57 +00:00
|
|
|
children: [
|
2023-03-28 15:44:51 +00:00
|
|
|
Text(
|
|
|
|
"Label",
|
|
|
|
style: STextStyles.w500_14(context).copyWith(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textSubtitle1,
|
|
|
|
),
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
SimpleEditButton(
|
|
|
|
editValue: utxo!.name,
|
|
|
|
editLabel: "label",
|
|
|
|
onValueChanged: (newName) {
|
|
|
|
MainDB.instance.putUTXO(
|
|
|
|
utxo!.copyWith(
|
|
|
|
name: newName,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
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: [
|
2023-03-07 17:11:57 +00:00
|
|
|
Text(
|
2023-03-28 15:44:51 +00:00
|
|
|
"Address",
|
|
|
|
style: STextStyles.w500_14(context).copyWith(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textSubtitle1,
|
|
|
|
),
|
2023-03-07 17:11:57 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
isDesktop
|
|
|
|
? IconCopyButton(
|
|
|
|
data: utxo!.address!,
|
|
|
|
)
|
|
|
|
: SimpleCopyButton(
|
|
|
|
data: utxo!.address!,
|
|
|
|
),
|
2023-03-07 17:11:57 +00:00
|
|
|
],
|
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
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)
|
2023-03-14 14:40:09 +00:00
|
|
|
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,
|
2023-03-13 23:09:14 +00:00
|
|
|
children: [
|
|
|
|
Text(
|
2023-03-28 15:44:51 +00:00
|
|
|
"Address label",
|
2023-03-14 14:40:09 +00:00
|
|
|
style: STextStyles.w500_14(context).copyWith(
|
|
|
|
color: Theme.of(context)
|
|
|
|
.extension<StackColors>()!
|
|
|
|
.textSubtitle1,
|
|
|
|
),
|
2023-03-13 23:09:14 +00:00
|
|
|
),
|
2023-03-14 14:40:09 +00:00
|
|
|
isDesktop
|
|
|
|
? IconCopyButton(
|
2023-03-28 15:44:51 +00:00
|
|
|
data: label!.value,
|
2023-03-14 14:40:09 +00:00
|
|
|
)
|
|
|
|
: SimpleCopyButton(
|
2023-03-28 15:44:51 +00:00
|
|
|
data: label!.value,
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-13 23:09:14 +00:00
|
|
|
],
|
|
|
|
),
|
2023-03-14 14:40:09 +00:00
|
|
|
const SizedBox(
|
|
|
|
height: 4,
|
|
|
|
),
|
|
|
|
Text(
|
2023-03-28 15:44:51 +00:00
|
|
|
label!.value,
|
2023-03-14 14:40:09 +00:00
|
|
|
style: STextStyles.w500_14(context),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2023-03-13 23:09:14 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
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>()!
|
|
|
|
.textSubtitle1,
|
|
|
|
),
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
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,
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 4,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"${utxo!.getConfirmations(currentHeight)}",
|
|
|
|
style: STextStyles.w500_14(context),
|
|
|
|
),
|
|
|
|
],
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
),
|
|
|
|
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,
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
),
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
],
|
2023-03-14 14:40:09 +00:00
|
|
|
),
|
2023-03-28 15:44:51 +00:00
|
|
|
),
|
|
|
|
if (!isDesktop) const _Div(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
if (!isDesktop) const Spacer(),
|
|
|
|
if (!isDesktop)
|
|
|
|
SecondaryButton(
|
|
|
|
label: utxo!.isBlocked ? "Unfreeze" : "Freeze",
|
|
|
|
onPressed: _toggleFreeze,
|
|
|
|
),
|
|
|
|
if (!isDesktop)
|
|
|
|
const SizedBox(
|
|
|
|
height: 16,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
2023-03-07 15:39:34 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2023-03-14 14:40:09 +00:00
|
|
|
|
|
|
|
class _Div extends StatelessWidget {
|
2024-05-27 23:56:22 +00:00
|
|
|
const _Div({super.key});
|
2023-03-14 14:40:09 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
if (Util.isDesktop) {
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.0,
|
|
|
|
color: Theme.of(context).extension<StackColors>()!.textFieldDefaultBG,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|