@@ -18,6 +18,7 @@ import 'package:flutter_svg/flutter_svg.dart';
1818import 'package:isar_community/isar.dart' ;
1919import 'package:tuple/tuple.dart' ;
2020
21+ import '../../../../db/isar/main_db.dart' ;
2122import '../../../../models/isar/models/isar_models.dart' ;
2223import '../../../../models/keys/view_only_wallet_data.dart' ;
2324import '../../../../notifications/show_flush_bar.dart' ;
@@ -51,6 +52,7 @@ import '../../../../wallets/wallet/wallet_mixin_interfaces/spark_interface.dart'
5152import '../../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart' ;
5253import '../../../../widgets/conditional_parent.dart' ;
5354import '../../../../widgets/custom_buttons/app_bar_icon_button.dart' ;
55+ import '../../../../widgets/custom_buttons/simple_edit_button.dart' ;
5456import '../../../../widgets/custom_loading_overlay.dart' ;
5557import '../../../../widgets/desktop/desktop_dialog.dart' ;
5658import '../../../../widgets/desktop/primary_button.dart' ;
@@ -762,6 +764,76 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
762764 ),
763765 ),
764766
767+ const SizedBox (height: 12 ),
768+ Builder (
769+ builder: (context) {
770+ final label = MainDB .instance.getAddressLabelSync (
771+ walletId,
772+ address,
773+ );
774+ final labelValue = label? .value ?? "" ;
775+ return Container (
776+ decoration: BoxDecoration (
777+ border: Border .all (
778+ color: Theme .of (
779+ context,
780+ ).extension < StackColors > ()! .backgroundAppBar,
781+ width: 1 ,
782+ ),
783+ borderRadius: BorderRadius .circular (
784+ Constants .size.circularBorderRadius,
785+ ),
786+ ),
787+ child: RoundedWhiteContainer (
788+ child: Row (
789+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
790+ children: [
791+ Expanded (
792+ child: Text (
793+ labelValue.isNotEmpty ? labelValue : "No label" ,
794+ style: STextStyles .desktopTextExtraExtraSmall (
795+ context,
796+ ).copyWith (
797+ color: Theme .of (
798+ context,
799+ ).extension < StackColors > ()! .textDark,
800+ ),
801+ ),
802+ ),
803+ SimpleEditButton (
804+ editValue: labelValue,
805+ editLabel: "label" ,
806+ overrideTitle: "Edit label" ,
807+ onValueChanged: (value) {
808+ final existingLabel =
809+ MainDB .instance.getAddressLabelSync (
810+ walletId,
811+ address,
812+ );
813+ if (existingLabel != null ) {
814+ MainDB .instance.putAddressLabel (
815+ existingLabel.copyWith (label: value),
816+ );
817+ } else {
818+ MainDB .instance.putAddressLabel (
819+ AddressLabel (
820+ walletId: walletId,
821+ addressString: address,
822+ value: value,
823+ tags: null ,
824+ ),
825+ );
826+ }
827+ setState (() {});
828+ },
829+ ),
830+ ],
831+ ),
832+ ),
833+ );
834+ },
835+ ),
836+
765837 if (canGen) const SizedBox (height: 20 ),
766838
767839 if (canGen)
0 commit comments