Skip to content

Commit dbbbf88

Browse files
committed
feat(BullEye): rename AddressViewer to BullEye with typed constructors
Introduce BullEye.address, BullEye.transaction, BullEye.invoice named constructors with contextual dialog titles. Replace all remaining manual address/txid display patterns across the codebase. Remove dead code from CommonSendBottomButtons. Fix DetailsTableItem double-copy conflict. Fix short address crash and TextPainter memory leak. Restore BIP21 URI clipboard regression in receive screen.
1 parent dd7673a commit dbbbf88

42 files changed

Lines changed: 533 additions & 539 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/core/screens/send_confirm_screen.dart

Lines changed: 19 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import 'package:bb_mobile/core/errors/send_errors.dart';
2+
import 'package:bb_mobile/core/widgets/bull_eye.dart';
23
import 'package:bb_mobile/core/swaps/domain/entity/swap.dart';
34
import 'package:bb_mobile/core/themes/app_theme.dart';
45
import 'package:bb_mobile/core/utils/build_context_x.dart';
5-
import 'package:bb_mobile/core/utils/string_formatting.dart';
66
import 'package:bb_mobile/core/widgets/buttons/button.dart';
77
import 'package:bb_mobile/core/widgets/text/text.dart';
88
import 'package:bb_mobile/features/bitcoin_price/ui/currency_text.dart';
99
import 'package:bb_mobile/generated/flutter_gen/assets.gen.dart';
1010
import 'package:flutter/material.dart';
1111
import 'package:flutter/services.dart';
12-
import 'package:flutter_bloc/flutter_bloc.dart';
1312
import 'package:gap/gap.dart';
1413

1514
enum SendType { send, swap }
@@ -160,31 +159,10 @@ class CommonOnchainSendInfoSection extends StatelessWidget {
160159
_divider(context),
161160
CommonInfoRow(
162161
title: context.loc.coreScreensToLabel,
163-
details: Row(
164-
mainAxisAlignment: .end,
165-
mainAxisSize: .min,
166-
children: [
167-
Expanded(
168-
child: BBText(
169-
_receiveWalletLabel,
170-
style: context.font.bodyLarge?.copyWith(
171-
color: context.appColors.secondary,
172-
),
173-
textAlign: .end,
174-
),
175-
),
176-
const Gap(4),
177-
InkWell(
178-
child: Icon(
179-
Icons.copy,
180-
color: context.appColors.primary,
181-
size: 16,
182-
),
183-
onTap: () {
184-
Clipboard.setData(ClipboardData(text: _receiveWalletLabel));
185-
},
186-
),
187-
],
162+
details: BullEye.address(
163+
_receiveWalletLabel,
164+
style: context.font.bodyLarge,
165+
color: context.appColors.secondary,
188166
),
189167
),
190168
if (_isToSelf) ...[
@@ -312,40 +290,12 @@ class CommonLnSwapSendInfoSection extends StatelessWidget {
312290
_divider(context),
313291
CommonInfoRow(
314292
title: context.loc.coreScreensToLabel,
315-
details: Row(
316-
mainAxisAlignment: .end,
317-
mainAxisSize: .min,
318-
children: [
319-
BBText(
320-
StringFormatting.truncateMiddle(_paymentRequestAddress),
321-
style: context.font.bodyLarge?.copyWith(
322-
color: context.appColors.secondary,
323-
),
324-
textAlign: .end,
325-
),
326-
const Gap(4),
327-
InkWell(
328-
child: Icon(
329-
Icons.copy,
330-
color: context.appColors.primary,
331-
size: 16,
332-
),
333-
onTap: () {
334-
Clipboard.setData(
335-
ClipboardData(text: _paymentRequestAddress),
336-
);
337-
},
338-
),
339-
],
293+
details: BullEye.address(
294+
_paymentRequestAddress,
295+
style: context.font.bodyLarge?.copyWith(
296+
color: context.appColors.secondary,
297+
),
340298
),
341-
// const Gap(4),
342-
// InkWell(
343-
// child: Icon(
344-
// Icons.copy,
345-
// color: context.colour.primary,
346-
// size: 16,
347-
// ),
348-
// ),
349299
),
350300
_divider(context),
351301
CommonInfoRow(
@@ -560,35 +510,11 @@ class CommonChainSwapSendInfoSection extends StatelessWidget {
560510
swap.isChainSwap &&
561511
(swap as ChainSwap).receiveWalletId == null &&
562512
(swap as ChainSwap).receiveAddress != null
563-
? Row(
564-
mainAxisAlignment: .end,
565-
mainAxisSize: .min,
566-
children: [
567-
BBText(
568-
StringFormatting.truncateMiddle(
569-
(swap as ChainSwap).receiveAddress!,
570-
),
571-
style: context.font.bodyLarge?.copyWith(
572-
color: context.appColors.secondary,
573-
),
574-
textAlign: .end,
575-
),
576-
const Gap(4),
577-
InkWell(
578-
child: Icon(
579-
Icons.copy,
580-
color: context.appColors.primary,
581-
size: 16,
582-
),
583-
onTap: () {
584-
Clipboard.setData(
585-
ClipboardData(
586-
text: (swap as ChainSwap).receiveAddress!,
587-
),
588-
);
589-
},
590-
),
591-
],
513+
? BullEye.address(
514+
(swap as ChainSwap).receiveAddress!,
515+
style: context.font.bodyLarge?.copyWith(
516+
color: context.appColors.secondary,
517+
),
592518
)
593519
: receiveWalletLabel != null && receiveWalletLabel!.isNotEmpty
594520
? BBText(
@@ -704,56 +630,21 @@ class CommonChainSwapSendInfoSection extends StatelessWidget {
704630

705631
class CommonSendBottomButtons extends StatelessWidget {
706632
const CommonSendBottomButtons({
707-
required bool isBitcoinWallet,
708-
required StateStreamableSource<Object?> blocProviderValue,
709633
required bool disableSendButton,
710634
required Function onSendPressed,
711-
}) : _isBitcoinWallet = isBitcoinWallet,
712-
_blocProviderValue = blocProviderValue,
713-
_disableSendButton = disableSendButton,
635+
}) : _disableSendButton = disableSendButton,
714636
_onSendPressed = onSendPressed;
715637

716-
// ignore: unused_field
717-
final bool _isBitcoinWallet;
718-
// ignore: unused_field
719-
final StateStreamableSource<Object?> _blocProviderValue;
720638
final bool _disableSendButton;
721639
final Function _onSendPressed;
722640

723641
@override
724642
Widget build(BuildContext context) {
725643
return Padding(
726644
padding: const EdgeInsets.symmetric(horizontal: 16),
727-
child: Column(
728-
crossAxisAlignment: .stretch,
729-
children: [
730-
// if (_isBitcoinWallet) ...[
731-
// BBButton.big(
732-
// label: 'Advanced Settings',
733-
// onPressed: () {
734-
// showModalBottomSheet(
735-
// context: context,
736-
// isScrollControlled: true,
737-
// backgroundColor: context.colour.secondaryFixed,
738-
// builder:
739-
// (BuildContext buildContext) => BlocProvider.value(
740-
// value: _blocProviderValue,
741-
// child: const AdvancedOptionsBottomSheet(),
742-
// ),
743-
// );
744-
// },
745-
// borderColor: context.colour.secondary,
746-
// outlined: true,
747-
// bgColor: context.appColors.transparent,
748-
// textColor: context.colour.secondary,
749-
// ),
750-
// const Gap(12),
751-
// ],
752-
CommonConfirmSendButton(
753-
disableSendButton: _disableSendButton,
754-
onPressed: _onSendPressed,
755-
),
756-
],
645+
child: CommonConfirmSendButton(
646+
disableSendButton: _disableSendButton,
647+
onPressed: _onSendPressed,
757648
),
758649
);
759650
}

lib/core/transactions/ui/transaction_screen.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:bb_mobile/core/transactions/domain/error/transaction_error.dart'
55
import 'package:bb_mobile/core/transactions/presentation/transaction_cubit.dart';
66
import 'package:bb_mobile/core/transactions/presentation/transaction_state.dart';
77
import 'package:bb_mobile/core/utils/build_context_x.dart';
8-
import 'package:bb_mobile/core/widgets/address_viewer.dart';
8+
import 'package:bb_mobile/core/widgets/bull_eye.dart';
99
import 'package:bb_mobile/core/widgets/loading/fading_linear_progress.dart';
1010
import 'package:bb_mobile/core/widgets/text/text.dart';
1111
import 'package:flutter/material.dart';
@@ -398,7 +398,7 @@ class _SummarySection extends StatelessWidget {
398398
label: context.loc.coreScreensToLabel,
399399
child: Align(
400400
alignment: Alignment.centerRight,
401-
child: AddressViewer(
401+
child: BullEye.address(
402402
toLabel!,
403403
style: context.font.bodyLarge,
404404
color: context.appColors.secondary,
@@ -453,7 +453,7 @@ class _InputAddressRow extends StatelessWidget {
453453
children: [
454454
SizedBox(
455455
width: double.infinity,
456-
child: AddressViewer(
456+
child: BullEye.address(
457457
fullAddress,
458458
style: context.font.bodySmall,
459459
color: context.appColors.secondary,
@@ -488,7 +488,7 @@ class _OutputAddressRow extends StatelessWidget {
488488
children: [
489489
SizedBox(
490490
width: double.infinity,
491-
child: AddressViewer(
491+
child: BullEye.address(
492492
fullAddress,
493493
style: context.font.bodySmall,
494494
color: context.appColors.secondary,

0 commit comments

Comments
 (0)