diff --git a/lib/pages/coin_control/utxo_details_view.dart b/lib/pages/coin_control/utxo_details_view.dart index fd9b77a95..1fc8f3343 100644 --- a/lib/pages/coin_control/utxo_details_view.dart +++ b/lib/pages/coin_control/utxo_details_view.dart @@ -38,9 +38,12 @@ class UtxoDetailsView extends ConsumerStatefulWidget { class _UtxoDetailsViewState extends ConsumerState { static const double _spacing = 12; - late Stream stream; + late Stream streamUTXO; UTXO? utxo; + Stream? streamLabel; + AddressLabel? label; + bool _popWithRefresh = false; Future _toggleFreeze() async { @@ -55,7 +58,18 @@ class _UtxoDetailsViewState extends ConsumerState { .idEqualTo(widget.utxoId) .findFirstSync()!; - stream = MainDB.instance.watchUTXO(id: widget.utxoId); + 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); + } + } super.initState(); } @@ -116,7 +130,7 @@ class _UtxoDetailsViewState extends ConsumerState { ), ), child: StreamBuilder( - stream: stream, + stream: streamUTXO, builder: (context, snapshot) { if (snapshot.hasData) { utxo = snapshot.data!; @@ -164,6 +178,42 @@ class _UtxoDetailsViewState extends ConsumerState { ], ), ), + if (label != null && label!.value.isNotEmpty) + const SizedBox( + height: _spacing, + ), + if (label != null && label!.value.isNotEmpty) + RoundedWhiteContainer( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Address label", + style: STextStyles.w500_14(context).copyWith( + color: Theme.of(context) + .extension()! + .textSubtitle1, + ), + ), + SimpleCopyButton( + data: label!.value, + ), + ], + ), + const SizedBox( + height: 4, + ), + Text( + label!.value, + style: STextStyles.w500_14(context), + ), + ], + ), + ), const SizedBox( height: _spacing, ),